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 ' _ ' _ ' ' _ ' _ _ _ _ _ _ _ _ _ Public Class CRMEstate_Leads Inherits BaseObject Private _FirstName As String 'Keresztnév Private _LastName As String 'Vezetéknév Private _EMail As String 'e-mail cím Private _Mobile As String 'mobil telefon Private _Contacts As Contacts 'Kapcsolat Private _CRMEstate_FirstMeet As CRMEstate_FirstMeet 'Hol találkozott először Private _LeadSource As eLeadSource Private _PreferredContactMethod As ePreferredContactMethod Private _LeadStatus As eLeadStatus Private _ImmovablesTypes As eImmovablesTypes Private _HRPerson As HRPerson Private _ObjectCreated As Date Private _UserCreated As User Private _DocumentBody As String Private _ImmovablesPriceListHeader As ImmovablesPriceListHeader Public Sub New(ByVal session As Session) MyBase.New(session) End Sub Public Overrides Sub AfterConstruction() MyBase.AfterConstruction() If Not SecuritySystem.CurrentUser Is Nothing Then Dim currentUser As User = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser)) HRPerson = Session.FindObject(Of HRPerson)(CriteriaOperator.Parse("User=?", currentUser)) End If FirstName = "" LastName = "" End Sub Protected Overrides Sub OnSaving() MyBase.OnSaving() If Session.IsNewObject(Me) Then ObjectCreated = GetSQLTime(Session) UserCreated = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser)) End If End Sub _ Property ImmovablesPriceListHeader As ImmovablesPriceListHeader Get Return _ImmovablesPriceListHeader End Get Set(value As ImmovablesPriceListHeader) SetPropertyValue("ImmovablesPriceListHeader", _ImmovablesPriceListHeader, value) End Set End Property Property Contacts As Contacts Get Return _Contacts End Get Set(ByVal value As Contacts) SetPropertyValue("Contacts", _Contacts, value) End Set End Property _ Property FirstName As String Get Return _FirstName End Get Set(ByVal value As String) SetPropertyValue("FirstName", _FirstName, value) End Set End Property _ Property LastName As String Get Return _LastName End Get Set(ByVal value As String) SetPropertyValue("LastName", _LastName, value) End Set End Property Property EMail As String Get Return _EMail End Get Set(value As String) SetPropertyValue("EMail", _EMail, value) End Set End Property Property Mobile As String Get Return _Mobile End Get Set(value As String) SetPropertyValue("Mobile", _Mobile, value) End Set End Property Property CRMEstate_FirstMeet As CRMEstate_FirstMeet Get Return _CRMEstate_FirstMeet End Get Set(ByVal value As CRMEstate_FirstMeet) SetPropertyValue("CRMEstate_FirstMeet", _CRMEstate_FirstMeet, value) End Set End Property Property LeadSource As eLeadSource Get Return _LeadSource End Get Set(ByVal value As eLeadSource) SetPropertyValue("LeadSource", _LeadSource, value) End Set End Property Property PreferredContactMethod As ePreferredContactMethod Get Return _PreferredContactMethod End Get Set(ByVal value As ePreferredContactMethod) SetPropertyValue("PreferredContactMethod", _PreferredContactMethod, value) End Set End Property Property LeadStatus As eLeadStatus Get Return _LeadStatus End Get Set(ByVal value As eLeadStatus) SetPropertyValue("LeadStatus", _LeadStatus, value) End Set End Property _ Property ImmovablesTypes As eImmovablesTypes Get Return _ImmovablesTypes End Get Set(ByVal value As eImmovablesTypes) SetPropertyValue("ImmovablesTypes", _ImmovablesTypes, 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 _ Property ObjectCreated As Date Get Return _ObjectCreated End Get Set(value As Date) SetPropertyValue("ObjectCreated", _ObjectCreated, value) End Set End Property _ Property UserCreated As User Get Return _UserCreated End Get Set(value As User) SetPropertyValue("UserCreated", _UserCreated, value) End Set End Property _ Property DocumentBody As String Get Return _DocumentBody End Get Set(value As String) SetPropertyValue("DocumentBody", _DocumentBody, value) End Set End Property '---------ReadOnly---------------- _ ReadOnly Property CRMEstate_Opportunity As XPCollection(Of CRMEstate_Opportunity) Get Return New XPCollection(Of CRMEstate_Opportunity)(Session, CriteriaOperator.Parse("CRMEstate_Leads=?", Me)) End Get End Property _ ReadOnly Property Apartments As XPCollection(Of ImmovablesPriceListRowsA) Get Return New XPCollection(Of ImmovablesPriceListRowsA)(Session, CriteriaOperator.Parse("ImmovablesPriceListHeader=?", Me.ImmovablesPriceListHeader)) End Get End Property _ ReadOnly Property Offices As XPCollection(Of ImmovablesPriceListRowsO) Get Return New XPCollection(Of ImmovablesPriceListRowsO)(Session, CriteriaOperator.Parse("ImmovablesPriceListHeader=?", ImmovablesPriceListHeader)) End Get End Property _ ReadOnly Property Garages As XPCollection(Of ImmovablesPriceListRowsG) Get Return New XPCollection(Of ImmovablesPriceListRowsG)(Session, CriteriaOperator.Parse("ImmovablesPriceListHeader=?", ImmovablesPriceListHeader)) End Get End Property _ ReadOnly Property Container As XPCollection(Of ImmovablesPriceListRowsC) Get Return New XPCollection(Of ImmovablesPriceListRowsC)(Session, CriteriaOperator.Parse("ImmovablesPriceListHeader=?", ImmovablesPriceListHeader)) End Get End Property _ ReadOnly Property StudentHostel As XPCollection(Of StudentHostel) Get Return New XPCollection(Of StudentHostel)(Session, CriteriaOperator.Parse("CanForSale=True")) End Get End Property _ ReadOnly Property CRMEstate_Leads_Immovables As XPCollection(Of CRMEstate_Leads_Immovables) Get Return GetCollection(Of CRMEstate_Leads_Immovables)("CRMEstate_Leads_Immovables") End Get End Property _ ReadOnly Property Selected_Apartments As XPCollection(Of Apartments) Get Dim _Criteria As String = "" Dim _CRMEstate_Leads_Immovables As CRMEstate_Leads_Immovables If Me.CRMEstate_Leads_Immovables.Count > 0 Then For Each _CRMEstate_Leads_Immovables In Me.CRMEstate_Leads_Immovables If _Criteria = "" Then _Criteria = "Oid in ('" & _CRMEstate_Leads_Immovables.Immovables.Oid.ToString & "'" Else _Criteria += ",'" & _CRMEstate_Leads_Immovables.Immovables.Oid.ToString & "'" End If Next _Criteria += ")" Else _Criteria += "1=2" End If Dim _Apartments_Collection As New XPCollection(Of Apartments)(Session, CriteriaOperator.Parse(_Criteria)) Dim _Apartments As Apartments For Each _Apartments In _Apartments_Collection For Each _CRMEstate_Leads_Immovables In Me.CRMEstate_Leads_Immovables If _CRMEstate_Leads_Immovables.Immovables.Oid.ToString = _Apartments.Oid.ToString Then _Apartments.OfferListPriceNettoHUF = _CRMEstate_Leads_Immovables.ListPriceNettoHUF _Apartments.OfferListPriceNettoHUFRent = _CRMEstate_Leads_Immovables.ListPriceNettoHUFRent _Apartments.OfferListPriceBruttoHUF = _CRMEstate_Leads_Immovables.ListPriceBruttoHUF _Apartments.OfferListPriceBruttoHUFRent = _CRMEstate_Leads_Immovables.ListPriceBruttoDEVRent End If Next Next Return _Apartments_Collection End Get End Property _ ReadOnly Property Selected_Garages As XPCollection(Of Garages) Get Dim _Criteria As String = "" Dim _CRMEstate_Leads_Immovables As CRMEstate_Leads_Immovables If Me.CRMEstate_Leads_Immovables.Count > 0 Then For Each _CRMEstate_Leads_Immovables In Me.CRMEstate_Leads_Immovables If _Criteria = "" Then _Criteria = "Oid in ('" & _CRMEstate_Leads_Immovables.Immovables.Oid.ToString & "'" Else _Criteria += ",'" & _CRMEstate_Leads_Immovables.Immovables.Oid.ToString & "'" End If Next _Criteria += ")" Else _Criteria += "1=2" End If Dim _Garages_Collection As New XPCollection(Of Garages)(Session, CriteriaOperator.Parse(_Criteria)) Dim _Garages As Garages For Each _Garages In _Garages_Collection For Each _CRMEstate_Leads_Immovables In Me.CRMEstate_Leads_Immovables If _CRMEstate_Leads_Immovables.Immovables.Oid.ToString = _Garages.Oid.ToString Then _Garages.OfferListPriceNettoHUF = _CRMEstate_Leads_Immovables.ListPriceNettoHUF _Garages.OfferListPriceNettoHUFRent = _CRMEstate_Leads_Immovables.ListPriceNettoHUFRent _Garages.OfferListPriceBruttoHUF = _CRMEstate_Leads_Immovables.ListPriceBruttoHUF _Garages.OfferListPriceBruttoHUFRent = _CRMEstate_Leads_Immovables.ListPriceBruttoDEVRent End If Next Next Return _Garages_Collection End Get End Property _ ReadOnly Property Selected_Container As XPCollection(Of Container) Get Dim _Criteria As String = "" Dim _CRMEstate_Leads_Immovables As CRMEstate_Leads_Immovables If Me.CRMEstate_Leads_Immovables.Count > 0 Then For Each _CRMEstate_Leads_Immovables In Me.CRMEstate_Leads_Immovables If _Criteria = "" Then _Criteria = "Oid in ('" & _CRMEstate_Leads_Immovables.Immovables.Oid.ToString & "'" Else _Criteria += ",'" & _CRMEstate_Leads_Immovables.Immovables.Oid.ToString & "'" End If Next _Criteria += ")" Else _Criteria += "1=2" End If Dim _Container_Collection As New XPCollection(Of Container)(Session, CriteriaOperator.Parse(_Criteria)) Dim _Container As Container For Each _Container In _Container_Collection For Each _CRMEstate_Leads_Immovables In Me.CRMEstate_Leads_Immovables If _CRMEstate_Leads_Immovables.Immovables.Oid.ToString = _Container.Oid.ToString Then _Container.OfferListPriceNettoHUF = _CRMEstate_Leads_Immovables.ListPriceNettoHUF _Container.OfferListPriceNettoHUFRent = _CRMEstate_Leads_Immovables.ListPriceNettoHUFRent _Container.OfferListPriceBruttoHUF = _CRMEstate_Leads_Immovables.ListPriceBruttoHUF _Container.OfferListPriceBruttoHUFRent = _CRMEstate_Leads_Immovables.ListPriceBruttoDEVRent End If Next Next Return _Container_Collection End Get End Property _ ReadOnly Property Selected_Offices As XPCollection(Of Offices) Get Dim _Criteria As String = "" Dim _CRMEstate_Leads_Immovables As CRMEstate_Leads_Immovables If Me.CRMEstate_Leads_Immovables.Count > 0 Then For Each _CRMEstate_Leads_Immovables In Me.CRMEstate_Leads_Immovables If _Criteria = "" Then _Criteria = "Oid in ('" & _CRMEstate_Leads_Immovables.Immovables.Oid.ToString & "'" Else _Criteria += ",'" & _CRMEstate_Leads_Immovables.Immovables.Oid.ToString & "'" End If Next _Criteria += ")" Else _Criteria += "1=2" End If Dim _Offices_Collection As New XPCollection(Of Offices)(Session, CriteriaOperator.Parse(_Criteria)) Dim _Offices As Offices For Each _Offices In _Offices_Collection For Each _CRMEstate_Leads_Immovables In Me.CRMEstate_Leads_Immovables If _CRMEstate_Leads_Immovables.Immovables.Oid.ToString = _Offices.Oid.ToString Then _Offices.OfferListPriceNettoHUF = _CRMEstate_Leads_Immovables.ListPriceNettoHUF _Offices.OfferListPriceNettoHUFRent = _CRMEstate_Leads_Immovables.ListPriceNettoHUFRent _Offices.OfferListPriceBruttoHUF = _CRMEstate_Leads_Immovables.ListPriceBruttoHUF _Offices.OfferListPriceBruttoHUFRent = _CRMEstate_Leads_Immovables.ListPriceBruttoDEVRent End If Next Next Return _Offices_Collection End Get End Property _ ReadOnly Property CRMEstate_Leads_Activity As XPCollection(Of CRMEstate_Leads_Activity) Get Return GetCollection(Of CRMEstate_Leads_Activity)("CRMEstate_Leads_Activity") End Get End Property ReadOnly Property DisplayName As String Get Return LastName & " " & FirstName & ", m: " & Mobile & ", e: " & EMail End Get End Property End Class