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
Public Enum eContactsRoles
    eDecisionMakingProject = 0 ' Project döntéshozó
    eAdministrator = 1 ' Adminisztrációs munkatárs
    eDecisionMakingFinancial = 2 'Pénzügyi döntéshozó
End Enum
<DefaultClassOptions()> _
<NavigationItem(False), CreatableItem(False)> _
Public Class CRM_Opportunities_Contacts_Roles
    Inherits BaseObject
    Private _CRM_Opportunities As CRM_Opportunities
    Private _Contacts As Contacts
    Private _ContactsRoles As eContactsRoles
    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("CRM_Opportunities-CRM_Opportunities_Contacts_Roles", GetType(CRM_Opportunities))> _
    Property CRM_Opportunities As CRM_Opportunities
        Get
            Return _CRM_Opportunities
        End Get
        Set(value As CRM_Opportunities)
            SetPropertyValue("CRM_Opportunities", _CRM_Opportunities, value)
        End Set
    End Property
    '<RuleUniqueValue("CRM_Opportunities_Contacts_Roles.Contact.RuleUniqueValue", DefaultContexts.Save, CriteriaEvaluationBehavior:=PersistentCriteriaEvaluationBehavior.BeforeTransaction, _
    '                   targetcriteria:="'@This.Contacts.Oid'=Oid")> _
    <DataSourceCriteria("'@This.CRM_Opportunities.Customers' = Customers")> _
    Property Contacts As Contacts
        Get
            Return _Contacts
        End Get
        Set(value As Contacts)
            SetPropertyValue("Contacts", _Contacts, value)
        End Set
    End Property
    Property ContactsRoles As eContactsRoles
        Get
            Return _ContactsRoles
        End Get
        Set(value As eContactsRoles)
            SetPropertyValue("ContactsRoles", _ContactsRoles, value)
        End Set
    End Property
End Class
