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("FinancialStock")> _
<CreatableItem(False)> _
Public Class Rule5DMatrix
    Inherits BaseObject
    Private _ShortName As String
    Private _RequireUniqueObjects As Boolean
    Private _RequireJobNumberObjects As Boolean
    Private _RequireControlling As Boolean
    Private _RequireCostHolder As Boolean
    Private _RequireCostPlace As Boolean

    Private _VisibleUniqueObjects As Boolean
    Private _VisibleJobNumberObjects As Boolean
    Private _VisibleControlling As Boolean
    Private _VisibleCostHolder As Boolean
    Private _VisibleCostPlace As Boolean

    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.
        If Session.IsNewObject(Me) Then
            VisibleControlling = True
            VisibleCostHolder = True
            VisibleCostPlace = True
            VisibleJobNumberObjects = True
            VisibleUniqueObjects = True
        End If
    End Sub

    Property ShortName As String
        Get
            Return _ShortName
        End Get
        Set(value As String)
            SetPropertyValue("ShortName", _ShortName, value)
        End Set
    End Property

    Property RequireUniqueObjects As Boolean
        Get
            Return _RequireUniqueObjects
        End Get
        Set(value As Boolean)
            SetPropertyValue("RequireUniqueObjects", _RequireUniqueObjects, value)
            If value = True Then
                If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
                    VisibleUniqueObjects = True
                End If
            End If
        End Set
    End Property
    Property RequireJobNumberObjects As Boolean
        Get
            Return _RequireJobNumberObjects
        End Get
        Set(value As Boolean)
            SetPropertyValue("RequireJobNumberObjects", _RequireJobNumberObjects, value)
            If value = True Then
                If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
                    VisibleJobNumberObjects = True
                End If
            End If
        End Set
    End Property
    Property RequireControlling As Boolean
        Get
            Return _RequireControlling
        End Get
        Set(value As Boolean)
            SetPropertyValue("RequireControlling", _RequireControlling, value)
            If value = True Then
                If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
                    VisibleControlling = True
                End If
            End If
        End Set
    End Property
    Property RequireCostHolder As Boolean
        Get
            Return _RequireCostHolder
        End Get
        Set(value As Boolean)
            SetPropertyValue("RequireCostHolder", _RequireCostHolder, value)
            If value = True Then
                If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
                    VisibleCostHolder = True
                End If
            End If
        End Set
    End Property
    Property RequireCostPlace As Boolean
        Get
            Return _RequireCostPlace
        End Get
        Set(value As Boolean)
            SetPropertyValue("RequireCostPlace", _RequireCostPlace, value)
            If value = True Then
                If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
                    VisibleCostPlace = True
                End If
            End If
        End Set
    End Property

    Property VisibleUniqueObjects As Boolean
        Get
            Return _VisibleUniqueObjects
        End Get
        Set(value As Boolean)
            SetPropertyValue("VisibleUniqueObjects", _VisibleUniqueObjects, value)
            If value = False Then
                If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
                    RequireUniqueObjects = False
                End If
            End If
        End Set
    End Property
    Property VisibleJobNumberObjects As Boolean
        Get
            Return _VisibleJobNumberObjects
        End Get
        Set(value As Boolean)
            SetPropertyValue("VisibleJobNumberObjects", _VisibleJobNumberObjects, value)
            If value = False Then
                If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
                    RequireJobNumberObjects = False
                End If
            End If
        End Set
    End Property
    Property VisibleControlling As Boolean
        Get
            Return _VisibleControlling
        End Get
        Set(value As Boolean)
            SetPropertyValue("VisibleControlling", _VisibleControlling, value)
            If value = False Then
                If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
                    RequireControlling = False
                End If
            End If
        End Set
    End Property
    Property VisibleCostHolder As Boolean
        Get
            Return _VisibleCostHolder
        End Get
        Set(value As Boolean)
            SetPropertyValue("VisibleCostHolder", _VisibleCostHolder, value)
            If value = False Then
                If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
                    RequireCostHolder = False
                End If
            End If
        End Set
    End Property
    Property VisibleCostPlace As Boolean
        Get
            Return _VisibleCostPlace
        End Get
        Set(value As Boolean)
            SetPropertyValue("VisibleCostPlace", _VisibleCostPlace, value)
            If value = False Then
                If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
                    RequireCostPlace = False
                End If
            End If
        End Set
    End Property

End Class
