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(False), CreatableItem(False)> _
<DefaultProperty("Customers")> _
Public Class CRMEstate_Opportunity_Customers
    Inherits BaseObject
    Private _CRMEstate_Opportunity_Immovables As CRMEstate_Opportunity_Immovables
    Private _Customers As Customers
    Private _BirthDay As Date
    Private _PlaceOfBirth As String
    Private _SocialNumberLastFourDigit As String 'Személyi szám 
    Private _SocialNumber As String 'Személy igazolvány szám
    Private _MotherName As String
    Private _AddressNotice As Address 'Értesítési cím
    Private _AddressInvoice As Address 'Számlázási cím
    Private _RightQuota As Double
    Private _RightState As eRightState
    Private _KSHNumber As String
    Private _CorporateNumber 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
    <Association("CRMEstate_Opportunity_Immovables-CRMEstate_Opportunity_Customers", GetType(CRMEstate_Opportunity_Immovables))> _
    Property CRMEstate_Opportunity_Immovables As CRMEstate_Opportunity_Immovables
        Get
            Return _CRMEstate_Opportunity_Immovables
        End Get
        Set(value As CRMEstate_Opportunity_Immovables)
            SetPropertyValue("CRMEstate_Opportunity_Immovables", _CRMEstate_Opportunity_Immovables, value)
        End Set
    End Property
    <ImmediatePostData()>
    <RuleRequiredField("CRMEstate_Opportunity_Customers.Customers", DefaultContexts.Save)> _
    Property Customers As Customers
        Get
            Return _Customers
        End Get
        Set(value As Customers)
            SetPropertyValue("Customers", _Customers, value)
            If Not Session.IsObjectsSaving And Not Session.IsObjectsLoading And value IsNot Nothing Then
                Dim _ExistingCRMEstate_Opportunity_Customers As CRMEstate_Opportunity_Customers = Session.FindObject(Of CRMEstate_Opportunity_Customers)(CriteriaOperator.Parse("Customers=?", value))
                If _ExistingCRMEstate_Opportunity_Customers IsNot Nothing Then
                    Me.AddressInvoice = _ExistingCRMEstate_Opportunity_Customers.AddressInvoice
                    Me.AddressNotice = _ExistingCRMEstate_Opportunity_Customers.AddressNotice
                    Me.BirthDay = _ExistingCRMEstate_Opportunity_Customers.BirthDay
                    Me.MotherName = _ExistingCRMEstate_Opportunity_Customers.MotherName
                    Me.PlaceOfBirth = _ExistingCRMEstate_Opportunity_Customers.PlaceOfBirth
                    Me.SocialNumber = _ExistingCRMEstate_Opportunity_Customers.SocialNumber
                    Me.SocialNumberLastFourDigit = _ExistingCRMEstate_Opportunity_Customers.SocialNumberLastFourDigit
                End If
            End If
        End Set
    End Property
    <RuleRequiredField("CRMEstate_Opportunity_Customers.BirthDay", DefaultContexts.Save)> _
    Property BirthDay As Date
        Get
            Return _BirthDay
        End Get
        Set(value As Date)
            SetPropertyValue("BirthDay", _BirthDay, value)
        End Set
    End Property
    <RuleRequiredField("CRMEstate_Opportunity_Customers.PlaceOfBirth", DefaultContexts.Save)> _
    Property PlaceOfBirth As String
        Get
            Return _PlaceOfBirth
        End Get
        Set(ByVal value As String)
            SetPropertyValue("PlaceOfBirth", _PlaceOfBirth, value)
        End Set
    End Property
    <RuleRequiredField("CRMEstate_Opportunity_Customers.SocialNumberLastFourDigit", DefaultContexts.Save)> _
    Property SocialNumberLastFourDigit As String
        Get
            Return _SocialNumberLastFourDigit
        End Get
        Set(value As String)
            SetPropertyValue("SocialNumberLastFourDigit", _SocialNumberLastFourDigit, value)
        End Set
    End Property
    <RuleRequiredField("CRMEstate_Opportunity_Customers.SocialNumber", DefaultContexts.Save)> _
    Property SocialNumber As String
        Get
            Return _SocialNumber
        End Get
        Set(value As String)
            SetPropertyValue("SocialNumber", _SocialNumber, value)
        End Set
    End Property
    <RuleRequiredField("CRMEstate_Opportunity_Customers.MotherName", DefaultContexts.Save)> _
    Property MotherName As String
        Get
            Return _MotherName
        End Get
        Set(ByVal value As String)
            SetPropertyValue("MotherName", _MotherName, value)
        End Set
    End Property
    <RuleRequiredField("CRMEstate_Opportunity_Customers.AddressNotice", DefaultContexts.Save)> _
    Property AddressNotice As Address
        Get
            Return _AddressNotice
        End Get
        Set(value As Address)
            SetPropertyValue("AddressNotice", _AddressNotice, value)
        End Set
    End Property
    <RuleRequiredField("CRMEstate_Opportunity_Customers.AddressInvoice", DefaultContexts.Save)> _
    Property AddressInvoice As Address
        Get
            Return _AddressInvoice
        End Get
        Set(value As Address)
            SetPropertyValue("AddressInvoice", _AddressInvoice, value)
        End Set
    End Property
    <RuleRequiredField("CRMEstate_Opportunity_Customers.RightQuota", DefaultContexts.Save)> _
    Property RightQuota As Double
        Get
            Return _RightQuota
        End Get
        Set(value As Double)
            SetPropertyValue("RightQuota", _RightQuota, value)
        End Set
    End Property
    <RuleRequiredField("CRMEstate_Opportunity_Customers.RightState", DefaultContexts.Save)> _
    Property RightState As eRightState
        Get
            Return _RightState
        End Get
        Set(value As eRightState)
            SetPropertyValue("RightState", _RightState, value)
        End Set
    End Property
    Property KSHNumber As String
        Get
            Return _KSHNumber
        End Get
        Set(value As String)
            SetPropertyValue("KSHNumber", _KSHNumber, value)
        End Set
    End Property
    Property CorporateNumber As String
        Get
            Return _CorporateNumber
        End Get
        Set(value As String)
            SetPropertyValue("CorporateNumber", _CorporateNumber, value)
        End Set
    End Property
End Class




