Imports System
Imports System.ComponentModel

Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering

Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
Imports DevExpress.ExpressApp.ConditionalAppearance

<DefaultClassOptions(), NavigationItem(False), CreatableItem(False), DefaultProperty("Description")> _
<Appearance("APCSheetHeader - Disable ObjectCreated all time", AppearanceItemType.ViewItem, "1=1", TargetItems:="ObjectCreated", Enabled:=False)> _
<Appearance("APCSheetHeader - Disable UserCreated all time", AppearanceItemType.ViewItem, "1=1", TargetItems:="UserCreated", Enabled:=False)> _
Public Class APCSheetReviewHeader 'Betakarítás előtti jegyzőkönyv
    Inherits BaseObject
    Private _APCSheetByProducts As APCSheetByProducts
    Private _Description As String
    Private _FileData As FileData
    Private _ObjectCreated As Date
    Private _UserCreated As User
    Private _ReportData As ReportData
    Private _ReviewDate As Date

    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
        'If Me.ReportData Is Nothing Then
        '    Me.ReportData = Session.FindObject(Of ReportData)(CriteriaOperator.Parse("Oid = '43'"))
        'End If
    End Sub
    Protected Overrides Sub OnSaving()
        MyBase.OnSaving()
        If Session.IsNewObject(Me) Then
            ObjectCreated = GetSQLTime(Session)
            UserCreated = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser))
        End If
    End Sub

    Property APCSheetByProducts As APCSheetByProducts
        Get
            Return _APCSheetByProducts
        End Get
        Set(value As APCSheetByProducts)
            SetPropertyValue("APCSheetByProducts", _APCSheetByProducts, value)
        End Set
    End Property
    <Size(-1)>
    Property Description As String
        Get
            Return _Description
        End Get
        Set(value As String)
            SetPropertyValue("Description", _Description, value)
        End Set
    End Property
    Property FileData As FileData
        Get
            Return _FileData
        End Get
        Set(value As FileData)
            SetPropertyValue("FileData", _FileData, value)
        End Set
    End Property
    <NonCloneable> Property ObjectCreated As Date
        Get
            Return _ObjectCreated
        End Get
        Set(value As Date)
            SetPropertyValue("ObjectCreated", _ObjectCreated, value)
        End Set
    End Property
    <NonCloneable> Property UserCreated As User
        Get
            Return _UserCreated
        End Get
        Set(value As User)
            SetPropertyValue("UserCreated", _UserCreated, value)
        End Set
    End Property
    Property ReportData As ReportData
        Get
            Return _ReportData
        End Get
        Set(value As ReportData)
            SetPropertyValue("ReportData", _ReportData, value)
        End Set
    End Property
    Property ReviewDate As Date
        Get
            Return _ReviewDate
        End Get
        Set(value As Date)
            SetPropertyValue("ReviewDate", _ReviewDate, value)
        End Set
    End Property

    ReadOnly Property APCSheetReviewRows As XPCollection(Of APCSheetReviewRows)
        Get
            Return New XPCollection(Of APCSheetReviewRows)(Session, CriteriaOperator.Parse("APCSheetReviewHeader=?", Me))
        End Get
    End Property
    ReadOnly Property APCSheetReviewHeaderPhotos As XPCollection(Of APCSheetReviewHeaderPhotos)
        Get
            Return New XPCollection(Of APCSheetReviewHeaderPhotos)(Session, CriteriaOperator.Parse("APCSheetReviewHeader=?", Me))
        End Get
    End Property
End Class
