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("RealEstateTransactions")> _
<DefaultProperty("DisplayName")> _
<Appearance("Hide rent Action if opportunity type not rent", AppearanceItemType:="Action", Criteria:="OpportunityType=1", Context:="Any", TargetItems:="aCreateContractRent", Visibility:=Editors.ViewItemVisibility.Hide)> _
<Appearance("Hide sold Action if opportunity type not sold", AppearanceItemType:="Action", Criteria:="OpportunityType=0", Context:="Any", TargetItems:="aCreateContractSold", Visibility:=Editors.ViewItemVisibility.Hide)> _
Public Class CRMEstate_Opportunity
    Inherits BaseObject
    Private _CRMEstate_Leads As CRMEstate_Leads
    Private _OpportunityType As eOpportunityType
    Private _DocumentNumber As String 'Ügy azonosító
    Private _Description As String 'Leírás
    Private _ObjectCreated As Date 'Létrehozva
    Private _HRPerson As HRPerson 'Felelős

    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
    End Sub

    Property CRMEstate_Leads As CRMEstate_Leads
        Get
            Return _CRMEstate_Leads
        End Get
        Set(ByVal value As CRMEstate_Leads)
            SetPropertyValue("CRMEstate_Leads", _CRMEstate_Leads, value)
        End Set
    End Property
    Property OpportunityType As eOpportunityType
        Get
            Return _OpportunityType
        End Get
        Set(value As eOpportunityType)
            SetPropertyValue("OpportunityType", _OpportunityType, value)
        End Set
    End Property
    <NonCloneable()> _
    Property DocumentNumber As String
        Get
            Return _DocumentNumber
        End Get
        Set(value As String)
            SetPropertyValue("DocumentNumber", _DocumentNumber, value)
        End Set
    End Property
    <Size(4000)> _
    Property Description As String
        Get
            Return _Description
        End Get
        Set(value As String)
            SetPropertyValue("Description", _Description, value)
        End Set
    End Property
    Property ObjectCreated As Date
        Get
            Return _ObjectCreated
        End Get
        Set(value As Date)
            SetPropertyValue("ObjectCreated", _ObjectCreated, value)
        End Set
    End Property
    Property HRPerson As HRPerson
        Get
            Return _HRPerson
        End Get
        Set(value As HRPerson)
            SetPropertyValue("HRPerson", _HRPerson, value)
        End Set
    End Property
    <VisibleInListView(False)> _
    <Association("CRMEstate_Opportunity-CRMEstate_Opportunity_Immovables", GetType(CRMEstate_Opportunity_Immovables))> _
    ReadOnly Property CRMEstate_Opportunity_Immovables As XPCollection(Of CRMEstate_Opportunity_Immovables)
        Get
            Return GetCollection(Of CRMEstate_Opportunity_Immovables)("CRMEstate_Opportunity_Immovables")
        End Get
    End Property
    <VisibleInListView(False)> _
    ReadOnly Property Contracts As XPCollection(Of Contracts)
        Get
            Return New XPCollection(Of Contracts)(Session, CriteriaOperator.Parse("CRMEstate_Opportunity_Immovables.CRMEstate_Opportunity=?", Me))
        End Get
    End Property
    <VisibleInListView(False)> _
    ReadOnly Property InvoiceHeader As XPCollection(Of InvoiceHeader)
        Get
            Return New XPCollection(Of InvoiceHeader)(Session, CriteriaOperator.Parse("Oid<>Oid"))
        End Get
    End Property
    <VisibleInListView(False)> _
    ReadOnly Property PCIGroup As XPCollection(Of PCIGroup)
        Get
            Return New XPCollection(Of PCIGroup)(Session, CriteriaOperator.Parse("Oid<>Oid"))
        End Get
    End Property
    ReadOnly Property DisplayName
        Get
            Return DocumentNumber & ", " & CRMEstate_Leads.LastName & " " & CRMEstate_Leads.FirstName & ", " & ObjectCreated
        End Get
    End Property
End Class



