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 eInstallationDocumentationStatus
    ePublic = 0 '-- Bárki láthatja
    ePrivat = 1 '-- Csak belső használatra
    eCustomers = 2 '-- Az ügyfél akinek a gyártmány átadása történt láthatja
End Enum
<DefaultClassOptions()> _
<NavigationItem(False), CreatableItem(False)> _
<Appearance("SubcontractorDocuments - Hide XML properties, when IsDashboard = False", _
    AppearanceItemType.ViewItem, "IsDashboard = False", TargetItems:="XML_ServerName;XML_UserName;XML_DatabaseName;XML_Password;XML_SqlType", visibility:=Editors.ViewItemVisibility.Hide)> _
Public Class InstallationDocumentations
    Inherits FileAttachmentBase
    Private _Installation As Installation
    Private _Status As eInstallationDocumentationStatus
    Private _RowGroup1 As String 'Szöveges csoportosítás (nem kötelező)
    Private _RowGroup2 As String 'Szöveges másodlagos csoportosítás (nem kötelező)
    Private _IsDashboard As Boolean 'Műszerfal-e
    Private _XML_ServerName As String
    Private _XML_UserName As String
    Private _XML_DatabaseName As String
    Private _XML_Password As String
    Private _XML_SqlType As eSQLType

    Public Sub New(ByVal session As Session)
        MyBase.New(session)
    End Sub
    Public Overrides Sub AfterConstruction()
        MyBase.AfterConstruction()
        Me.Status = eInstallationDocumentationStatus.eCustomers
    End Sub

    <Persistent(), Association("Installation-InstallationDocumentations")> _
    Property Installation() As Installation
        Get
            Return _Installation
        End Get
        Set(ByVal value As Installation)
            SetPropertyValue("Installation", _Installation, value)
        End Set
    End Property
    Property Status As eInstallationDocumentationStatus
        Get
            Return _Status
        End Get
        Set(value As eInstallationDocumentationStatus)
            SetPropertyValue("Status", _Status, value)
        End Set
    End Property
    Property RowGroup1 As String
        Get
            Return _RowGroup1
        End Get
        Set(value As String)
            SetPropertyValue("RowGroup1", _RowGroup1, value)
        End Set
    End Property
    Property RowGroup2 As String
        Get
            Return _RowGroup2
        End Get
        Set(value As String)
            SetPropertyValue("RowGroup2", _RowGroup2, value)
        End Set
    End Property

    <ImmediatePostData()> _
    Property IsDashboard As Boolean
        Get
            Return _IsDashboard
        End Get
        Set(value As Boolean)
            SetPropertyValue("IsDashboard", _IsDashboard, value)
        End Set
    End Property
    <RuleRequiredField("InstallationDocumentations - XML_ServerName", DefaultContexts.Save, TargetCriteria:="IsDashboard=True")> _
    Property XML_ServerName As String
        Get
            Return _XML_ServerName
        End Get
        Set(value As String)
            SetPropertyValue("XML_ServerName", _XML_ServerName, value)
        End Set
    End Property
    <RuleRequiredField("InstallationDocumentations - XML_UserName", DefaultContexts.Save, TargetCriteria:="IsDashboard=True")> _
    Property XML_UserName As String
        Get
            Return _XML_UserName
        End Get
        Set(value As String)
            SetPropertyValue("XML_UserName", _XML_UserName, value)
        End Set
    End Property
    <RuleRequiredField("InstallationDocumentations - XML_DatabaseName", DefaultContexts.Save, TargetCriteria:="IsDashboard=True")> _
    Property XML_DatabaseName As String
        Get
            Return _XML_DatabaseName
        End Get
        Set(value As String)
            SetPropertyValue("XML_DatabaseName", _XML_DatabaseName, value)
        End Set
    End Property
    <PasswordPropertyText(True)> _
    <ValueConverter(GetType(Encryption))> _
    <RuleRequiredField("InstallationDocumentations - XML_Password", DefaultContexts.Save, TargetCriteria:="IsDashboard=True")> _
    Property XML_Password As String
        Get
            Return _XML_Password
        End Get
        Set(value As String)
            SetPropertyValue("XML_Password", _XML_Password, value)
        End Set
    End Property
    <RuleRequiredField("InstallationDocumentations - XML_SqlType", DefaultContexts.Save, TargetCriteria:="IsDashboard=True")> _
    Property XML_SqlType As eSQLType
        Get
            Return _XML_SqlType
        End Get
        Set(value As eSQLType)
            SetPropertyValue("XML_SqlType", _XML_SqlType, value)
        End Set
    End Property

End Class







