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()> _
<NonPersistent()> _
<NavigationItem(False)> _
<CreatableItem(False)> _
<Appearance("Hide CreateContracts_CustomizePupUp-OfferOutHeader properties, when CreateContractsFrom=0 ", AppearanceItemType.ViewItem, "CreateContractsFrom=0", TargetItems:="OfferOutHeader", visibility:=Editors.ViewItemVisibility.Hide)> _
<Appearance("Hide CreateContracts_CustomizePupUp-OrderInAcknowledgementHeader properties, when CreateContractsFrom=1 ", AppearanceItemType.ViewItem, "CreateContractsFrom=1", TargetItems:="OrderInAcknowledgementHeader", visibility:=Editors.ViewItemVisibility.Hide)> _
Public Class CreateContracts_CustomizePupUp
    Inherits BaseObject

    Private _CRM_Opportunities As CRM_Opportunities
    Private _ContractTemplate As ContractTemplate
    Private _OrderInAcknowledgementHeader As OrderInAcknowledgementHeader
    Private _OfferOutHeader As OfferOutHeader
    Private _WithOfferInRows As Boolean
    Private _CreateContractsFrom As eCreateContractsFrom
    Private _Controlling As Controlling

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

    <Browsable(False)> _
    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
    <DataSourceCriteria("'@This.CRM_Opportunities.CustomersFrom'=CustomersFrom AND IsCRM='True' AND PartnerType='0'")> _
    Property ContractTemplate As ContractTemplate
        Get
            Return _ContractTemplate
        End Get
        Set(value As ContractTemplate)
            SetPropertyValue("ContractTemplate", _ContractTemplate, value)
        End Set
    End Property
    <DataSourceCriteria("'@This.CRM_Opportunities'=OrderInHeader.CRM_Opportunities")> _
    Property OrderInAcknowledgementHeader As OrderInAcknowledgementHeader
        Get
            Return _OrderInAcknowledgementHeader
        End Get
        Set(value As OrderInAcknowledgementHeader)
            SetPropertyValue("OrderInAcknowledgementHeader", _OrderInAcknowledgementHeader, value)
        End Set
    End Property
    <DataSourceCriteria("'@This.CRM_Opportunities'=CRM_Opportunities")> _
    Property OfferOutHeader As OfferOutHeader
        Get
            Return _OfferOutHeader
        End Get
        Set(value As OfferOutHeader)
            SetPropertyValue("OfferOutHeader", _OfferOutHeader, value)
        End Set
    End Property
    Property WithOfferInRows As Boolean
        Get
            Return _WithOfferInRows
        End Get
        Set(value As Boolean)
            SetPropertyValue("WithOfferInRows", _WithOfferInRows, value)
        End Set
    End Property
    <ImmediatePostData()> _
    Property CreateContractsFrom As eCreateContractsFrom
        Get
            Return _CreateContractsFrom
        End Get
        Set(value As eCreateContractsFrom)
            SetPropertyValue("CreateContractsFrom", _CreateContractsFrom, value)
        End Set
    End Property
    Property Controlling As Controlling
        Get
            Return _Controlling
        End Get
        Set(value As Controlling)
            SetPropertyValue("Controlling", _Controlling, value)
        End Set
    End Property
End Class
Public Enum eCreateContractsFrom
    eOrderInAcknowledgement = 0
    eOfferOutHeader = 1
End Enum
