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 eFixedAssestsTransactionType
    eActivation = 0 'Aktiválás
    eReactivation = 1 'Ráaktiválás
End Enum

<DefaultClassOptions()> _
<NavigationItem(False)> _
<CreatableItem(False)> _
Public Class FixedAssetsTransactions
    Inherits BaseObject
    Private _CustomersFrom As CustomersFrom
    Private _FixedAssetsCard As FixedAssetsCard
    Private _RowIndex As Long = 0
    Private _FixedAssets As FixedAssets
    Private _DateExecution As Date
    Private _DateOpen As Date
    Private _FixedAssestsTransactionType As eFixedAssestsTransactionType
    Private _AmountHUF As Double = 0 'Összeg
    Private _AmountHUFSalvage As Double = 0 'Maradványérték
    Private _AmountHUFDevelopmentReserve As Double = 0 'Fejlesztési tartalék
    Private _Description As String 'Megjegyzés
    Private _ObjectCreated As Date
    Private _UserCreated As User

    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 Session.IsNewObject(Me) Then
            ObjectCreated = GetSQLTime(Session)
            UserCreated = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser))
        End If
    End Sub

    Property CustomersFrom As CustomersFrom
        Get
            Return _CustomersFrom
        End Get
        Set(value As CustomersFrom)
            SetPropertyValue("CustomersFrom", _CustomersFrom, value)
        End Set
    End Property
    Property FixedAssetsCard As FixedAssetsCard
        Get
            Return _FixedAssetsCard
        End Get
        Set(value As FixedAssetsCard)
            SetPropertyValue("FixedAssetsCard", _FixedAssetsCard, value)
        End Set
    End Property
    Property RowIndex As Long
        Get
            Return _RowIndex
        End Get
        Set(value As Long)
            SetPropertyValue("RowIndex", _RowIndex, value)
        End Set
    End Property
    Property FixedAssets As FixedAssets
        Get
            Return _FixedAssets
        End Get
        Set(value As FixedAssets)
            SetPropertyValue("FixedAssets", _FixedAssets, value)
        End Set
    End Property
    Property DateExecution As Date
        Get
            Return _DateExecution
        End Get
        Set(value As Date)
            SetPropertyValue("DateExecution", _DateExecution, value)
        End Set
    End Property
    Property DateOpen As Date
        Get
            Return _DateOpen
        End Get
        Set(value As Date)
            SetPropertyValue("DateOpen", _DateOpen, value)
        End Set
    End Property
    Property FixedAssestsTransactionType As eFixedAssestsTransactionType
        Get
            Return _FixedAssestsTransactionType
        End Get
        Set(value As eFixedAssestsTransactionType)
            SetPropertyValue("FixedAssestsTransactionType", _FixedAssestsTransactionType, value)
        End Set
    End Property
    Property AmountHUF As Double
        Get
            Return _AmountHUF
        End Get
        Set(value As Double)
            SetPropertyValue("AmountHUF", _AmountHUF, value)
        End Set
    End Property
    Property AmountHUFSalvage As Double
        Get
            Return _AmountHUFSalvage
        End Get
        Set(value As Double)
            SetPropertyValue("AmountHUFSalvage", _AmountHUFSalvage, value)
        End Set
    End Property
    Property AmountHUFDevelopmentReserve As Double
        Get
            Return _AmountHUFDevelopmentReserve
        End Get
        Set(value As Double)
            SetPropertyValue("AmountHUFDevelopmentReserve", _AmountHUFDevelopmentReserve, value)
        End Set
    End Property
    <Size(-1)> _
    Property Description As String
        Get
            Return _Description
        End Get
        Set(value As String)
            SetPropertyValue("Description", _Description, 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
End Class
