EDMI: Include Doctypes in ClientConfig
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.Runtime.Serialization
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Language
|
||||
Imports DigitalData.Modules.Logging
|
||||
@@ -11,7 +12,9 @@ Public Class GlobalState
|
||||
|
||||
Public Property ObjectStores As New List(Of ObjectStore)
|
||||
Public Property Connections As New List(Of DatabaseConnection)
|
||||
Public Property ClientConfig As New Config.ClientConfiguration
|
||||
Public Property Doctypes As New List(Of Doctype)
|
||||
|
||||
Public Property ClientConfig As New ClientConfiguration
|
||||
|
||||
Public Property TableStore As New DataSet
|
||||
|
||||
@@ -62,18 +65,45 @@ Public Class GlobalState
|
||||
Return MSSQLServer.DecryptConnectionString(oBuilder.ToString)
|
||||
End Function
|
||||
|
||||
Public Sub LoadDoctypes()
|
||||
_Logger.Info("Loading Doctypes")
|
||||
|
||||
Try
|
||||
Dim oSQL As String = "SELECT * FROM VWIDB_DOCTYPE_HANDLING"
|
||||
Dim oTable As DataTable = _MSSQL_IDB.GetDatatable(oSQL)
|
||||
|
||||
_Logger.Info("Found [{0}] Document Types", oTable.Rows.Count)
|
||||
|
||||
Dim oDocTypes As New List(Of Doctype)
|
||||
|
||||
For Each oRow As DataRow In oTable.Rows
|
||||
Dim oDoctype As New Doctype With {
|
||||
.Name = oRow.Item("DOCTYPE"),
|
||||
.FileChangedAction = oRow.Item("CHANGED_HANDLING")
|
||||
}
|
||||
|
||||
_Logger.Info("New Doctype [{0}]", oDoctype.Name)
|
||||
oDocTypes.Add(oDoctype)
|
||||
Next
|
||||
|
||||
Doctypes = oDocTypes
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
Public Sub LoadObjectStores()
|
||||
_Logger.Info("Loading Object Stores")
|
||||
Try
|
||||
Dim oSQL As String = "SELECT * FROM VWIDB_OBJECTSTORE"
|
||||
Dim oDatatable As DataTable = _MSSQL_IDB.GetDatatable(oSQL)
|
||||
Dim oTable As DataTable = _MSSQL_IDB.GetDatatable(oSQL)
|
||||
|
||||
ObjectStores.Clear()
|
||||
_Logger.Info("Found [{0}] Object Stores", oTable.Rows.Count)
|
||||
|
||||
_Logger.Info("Found [{0}] Object Stores", oDatatable.Rows.Count)
|
||||
Dim oObjectStores As New List(Of ObjectStore)
|
||||
|
||||
For Each oRow As DataRow In oDatatable.Rows
|
||||
For Each oRow As DataRow In oTable.Rows
|
||||
Dim oStore As New ObjectStore() With {
|
||||
.Id = oRow.Item("OST_ID"),
|
||||
.IsArchive = oRow.Item("OS_IS_ARCHIVE"),
|
||||
@@ -81,8 +111,10 @@ Public Class GlobalState
|
||||
.Title = oRow.Item("OS_TITLE")
|
||||
}
|
||||
_Logger.Info("New Object Store [{0}]", oStore.Title)
|
||||
ObjectStores.Add(oStore)
|
||||
oObjectStores.Add(oStore)
|
||||
Next
|
||||
|
||||
ObjectStores = oObjectStores
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
@@ -92,13 +124,13 @@ Public Class GlobalState
|
||||
_Logger.Info("Loading Database Connections")
|
||||
Try
|
||||
Dim oSQL As String = "SELECT * FROM TBDD_CONNECTION"
|
||||
Dim oDatatable As DataTable = _MSSQL_ECM.GetDatatable(oSQL)
|
||||
Dim oTable As DataTable = _MSSQL_ECM.GetDatatable(oSQL)
|
||||
|
||||
Connections.Clear()
|
||||
_Logger.Info("Found [{0}] Connections", oTable.Rows.Count)
|
||||
|
||||
_Logger.Info("Found [{0}] Connections", oDatatable.Rows.Count)
|
||||
Dim oConnections As New List(Of DatabaseConnection)
|
||||
|
||||
For Each oRow As DataRow In oDatatable.Rows
|
||||
For Each oRow As DataRow In oTable.Rows
|
||||
Dim oConnection As New DatabaseConnection() With {
|
||||
.Id = oRow.ItemEx(Of Integer)("GUID"),
|
||||
.Active = oRow.ItemEx(Of Boolean)("AKTIV"),
|
||||
@@ -110,21 +142,30 @@ Public Class GlobalState
|
||||
.Username = oRow.ItemEx(Of String)("USERNAME")
|
||||
}
|
||||
_Logger.Info("New Connection [{0}]", oConnection.Title)
|
||||
Connections.Add(oConnection)
|
||||
oConnections.Add(oConnection)
|
||||
Next
|
||||
|
||||
Connections = oConnections
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Class ObjectStore
|
||||
Public Sub LoadClientConfig(pConfig As Config)
|
||||
_Logger.Info("Loading Client Config")
|
||||
_Logger.Debug("ForceDirectDatabaseAccess: {0}", pConfig.ClientConfig.ForceDirectDatabaseAccess)
|
||||
ClientConfig.ForceDirectDatabaseAccess = pConfig.ClientConfig.ForceDirectDatabaseAccess
|
||||
ClientConfig.DocumentTypes = Doctypes
|
||||
End Sub
|
||||
|
||||
Public Class ObjectStore
|
||||
Public Id As Long
|
||||
Public Title As String
|
||||
Public IsArchive As Boolean
|
||||
Public Path As String
|
||||
End Class
|
||||
|
||||
Class DatabaseConnection
|
||||
Public Class DatabaseConnection
|
||||
Public Id As Long
|
||||
Public Title As String
|
||||
Public Provider As String
|
||||
@@ -134,4 +175,19 @@ Public Class GlobalState
|
||||
Public Password As String
|
||||
Public Active As Boolean
|
||||
End Class
|
||||
|
||||
|
||||
Public Class ClientConfiguration
|
||||
Public Property ForceDirectDatabaseAccess As Boolean = False
|
||||
Public Property DocumentTypes As New List(Of Doctype)
|
||||
End Class
|
||||
|
||||
<DataContract>
|
||||
Public Class Doctype
|
||||
<DataMember>
|
||||
Public Property Name As String
|
||||
<DataMember>
|
||||
Public Property FileChangedAction As String
|
||||
End Class
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user