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)> _
<Appearance("Disable UserCreated-BankImportHeader", AppearanceItemType.ViewItem, "1=1", TargetItems:="UserCreated", Enabled:=False)> _
<Appearance("Disable ObjectCreated-BankImportHeader", AppearanceItemType.ViewItem, "1=1", TargetItems:="ObjectCreated", Enabled:=False)> _
Public Class BankImportHeader 'Banki kivonat betöltő fejléc
    Inherits BaseObject
    Private _ShortName As String 'Banki elektronikus kivonat megnevezése
    Private _FileData As FileData 'Elektronikus kivonat file.
    Private _ObjectCreated As Date 'Létrehozva
    Private _UserCreated As User 'Létrehozta
    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
    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 ShortName As String
        Get
            Return _ShortName
        End Get
        Set(value As String)
            SetPropertyValue("ShortName", _ShortName, 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

    <Association("BankImportHeader-BankImportHeaderSum", GetType(BankImportHeaderSum)), VisibleInListView(False)> _
    ReadOnly Property BankImportHeaderSum As XPCollection(Of BankImportHeaderSum)
        Get
            Return GetCollection(Of BankImportHeaderSum)("BankImportHeaderSum")
        End Get
    End Property

End Class