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 DevExpress.ExpressApp.ConditionalAppearance

<DefaultClassOptions()> _
<NavigationItem("RealEstateStocks")> _
<Appearance("Disable UserCreated", AppearanceItemType.ViewItem, "1=1", TargetItems:="UserCreated", Enabled:=False)> _
<Appearance("Disable DateCreated", AppearanceItemType.ViewItem, "1=1", TargetItems:="DateCreated", Enabled:=False)> _
Public Class ImmovablesPriceListHeader
    Inherits BaseObject

    Private _ImmovablesGroups As ImmovablesGroups
    Private _UserCreated As User
    Private _DateCreated As Date
    Private _DueDate As Date 'Ajánlat érvényessége
    Private _DocumentBody As String ' RichText
    Private _IsActive As Boolean '
    Private _ShortName As String '
    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()
        If DueDate = "#12:00:00 AM#" Then
            DueDate = GetSQLTime(Session)
            DueDate = DueDate.AddDays(30)
        End If
    End Sub
    Protected Overrides Sub OnSaving()
        MyBase.OnSaving()
        If Session.IsNewObject(Me) Then
            DateCreated = GetSQLTime(Session)
            UserCreated = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser))
        End If
    End Sub
    <ImmediatePostData()> _
    Property ImmovablesGroups As ImmovablesGroups
        Get
            Return _ImmovablesGroups
        End Get
        Set(value As ImmovablesGroups)
            SetPropertyValue("ImmovablesGroups", _ImmovablesGroups, value)
            If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving Then

            End If
        End Set
    End Property
    <NonCloneable> _
    Property UserCreated As User
        Get
            Return _UserCreated
        End Get
        Set(ByVal value As User)
            SetPropertyValue("UserCreated", _UserCreated, value)
        End Set
    End Property
    <NonCloneable> _
    Property DateCreated As Date
        Get
            Return _DateCreated
        End Get
        Set(ByVal value As Date)
            SetPropertyValue("DateCreated", _DateCreated, value)
        End Set
    End Property
    Property DueDate As Date
        Get
            Return _DueDate
        End Get
        Set(ByVal value As Date)
            SetPropertyValue("DueDate", _DueDate, value)
        End Set
    End Property
    <Size(-1)> _
    Property DocumentBody As String
        Get
            Return _DocumentBody
        End Get
        Set(ByVal value As String)
            SetPropertyValue("DocumentBody", _DocumentBody, value)
        End Set
    End Property
    Property IsActive As Boolean
        Get
            Return _IsActive
        End Get
        Set(ByVal value As Boolean)
            SetPropertyValue("IsActive", _IsActive, value)
        End Set
    End Property
    Property ShortName As String
        Get
            Return _ShortName
        End Get
        Set(ByVal value As String)
            SetPropertyValue("ShortName", _ShortName, value)
        End Set
    End Property
    <Size(-1)> _
    Property Desctiption As String
        Get
            Return _Description
        End Get
        Set(ByVal value As String)
            SetPropertyValue("Description", _Description, value)
        End Set
    End Property
    <VisibleInListView(False)> _
    <Association("ImmovablesPriceListHeader-ImmovablesPriceListRowsA", GetType(ImmovablesPriceListRowsA))> _
    ReadOnly Property ImmovablesPriceListRowsA As XPCollection(Of ImmovablesPriceListRowsA)
        Get
            Return GetCollection(Of ImmovablesPriceListRowsA)("ImmovablesPriceListRowsA")
        End Get
    End Property
    <VisibleInListView(False)> _
    <Association("ImmovablesPriceListHeader-ImmovablesPriceListRowsO", GetType(ImmovablesPriceListRowsO))> _
    ReadOnly Property ImmovablesPriceListRowsO As XPCollection(Of ImmovablesPriceListRowsO)
        Get
            Return GetCollection(Of ImmovablesPriceListRowsO)("ImmovablesPriceListRowsO")
        End Get
    End Property
    <VisibleInListView(False)> _
    <Association("ImmovablesPriceListHeader-ImmovablesPriceListRowsC", GetType(ImmovablesPriceListRowsC))> _
    ReadOnly Property ImmovablesPriceListRowsC As XPCollection(Of ImmovablesPriceListRowsC)
        Get
            Return GetCollection(Of ImmovablesPriceListRowsC)("ImmovablesPriceListRowsC")
        End Get
    End Property
    <VisibleInListView(False)> _
    <Association("ImmovablesPriceListHeader-ImmovablesPriceListRowsG", GetType(ImmovablesPriceListRowsG))> _
    ReadOnly Property ImmovablesPriceListRowsG As XPCollection(Of ImmovablesPriceListRowsG)
        Get
            Return GetCollection(Of ImmovablesPriceListRowsG)("ImmovablesPriceListRowsG")
        End Get
    End Property
End Class
