Files
Nuvolar/Nuvolar.Module/BusinessObjects/Business/BusinessTransactions/Production/Recipe.vb
T
2017-03-08 11:21:27 +01:00

138 lines
4.7 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
<DefaultClassOptions()> _
<NavigationItem("BusinessStocks")> _
<Appearance("Recipe - Disable DocumentNumber", AppearanceItemType.ViewItem, "1=1", TargetItems:="DocumentNumber", Enabled:=False)> _
<Appearance("Recipe - Disable UserCreated", AppearanceItemType.ViewItem, "1=1", TargetItems:="UserCreated", Enabled:=False)> _
<Appearance("Recipe - Disable ObjectCreated", AppearanceItemType.ViewItem, "1=1", TargetItems:="ObjectCreated", Enabled:=False)> _
Public Class Recipe 'Gygártási receptek
Inherits BaseObject
Private _RecipeType As RecipeType
Private _CustomersFrom As CustomersFrom 'Saját cég
Private _DocumentNumber As String 'Recept sorszáma
Private _ShortName As String 'Recept megnevezése
Private _Description As String 'Recept leírása
Private _UserCreated As User
Private _ObjectCreated As Date
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
If String.IsNullOrEmpty(DocumentNumber) Then
If RecipeType IsNot Nothing Then
If RecipeType.NumberGenerator IsNot Nothing Then
DocumentNumber = RecipeType.NumberGenerator.GetNewNumber(RecipeType.NumberGenerator)
End If
End If
End If
End Sub
<ImmediatePostData()> _
<RuleRequiredField("Recipe-RecipeType", DefaultContexts.Save)> _
Property RecipeType As RecipeType
Get
Return _RecipeType
End Get
Set(value As RecipeType)
SetPropertyValue("RecipeType", _RecipeType, value)
End Set
End Property
Property CustomersFrom As CustomersFrom
Get
Return _CustomersFrom
End Get
Set(value As CustomersFrom)
SetPropertyValue("CustomersFrom", _CustomersFrom, value)
End Set
End Property
Property DocumentNumber As String
Get
Return _DocumentNumber
End Get
Set(value As String)
SetPropertyValue("DocumentNumber", _DocumentNumber, value)
End Set
End Property
<RuleRequiredField("Recipe-ShortName", DefaultContexts.Save)> _
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
<NonCloneable> _
Property UserCreated As User
Get
Return _UserCreated
End Get
Set(value As User)
SetPropertyValue("UserCreated", _UserCreated, 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
<VisibleInListView(False)> _
<Association("Recipe-RecipeFrom", GetType(RecipeFrom))> _
ReadOnly Property RecipeFrom As XPCollection(Of RecipeFrom)
Get
Return GetCollection(Of RecipeFrom)("RecipeFrom")
End Get
End Property
<VisibleInListView(False)> _
<Association("Recipe-RecipeFromOther", GetType(RecipeFromOther))> _
ReadOnly Property RecipeFromOther As XPCollection(Of RecipeFromOther)
Get
Return GetCollection(Of RecipeFromOther)("RecipeFromOther")
End Get
End Property
<VisibleInListView(False)> _
<Association("Recipe-RecipeTo", GetType(RecipeTo))> _
ReadOnly Property RecipeTo As XPCollection(Of RecipeTo)
Get
Return GetCollection(Of RecipeTo)("RecipeTo")
End Get
End Property
<VisibleInListView(False)> _
<Association("Recipe-RecipeToOther", GetType(RecipeToOther))> _
ReadOnly Property RecipeToOther As XPCollection(Of RecipeToOther)
Get
Return GetCollection(Of RecipeToOther)("RecipeToOther")
End Get
End Property
End Class