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.Persistent.Base.General
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Linq
Imports System.Linq.Expressions
Imports DevExpress.ExpressApp.ConditionalAppearance
Public Enum eInfoType
    eOpen = 0 'Nyitott tételek a számla devizanemére vonatkozósan
    eClose = 1 'Kifutott tételek a számla devizanemére vonatkozóan
    eAll = 2 'Összes
End Enum
Public Enum ePACIQType
    eFull = 0 'Összes
    ePeriodicWithOpen = 1 'Adott időszakra vonatkozó nyitóval
    ePeriodicNoOpen = 2 'Adott időszakra vonatkozó nyitó nélkül, de az 
    'időszakon lelüli pü teljesítések amelyek az időszakon kívüli számlákkal kapcsolatosak azokat NE
End Enum
<DefaultClassOptions()> _
<NavigationItem("FinancialTransactions")> _
<DeferredDeletion(False)> _
Public Class PartnerAccountConnectionInfoQueryHeader
    Inherits BaseObject
    Private _DateOpen As Date 'Nyitó dátum
    Private _DateClose As Date 'Záró dátum
    Private _ShortName As String 'A lekérdezés megnevezése
    Private _InfoType As eInfoType 'A lekérdezés tipusa (nyitott tételek, lezárt tételek összes tétel)
    Private _PartnerType As ePartnerType 'Partner tipusa
    Private _PACIQType As ePACIQType 'Lekérdezés típusa
    Private _UserCreated As User
    Private _ObjectCreated As Date
    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
        If Session.IsNewObject(Me) Then
            Me.DateClose = Now
            Me.DateOpen = CDate(Year(Now).ToString & "/01/01")
            Dim _PartnerAccountConnectionInfoQuerySelectedCustomersFrom As PartnerAccountConnectionInfoQuerySelectedCustomersFrom
            Dim _CustomersFrom_Collection As New XPCollection(Of CustomersFrom)(Session)
            Dim _CustomersFrom As CustomersFrom

            For Each _CustomersFrom In _CustomersFrom_Collection
                _PartnerAccountConnectionInfoQuerySelectedCustomersFrom = New PartnerAccountConnectionInfoQuerySelectedCustomersFrom(Session)
                _PartnerAccountConnectionInfoQuerySelectedCustomersFrom.PartnerAccountConnectionInfoQueryHeader = Me
                _PartnerAccountConnectionInfoQuerySelectedCustomersFrom.CustomersFrom = _CustomersFrom
            Next
        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 DateOpen As Date
        Get
            Return _DateOpen
        End Get
        Set(value As Date)
            SetPropertyValue("DateOpen", _DateOpen, value)
        End Set
    End Property
    Property DateClose As Date
        Get
            Return _DateClose
        End Get
        Set(ByVal value As Date)
            SetPropertyValue("DateClose", _DateClose, 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
    Property InfoType As eInfoType
        Get
            Return _InfoType
        End Get
        Set(value As eInfoType)
            SetPropertyValue("InfoType", _InfoType, value)
        End Set
    End Property
    Property PartnerType As ePartnerType
        Get
            Return _PartnerType
        End Get
        Set(value As ePartnerType)
            SetPropertyValue("PartnerType", _PartnerType, value)
        End Set
    End Property
    Property PACIQType As ePACIQType
        Get
            Return _PACIQType
        End Get
        Set(value As ePACIQType)
            SetPropertyValue("PACIQType", _PACIQType, 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
    <NonCloneable> _
    Property ObjectCreated As Date
        Get
            Return _ObjectCreated
        End Get
        Set(value As Date)
            SetPropertyValue("ObjectCreated", _ObjectCreated, value)
        End Set
    End Property


    <Association("PartnerAccountConnectionInfoQueryHeader-PartnerAccountConnectionInfoQueryRows", GetType(PartnerAccountConnectionInfoQueryRows)), VisibleInListView(False)> _
    ReadOnly Property PartnerAccountConnectionInfoQueryRows As XPCollection(Of PartnerAccountConnectionInfoQueryRows)
        Get
            Return GetCollection(Of PartnerAccountConnectionInfoQueryRows)("PartnerAccountConnectionInfoQueryRows")
        End Get
    End Property
    <Association("PartnerAccountConnectionInfoQueryHeader-PartnerAccountConnectionInfoQueryPartner", GetType(PartnerAccountConnectionInfoQueryPartner)), VisibleInListView(False)> _
    ReadOnly Property PartnerAccountConnectionInfoQueryPartner As XPCollection(Of PartnerAccountConnectionInfoQueryPartner)
        Get
            Return GetCollection(Of PartnerAccountConnectionInfoQueryPartner)("PartnerAccountConnectionInfoQueryPartner")
        End Get
    End Property
    <Association("PartnerAccountConnectionInfoQueryHeader-PartnerAccountConnectionInfoQuerySelectedCustomers", GetType(PartnerAccountConnectionInfoQuerySelectedCustomers)), VisibleInListView(False)> _
    ReadOnly Property PartnerAccountConnectionInfoQuerySelectedCustomers As XPCollection(Of PartnerAccountConnectionInfoQuerySelectedCustomers)
        Get
            Return GetCollection(Of PartnerAccountConnectionInfoQuerySelectedCustomers)("PartnerAccountConnectionInfoQuerySelectedCustomers")
        End Get
    End Property
    <Association("PartnerAccountConnectionInfoQueryHeader-PartnerAccountConnectionInfoQuerySelectedCustomersFrom", GetType(PartnerAccountConnectionInfoQuerySelectedCustomersFrom)), VisibleInListView(False)> _
    ReadOnly Property PartnerAccountConnectionInfoQuerySelectedCustomersFrom As XPCollection(Of PartnerAccountConnectionInfoQuerySelectedCustomersFrom)
        Get
            Return GetCollection(Of PartnerAccountConnectionInfoQuerySelectedCustomersFrom)("PartnerAccountConnectionInfoQuerySelectedCustomersFrom")
        End Get
    End Property
End Class
