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

<NavigationItem(False), CreatableItem(False)> _
<DefaultClassOptions()> _
<Appearance("Hide CRMEstate_Leads_Immovables", AppearanceItemType.ViewItem, "1=1", TargetItems:="CRMEstate_Leads_Immovables", visibility:=Editors.ViewItemVisibility.Hide)> _
<Appearance("Disable DateTo", AppearanceItemType.ViewItem, "1=1", TargetItems:="DateTo", Enabled:=False)> _
Public Class CRMEstate_Leads_Immovables_Reservation_Popup
    Inherits BaseObject
    Private _DateTo As Date ' Meddig
    Private _DateFrom As Date ' Mettől
    Private _AlertPeriod As AlertPeriod
    Private _CRMEstate_Leads_Immovables As CRMEstate_Leads_Immovables ' A kiválasztott ingatlan

    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
    End Sub
    <RuleRequiredField("CRMEstate_Leads_Immovables_Reservation_Popup-DateTo", DefaultContexts.Save)> _
    Property DateTo As Date
        Get
            Return _DateTo
        End Get
        Set(value As Date)
            SetPropertyValue("DateTo", _DateTo, value)
        End Set
    End Property
    <RuleRequiredField("CRMEstate_Leads_Immovables_Reservation_Popup-DateFrom", DefaultContexts.Save)> _
    <ImmediatePostData()> _
    Property DateFrom As Date
        Get
            Return _DateFrom
        End Get
        Set(value As Date)
            SetPropertyValue("DateFrom", _DateFrom, value)
            If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving Then
                Me.DateTo = Me.DateFrom.AddHours(72)
            End If
        End Set
    End Property
    Property AlertPeriod As AlertPeriod
        Get
            Return _AlertPeriod
        End Get
        Set(value As AlertPeriod)
            SetPropertyValue("AlertPeriod", _AlertPeriod, value)
        End Set
    End Property
    Property CRMEstate_Leads_Immovables As CRMEstate_Leads_Immovables
        Get
            Return _CRMEstate_Leads_Immovables
        End Get
        Set(value As CRMEstate_Leads_Immovables)
            SetPropertyValue("CRMEstate_Leads_Immovables", _CRMEstate_Leads_Immovables, value)
        End Set
    End Property

    '------------ReadOnly-------------------
    <VisibleInListView(False)> _
    ReadOnly Property CollectionOfReservation As XPCollection(Of CRMEstate_Leads_Immovables_Reservation)
        Get
            Return _CRMEstate_Leads_Immovables.CRMEstate_Leads_Immovables_Reservation
        End Get
    End Property
End Class
