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()> _
<NonPersistent()>
<CreatableItem(False)> _
<NavigationItem(False)> _
Public Class ServiceFinder
    Inherits BaseObject
    Private _MasterKey As Guid
    Private _Services As Services
    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
    <Browsable(False)> _
    Property MasterKey As Guid
        Get
            Return _MasterKey
        End Get
        Set(value As Guid)
            SetPropertyValue("MasterKey", _MasterKey, value)
        End Set
    End Property
    <ImmediatePostData(), Browsable(False)>
    Property Services As Services
        Get
            Return _Services
        End Get
        Set(value As Services)
            SetPropertyValue("Services", _Services, value)
            If Session.IsObjectsSaving = False And Session.IsObjectsLoading = False Then
                Dim c As XPCollection(Of ServiceFinderInfo)
                c = Me.ServiceFinderInfo
            End If
        End Set
    End Property
    <VisibleInListView(False), VisibleInLookupListView(False)> _
    ReadOnly Property ServiceSelect As XPCollection(Of Services)
        Get
            Return New XPCollection(Of Services)(Session)
        End Get
    End Property
    <VisibleInListView(False), VisibleInLookupListView(False)> _
    ReadOnly Property ServiceSelected As XPCollection(Of ServiceSelected)
        Get
            Return New XPCollection(Of ServiceSelected)(Session, CriteriaOperator.Parse("MasterKey=?", Me.MasterKey))
        End Get
    End Property
    <VisibleInListView(False), VisibleInLookupListView(False)> _
       ReadOnly Property ServiceFinderInfo As XPCollection(Of ServiceFinderInfo)
        Get
            Return New XPCollection(Of ServiceFinderInfo)(Session, CriteriaOperator.Parse("1=2"))
        End Get
    End Property
End Class
