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 System.Drawing
Imports DevExpress.ExpressApp.Utils

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

    Private _StorageInRows As StorageInRows
    Private _StorageOutRows As StorageOutRows
    Private _QTT As Double 'A mozgatott mennyiség előjelesen
    Private _QTT_Free_Before As Double 'Előző állapot
    Private _QTT_Free_After As Double 'Utána állapot
    Private _ExecutionDate As Date
    Private _ObjectCreated As Date
    Private _UserCreated As User
    Private _MoveEventsType As eMoveEventsType 'Esemény megnevezése
    Private _FullIndex As Long

    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
    End Sub
    Protected Overrides Sub OnSaving()
        MyBase.OnSaving()
        If Session.IsNewObject(Me) Then
            ObjectCreated = GetSQLTime(Session)
            UserCreated = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser))
        End If
    End Sub
    Property StorageInRows As StorageInRows
        Get
            Return _StorageInRows
        End Get
        Set(value As StorageInRows)
            SetPropertyValue("StorageInRows", _StorageInRows, value)
        End Set
    End Property
    Property StorageOutRows As StorageOutRows
        Get
            Return _StorageOutRows
        End Get
        Set(value As StorageOutRows)
            SetPropertyValue("StorageOutRows", _StorageOutRows, value)
        End Set
    End Property
    Property QTT As Double
        Get
            Return _QTT
        End Get
        Set(value As Double)
            SetPropertyValue("QTT", _QTT, value)
        End Set
    End Property
    Property QTT_Free_Before As Double
        Get
            Return _QTT_Free_Before
        End Get
        Set(value As Double)
            SetPropertyValue("QTT_Free_Before", _QTT_Free_Before, value)
        End Set
    End Property
    Property QTT_Free_After As Double
        Get
            Return _QTT_Free_After
        End Get
        Set(value As Double)
            SetPropertyValue("QTT_Free_After", _QTT_Free_After, value)
        End Set
    End Property
    Property ExecutionDate As Date
        Get
            Return _ExecutionDate
        End Get
        Set(value As Date)
            SetPropertyValue("ExecutionDate", _ExecutionDate, value)
        End Set
    End Property
    Property ObjectCreated As Date
        Get
            Return _ObjectCreated
        End Get
        Set(value As Date)
            SetPropertyValue("ObjectCreated", _ObjectCreated, value)
        End Set
    End Property
    Property UserCreated As User
        Get
            Return _UserCreated
        End Get
        Set(value As User)
            SetPropertyValue("UserCreated", _UserCreated, value)
        End Set
    End Property
    Property MoveEventsType As eMoveEventsType
        Get
            Return _MoveEventsType
        End Get
        Set(value As eMoveEventsType)
            SetPropertyValue("MoveEventsType", _MoveEventsType, value)
        End Set
    End Property
    Property FullIndex As Long
        Get
            Return _FullIndex
        End Get
        Set(value As Long)
            SetPropertyValue("FullIndex", _FullIndex, value)
        End Set
    End Property

    <VisibleInDetailView(False)> _
    ReadOnly Property Image1 As Image
        Get
            Select Case MoveEventsType
                Case eMoveEventsType.StorageInFinal
                    Return ImageLoader.Instance.GetImageInfo("arrow_down_blue").Image
                Case eMoveEventsType.StorageInBackToEdit
                    Return ImageLoader.Instance.GetImageInfo("arrow_right_blue").Image
                Case eMoveEventsType.StorageInStorno
                    Return ImageLoader.Instance.GetImageInfo("box_next").Image

                Case eMoveEventsType.StorageOutFinal
                    Return ImageLoader.Instance.GetImageInfo("arrow_up_green").Image
                Case eMoveEventsType.StorageOutBackToEdit
                    Return ImageLoader.Instance.GetImageInfo("arrow_left_blue").Image
                Case eMoveEventsType.StorageOutStorno
                    Return ImageLoader.Instance.GetImageInfo("box_previous").Image
                
                Case Else
                    Return Nothing
            End Select
        End Get
    End Property
End Class
