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(False), CreatableItem(False)> _
Public Class LiquidAssetsReturnDenomination
    Inherits BaseObject
    Private _LiquidAssetsReturnHeader As LiquidAssetsReturnHeader
    Private _Idx As Long
    Private _Denomination As String
    Private _DenominationValue As Double
    Private _SumValue As Long
    Public Sub New(ByVal session As Session)
        MyBase.New(session)
        ' This constructor is used when an object is loaded from a persistent storage.
        ' Do not place any code here or place it only when the IsLoading property is false:
        ' if (!IsLoading){
        '   It is now OK to place your initialization code here.
        ' }
        ' or as an alternative, move your initialization code into the AfterConstruction method.
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
        ' Place here your initialization code.
    End Sub

    <Association("LiquidAssetsReturnHeader-LiquidAssetsReturnDenomination", GetType(LiquidAssetsReturnHeader))> _
    Property LiquidAssetsReturnHeader As LiquidAssetsReturnHeader
        Get
            Return _LiquidAssetsReturnHeader
        End Get
        Set(value As LiquidAssetsReturnHeader)
            SetPropertyValue("LiquidAssetsReturnHeader", _LiquidAssetsReturnHeader, value)
        End Set
    End Property
    Property Denomination As String
        Get
            Return _Denomination
        End Get
        Set(value As String)
            SetPropertyValue("Denomination", _Denomination, value)
        End Set
    End Property
    Property DenominationValue As Double
        Get
            Return _DenominationValue
        End Get
        Set(value As Double)
            SetPropertyValue("DenominationValue", _DenominationValue, value)
            If Session.IsObjectsSaving = False And Session.IsObjectsLoading = False Then
                Select Case Denomination
                    Case "20 000" : SumValue = 20000 * DenominationValue
                    Case "10 000" : SumValue = 10000 * DenominationValue
                    Case "5 000" : SumValue = 5000 * DenominationValue
                    Case "2 000" : SumValue = 2000 * DenominationValue
                    Case "1 000" : SumValue = 1000 * DenominationValue
                    Case "500" : SumValue = 500 * DenominationValue
                    Case "200" : SumValue = 200 * DenominationValue
                    Case "100" : SumValue = 100 * DenominationValue
                    Case "50" : SumValue = 50 * DenominationValue
                    Case "20" : SumValue = 20 * DenominationValue
                    Case "10" : SumValue = 10 * DenominationValue
                    Case "5" : SumValue = 5 * DenominationValue
                    Case "2" : SumValue = 2 * DenominationValue
                    Case "1" : SumValue = 1 * DenominationValue
                    Case "50 cent" : SumValue = 0.5 * DenominationValue
                    Case "20 cent" : SumValue = 0.2 * DenominationValue
                    Case "10 cent" : SumValue = 0.1 * DenominationValue
                    Case "5 cent" : SumValue = 0.05 * DenominationValue
                    Case "2 cent" : SumValue = 0.02 * DenominationValue
                    Case "1 cent" : SumValue = 0.01 * DenominationValue
                End Select
            End If
        End Set
    End Property
    Property SumValue As Long
        Get
            Return _SumValue
        End Get
        Set(value As Long)
            SetPropertyValue("SumValue", _SumValue, value)
        End Set
    End Property
    Property Idx As Long
        Get
            Return _Idx
        End Get
        Set(value As Long)
            SetPropertyValue("Idx", _Idx, value)
        End Set
    End Property
End Class
