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 ePriceMode
    eDEVToHUF = 0
    eHUFToDEV = 1
End Enum
<DefaultClassOptions()> _
<NavigationItem(False), CreatableItem(False)> _
Public Class ModifyProductsParameters
    Inherits BaseObject

    Private _CurrencyRate As Double
    Private _CurrencyName As CurrencyName
    Private _ProductType As eProductType
    Private _IsProductType As Boolean = False

    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
        CurrencyName = Session.FindObject(Of CurrencyName)(Session.ParseCriteria("ShortName='HUF'"))
    End Sub

    <NonPersistent()> Property Parameter_01 As String
    <NonPersistent()> Property Parameter_02 As String
    <NonPersistent()> Property Parameter_03 As String
    <NonPersistent()> Property Parameter_04 As String
    <NonPersistent()> Property Parameter_05 As String
    <NonPersistent()> Property Parameter_06 As String
    <NonPersistent()> Property Parameter_07 As String
    <NonPersistent()> Property Parameter_08 As String
    <NonPersistent()> Property Parameter_09 As String
    <NonPersistent()> Property Parameter_10 As String
    <NonPersistent()> Property IsParameter_01 As Boolean = False
    <NonPersistent()> Property IsParameter_02 As Boolean = False
    <NonPersistent()> Property IsParameter_03 As Boolean = False
    <NonPersistent()> Property IsParameter_04 As Boolean = False
    <NonPersistent()> Property IsParameter_05 As Boolean = False
    <NonPersistent()> Property IsParameter_06 As Boolean = False
    <NonPersistent()> Property IsParameter_07 As Boolean = False
    <NonPersistent()> Property IsParameter_08 As Boolean = False
    <NonPersistent()> Property IsParameter_09 As Boolean = False
    <NonPersistent()> Property IsParameter_10 As Boolean = False
    <NonPersistent()> Property IsCurrencyName As Boolean = False
    <NonPersistent()> Property IsCustomsTariffs As Boolean = False
    <NonPersistent()> Property IsCountryFrom As Boolean = False
    <NonPersistent()> Property IsCustomersOrder1 As Boolean = False
    <NonPersistent()> Property IsCustomersOrder2 As Boolean = False
    <NonPersistent()> Property IsCustomersOrder3 As Boolean = False
    <NonPersistent()> Property ProductsGroups As ProductsGroups
    <NonPersistent()> Property IsUnits As Boolean = False
    <NonPersistent()> Property IsVAT As Boolean = False
    <NonPersistent()> Property CustomersOrder1 As CustomersOrder
    <NonPersistent()> Property CustomersOrder2 As CustomersOrder
    <NonPersistent()> Property CustomersOrder3 As CustomersOrder
    <NonPersistent()> Property Units As Units
    <NonPersistent()> Property VAT As VAT
    <NonPersistent()> Property CustomsTariffs As CustomsTariffs
    <NonPersistent()> Property CountryFrom As Country
    <NonPersistent()> Property IsListPriceHUF As Boolean = False 'Listaár módosuljon ?
    <NonPersistent()> Property IsListPriceDEV As Boolean = False 'Listaár módosuljon ?
    <NonPersistent()> Property ListPricePercent As Double = 0 'Listaár %-kal módosul ? termékár változás
    <NonPersistent()> Property IsListPriceRegenerate As Boolean = False 'Listaár újraszámolódjon ? valuta váltás 
    <NonPersistent()> Property PriceMode As ePriceMode = ePriceMode.eDEVToHUF
    <NonPersistent()> Property IsProducer As Boolean = False
    <NonPersistent()> Property Producer As Customers
    <NonPersistent()> Property IsDecimalIn As Boolean
    <NonPersistent()> Property IsDecimalOut As Boolean
    <NonPersistent()> Property DecimalIn As Double
    <NonPersistent()> Property DecimalOut As Double

    <NonPersistent()>
    <ImmediatePostData(True)> _
    Property CurrencyName As CurrencyName
        Get
            Return _CurrencyName
        End Get
        Set(value As CurrencyName)
            SetPropertyValue("CurrencyName", _CurrencyName, value)
            If Not Session.IsObjectsSaving And Not Session.IsObjectsLoading And value.ShortName <> "HUF" Then
                Dim _CurrencyRate As CurrencyRate = Session.FindObject(Of CurrencyRate)(Session.ParseCriteria("IsMNB=? AND GetDate(DateValid)=? AND CurrencyName=?", True, GetSQLTime(Session).Date, value))
                If _CurrencyRate Is Nothing Then
                    _CurrencyRate = Session.FindObject(Of CurrencyRate)(Session.ParseCriteria("IsMNB=? AND GetDate(DateValid)=?", True, GetSQLTime(Session).Date.AddDays(-1)))
                    If _CurrencyRate IsNot Nothing Then
                        CurrencyRate = _CurrencyRate.RateAverage
                    End If
                Else
                    If _CurrencyRate IsNot Nothing Then
                        CurrencyRate = _CurrencyRate.RateAverage
                    End If
                End If
            End If
        End Set
    End Property
    <NonPersistent()>
    Property CurrencyRate As Double
        Get
            Return _CurrencyRate
        End Get
        Set(value As Double)
            SetPropertyValue("CurrencyRate", _CurrencyRate, value)
        End Set
    End Property
    <NonPersistent()>
    Property ProductType As eProductType
        Get
            Return _ProductType
        End Get
        Set(value As eProductType)
            SetPropertyValue("ProductType", _ProductType, value)
        End Set
    End Property
    ''' <summary>
    ''' Termék tipus módosuljon ?
    ''' </summary>
    ''' <returns></returns>
    <NonPersistent()>
    Property IsProductType As Boolean
        Get
            Return _IsProductType
        End Get
        Set(value As Boolean)
            SetPropertyValue("IsProductType", _IsProductType, value)
        End Set
    End Property

    ''' <summary>
    ''' ADRPackingUnit módosuljon ?
    ''' </summary>
    ''' <returns></returns>
    <NonPersistent()> Property IsADRPackingUnit As Boolean
    <NonPersistent()> Property ADRPackingUnit As eADRPackingUnit
    ''' <summary>
    ''' Alapértelmezett termék, amelynek a Barcode, UNList,Sentence,Documentations szinkronba jön
    ''' </summary>
    ''' <returns></returns>
    <NonPersistent()> Property ProductsSource As Products
    ''' <summary>
    ''' Sentence klónozás legyen ?
    ''' </summary>
    ''' <returns></returns>
    <NonPersistent()> Property CloneSentence As Boolean
    ''' <summary>
    ''' UNList klónozás legyen
    ''' </summary>
    ''' <returns></returns>
    <NonPersistent()> Property CloneUNList As Boolean
    ''' <summary>
    ''' Documentations klónozás legyen
    ''' </summary>
    ''' <returns></returns>
    <NonPersistent()> Property CloneDocumentations As Boolean
    <NonPersistent> Property IsPacketMode As Boolean
    ''' <summary>
    ''' Csomagolási mód változtatása
    ''' </summary>
    ''' <returns></returns>
    <NonPersistent> Property PacketMode As PacketMode
End Class
