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(False), CreatableItem(False), DeferredDeletion(False)> _
Public Class DBCLogin
    Inherits BaseObject

    Private _ShortName As String

    Private _SQLType_From As eSQLType
    Private _SQLServer_From As String
    Private _SQLUser_From As String
    Private _SQLPassword_From As String
    Private _SQLDatabase_From As String

    Private _SQLType_To As eSQLType
    Private _SQLServer_To As String
    Private _SQLUser_To As String
    Private _SQLPassword_To As String
    Private _SQLDatabase_To As String

    Private _UserCreated As User
    Private _ObjectCreated As Date

    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

    Property ShortName As String
        Get
            Return _ShortName
        End Get
        Set(value As String)
            SetPropertyValue("ShortName", _ShortName, value)
        End Set
    End Property
    Property SQLType_From As eSQLType
        Get
            Return _SQLType_From
        End Get
        Set(value As eSQLType)
            SetPropertyValue("SQLType_From", _SQLType_From, value)
        End Set
    End Property
    Property SQLServer_From As String
        Get
            Return _SQLServer_From
        End Get
        Set(value As String)
            SetPropertyValue("SQLServer_From", _SQLServer_From, value)
        End Set
    End Property
    Property SQLUser_From As String
        Get
            Return _SQLUser_From
        End Get
        Set(value As String)
            SetPropertyValue("SQLUser_From", _SQLUser_From, value)
        End Set
    End Property
    Property SQLPassword_From As String
        Get
            Return _SQLPassword_From
        End Get
        Set(value As String)
            SetPropertyValue("SQLPassword_From", _SQLPassword_From, value)
        End Set
    End Property
    Property SQLDatabase_From As String
        Get
            Return _SQLDatabase_From
        End Get
        Set(value As String)
            SetPropertyValue("SQLDatabase_From", _SQLDatabase_From, value)
        End Set
    End Property

    Property SQLType_To As eSQLType
        Get
            Return _SQLType_To
        End Get
        Set(value As eSQLType)
            SetPropertyValue("SQLType_To", _SQLType_To, value)
        End Set
    End Property
    Property SQLServer_To As String
        Get
            Return _SQLServer_To
        End Get
        Set(value As String)
            SetPropertyValue("SQLServer_To", _SQLServer_To, value)
        End Set
    End Property
    Property SQLUser_To As String
        Get
            Return _SQLUser_To
        End Get
        Set(value As String)
            SetPropertyValue("SQLUser_To", _SQLUser_To, value)
        End Set
    End Property
    Property SQLPassword_To As String
        Get
            Return _SQLPassword_To
        End Get
        Set(value As String)
            SetPropertyValue("SQLPassword_To", _SQLPassword_To, value)
        End Set
    End Property
    Property SQLDatabase_To As String
        Get
            Return _SQLDatabase_To
        End Get
        Set(value As String)
            SetPropertyValue("SQLDatabase_To", _SQLDatabase_To, 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

    '//XPCollections
    <VisibleInListView(False), VisibleInLookupListView(False)> _
    ReadOnly Property DBCTables_From As XPCollection(Of DBCTables)
        Get
            Return New XPCollection(Of DBCTables)(Session, CriteriaOperator.Parse("DBCLogin=? and DBCType=0", Me))
        End Get
    End Property
    <VisibleInListView(False), VisibleInLookupListView(False)> _
    ReadOnly Property DBCTables_To As XPCollection(Of DBCTables)
        Get
            Return New XPCollection(Of DBCTables)(Session, CriteriaOperator.Parse("DBCLogin=? and DBCType=1", Me))
        End Get
    End Property
End Class
