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

<NonPersistent()> _
<NavigationItem(False), CreatableItem(False)> _
<DefaultClassOptions()> _
<Appearance("Disable QTT, Units", AppearanceItemType.ViewItem, "1=1", TargetItems:="QTT;Units", Enabled:=False)> _
<Appearance("Disable SUMFinalPrice", AppearanceItemType.ViewItem, "1=1", TargetItems:="SUMFinalPrice", Enabled:=False)> _
<Appearance("Disable DiscountPriceHUF and DiscountPriceDEV", AppearanceItemType.ViewItem, "DiscountPercent>0", TargetItems:="DiscountPriceHUF;DiscountPriceDEV", Enabled:=False)> _
<Appearance("Disable DiscountPercent", AppearanceItemType.ViewItem, "DiscountPriceHUF > 0 Or DiscountPriceDEV > 0", TargetItems:="DiscountPercent", Enabled:=False)> _
<Appearance("Hide DiscountPriceHUF if CurrencyName is HUF", AppearanceItemType.ViewItem, "OfferOutHeader.CurrencyName.ShortName='HUF'", TargetItems:="DiscountPriceDEV", visibility:=Editors.ViewItemVisibility.Hide)> _
<Appearance("Hide DiscountPriceDEV if CurrencyName is not HUF", AppearanceItemType.ViewItem, "OfferOutHeader.CurrencyName.ShortName<>'HUF'", TargetItems:="DiscountPriceHUF", visibility:=Editors.ViewItemVisibility.Hide)> _
<Appearance("Hide OfferOutHeader", AppearanceItemType.ViewItem, "1=1", TargetItems:="OfferOutHeader", visibility:=Editors.ViewItemVisibility.Hide)> _
Public Class InsertDiscountRowPopup
    Inherits BaseObject
    Private _Row_Group1 As String
    Private _Row_Group2 As String
    Private _ShortName As String = "Kedvezmény"
    Private _Description As String
    Private _DiscountPriceHUF As Double
    Private _DiscountPriceDEV As Double
    Private _Units As Units
    Private _DiscountPercent As Double
    Private _QTT As Double
    Private _OfferOutHeader As OfferOutHeader
    Private _SUMFinalPrice As Double

    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
        Me.QTT = 1
        Me.Units = Session.FindObject(Of Units)(CriteriaOperator.Parse("ShortName='DB'"))
    End Sub
    Property Row_Group1 As String
        Get
            Return _Row_Group1
        End Get
        Set(value As String)
            SetPropertyValue("Row_Group1", _Row_Group1, value)
        End Set
    End Property
    Property Row_Group2 As String
        Get
            Return _Row_Group2
        End Get
        Set(value As String)
            SetPropertyValue("Row_Group2", _Row_Group2, value)
        End Set
    End Property
    Property ShortName As String
        Get
            Return _ShortName
        End Get
        Set(value As String)
            SetPropertyValue("ShortName", _ShortName, value)
        End Set
    End Property
    <Size(-1)> _
    Property Description As String
        Get
            Return _Description
        End Get
        Set(value As String)
            SetPropertyValue("Description", _Description, value)
        End Set
    End Property
    <ImmediatePostData()> _
    Property DiscountPriceHUF As Double
        Get
            Return _DiscountPriceHUF
        End Get
        Set(value As Double)
            SetPropertyValue("DiscountPriceHUF", _DiscountPriceHUF, value)
        End Set
    End Property
    <ImmediatePostData()> _
    Property DiscountPriceDEV As Double
        Get
            Return _DiscountPriceDEV
        End Get
        Set(value As Double)
            SetPropertyValue("DiscountPriceDEV", _DiscountPriceDEV, value)
        End Set
    End Property
    <Browsable(False)> _
    Property Units As Units
        Get
            Return _Units
        End Get
        Set(value As Units)
            SetPropertyValue("Units", _Units, value)
        End Set
    End Property
    <Browsable(False)> _
    Property QTT As Double
        Get
            Return _QTT
        End Get
        Set(value As Double)
            SetPropertyValue("QTT", _QTT, value)
        End Set
    End Property
    <ImmediatePostData()> _
    Property DiscountPercent As Double
        Get
            Return _DiscountPercent
        End Get
        Set(value As Double)
            SetPropertyValue("DiscountPercent", _DiscountPercent, value)
        End Set
    End Property
    Property OfferOutHeader As OfferOutHeader
        Get
            Return _OfferOutHeader
        End Get
        Set(value As OfferOutHeader)
            SetPropertyValue("OfferOutHeader", _OfferOutHeader, value)
        End Set
    End Property
    <ImmediatePostData()> _
    Property SUMFinalPrice As Double
        Get
            Return _SUMFinalPrice
        End Get
        Set(value As Double)
            SetPropertyValue("SUMFinalPrice", _SUMFinalPrice, value)
        End Set
    End Property
End Class
