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

Public Enum eWinLoss
    eRateDiffWin = 0
    eRateDiffLoss = 1
    eRoundingWin = 2
    eRoundingLoss = 3
    eRevaluationWin = 4
    eRevaluationLoss = 5
End Enum
<DefaultClassOptions(), CreatableItem(False)> _
<NavigationItem("FinancialStock")> _
Public Class GLHeader_RateDiffParameter
    Inherits BaseObject
    Private _ChartOfAccounts_RateDiff_Win As ChartOfAccounts '(deb)
    Private _ChartOfAccounts_RateDiff_Loss As ChartOfAccounts '(deb)
    Private _Controlling_RateDiff_Win As Controlling
    Private _Controlling_RateDiff_Loss As Controlling

    Private _ChartOfAccounts_Rounding_Win As ChartOfAccounts '(deb)
    Private _ChartOfAccounts_Rounding_Loss As ChartOfAccounts '(deb)

    Private _Controlling_Rounding_Win As Controlling
    Private _Controlling_Rounding_Loss As Controlling

    Private _Controlling_Revaluation_Win As Controlling
    Private _Controlling_Revaluation_Loss As Controlling


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

    <Browsable(False)> _
    Property ChartOfAccounts_RateDiff_Win As ChartOfAccounts
        Get
            Return _ChartOfAccounts_RateDiff_Win
        End Get
        Set(value As ChartOfAccounts)
            SetPropertyValue("ChartOfAccounts_RateDiff_Win", _ChartOfAccounts_RateDiff_Win, value)
        End Set
    End Property
    <Browsable(False)> _
    Property ChartOfAccounts_RateDiff_Loss As ChartOfAccounts
        Get
            Return _ChartOfAccounts_RateDiff_Loss
        End Get
        Set(value As ChartOfAccounts)
            SetPropertyValue("ChartOfAccounts_RateDiff_Loss", _ChartOfAccounts_RateDiff_Loss, value)
        End Set
    End Property

    <RuleRequiredField("GLHeader_RateDiffParameter-Controlling_RateDiff_Win", DefaultContexts.Save)>
    <ImmediatePostData(True), DataSourceCriteria("IsParent=False")>
    Property Controlling_RateDiff_Win As Controlling
        Get
            Return _Controlling_RateDiff_Win
        End Get
        Set(value As Controlling)
            SetPropertyValue("Controlling_RateDiff_Win", _Controlling_RateDiff_Win, value)
        End Set
    End Property
    <RuleRequiredField("GLHeader_RateDiffParameter-Controlling_RateDiff_Loss", DefaultContexts.Save)>
    <ImmediatePostData(True), DataSourceCriteria("IsParent=False")>
    Property Controlling_RateDiff_Loss As Controlling
        Get
            Return _Controlling_RateDiff_Loss
        End Get
        Set(ByVal value As Controlling)
            SetPropertyValue("Controlling_RateDiff_Loss", _Controlling_RateDiff_Loss, value)
        End Set
    End Property

    <Browsable(False)>
    Property ChartOfAccounts_Rounding_Win As ChartOfAccounts
        Get
            Return _ChartOfAccounts_Rounding_Win
        End Get
        Set(value As ChartOfAccounts)
            SetPropertyValue("ChartOfAccounts_Rounding_Win", _ChartOfAccounts_Rounding_Win, value)
        End Set
    End Property
    <Browsable(False)>
    Property ChartOfAccounts_Rounding_Loss As ChartOfAccounts
        Get
            Return _ChartOfAccounts_Rounding_Loss
        End Get
        Set(value As ChartOfAccounts)
            SetPropertyValue("ChartOfAccounts_Rounding_Loss", _ChartOfAccounts_Rounding_Loss, value)
        End Set
    End Property

    <RuleRequiredField("GLHeader_RoundingParameter-Controlling_Rounding_Win", DefaultContexts.Save)>
    <ImmediatePostData(True), DataSourceCriteria("IsParent=False")>
    Property Controlling_Rounding_Win As Controlling
        Get
            Return _Controlling_Rounding_Win
        End Get
        Set(value As Controlling)
            SetPropertyValue("Controlling_Rounding_Win", _Controlling_Rounding_Win, value)
        End Set
    End Property
    <RuleRequiredField("GLHeader_RoundingParameter-Controlling_Rounding_Loss", DefaultContexts.Save)>
    <ImmediatePostData(True), DataSourceCriteria("IsParent=False")>
    Property Controlling_Rounding_Loss As Controlling
        Get
            Return _Controlling_Rounding_Loss
        End Get
        Set(ByVal value As Controlling)
            SetPropertyValue("Controlling_Rounding_Loss", _Controlling_Rounding_Loss, value)
        End Set
    End Property

    Property Controlling_Revaluation_Win As Controlling
        Get
            Return _Controlling_Revaluation_Win
        End Get
        Set(value As Controlling)
            SetPropertyValue("Controlling_Revaluation_Win", _Controlling_Revaluation_Win, value)
        End Set
    End Property
    Property Controlling_Revaluation_Loss As Controlling
        Get
            Return _Controlling_Revaluation_Loss
        End Get
        Set(value As Controlling)
            SetPropertyValue("Controlling_Revaluation_Loss", _Controlling_Revaluation_Loss, value)
        End Set
    End Property

    <Association("GLHeader_RateDiffParameter-GLHeader_RateDiffParameterYear", GetType(GLHeader_RateDiffParameterYear)), VisibleInListView(False), VisibleInLookupListView(False)>
    ReadOnly Property GLHeader_RateDiffParameterYear As XPCollection(Of GLHeader_RateDiffParameterYear)
        Get
            Return GetCollection(Of GLHeader_RateDiffParameterYear)("GLHeader_RateDiffParameterYear")
        End Get
    End Property

    Public Function GetChartOfAccounts(_AccountYear As Long, _WinLoss As eWinLoss) As ChartOfAccounts
        Dim _ChartOfAccounts As ChartOfAccounts = Nothing
        Dim _GLHeader_RateDiffParameterYear As GLHeader_RateDiffParameterYear
        Select Case _WinLoss
            Case eWinLoss.eRateDiffLoss
                For Each _GLHeader_RateDiffParameterYear In Me.GLHeader_RateDiffParameterYear
                    If _GLHeader_RateDiffParameterYear.AccountYear = _AccountYear Then
                        _ChartOfAccounts = _GLHeader_RateDiffParameterYear.ChartOfAccounts_RateDiff_Loss
                        Exit For
                    End If
                Next
            Case eWinLoss.eRateDiffWin
                For Each _GLHeader_RateDiffParameterYear In Me.GLHeader_RateDiffParameterYear
                    If _GLHeader_RateDiffParameterYear.AccountYear = _AccountYear Then
                        _ChartOfAccounts = _GLHeader_RateDiffParameterYear.ChartOfAccounts_RateDiff_Win
                        Exit For
                    End If
                Next
            Case eWinLoss.eRoundingLoss
                For Each _GLHeader_RateDiffParameterYear In Me.GLHeader_RateDiffParameterYear
                    If _GLHeader_RateDiffParameterYear.AccountYear = _AccountYear Then
                        _ChartOfAccounts = _GLHeader_RateDiffParameterYear.ChartOfAccounts_Rounding_Loss
                        Exit For
                    End If
                Next
            Case eWinLoss.eRoundingWin
                For Each _GLHeader_RateDiffParameterYear In Me.GLHeader_RateDiffParameterYear
                    If _GLHeader_RateDiffParameterYear.AccountYear = _AccountYear Then
                        _ChartOfAccounts = _GLHeader_RateDiffParameterYear.ChartOfAccounts_Rounding_Win
                        Exit For
                    End If
                Next
            Case eWinLoss.eRevaluationWin
                For Each _GLHeader_RateDiffParameterYear In Me.GLHeader_RateDiffParameterYear
                    If _GLHeader_RateDiffParameterYear.AccountYear = _AccountYear Then
                        _ChartOfAccounts = _GLHeader_RateDiffParameterYear.ChartOfAccounts_Revaluation_Win
                        Exit For
                    End If
                Next
            Case eWinLoss.eRevaluationLoss
                For Each _GLHeader_RateDiffParameterYear In Me.GLHeader_RateDiffParameterYear
                    If _GLHeader_RateDiffParameterYear.AccountYear = _AccountYear Then
                        _ChartOfAccounts = _GLHeader_RateDiffParameterYear.ChartOfAccounts_Revaluation_Loss
                        Exit For
                    End If
                Next

        End Select
        Return _ChartOfAccounts
    End Function
