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
Imports System.Drawing
'-- Termék, termék beszállítók
<DefaultClassOptions()>
<Indices("ProductNumber", "ShortName")>
<NavigationItem("BusinessStocks")>
<Appearance("Disable ObjectCreated and UserCreated", AppearanceItemType.ViewItem, "1=1", TargetItems:="ObjectCreated;UserCreated", Enabled:=False)>
Public Class Products
    Inherits BaseObject
    Private _ProductType As eProductType = eProductType.eNormal
    Private _ProductsGroups As ProductsGroups 'Termék csoport
    Private _ProductNumber As String 'Termék cikkszáma, egyedi ! Nem lehet két egyforma !!!!!!
    Private _ProductCode As String 'Termék kód
    Private _ProductStrategyCode As String 'Stratégiai kód, az automatikus rendelést fogja befojásolni
    Private _ShortName As String 'Megnevezés
    Private _ShortName_Hu As String 'Megnevezés magyarul
    Private _ShortName_Gb As String 'Megnevezés angolul
    Private _ShortName_De As String 'Megnevezés németül
    Private _Description As String 'Leírás 
    Private _Description_Hu As String 'Leírás magyarul
    Private _Description_Gb As String 'Leírás angolul
    Private _Description_De As String 'Leírás németül
    Private _Description_Private As String 'Belső megjegyzés a termékre vonatkozóan
    Private _VAT As VAT 'ÁFA kód
    Private _Units As Units 'Mennyiségi egység
    Private _CustomsTariff As CustomsTariffs 'Vámtarifa szj, stb
    Private _NettoWeight As Double 'Nettó súly
    Private _GrossWeight As Double 'Bruttó súly (csomagolva a nettó)
    Private _PacketUnitOut As Double 'Eladási csomagolási egység
    Private _PacketUnitIn As Double 'Beszerzési csomagolási egység
    Private _PacketMode As PacketMode 'Csomagolási mód
    Private _ListPriceOutHUF As Double 'Listaár HUF eladási !!!
    Private _ListPriceOutDEV As Double 'Listaár DEV eladási
    Private _ListPriceInHUF As Double 'Listaár HUF vételi !!!
    Private _ListPriceInDEV As Double 'Listaár DEV vételi
    Private _CurrencyName As CurrencyName 'Deviza ( ez az alapértelmezett devizája !)
    Private _CountryFrom As Country 'Származási ország !
    Private _DecimalIn As Long ' Bejövő bizonylatoknál ? tizedesre
    Private _DecimalOut As Long 'Kimenő bizonylatoknál ? tizedesre
    Private _ObjectCreated As Date 'Létrehozás dátuma
    Private _UserCreated As User 'Létrehozó
    Private _Barcode As String 'Vonalkód
    Private _MasterBusinessDirectory As BusinessDirectory
    Private _IsStoragEverUsed As Boolean

    Private _Parameter_01 As String = ""
    Private _Parameter_02 As String = ""
    Private _Parameter_03 As String = ""
    Private _Parameter_04 As String = ""
    Private _Parameter_05 As String = ""
    Private _Parameter_06 As String = ""
    Private _Parameter_07 As String = ""
    Private _Parameter_08 As String = ""
    Private _Parameter_09 As String = ""
    Private _Parameter_10 As String = ""
    Private _HRPersonResponsible As HRPerson 'Termék felelős
    Private _HRPersonSpecialist As HRPerson 'Termék specialista

    '//WEB ShoppingCart megjelenéshez
    Private _Picture_110x110 As Image
    Private _Picture_240x220 As Image
    Private _Picture_FullSize As Image
    Private _ProductsGroupsWEB As ProductsGroupsWEB

    Private _Producer As Customers 'Gyártó
    Private _ADRPackingUnit As eADRPackingUnit
    Private _UNNumber As String 'UN szám (mezőgazdasági veszélyességhez) (Obsolete)
    Private _UNNumberDescription As String 'UN szám szöveges megjelenítése (Obsolete)
    Private _Agent As String 'Hatóanyag
    Private _DangerLabel As Double 'Veszélyességi bárca (Obsolete)
    Private _DangerLabelString As String 'Veszélyességi bárca szövegesen pld. 6.1,5.2
    Private _DangerClass As eDangerClass
    Private _PGNumber As String 'PG szám a veszélyességhez


    Private _FastCode As String 'Termék gyorskód
    Private _PLUCode As String 'Pult kód mérlegelt termékekhez
    Private _Empties As Products 'Göngyöleg
    Private _PriceColumnBruttoHUF01 As Double '1. ároszlop forintos bruttó ára
    Private _PriceColumnBruttoHUF02 As Double '2. ároszlop forintos bruttó ára
    Private _PriceColumnBruttoHUF03 As Double '3. ároszlop forintos bruttó ára
    Private _PriceColumnBruttoHUF04 As Double '4. ároszlop forintos bruttó ára
    Private _PriceColumnBruttoHUF05 As Double '5. ároszlop forintos bruttó ára
    Private _PriceColumnBruttoHUF06 As Double '6. ároszlop forintos bruttó ára
    Private _PriceColumnBruttoHUF07 As Double '7. ároszlop forintos bruttó ára
    Private _PriceColumnBruttoHUF08 As Double '8. ároszlop forintos bruttó ára
    Private _PriceColumnBruttoHUF09 As Double '9. ároszlop forintos bruttó ára
    Private _PriceColumnBruttoHUF10 As Double '10. ároszlop forintos bruttó ára

    Private _CustomersOrder01 As CustomersOrder '1. beszállító
    Private _CustomersOrder02 As CustomersOrder '2. beszállító
    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
        Me.ObjectCreated = GetSQLTime(Session)
        Me.UserCreated = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser))
        IsStoragEverUsed = False
    End Sub
    Protected Overrides Sub OnSaving()
        MyBase.OnSaving()
        If IsDeleted = False Then
            If CustomersOrder01 Is Nothing Then
                If Me.CustomersOrderPriority.Count > 0 Then
                    Me.CustomersOrderPriority.Sorting.Add(New SortProperty("RowIndex", DB.SortingDirection.Ascending))
                    Me.CustomersOrder01 = Me.CustomersOrderPriority(0).CustomersOrder
                End If
            End If
            If CustomersOrder02 Is Nothing Then
                If Me.CustomersOrderPriority.Count > 1 Then
                    Me.CustomersOrderPriority.Sorting.Add(New SortProperty("RowIndex", DB.SortingDirection.Ascending))
                    Me.CustomersOrder02 = Me.CustomersOrderPriority(1).CustomersOrder
                End If
            End If
        End If
    End Sub
    Property ProductType As eProductType
        Get
            Return _ProductType
        End Get
        Set(value As eProductType)
            SetPropertyValue("ProductType", _ProductType, value)
        End Set
    End Property
    Property ProductGroups As ProductsGroups
        Get
            Return _ProductsGroups
        End Get
        Set(ByVal value As ProductsGroups)
            SetPropertyValue("ProductsGroups", _ProductsGroups, value)
        End Set
    End Property
    <RuleRequiredField("Products.ProductNumber.RuleRequiredField", DefaultContexts.Save)>
    <RuleUniqueValue("Products.ProductNumber.RuleUniqueValue", DefaultContexts.Save,
    CriteriaEvaluationBehavior:=PersistentCriteriaEvaluationBehavior.BeforeTransaction)>
    <Size(255)>
    Property ProductNumber() As String
        Get
            Return _ProductNumber
        End Get
        Set(ByVal value As String)
            SetPropertyValue("ProductNumber", _ProductNumber, value)
        End Set
    End Property
    Property ProductCode As String
        Get
            Return _ProductCode
        End Get
        Set(value As String)
            SetPropertyValue("ProductCode", _ProductCode, value)
        End Set
    End Property
    Property ProductStrategyCode As String
        Get
            Return _ProductStrategyCode
        End Get
        Set(value As String)
            SetPropertyValue("ProductStrategyCode", _ProductStrategyCode, value)
        End Set
    End Property
    <Size(255)>
    Property ShortName As String
        Get
            Return _ShortName
        End Get
        Set(ByVal value As String)
            SetPropertyValue("ShortName", _ShortName, value)
        End Set
    End Property
    <Size(255)>
    Property ShortName_Hu As String
        Get
            Return _ShortName_Hu
        End Get
        Set(ByVal value As String)
            SetPropertyValue("ShortName_Hu", _ShortName_Hu, value)
        End Set
    End Property
    <Size(255)>
    Property ShortName_Gb As String
        Get
            Return _ShortName_Gb
        End Get
        Set(ByVal value As String)
            SetPropertyValue("ShortName_gb", _ShortName_Gb, value)
        End Set
    End Property
    <Size(255)>
    Property ShortName_De As String
        Get
            Return _ShortName_De
        End Get
        Set(ByVal value As String)
            SetPropertyValue("ShortName_De", _ShortName_De, value)
        End Set
    End Property
    <Size(-1)>
    Property Description() As String
        Get
            Return _Description
        End Get
        Set(ByVal value As String)
            SetPropertyValue("Description", _Description, value)
        End Set
    End Property
    <Size(-1)>
    Property Description_Hu() As String
        Get
            Return _Description_Hu
        End Get
        Set(ByVal value As String)
            SetPropertyValue("Description_Hu", _Description_Hu, value)
        End Set
    End Property
    <Size(-1)>
    Property Description_Gb() As String
        Get
            Return _Description_Gb
        End Get
        Set(ByVal value As String)
            SetPropertyValue("Description_gb", _Description_Gb, value)
        End Set
    End Property
    <Size(-1)>
    Property Description_De() As String
        Get
            Return _Description_De
        End Get
        Set(ByVal value As String)
            SetPropertyValue("Description_De", _Description_De, value)
        End Set
    End Property
    <Size(-1)>
    Property Description_Private As String
        Get
            Return _Description_Private
        End Get
        Set(value As String)
            SetPropertyValue("Description_Private", _Description_Private, value)
        End Set
    End Property
    Property VAT As VAT
        Get
            Return _VAT
        End Get
        Set(ByVal value As VAT)
            SetPropertyValue("VAT", _VAT, value)
        End Set
    End Property
    Property Units As Units
        Get
            Return _Units
        End Get
        Set(ByVal value As Units)
            SetPropertyValue("Units", _Units, value)
        End Set
    End Property
    Property CustomsTariff As CustomsTariffs
        Get
            Return _CustomsTariff
        End Get
        Set(ByVal value As CustomsTariffs)
            SetPropertyValue("CustomsTariff", _CustomsTariff, value)
        End Set
    End Property
    Property NettoWeight As Double
        Get
            Return _NettoWeight
        End Get
        Set(ByVal value As Double)
            SetPropertyValue("NettoWeight", _NettoWeight, value)
        End Set
    End Property
    Property GrossWeight As Double
        Get
            Return _GrossWeight
        End Get
        Set(ByVal value As Double)
            SetPropertyValue("GrossWeight", _GrossWeight, value)
        End Set
    End Property
    Property PacketUnitOut As Double
        Get
            Return _PacketUnitOut
        End Get
        Set(value As Double)
            SetPropertyValue("PacketUnitOut", _PacketUnitOut, value)
        End Set
    End Property
    Property PacketUnitIn As Double
        Get
            Return _PacketUnitIn
        End Get
        Set(value As Double)
            SetPropertyValue("PacketUnitIn", _PacketUnitIn, value)
        End Set
    End Property
    Property PacketMode As PacketMode
        Get
            Return _PacketMode
        End Get
        Set(ByVal value As PacketMode)
            SetPropertyValue("PacketMode", _PacketMode, value)
        End Set
    End Property

    Property ListPriceOutHUF As Double
        Get
            Return _ListPriceOutHUF
        End Get
        Set(ByVal value As Double)
            SetPropertyValue("ListPriceOutHUF", _ListPriceOutHUF, value)
        End Set
    End Property
    Property ListPriceOutDEV As Double
        Get
            Return _ListPriceOutDEV
        End Get
        Set(ByVal value As Double)
            SetPropertyValue("ListPriceOutDEV", _ListPriceOutDEV, value)
        End Set
    End Property
    Property ListPriceInHUF As Double
        Get
            Return _ListPriceInHUF
        End Get
        Set(value As Double)
            SetPropertyValue("ListPriceInHUF", _ListPriceInHUF, value)
        End Set
    End Property
    Property ListPriceInDEV As Double
        Get
            Return _ListPriceInDEV
        End Get
        Set(value As Double)
            SetPropertyValue("ListPriceInDEV", _ListPriceInDEV, value)
        End Set
    End Property
    Property CurrencyName As CurrencyName
        Get
            Return _CurrencyName
        End Get
        Set(ByVal value As CurrencyName)
            SetPropertyValue("Currencyname", _CurrencyName, value)
        End Set
    End Property
    Property CountryFrom As Country
        Get
            Return _CountryFrom
        End Get
        Set(ByVal value As Country)
            SetPropertyValue("CountryFrom", _CountryFrom, value)
        End Set
    End Property
    Property DecimalIn As Long
        Get
            Return _DecimalIn
        End Get
        Set(ByVal value As Long)
            SetPropertyValue("DecimalIn", _DecimalIn, value)

        End Set
    End Property
    Property DecimalOut As Long
        Get
            Return _DecimalOut
        End Get
        Set(ByVal value As Long)
            SetPropertyValue("DecimalOut", _DecimalOut, value)
        End Set
    End Property
    <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
    <Size(50)>
    Property Barcode As String
        Get
            Return _Barcode
        End Get
        Set(value As String)
            SetPropertyValue("Barcode", _Barcode, value)
        End Set
    End Property
    Property MasterBusinessDirectory As BusinessDirectory
        Get
            Return _MasterBusinessDirectory
        End Get
        Set(value As BusinessDirectory)
            SetPropertyValue("MasterBusinessDirectory", _MasterBusinessDirectory, value)
        End Set
    End Property
    <VisibleInListView(False)>
    <VisibleInDetailView(False)>
    Property IsStoragEverUsed As Boolean
        Get
            Return _IsStoragEverUsed
        End Get
        Set(value As Boolean)
            SetPropertyValue("IsStoragEverUsed", _IsStoragEverUsed, value)
        End Set
    End Property

    <Size(255)>
    Property Parameter_01 As String
        Get
            Return _Parameter_01
        End Get
        Set(value As String)
            SetPropertyValue("Parameter_01", _Parameter_01, value)
        End Set
    End Property
    <Size(255)>
    Property Parameter_02 As String
        Get
            Return _Parameter_02
        End Get
        Set(value As String)
            SetPropertyValue("Parameter_02", _Parameter_02, value)
        End Set
    End Property
    <Size(255)>
    Property Parameter_03 As String
        Get
            Return _Parameter_03
        End Get
        Set(value As String)
            SetPropertyValue("Parameter_03", _Parameter_03, value)
        End Set
    End Property
    <Size(255)>
    Property Parameter_04 As String
        Get
            Return _Parameter_04
        End Get
        Set(value As String)
            SetPropertyValue("Parameter_04", _Parameter_04, value)
        End Set
    End Property
    <Size(255)>
    Property Parameter_05 As String
        Get
            Return _Parameter_05
        End Get
        Set(value As String)
            SetPropertyValue("Parameter_05", _Parameter_05, value)
        End Set
    End Property
    <Size(255)>
    Property Parameter_06 As String
        Get
            Return _Parameter_06
        End Get
        Set(value As String)
            SetPropertyValue("Parameter_06", _Parameter_06, value)
        End Set
    End Property
    <Size(255)>
    Property Parameter_07 As String
        Get
            Return _Parameter_07
        End Get
        Set(value As String)
            SetPropertyValue("Parameter_07", _Parameter_07, value)
        End Set
    End Property
    <Size(255)>
    Property Parameter_08 As String
        Get
            Return _Parameter_08
        End Get
        Set(value As String)
            SetPropertyValue("Parameter_08", _Parameter_08, value)
        End Set
    End Property
    <Size(255)>
    Property Parameter_09 As String
        Get
            Return _Parameter_09
        End Get
        Set(value As String)
            SetPropertyValue("Parameter_09", _Parameter_09, value)
        End Set
    End Property
    <Size(255)>
    Property Parameter_10 As String
        Get
            Return _Parameter_10
        End Get
        Set(value As String)
            SetPropertyValue("Parameter_10", _Parameter_10, value)
        End Set
    End Property
    Property HRPersonResponsible As HRPerson
        Get
            Return _HRPersonResponsible
        End Get
        Set(value As HRPerson)
            SetPropertyValue("HRPersonResponsible", _HRPersonResponsible, value)
        End Set
    End Property
    Property HRPersonSpecialist As HRPerson
        Get
            Return _HRPersonSpecialist
        End Get
        Set(value As HRPerson)
            SetPropertyValue("HRPersonSpecialist", _HRPersonSpecialist, value)
        End Set
    End Property

    '//WEB miatt
    <ValueConverter(GetType(DevExpress.Xpo.Metadata.ImageValueConverter))>
    Property Picture_110x110 As Image
        Get
            Return _Picture_110x110
        End Get
        Set(value As Image)
            SetPropertyValue("Picture_110x110", _Picture_110x110, value)
        End Set
    End Property
    <ValueConverter(GetType(DevExpress.Xpo.Metadata.ImageValueConverter))>
    Property Picture_240x220 As Image
        Get
            Return _Picture_240x220
        End Get
        Set(value As Image)
            SetPropertyValue("Picture_240x220", _Picture_240x220, value)
        End Set
    End Property
    <ValueConverter(GetType(DevExpress.Xpo.Metadata.ImageValueConverter))>
    Property Picture_FullSize As Image
        Get
            Return _Picture_FullSize
        End Get
        Set(value As Image)
            SetPropertyValue("Picture_FullSize", _Picture_FullSize, value)
        End Set
    End Property
    Property ProductsGroupsWEB As ProductsGroupsWEB
        Get
            Return _ProductsGroupsWEB
        End Get
        Set(value As ProductsGroupsWEB)
            SetPropertyValue("ProductsGroupsWEB", _ProductsGroupsWEB, value)
        End Set
    End Property

    'Veszélyesség
    Property Producer As Customers
        Get
            Return _Producer
        End Get
        Set(value As Customers)
            SetPropertyValue("Producer", _Producer, value)
        End Set
    End Property
    Property ADRPackingUnit As eADRPackingUnit
        Get
            Return _ADRPackingUnit
        End Get
        Set(value As eADRPackingUnit)
            SetPropertyValue("ADRPackingUnit", _ADRPackingUnit, value)
        End Set
    End Property
    Property UNNumber As String
        Get
            Return _UNNumber
        End Get
        Set(value As String)
            SetPropertyValue("UNNumber", _UNNumber, value)
        End Set
    End Property
    <Size(800)>
    Property UNNumberDescription As String
        Get
            Return _UNNumberDescription
        End Get
        Set(value As String)
            SetPropertyValue("UNNumberDescription", _UNNumberDescription, value)
        End Set
    End Property
    Property Agent As String
        Get
            Return _Agent
        End Get
        Set(value As String)
            SetPropertyValue("Agent", _Agent, value)
        End Set
    End Property
    Property DangerLabel As Double
        Get
            Return _DangerLabel
        End Get
        Set(value As Double)
            SetPropertyValue("DangerLabel", _DangerLabel, value)
        End Set
    End Property
    Property DangerLabelString As String
        Get
            Return _DangerLabelString
        End Get
        Set(value As String)
            SetPropertyValue("DangerLabelString", _DangerLabelString, value)
        End Set
    End Property

    Property DangerClass As eDangerClass
        Get
            Return _DangerClass
        End Get
        Set(value As eDangerClass)
            SetPropertyValue("DangerClass", _DangerClass, value)
        End Set
    End Property
    Property PGNumber As String
        Get
            Return _PGNumber
        End Get
        Set(value As String)
            SetPropertyValue("PGNumber", _PGNumber, value)
        End Set
    End Property

    'Vonalkód, pultkód
    Property FastCode As String
        Get
            Return _FastCode
        End Get
        Set(value As String)
            SetPropertyValue("FastCode", _FastCode, value)
        End Set
    End Property
    Property PLUCode As String
        Get
            Return _PLUCode
        End Get
        Set(value As String)
            SetPropertyValue("PLUCode", _PLUCode, value)
        End Set
    End Property
    Property Empties As Products
        Get
            Return _Empties
        End Get
        Set(value As Products)
            SetPropertyValue("Empties", _Empties, value)
        End Set
    End Property

    'Ároszlop ÁRAK
    Property PriceColumnBruttoHUF01 As Double
        Get
            Return _PriceColumnBruttoHUF01
        End Get
        Set(value As Double)
            SetPropertyValue("PriceColumnBruttoHUF01", _PriceColumnBruttoHUF01, value)
        End Set
    End Property
    Property PriceColumnBruttoHUF02 As Double
        Get
            Return _PriceColumnBruttoHUF02
        End Get
        Set(value As Double)
            SetPropertyValue("PriceColumnBruttoHUF02", _PriceColumnBruttoHUF02, value)
        End Set
    End Property
    Property PriceColumnBruttoHUF03 As Double
        Get
            Return _PriceColumnBruttoHUF03
        End Get
        Set(value As Double)
            SetPropertyValue("PriceColumnBruttoHUF03", _PriceColumnBruttoHUF03, value)
        End Set
    End Property
    Property PriceColumnBruttoHUF04 As Double
        Get
            Return _PriceColumnBruttoHUF04
        End Get
        Set(value As Double)
            SetPropertyValue("PriceColumnBruttoHUF04", _PriceColumnBruttoHUF04, value)
        End Set
    End Property
    Property PriceColumnBruttoHUF05 As Double
        Get
            Return _PriceColumnBruttoHUF05
        End Get
        Set(value As Double)
            SetPropertyValue("PriceColumnBruttoHUF05", _PriceColumnBruttoHUF05, value)
        End Set
    End Property
    Property PriceColumnBruttoHUF06 As Double
        Get
            Return _PriceColumnBruttoHUF01
        End Get
        Set(value As Double)
            SetPropertyValue("PriceColumnBruttoHUF06", _PriceColumnBruttoHUF06, value)
        End Set
    End Property
    Property PriceColumnBruttoHUF07 As Double
        Get
            Return _PriceColumnBruttoHUF01
        End Get
        Set(value As Double)
            SetPropertyValue("PriceColumnBruttoHUF07", _PriceColumnBruttoHUF07, value)
        End Set
    End Property
    Property PriceColumnBruttoHUF08 As Double
        Get
            Return _PriceColumnBruttoHUF01
        End Get
        Set(value As Double)
            SetPropertyValue("PriceColumnBruttoHUF08", _PriceColumnBruttoHUF08, value)
        End Set
    End Property
    Property PriceColumnBruttoHUF09 As Double
        Get
            Return _PriceColumnBruttoHUF09
        End Get
        Set(value As Double)
            SetPropertyValue("PriceColumnBruttoHUF09", _PriceColumnBruttoHUF09, value)
        End Set
    End Property
    Property PriceColumnBruttoHUF10 As Double
        Get
            Return _PriceColumnBruttoHUF01
        End Get
        Set(value As Double)
            SetPropertyValue("PriceColumnBruttoHUF10", _PriceColumnBruttoHUF10, value)
        End Set
    End Property

    <VisibleInDetailView(False)>
    Property CustomersOrder01 As CustomersOrder
        Get
            Return _CustomersOrder01
        End Get
        Set(value As CustomersOrder)
            SetPropertyValue("CustomersOrder01", _CustomersOrder01, value)
        End Set
    End Property
    <VisibleInDetailView(False)>
    Property CustomersOrder02 As CustomersOrder
        Get
            Return _CustomersOrder02
        End Get
        Set(value As CustomersOrder)
            SetPropertyValue("CustomersOrder02", _CustomersOrder02, value)
        End Set
    End Property

    '//XPCollections
    <VisibleInListView(False)>
    <Association("Products-CustomersOrderPriority", GetType(CustomersOrderPriority))>
    Public ReadOnly Property CustomersOrderPriority As XPCollection(Of CustomersOrderPriority)
        Get
            Return GetCollection(Of CustomersOrderPriority)("CustomersOrderPriority")
        End Get
    End Property
    <VisibleInListView(False)>
    <Association>
    Public ReadOnly Property ProductsSentence As XPCollection(Of ProductsSentence)
        Get
            Return GetCollection(Of ProductsSentence)("ProductsSentence")
        End Get
    End Property
    <VisibleInListView(False)>
    <Association>
    Public ReadOnly Property ProductsUNList As XPCollection(Of ProductsUNList)
        Get
            Return GetCollection(Of ProductsUNList)("ProductsUNList")
        End Get
    End Property
    <VisibleInListView(False), Aggregated(), Association("Products-ProductsDocumentations", GetType(ProductsDocumentations))>
    Public ReadOnly Property ProductsDocumentations() As XPCollection(Of ProductsDocumentations)
        Get
            Return GetCollection(Of ProductsDocumentations)("ProductsDocumentations")
        End Get
    End Property
    Public ReadOnly Property Products_BusinessDirectory As XPCollection(Of BusinessDirectory)
        Get
            Dim _BusinessDirectory_Collection As New XPCollection(Of BusinessDirectory)(Session, CriteriaOperator.Parse("1=2"))

            If MasterBusinessDirectory IsNot Nothing Then
                If MasterBusinessDirectory.Children.Count > 0 Then
                    _BusinessDirectory_Collection.Add(MasterBusinessDirectory)
                    RecursiveBusinessDirectory(_BusinessDirectory_Collection, MasterBusinessDirectory.NestedBusinessDirectory)
                Else
                    _BusinessDirectory_Collection.Add(MasterBusinessDirectory)
                End If
            End If
            If ProductGroups IsNot Nothing Then
                If ProductGroups.MasterBusinessDirectory IsNot Nothing Then
                    If ProductGroups.MasterBusinessDirectory.Children.Count > 0 Then
                        _BusinessDirectory_Collection.Add(ProductGroups.MasterBusinessDirectory)
                        RecursiveBusinessDirectory(_BusinessDirectory_Collection, ProductGroups.MasterBusinessDirectory.NestedBusinessDirectory)
                    Else
                        _BusinessDirectory_Collection.Add(ProductGroups.MasterBusinessDirectory)
                    End If

                End If
            End If

            Return _BusinessDirectory_Collection
        End Get
    End Property
    <VisibleInListView(False), VisibleInLookupListView(False)>
    <Association("Products-ProductsBarcodes", GetType(ProductsBarcodes)), NoForeignKey()>
    Public ReadOnly Property ProductsBarcodes As XPCollection(Of ProductsBarcodes)
        Get
            Return GetCollection(Of ProductsBarcodes)("ProductsBarcodes")
        End Get
    End Property
    <VisibleInListView(False), VisibleInLookupListView(False), Aggregated()>
    <Association("Products-ProductsPictures", GetType(ProductsPictures))>
    ReadOnly Property ProductsPictures As XPCollection(Of ProductsPictures)
        Get
            Return GetCollection(Of ProductsPictures)("ProductsPictures")
        End Get
    End Property
#Region "Other subs"
    Private Sub RecursiveBusinessDirectory(_BusinessDirectoryList As XPCollection(Of BusinessDirectory), _NestedBusinessDirectory As XPCollection(Of BusinessDirectory))
        For Each _BusinessDirectory As BusinessDirectory In _NestedBusinessDirectory
            If _BusinessDirectory.Children.Count > 0 Then
                _BusinessDirectoryList.Add(_BusinessDirectory)
                RecursiveBusinessDirectory(_BusinessDirectoryList, _BusinessDirectory.NestedBusinessDirectory)
            Else
                _BusinessDirectoryList.Add(_BusinessDirectory)
            End If
        Next
    End Sub
#End Region

End Class







