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

<DefaultClassOptions(), NavigationItem(False), CreatableItem(False), DeferredDeletion(False)> _
Public Class StorageDate
    Inherits BaseObject

    Private _CustomersFrom As CustomersFrom
    Private _Products As Products
    Private _DateExecution As Date
    Private _DateExecutionYear As String
    Private _DateExecutionMonth As String
    Private _DateExecutionQuarter As String
    Private _DateExecutionWeek As String

    Private _QTT_Close As Double 'Záró készlet
    Private _SumAveragePriceHUF As Double 'Mérlegelt átlagár
    Private _SumPriceHUF As Double 'Mérlegelt átlagérték

    Public Sub New(ByVal session As Session)
        MyBase.New(session)
        ' This constructor is used when an object is loaded from a persistent storage.
        ' Do not place any code here or place it only when the IsLoading property is false:
        ' if (!IsLoading){
        '   It is now OK to place your initialization code here.
        ' }
        ' or as an alternative, move your initialization code into the AfterConstruction method.
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
        ' Place here your initialization code.
    End Sub
    Protected Overrides Sub OnSaving()
        MyBase.OnSaving()

        If String.IsNullOrEmpty(DateExecutionYear) Then DateExecutionYear = DateExecution.Year.ToString
        If String.IsNullOrEmpty(DateExecutionMonth) Then DateExecutionMonth = DateExecution.Month.ToString
        If String.IsNullOrEmpty(DateExecutionQuarter) Then DateExecutionQuarter = DatePart(DateInterval.Quarter, DateExecution).ToString
        If String.IsNullOrEmpty(DateExecutionWeek) Then DateExecutionWeek = DatePart(DateInterval.WeekOfYear, DateExecution).ToString

    End Sub
    Property CustomersFrom As CustomersFrom
        Get
            Return _CustomersFrom
        End Get
        Set(value As CustomersFrom)
            SetPropertyValue("CustomersFrom", _CustomersFrom, value)
        End Set
    End Property
    Property Products As Products
        Get
            Return _Products
        End Get
        Set(value As Products)
            SetPropertyValue("Products", _Products, value)
        End Set
    End Property

    Property DateExecution() As Date
        Get
            Return _DateExecution.Date
        End Get
        Set(ByVal value As Date)
            SetPropertyValue("DateExecution", _DateExecution, value.Date)
        End Set
    End Property

    <VisibleInDetailView(False), VisibleInListView(False), VisibleInLookupListView(False)> _
    Property DateExecutionYear As String
        Get
            Return _DateExecutionYear
        End Get
        Set(value As String)
            SetPropertyValue("DateExecutionYear", _DateExecutionYear, value)
        End Set
    End Property
    <VisibleInDetailView(False), VisibleInListView(False), VisibleInLookupListView(False)> _
    Property DateExecutionMonth As String
        Get
            Return _DateExecutionMonth
        End Get
        Set(value As String)
            SetPropertyValue("DateExecutionMonth", _DateExecutionMonth, value)
        End Set
    End Property
    <VisibleInDetailView(False), VisibleInListView(False), VisibleInLookupListView(False)> _
    Property DateExecutionQuarter As String
        Get
            Return _DateExecutionQuarter
        End Get
        Set(value As String)
            SetPropertyValue("DateExecutionQuarter", _DateExecutionQuarter, value)
        End Set
    End Property
    <VisibleInDetailView(False), VisibleInListView(False), VisibleInLookupListView(False)> _
    Property DateExecutionWeek As String
        Get
            Return _DateExecutionWeek
        End Get
        Set(value As String)
            SetPropertyValue("DateExecutionWeek", _DateExecutionWeek, value)
        End Set
    End Property

    Property SumPriceHUF As Double
        Get
            Return _SumPriceHUF
        End Get
        Set(value As Double)
            SetPropertyValue("SumPriceHUF", _SumPriceHUF, value)
        End Set
    End Property
    Property SumAveragePriceHUF As Double
        Get
            Return _SumAveragePriceHUF
        End Get
        Set(value As Double)
            SetPropertyValue("SumAveragePriceHUF", _SumAveragePriceHUF, value)
        End Set
    End Property
    Property QTT_Close As Double
        Get
            Return _QTT_Close
        End Get
        Set(value As Double)
            SetPropertyValue("QTT_Close", _QTT_Close, value)
        End Set
    End Property

End Class