End Class

<DefaultClassOptions(), CreatableItem(False)>
<NavigationItem(False)>
<RuleCriteria("RuleCriteria GLHeader_RateDiffParameterYear-ChartOfAccounts_RateDiff_Win", DefaultContexts.Save, "ChartOfAccounts_RateDiff_Win.Children.Count=0", "Csak gyermek objektum választható ki!", SkipNullOrEmptyValues:=False)>
<RuleCriteria("RuleCriteria GLHeader_RateDiffParameterYear-ChartOfAccounts_RateDiff_Loss", DefaultContexts.Save, "ChartOfAccounts_RateDiff_Loss.Children.Count=0", "Csak gyermek objektum választható ki!", SkipNullOrEmptyValues:=False)>
<RuleCriteria("RuleCriteria GLHeader_RateDiffParameterYear-ChartOfAccounts_Rounding_Win", DefaultContexts.Save, "ChartOfAccounts_Rounding_Win.Children.Count=0", "Csak gyermek objektum választható ki!", SkipNullOrEmptyValues:=False)>
<RuleCriteria("RuleCriteria GLHeader_RateDiffParameterYear-ChartOfAccounts_Rounding_Loss", DefaultContexts.Save, "ChartOfAccounts_Rounding_Loss.Children.Count=0", "Csak gyermek objektum választható ki!", SkipNullOrEmptyValues:=False)>
Public Class GLHeader_RateDiffParameterYear
    Inherits BaseObject
    Private _GLHeader_RateDiffParameter As GLHeader_RateDiffParameter
    Private _AccountYear As Long

    Private _ChartOfAccounts_RateDiff_Win As ChartOfAccounts 'Árfolyam nyereség
    Private _ChartOfAccounts_RateDiff_Loss As ChartOfAccounts 'Árfolyam veszteség

    Private _ChartOfAccounts_Rounding_Win As ChartOfAccounts 'Elengedési nyereség
    Private _ChartOfAccounts_Rounding_Loss As ChartOfAccounts 'Elengedési veszteség

    Private _ChartOfAccounts_Revaluation_Win As ChartOfAccounts 'Átértékelési nyereség
    Private _ChartOfAccounts_Revaluation_Loss As ChartOfAccounts 'Átértékelési veszteség



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

    <Association("GLHeader_RateDiffParameter-GLHeader_RateDiffParameterYear", GetType(GLHeader_RateDiffParameter))>
    Property GLHeader_RateDiffParameter As GLHeader_RateDiffParameter
        Get
            Return _GLHeader_RateDiffParameter
        End Get
        Set(value As GLHeader_RateDiffParameter)
            SetPropertyValue("GLHeader_RateDiffParameter", _GLHeader_RateDiffParameter, value)
        End Set
    End Property
    Property AccountYear As Long
        Get
            Return _AccountYear
        End Get
        Set(value As Long)
            SetPropertyValue("AccountYear", _AccountYear, value)
        End Set
    End Property
    <ImmediatePostData(True), DataSourceCriteria("AccountYear='@This.AccountYear'")>
    <RuleRequiredField("", DefaultContexts.Save)>
    Property ChartOfAccounts_RateDiff_Win As ChartOfAccounts
        Get
            Return _ChartOfAccounts_RateDiff_Win
        End Get
        Set(value As ChartOfAccounts)
            SetPropertyValue("ChartOfAccounts_RateDiff_Win", _ChartOfAccounts_RateDiff_Win, value)
        End Set
    End Property
    <ImmediatePostData(True), DataSourceCriteria("AccountYear='@This.AccountYear'")>
    <RuleRequiredField("", DefaultContexts.Save)>
    Property ChartOfAccounts_RateDiff_Loss As ChartOfAccounts
        Get
            Return _ChartOfAccounts_RateDiff_Loss
        End Get
        Set(value As ChartOfAccounts)
            SetPropertyValue("ChartOfAccounts_RateDiff_Loss", _ChartOfAccounts_RateDiff_Loss, value)
        End Set
    End Property

    <RuleRequiredField("", DefaultContexts.Save)>
    <ImmediatePostData(True), DataSourceCriteria("AccountYear='@This.AccountYear'")>
    Property ChartOfAccounts_Rounding_Win As ChartOfAccounts
        Get
            Return _ChartOfAccounts_Rounding_Win
        End Get
        Set(value As ChartOfAccounts)
            SetPropertyValue("ChartOfAccounts_Rounding_Win", _ChartOfAccounts_Rounding_Win, value)
        End Set
    End Property
    <ImmediatePostData(True), DataSourceCriteria("AccountYear='@This.AccountYear'")>
    Property ChartOfAccounts_Rounding_Loss As ChartOfAccounts
        Get
            Return _ChartOfAccounts_Rounding_Loss
        End Get
        Set(value As ChartOfAccounts)
            SetPropertyValue("ChartOfAccounts_Rounding_Loss", _ChartOfAccounts_Rounding_Loss, value)
        End Set
    End Property
    <RuleRequiredField("", DefaultContexts.Save)>
    <ImmediatePostData(True), DataSourceCriteria("AccountYear='@This.AccountYear'")>
    Property ChartOfAccounts_Revaluation_Win As ChartOfAccounts
        Get
            Return _ChartOfAccounts_Revaluation_Win
        End Get
        Set(value As ChartOfAccounts)
            SetPropertyValue("ChartOfAccounts_Revaluation_Win", _ChartOfAccounts_Revaluation_Win, value)
        End Set
    End Property
    <RuleRequiredField("", DefaultContexts.Save)>
    <ImmediatePostData(True), DataSourceCriteria("AccountYear='@This.AccountYear'")>
    Property ChartOfAccounts_Revaluation_Loss As ChartOfAccounts
        Get
            Return _ChartOfAccounts_Revaluation_Loss
        End Get
        Set(value As ChartOfAccounts)
            SetPropertyValue("ChartOfAccounts_Revaluation_Loss", _ChartOfAccounts_Revaluation_Loss, value)
        End Set
    End Property


End Class