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

'<Appearance("Disable CustomersFrom-Corner when it is not nothing", AppearanceItemType.ViewItem, "IsNull(CustomersFrom)=False", TargetItems:="CustomersFrom", Enabled:=False)> _
<DefaultClassOptions()> _
<NavigationItem("SQL Imports")> _
<Appearance("Disable UserCreated-Corner", AppearanceItemType.ViewItem, "1=1", TargetItems:="UserCreated", Enabled:=False)> _
<Appearance("Disable ObjectCreated-Corner", AppearanceItemType.ViewItem, "1=1", TargetItems:="ObjectCreated", Enabled:=False)> _
Public Class Corner
    Inherits BaseObject
    Private _CustomersFrom As CustomersFrom
    Private _ObjectCreated As Date 'Maga az objektum mikor készült el
    Private _UserCreated As User 'Ki csinálta
    Private _ShortName As String
    Private _ExcelCorner As String
    Private _ExcelFile As FileData
    Private _CostHolder As CostHolder
    Private _Customers_Cash As Customers ' Készpénzes vevő melyik legyen az ügyféltörzsben
    Private _Customers_ATM As Customers ' Bankkártyás vevő melyik legyen
    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    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
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
        ' Place here your initialization code.
    End Sub
    <RuleRequiredField("Corner-CustomersFrom", DefaultContexts.Save)> _
    Property CustomersFrom As CustomersFrom
        Get
            Return _CustomersFrom
        End Get
        Set(value As CustomersFrom)
            SetPropertyValue("CustomersFrom", _CustomersFrom, value)
        End Set
    End Property
    Property ShortName As String
        Get
            Return _ShortName
        End Get
        Set(value As String)
            SetPropertyValue("ShortName", _ShortName, value)
        End Set
    End Property
    <NonCloneable> _
    Property ObjectCreated As Date
        Get
            Return _ObjectCreated
        End Get
        Set(ByVal 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 ExcelFile As FileData
        Get
            Return _ExcelFile
        End Get
        Set(value As FileData)
            SetPropertyValue("ExcelFile", _ExcelFile, value)
        End Set
    End Property
    <Size(-1)> _
    Property ExcelCorner As String
        Get
            Return _ExcelCorner
        End Get
        Set(value As String)
            SetPropertyValue("ExcelCorner", _ExcelCorner, value)
        End Set
    End Property
    <VisibleInListView(False)> _
    ReadOnly Property GLAccounts As XPCollection(Of GLAccounts)
        Get
            Return New XPCollection(Of GLAccounts)(Session, CriteriaOperator.Parse("ImportedOther=?", Me.Oid))
        End Get
    End Property
    <VisibleInListView(False)> _
    ReadOnly Property InvoiceNameParameters As XPCollection(Of InvoiceNameParameters)
        Get
            Return New XPCollection(Of InvoiceNameParameters)(Session, CriteriaOperator.Parse("PHImportType=0"))
        End Get
    End Property
    <VisibleInListView(False)> _
    ReadOnly Property CustomerNameParameters As XPCollection(Of CustomerNameParameters)
        Get
            Return New XPCollection(Of CustomerNameParameters)(Session, CriteriaOperator.Parse("PHImportType=0"))
        End Get
    End Property
    Property CostHolder As CostHolder
        Get
            Return _CostHolder
        End Get
        Set(ByVal value As CostHolder)
            SetPropertyValue("CostHolder", _CostHolder, value)
        End Set
    End Property
    <RuleRequiredField("Corner-Customers_Cash", DefaultContexts.Save)> _
    Property Customers_Cash As Customers
        Get
            Return _Customers_Cash
        End Get
        Set(ByVal value As Customers)
            SetPropertyValue("Customers_Cash", _Customers_Cash, value)
        End Set
    End Property
    <RuleRequiredField("Corner-Customers_ATM", DefaultContexts.Save)> _
    Property Customers_ATM As Customers
        Get
            Return _Customers_ATM
        End Get
        Set(ByVal value As Customers)
            SetPropertyValue("Customers_ATM", _Customers_ATM, value)
        End Set
    End Property
End Class
