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

<DefaultClassOptions()> _
<NavigationItem("Customers")> _
<DefaultProperty("DisplayName")> _
<CreatableItem(False)> _
Public Class CustomerBankAccounts 'A partnerekhez tartozó bankszámlaszámok
    Inherits BaseObject
    Private _Customers As Customers
    Private _ShortName As String
    Private _IBAN As String
    Private _SWIFT As String
    Private _AccountNumber As String
    Private _IsDefault As Boolean
    Private _GIROInfo As GIROInfo
    Private _AutomaticProcessing As Boolean

    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()

    End Sub
    <Association("CustomerBankAccounts", GetType(Customers)), NonCloneable()> _
    Property Customers() As Customers
        Get
            Return _Customers
        End Get
        Set(ByVal value As Customers)
            SetPropertyValue("Customers", _Customers, value)
        End Set
    End Property
    Property ShortName As String
        Get
            Return _ShortName
        End Get
        Set(ByVal value As String)
            SetPropertyValue("ShortName", _ShortName, value)
        End Set
    End Property
    Property IBAN As String
        Get
            Return _IBAN
        End Get
        Set(ByVal value As String)
            SetPropertyValue("IBAN", _IBAN, value)
        End Set
    End Property
    Property SWIFT As String
        Get
            Return _SWIFT
        End Get
        Set(ByVal value As String)
            SetPropertyValue("SWIFT", _SWIFT, value)
        End Set
    End Property
    Property AccountNumber As String
        Get
            Return _AccountNumber
        End Get
        Set(ByVal value As String)
            SetPropertyValue("AccountNumber", _AccountNumber, value)
            If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then

                GIROInfo = Session.FindObject(Of GIROInfo)(CriteriaOperator.Parse("GIROID=?", Mid(AccountNumber, 1, 8)))
                If GIROInfo IsNot Nothing Then
                    ShortName = GIROInfo.ShortName
                End If

            End If
        End Set
    End Property
    ReadOnly Property DisplayName As String
        Get
            Return _AccountNumber & " (" & _ShortName & ")"
        End Get
    End Property
    Property IsDefault As Boolean
        Get
            Return _IsDefault
        End Get
        Set(value As Boolean)
            SetPropertyValue("IsDefault", _IsDefault, value)
        End Set
    End Property
    Property GIROInfo As GIROInfo
        Get
            Return _GIROInfo
        End Get
        Set(value As GIROInfo)
            SetPropertyValue("GIROInfo", _GIROInfo, value)
        End Set
    End Property
    Property AutomaticProcessing As Boolean
        Get
            Return _AutomaticProcessing
        End Get
        Set(value As Boolean)
            SetPropertyValue("AutomaticProcessing", _AutomaticProcessing, value)
        End Set
    End Property
End Class





