Files
2017-03-08 11:21:27 +01:00

395 lines
17 KiB
VB.net

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
'<EditorStateRule("Hide apartments", "Apartments", EditorState.Hidden, "ImmovablesTypes !=0", ViewType.DetailView)> _
'<EditorStateRule("Hide offices", "Offices", EditorState.Hidden, "ImmovablesTypes !=1", ViewType.DetailView)> _
'<EditorStateRule("Hide garages", "Garages", EditorState.Hidden, "ImmovablesTypes !=3", ViewType.DetailView)>
'<EditorStateRule("Hide container", "Container", EditorState.Hidden, "ImmovablesTypes !=2", ViewType.DetailView)> _
'<EditorStateRule("Hide studenthostel", "StudentHostel", EditorState.Hidden, "ImmovablesTypes !=4", ViewType.DetailView)> _
<DefaultClassOptions()> _
<NavigationItem("RealEstateTransactions")> _
<DefaultProperty("DisplayName")> _
<Appearance("Hide apartments", TargetItems:="Apartments", Criteria:="ImmovablesTypes !=0", Visibility:=Editors.ViewItemVisibility.Hide, Context:="DetailView")> _
<Appearance("Hide offices", TargetItems:="Offices", Criteria:="ImmovablesTypes !=1", Visibility:=Editors.ViewItemVisibility.Hide, Context:="DetailView")> _
<Appearance("Hide garages", TargetItems:="Garages", Criteria:="ImmovablesTypes !=3", Visibility:=Editors.ViewItemVisibility.Hide, Context:="DetailView")> _
<Appearance("Hide container", TargetItems:="Container", Criteria:="ImmovablesTypes !=2", Visibility:=Editors.ViewItemVisibility.Hide, Context:="DetailView")> _
<Appearance("Hide studenthostel", TargetItems:="StudentHostel", Criteria:="ImmovablesTypes !=4", Visibility:=Editors.ViewItemVisibility.Hide, Context:="DetailView")> _
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 = "<Nincs kitöltve>"
LastName = "<Nincs kitöltve>"
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
<ImmediatePostData(True)> _
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
<RuleRequiredField("CRMEstate_Leads-FirstName", DefaultContexts.Save)> _
Property FirstName As String
Get
Return _FirstName
End Get
Set(ByVal value As String)
SetPropertyValue("FirstName", _FirstName, value)
End Set
End Property
<RuleRequiredField("CRMEstate_Leads-LastName", DefaultContexts.Save)> _
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
<ImmediatePostData(True)> _
Property ImmovablesTypes As eImmovablesTypes
Get
Return _ImmovablesTypes
End Get
Set(ByVal value As eImmovablesTypes)
SetPropertyValue("ImmovablesTypes", _ImmovablesTypes, value)
End Set
End Property
<RuleRequiredField("CRMEstate_Leads-HRPerson", DefaultContexts.Save)> _
Property HRPerson As HRPerson
Get
Return _HRPerson
End Get
Set(value As HRPerson)
SetPropertyValue("HRPerson", _HRPerson, value)
End Set
End Property
<NonCloneable> _
Property ObjectCreated As Date
Get
Return _ObjectCreated
End Get
Set(value As Date)
SetPropertyValue("ObjectCreated", _ObjectCreated, value)
End Set
End Property
<NonCloneable> _
Property UserCreated As User
Get
Return _UserCreated
End Get
Set(value As User)
SetPropertyValue("UserCreated", _UserCreated, value)
End Set
End Property
<Size(-1)> _
Property DocumentBody As String
Get
Return _DocumentBody
End Get
Set(value As String)
SetPropertyValue("DocumentBody", _DocumentBody, value)
End Set
End Property
'---------ReadOnly----------------
<VisibleInListView(False)> _
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
<VisibleInListView(False)> _
ReadOnly Property Apartments As XPCollection(Of ImmovablesPriceListRowsA)
Get
Return New XPCollection(Of ImmovablesPriceListRowsA)(Session, CriteriaOperator.Parse("ImmovablesPriceListHeader=?", Me.ImmovablesPriceListHeader))
End Get
End Property
<VisibleInListView(False)> _
ReadOnly Property Offices As XPCollection(Of ImmovablesPriceListRowsO)
Get
Return New XPCollection(Of ImmovablesPriceListRowsO)(Session, CriteriaOperator.Parse("ImmovablesPriceListHeader=?", ImmovablesPriceListHeader))
End Get
End Property
<VisibleInListView(False)> _
ReadOnly Property Garages As XPCollection(Of ImmovablesPriceListRowsG)
Get
Return New XPCollection(Of ImmovablesPriceListRowsG)(Session, CriteriaOperator.Parse("ImmovablesPriceListHeader=?", ImmovablesPriceListHeader))
End Get
End Property
<VisibleInListView(False)> _
ReadOnly Property Container As XPCollection(Of ImmovablesPriceListRowsC)
Get
Return New XPCollection(Of ImmovablesPriceListRowsC)(Session, CriteriaOperator.Parse("ImmovablesPriceListHeader=?", ImmovablesPriceListHeader))
End Get
End Property
<VisibleInListView(False)> _
ReadOnly Property StudentHostel As XPCollection(Of StudentHostel)
Get
Return New XPCollection(Of StudentHostel)(Session, CriteriaOperator.Parse("CanForSale=True"))
End Get
End Property
<Association("CRMEstate_Leads-CRMEstate_Leads_Immovables", GetType(CRMEstate_Leads_Immovables)), VisibleInListView(False)> _
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
<VisibleInListView(False)> _
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
<VisibleInListView(False)> _
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
<VisibleInListView(False)> _
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
<VisibleInListView(False)> _
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
<Association("CRMEstate_Leads-CRMEstate_Leads_Activity", GetType(CRMEstate_Leads_Activity)), VisibleInListView(False)> _
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