118 lines
4.5 KiB
VB.net
118 lines
4.5 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("Customers")> _
|
|
<Appearance("Disable Subcontractor-ObjectCreated", AppearanceItemType.ViewItem, "1=1", TargetItems:="ObjectCreated", Enabled:=False)> _
|
|
<Appearance("Disable Subcontractor-UserCreated", AppearanceItemType.ViewItem, "1=1", TargetItems:="UserCreated", Enabled:=False)> _
|
|
<Appearance("Disable Subcontractor-Customers, when is not nothing", AppearanceItemType.ViewItem, "IsNull(Customers)=False", TargetItems:="Customers", Enabled:=False)> _
|
|
Public Class Subcontractor
|
|
Inherits BaseObject
|
|
|
|
Private _Customers As Customers 'Alvállalkozó
|
|
Private _ObjectCreated As Date ' Objektum mikor készült
|
|
Private _UserCreated As User 'Ki készítette
|
|
|
|
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 Customers As Customers
|
|
Get
|
|
Return _Customers
|
|
End Get
|
|
Set(value As Customers)
|
|
SetPropertyValue("Customers", _Customers, value)
|
|
End Set
|
|
End Property
|
|
<NonCloneable> _
|
|
Property ObjectCreated As Date
|
|
Get
|
|
Return _ObjectCreated
|
|
End Get
|
|
Set(ByVal 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
|
|
|
|
'----------------ReadOnly properties---------------------
|
|
<VisibleInListView(False)> _
|
|
<Aggregated()> _
|
|
<Association("Subcontractor-SubcontractorCustomers", GetType(SubcontractorCustomers))> _
|
|
Public ReadOnly Property SubcontractorCustomers As XPCollection(Of SubcontractorCustomers)
|
|
Get
|
|
Return GetCollection(Of SubcontractorCustomers)("SubcontractorCustomers")
|
|
End Get
|
|
End Property
|
|
<VisibleInListView(False)> _
|
|
<Aggregated()> _
|
|
<Association("Subcontractor-SubcontractorWorksheetType", GetType(SubcontractorWorksheetType))> _
|
|
Public ReadOnly Property SubcontractorWorksheetType As XPCollection(Of SubcontractorWorksheetType)
|
|
Get
|
|
Return GetCollection(Of SubcontractorWorksheetType)("SubcontractorWorksheetType")
|
|
End Get
|
|
End Property
|
|
<VisibleInListView(False)> _
|
|
<Aggregated()> _
|
|
<Association("Subcontractor-SubcontractorDocuments", GetType(SubcontractorDocuments))> _
|
|
Public ReadOnly Property SubcontractorDocuments As XPCollection(Of SubcontractorDocuments)
|
|
Get
|
|
Return GetCollection(Of SubcontractorDocuments)("SubcontractorDocuments")
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property SubcontractorUser As XPCollection(Of User)
|
|
Get
|
|
Dim _User_Collection As New XPCollection(Of User)(Session, CriteriaOperator.Parse("1=2"))
|
|
If Me.Customers IsNot Nothing Then
|
|
Dim _Contacts_Collection As New XPCollection(Of Contacts)(Session, CriteriaOperator.Parse("Customers=?", Me.Customers))
|
|
|
|
For Each _Contacts As Contacts In _Contacts_Collection
|
|
If _Contacts.User IsNot Nothing Then
|
|
_User_Collection.Add(Session.GetObjectByKey(Of User)(_Contacts.User.Oid))
|
|
End If
|
|
Next
|
|
|
|
Return _User_Collection
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
Public ReadOnly Property SubcontractorUserRoles As XPCollection(Of SubcontractorUserRoles)
|
|
Get
|
|
If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
|
|
Return New XPCollection(Of SubcontractorUserRoles)(Session, CriteriaOperator.Parse("Subcontractor.Oid=?", Me.Oid))
|
|
Else
|
|
Return Nothing
|
|
End If
|
|
End Get
|
|
End Property
|
|
End Class
|