Files
2017-03-26 20:00:03 +02:00

136 lines
5.4 KiB
VB.net

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
Public Enum eStoragePDACollectionHeaderStatus
eOpen = 0
eClosed = 1
eReady = 2
End Enum
Public Enum eStoragePDACollectionType
eIsInventory = 0
eIsLocationIn = 1
eIsLocationOut = 2
End Enum
<DefaultClassOptions()> _
<NavigationItem("PDA")> _
<DeferredDeletion(False)> _
<DefaultProperty("DocumentNumber")> _
<Appearance("StoragePDACollectionHeader - Disable ObjectCreated, UserCreated, DocumentNumber", AppearanceItemType.ViewItem, "1=1", TargetItems:="ObjectCreated;UserCreated;DocumentNumber", Enabled:=False)> _
<Appearance("StoragePDACollectionHeader - Disable all properties, when StoragePDACollectionHeaderStatus=1", AppearanceItemType.ViewItem, "StoragePDACollectionHeaderStatus=1", TargetItems:="*", Enabled:=False)> _
<Appearance("StoragePDACollectionHeader - Disable aInsertStoragePDARows, when StoragePDACollectionHeaderStatus=1", AppearanceItemType.Action, "StoragePDACollectionHeaderStatus=1", TargetItems:="aInsertStoragePDARows", Visibility:=Editors.ViewItemVisibility.Hide)> _
<Appearance("StoragePDACollectionHeader - Disable aDeleteStoragePDARows, when StoragePDACollectionHeaderStatus=1", AppearanceItemType.Action, "StoragePDACollectionHeaderStatus=1", TargetItems:="aDeleteStoragePDARows", Visibility:=Editors.ViewItemVisibility.Hide)> _
Public Class StoragePDACollectionHeader
Inherits BaseObject
Private _DocumentNumber As String
Private _StoragePDACollectionHeaderStatus As eStoragePDACollectionHeaderStatus
Private _StoragePDACollectionType As eStoragePDACollectionType
Private _StoragePDAParameters As StoragePDAParameters
Private _ObjectCreated As Date
Private _UserCreated As User
Private _StorageInHeader As StorageInHeader
Private _StorageOutHeader As StorageOutHeader
Public Sub New(ByVal session As Session)
MyBase.New(session)
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
Me.ObjectCreated = GetSQLTime(Session)
Me.UserCreated = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser))
Me.StoragePDACollectionHeaderStatus = eStoragePDACollectionHeaderStatus.eOpen
End Sub
Protected Overrides Sub OnSaving()
MyBase.OnSaving()
If Session.IsNewObject(Me) Then
Me.DocumentNumber = Me.StoragePDAParameters.NumberGenerator.GetNewNumber(Me.StoragePDAParameters.NumberGenerator)
End If
End Sub
Property DocumentNumber As String
Get
Return _DocumentNumber
End Get
Set(value As String)
SetPropertyValue("DocumentNumber", _DocumentNumber, value)
End Set
End Property
Property StoragePDACollectionHeaderStatus As eStoragePDACollectionHeaderStatus
Get
Return _StoragePDACollectionHeaderStatus
End Get
Set(value As eStoragePDACollectionHeaderStatus)
SetPropertyValue("StoragePDACollectionHeaderStatus", _StoragePDACollectionHeaderStatus, value)
End Set
End Property
Property StorageCollectionType As eStoragePDACollectionType
Get
Return _StoragePDACollectionType
End Get
Set(value As eStoragePDACollectionType)
SetPropertyValue("StoragePDACollectionType", _StoragePDACollectionType, value)
End Set
End Property
<RuleRequiredField("StoragePDACollectionHeader-StoragePDAParameters", DefaultContexts.Save)> _
Property StoragePDAParameters As StoragePDAParameters
Get
Return _StoragePDAParameters
End Get
Set(value As StoragePDAParameters)
SetPropertyValue("StoragePDAParameters", _StoragePDAParameters, 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
Property StorageInHeader As StorageInHeader
Get
Return _StorageInHeader
End Get
Set(value As StorageInHeader)
SetPropertyValue("StorageInHeader", _StorageInHeader, value)
End Set
End Property
Property StorageOutHeader As StorageOutHeader
Get
Return _StorageOutHeader
End Get
Set(value As StorageOutHeader)
SetPropertyValue("StorageOutHeader", _StorageOutHeader, value)
End Set
End Property
'--------------------ReadOnly--------------------------
<VisibleInListView(False), VisibleInLookupListView(False)> _
<Association("StoragePDACollectionHeader-StoragePDACollectionRows", GetType(StoragePDACollectionRows)), Aggregated()> _
Public ReadOnly Property StoragePDACollectionRows() As XPCollection(Of StoragePDACollectionRows)
Get
Return GetCollection(Of StoragePDACollectionRows)("StoragePDACollectionRows")
End Get
End Property
End Class