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 System.Linq
Imports System.Linq.Expressions

<DefaultClassOptions(), NavigationItem(False), CreatableItem(False), DefaultProperty("AccountYear")> _
Public Class ChartOfAccountsYear
    Inherits BaseObject
    Private _AccountYear As Long
    Private _IsClosed As Boolean = False
    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
    End Sub

    <RuleValueComparison("RuleValueComparison ChartOfAccountsYear-AccountYear", DefaultContexts.Save, ValueComparisonType.GreaterThan, "2000")> _
    <RuleUniqueValue("RuleUniqueValue ChartOfAccountsYear-AccountYear", PersistentCriteriaEvaluationBehavior.InTransaction)> _
    Property AccountYear As Long
        Get
            Return _AccountYear
        End Get
        Set(value As Long)
            SetPropertyValue("AccountYear", _AccountYear, value)
        End Set
    End Property
    Property IsClosed As Boolean
        Get
            Return _IsClosed
        End Get
        Set(value As Boolean)
            SetPropertyValue("IsClosed", _IsClosed, value)
        End Set
    End Property
    <VisibleInListView(False), VisibleInLookupListView(False)>
    ReadOnly Property ChartOfAccounts As XPCollection(Of ChartOfAccounts)
        Get
            Return New XPCollection(Of ChartOfAccounts)(Session, CriteriaOperator.Parse("AccountYear=?", AccountYear))
        End Get
    End Property

End Class
