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()> _
<Appearance("Hide Results if Status<>General.TaskStatus.Completed", AppearanceItemType.ViewItem, "Status<>4", TargetItems:="Results", visibility:=Editors.ViewItemVisibility.Hide)> _
Public Class CRM_Leads_Activity_Task
    Inherits Task
    Private _CRM_Leads_Activity As CRM_Leads_Activity
    Private _ObjectCreated As Date 'Létrehozva
    Private _UserCreated As User 'Létrehozó
    Private _HRPerson As HRPerson
    Private _Results As String = "" ' Mi lett a taszk eredménye (szöveges) csak akkor látszódjon, ha van eredmény (Completed)
    Private _AlertPeriod As AlertPeriod 'Figyelmeztetés
    Private _MasterKey As Guid ' Hordozott objektum 
    Private _CRM_Opportunities As CRM_Opportunities 'CRM ügy

    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
    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
    <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
    Property HRPerson As HRPerson
        Get
            Return _HRPerson
        End Get
        Set(value As HRPerson)
            SetPropertyValue("HRPerson", _HRPerson, value)
        End Set
    End Property
    <Association("CRM_Leads_Activity-CRM_Leads_Activity_Task", GetType(CRM_Leads_Activity))> _
    Property CRM_Leads_Activity As CRM_Leads_Activity
        Get
            Return _CRM_Leads_Activity
        End Get
        Set(value As CRM_Leads_Activity)
            SetPropertyValue("CRM_Leads_Activity", _CRM_Leads_Activity, value)
        End Set
    End Property
    <Size(-1)> _
    Property Results As String
        Get
            Return _Results
        End Get
        Set(value As String)
            SetPropertyValue("Results", _Results, value)
        End Set
    End Property
    Property AlertPeriod As AlertPeriod
        Get
            Return _AlertPeriod
        End Get
        Set(value As AlertPeriod)
            SetPropertyValue("AlertPeriod", _AlertPeriod, value)
        End Set
    End Property
    <Browsable(False)> _
    Property MasterKey As Guid
        Get
            Return _MasterKey
        End Get
        Set(value As Guid)
            SetPropertyValue("MasterKey", _MasterKey, value)
        End Set
    End Property
    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
End Class
