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.Reflection


'------------------------------- Raktárkezelés -----------------------------------------------------------------------------------
<DefaultClassOptions()> _
<NavigationItem("StorageStocks")> _
Public Class Storage '-- Raktárak ------------
    Inherits BaseObject
    Private _CustomersFrom As CustomersFrom ' -- Saját cég
    Private _Address As Address ' -- Cím
    Private _ShortName As String ' -- Megnevezés
    Private _Description As String ' -- Leírás
    Private _NumberGeneratorOut As NumberGenerator ' -- Sorszám generátor kitárolás
    Private _NumberGeneratorIn As NumberGenerator ' -- Sorszám generátor betárolás
    Private _NumberGeneratorOutS As NumberGenerator ' -- Sorszám generátor kitárolás storno
    Private _NumberGeneratorInS As NumberGenerator ' -- Sorszám generátor betárolás storno
    Private _ReportIn As ReportData ' -- Nyomtatvány betárolás
    Private _ReportOut As ReportData ' -- Nyomtatvány kitárolás
    Private _ReportInventory As ReportData '--Leltár nyomtatvány DataType InventorySIR


    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Public Overrides Sub AfterConstruction()
    End Sub
    Property CustomersFrom As CustomersFrom
        Get
            Return _CustomersFrom
        End Get
        Set(ByVal value As CustomersFrom)
            SetPropertyValue("CustomersFrom", _CustomersFrom, value)
        End Set
    End Property
    <DataSourceProperty("CustomersFrom_Address")> _
    Property Address As Address
        Get
            Return _Address
        End Get
        Set(ByVal value As Address)
            SetPropertyValue("Address", _Address, value)
        End Set
    End Property
    <RuleRequiredField("Storage-ShortName", DefaultContexts.Save)> _
    Property ShortName As String
        Get
            Return _ShortName
        End Get
        Set(ByVal value As String)
            SetPropertyValue("ShortName", _ShortName, value)
        End Set
    End Property
    <RuleRequiredField("Storage-Description", DefaultContexts.Save)> _
    Property Description As String
        Get
            Return _Description
        End Get
        Set(ByVal value As String)
            SetPropertyValue("Description", _Description, value)
        End Set
    End Property
    <RuleRequiredField("Storage-NumberGeneratorOut", DefaultContexts.Save), NonCloneable()> _
    Property NumberGeneratorOut As NumberGenerator
        Get
            Return _NumberGeneratorOut
        End Get
        Set(ByVal value As NumberGenerator)
            SetPropertyValue("NumberGeneratorOut", _NumberGeneratorOut, value)
        End Set
    End Property
    <RuleRequiredField("Storage-NumberGeneratorIn", DefaultContexts.Save), NonCloneable()> _
    Property NumberGeneratorIn As NumberGenerator
        Get
            Return _NumberGeneratorIn
        End Get
        Set(ByVal value As NumberGenerator)
            SetPropertyValue("NumberGeneratorIn", _NumberGeneratorIn, value)
        End Set
    End Property
    <RuleRequiredField("Storage-NumberGeneratorOutS", DefaultContexts.Save), NonCloneable()> _
    Property NumberGeneratorOutS As NumberGenerator
        Get
            Return _NumberGeneratorOutS
        End Get
        Set(ByVal value As NumberGenerator)
            SetPropertyValue("NumberGeneratorOutS", _NumberGeneratorOutS, value)
        End Set
    End Property
    <RuleRequiredField("Storage-NumberGeneratorInS", DefaultContexts.Save), NonCloneable()> _
    Property NumberGeneratorInS As NumberGenerator
        Get
            Return _NumberGeneratorInS
        End Get
        Set(ByVal value As NumberGenerator)
            SetPropertyValue("NumberGeneratorInS", _NumberGeneratorInS, value)
        End Set
    End Property
    Property ReportIn As ReportData
        Get
            Return _ReportIn
        End Get
        Set(ByVal value As ReportData)
            SetPropertyValue("ReportIn", _ReportIn, value)
        End Set
    End Property
    Property ReportOut As ReportData
        Get
            Return _ReportOut
        End Get
        Set(ByVal value As ReportData)
            SetPropertyValue("ReportOut", _ReportOut, value)
        End Set
    End Property
    Property ReportInventory As ReportData
        Get
            Return _ReportInventory
        End Get
        Set(value As ReportData)
            SetPropertyValue("ReportInventory", _ReportInventory, value)
        End Set
    End Property

    '-------------ReadOnly--------------
    <VisibleInListView(False)> _
    Private ReadOnly Property CustomersFrom_Address As XPCollection(Of Address)
        Get
            Dim _Address_Collection As New XPCollection(Of Address)(Session, CriteriaOperator.Parse("Oid<>Oid"))
            _Address_Collection.Add(CustomersFrom.Address1)
            _Address_Collection.Add(CustomersFrom.Address2)

            Dim _CustomersAddress_Collection As New XPCollection(Of CustomersAddress)(Session, CriteriaOperator.Parse("Customers.Oid=?", CustomersFrom.Oid))
            Dim _CustomersAddress As CustomersAddress

            For Each _CustomersAddress In _CustomersAddress_Collection
                _Address_Collection.Add(_CustomersAddress.Address)
            Next

            
            Return _Address_Collection
        End Get
    End Property

End Class



