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("BusinessStocks")> _
<CreatableItem(False)> _
Public Class WorkPlace
    Inherits BaseObject
    Private _CustomersFrom As CustomersFrom 'Saját cég
    Private _Customers As Customers 'Partner
    Private _ShortName As String 'Munkahely megnevezése
    Private _Description As String 'Munkahely leírása
    Private _Address As Address 'Munkahely címe
    Private _CostPlace As CostPlace
    Private _OperationalLogType As eOperationalLogType

    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
            Dim _CostPlace As CostPlace = New CostPlace(Session)
            _CostPlace.Name = Me.ShortName
            _CostPlace.Save()
            Me.CostPlace = _CostPlace
        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 Customers As Customers
        Get
            Return _Customers
        End Get
        Set(value As Customers)
            SetPropertyValue("Customers", _Customers, value)
        End Set
    End Property
    Property ShortName As String
        Get
            Return _ShortName
        End Get
        Set(value As String)
            SetPropertyValue("ShortName", _ShortName, value)
        End Set
    End Property
    Property Description As String
        Get
            Return _Description
        End Get
        Set(value As String)
            SetPropertyValue("Description", _Description, value)
        End Set
    End Property
    Property Address As Address
        Get
            Return _Address
        End Get
        Set(value As Address)
            SetPropertyValue("Address", _Address, value)
        End Set
    End Property
    Property CostPlace As CostPlace
        Get
            Return _CostPlace
        End Get
        Set(value As CostPlace)
            SetPropertyValue("CostPlace", _CostPlace, value)
        End Set
    End Property
    Property OperationalLogType As eOperationalLogType
        Get
            Return _OperationalLogType
        End Get
        Set(value As eOperationalLogType)
            SetPropertyValue("OperationalLogType", _OperationalLogType, value)
        End Set
    End Property
End Class
