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)> _
<NonPersistent()>
Public Class RegistryRowsFinancialPopup
    Inherits BaseObject

    Private _RegistryHeader As RegistryHeader
    Private _VAT As VAT
    Private _WorkflowSystemSteps As WorkflowSystemSteps
    Private _HRPerson As HRPerson
    Private _Description As String
    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
    <Browsable(False)> _
    Property RegistryHeader As RegistryHeader
        Get
            Return _RegistryHeader
        End Get
        Set(value As RegistryHeader)
            SetPropertyValue("RegistryHeader", _RegistryHeader, value)
        End Set
    End Property
    <RuleRequiredField("RegistryRowsFinancialPopup-VAT", "DialogOk_Contexts")> _
    Property VAT As VAT
        Get
            Return _VAT
        End Get
        Set(value As VAT)
            SetPropertyValue("VAT", _VAT, value)
        End Set
    End Property
    <RuleRequiredField("RegistryRowsFinancialPopup-WorkflowSystemSteps", "DialogOk_Contexts")> _
    <DataSourceCriteria("WorkflowSystem = '@This.RegistryHeader.RegistryType.WorkflowSystem'")> _
    Property WorkflowSystemSteps As WorkflowSystemSteps
        Get
            Return _WorkflowSystemSteps
        End Get
        Set(value As WorkflowSystemSteps)
            SetPropertyValue("WorkflowSystemSteps", _WorkflowSystemSteps, value)

            If Session.IsObjectsLoading() = False And Session.IsObjectsSaving() = False And Me.WorkflowSystemSteps IsNot Nothing Then
                If Me.WorkflowSystemSteps.HRResponsible IsNot Nothing Then
                    Me.HRPerson = Me.WorkflowSystemSteps.HRResponsible
                Else
                    Me.HRPerson = Me.RegistryHeader.HRResponsible
                End If
            End If
        End Set
    End Property
    <RuleRequiredField("RegistryRowsFinancialPopup-HRPerson", "DialogOk_Contexts")> _
    Property HRPerson As HRPerson
        Get
            Return _HRPerson
        End Get
        Set(value As HRPerson)
            SetPropertyValue("HRPerson", _HRPerson, value)
        End Set
    End Property
    <Size(-1)> _
    Property Description As String
        Get
            Return _Description
        End Get
        Set(value As String)
            SetPropertyValue("Description", _Description, value)
        End Set
    End Property
End Class
