Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl

<DefaultClassOptions()>
<NavigationItem("FinancialStock")>
<DefaultProperty("FullBankAccount")>
Public Class BankInformation '-- Bankok !
    Inherits BaseObject
    Private _LiquidAssets As LiquidAssets
    Private _SWIFT As String
    Private _IBAN As String
    Private _AccountNumber As String
    Private _CurrencyName As CurrencyName
    Private _GIROInfo As GIROInfo
    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Property LiquidAssests As LiquidAssets
        Get
            Return _LiquidAssets
        End Get
        Set(ByVal value As LiquidAssets)
            SetPropertyValue("LiquidAssests", _LiquidAssets, 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 IBAN As String
        Get
            Return _IBAN
        End Get
        Set(ByVal value As String)
            SetPropertyValue("IBAN", _IBAN, 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)))
            End If
        End Set
    End Property
    Property CurrencyName As CurrencyName
        Get
            Return _CurrencyName
        End Get
        Set(ByVal value As CurrencyName)
            SetPropertyValue("CurrencyName", _CurrencyName, 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
    ReadOnly Property FullBankAccount As String
        Get
            Return "IBAN: " & _IBAN & " " & _AccountNumber & " SWIFT: " & _SWIFT
        End Get
    End Property
End Class
