EDMI: Work on ClassDataASorDB
This commit is contained in:
@@ -44,10 +44,10 @@ Public Class ClassInit
|
||||
_Loader = New ClassInitLoader()
|
||||
|
||||
' === Init Schritte definieren
|
||||
_Loader.AddStep("Checking connectivity..", AddressOf CheckConnectivity, True)
|
||||
_Loader.AddStep("Initializing Database (1/2)", AddressOf InitializeDatabase, True)
|
||||
_Loader.AddStep("Initializing Service", AddressOf InitializeService, True)
|
||||
_Loader.AddStep("Initializing Database (2/2)", AddressOf InitializeDatabaseWithFallback, True)
|
||||
_Loader.AddStep("Initializing User..", AddressOf InitializeUser, True)
|
||||
_Loader.AddStep("Initializing IDB Database..", AddressOf InitializeIDBDatabase, True)
|
||||
_Loader.AddStep("Initializing IDB Service..", AddressOf InitializeIDBService, True)
|
||||
_Loader.AddStep("Initializing Language..", AddressOf InitializeLanguage, False)
|
||||
_Loader.AddStep("Loading 3rd-party licenses..", AddressOf Initialize3rdParty, False)
|
||||
_Loader.AddStep("Loading Basic Configs..", AddressOf InitBasicData, False)
|
||||
@@ -115,13 +115,41 @@ Public Class ClassInit
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CheckConnectivity(MyApplication As My.MyApplication)
|
||||
Private Sub InitializeDatabase(MyApplication As My.MyApplication)
|
||||
Dim oConnectionString = MSSQLServer.DecryptConnectionString(My.SystemConfig.ConnectionString)
|
||||
My.Database = New MSSQLServer(My.LogConfig, oConnectionString)
|
||||
My.DatabaseECM = New MSSQLServer(My.LogConfig, oConnectionString)
|
||||
|
||||
If My.Database.DBInitialized = False Then
|
||||
If My.DatabaseECM.DBInitialized = False Then
|
||||
_Logger.Warn("Could not initialize DD_ECM-Database!")
|
||||
Throw New InitException("Could not initialize DD_ECM-Database!")
|
||||
Throw New InitException("Could not initialize ECM-Database!")
|
||||
|
||||
Else
|
||||
Dim oSQl = "SELECT * FROM TBDD_CONNECTION WHERE BEZEICHNUNG = 'IDB'"
|
||||
Dim oDatatable As DataTable = My.DatabaseECM.GetDatatable(oSQl)
|
||||
|
||||
If IsNothing(oDatatable) OrElse oDatatable.Rows.Count = 0 Then
|
||||
_Logger.Warn("No IDB connection entries in TBDD_CONNECTION found!")
|
||||
Throw New InitException("Fehler beim Laden der IDB Verbindungsdaten!")
|
||||
End If
|
||||
|
||||
If oDatatable.Rows.Count > 1 Then
|
||||
_Logger.Warn("Multiple IDB connection entries in TBDD_CONNECTION found!")
|
||||
Throw New InitException("Fehler beim Laden der IDB Verbindungsdaten!")
|
||||
End If
|
||||
|
||||
Dim oDataRow As DataRow = oDatatable.Rows.Item(0)
|
||||
Dim oConString = My.DatabaseECM.GetConnectionString(
|
||||
oDataRow.Item("SERVER").ToString,
|
||||
oDataRow.Item("DATENBANK").ToString,
|
||||
oDataRow.Item("USERNAME").ToString,
|
||||
oDataRow.Item("PASSWORD").ToString)
|
||||
|
||||
My.DatabaseIDB = New MSSQLServer(My.LogConfig, oConString)
|
||||
End If
|
||||
|
||||
If My.DatabaseIDB.DBInitialized = False Then
|
||||
_Logger.Warn("Could not initialize IDB-Database!")
|
||||
Throw New InitException("Could not initialize IDB-Database!")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -130,6 +158,7 @@ Public Class ClassInit
|
||||
Dim oSql = "Select LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE'"
|
||||
Dim oDatatable As DataTable = _DataASorDB.GetDatatable("DD_ECM", oSql, "TBDD_3RD_PARTY_MODULES", "", "")
|
||||
|
||||
|
||||
If oDatatable.Rows.Count = 0 Then
|
||||
Throw New InitException("Konfiguration konnte nicht geladen werden!")
|
||||
End If
|
||||
@@ -139,48 +168,49 @@ Public Class ClassInit
|
||||
MyApplication.Settings.GdPictureKey = NotNull(oRow.Item("LICENSE"), String.Empty)
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
Throw New InitException("Error initializing3rdParty!", ex)
|
||||
Throw New InitException("Error Initialize3rdParty!", ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub InitializeDatabaseWithFallback(MyApplication As My.MyApplication)
|
||||
Try
|
||||
My.Database = New DatabaseWithFallback(_LogConfig, My.Application.Service.Client, My.DatabaseECM, My.DatabaseIDB)
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
Throw New InitException("Error InitializeDatabaseWithFallback!", ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub InitBasicData(MyApplication As My.MyApplication)
|
||||
Try
|
||||
Dim oSql = ""
|
||||
My.Tables.DTIDB_COMMON_SQL = My.DatabaseECM.GetDatatable("SELECT * FROM TBIDB_COMMON_SQL WHERE ACTIVE = 1")
|
||||
My.Tables.DTIDB_CATALOG = My.DatabaseECM.GetDatatable("SELECT * FROM TBIDB_CATALOG")
|
||||
|
||||
oSql = "SELECT * FROM TBIDB_COMMON_SQL WHERE ACTIVE = 1"
|
||||
My.Tables.DTIDB_COMMON_SQL = _DataASorDB.GetDatatable("IDB", oSql, "TBIDB_COMMON_SQL", "", "")
|
||||
oSql = "SELECT * FROM TBIDB_CATALOG"
|
||||
My.Tables.DTIDB_CATALOG = _DataASorDB.GetDatatable("IDB", oSql, "TBIDB_CATALOG", "", "")
|
||||
'TODO: Get FilesStores from Application Server
|
||||
For Each oRow As DataRow In My.Tables.DTIDB_CATALOG.Rows
|
||||
'Console.WriteLine(oRow.Item("CAT_TITLE").ToString)
|
||||
Select Case oRow.Item("CAT_TITLE").ToString
|
||||
Case "FILESTORE_ARCHIVE"
|
||||
My.Filestore_Archive = oRow.Item("CAT_STRING")
|
||||
|
||||
Case "FILESTORE_WORK"
|
||||
My.Filestore_Work = oRow.Item("CAT_STRING")
|
||||
My.Filestore_Work = "Q:\DigitalData - IDB"
|
||||
|
||||
End Select
|
||||
|
||||
Next
|
||||
oSql = "SELECT * FROM TBDD_CONNECTION"
|
||||
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
Throw New InitException("Error in InitBasicData", ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub InitializeIDBService(MyApplication As My.MyApplication)
|
||||
Private Sub InitializeService(MyApplication As My.MyApplication)
|
||||
Try
|
||||
MyApplication.Service.Address = My.SystemConfig.AppServerConfig
|
||||
Dim oServerData = Client.ParseServiceAddress(My.SystemConfig.AppServerConfig)
|
||||
|
||||
My.Application.Service.Client = New Client(_LogConfig, oServerData.Item1, oServerData.Item2)
|
||||
|
||||
Dim oSplit() As String = MyApplication.Service.Address.Split(":"c)
|
||||
Dim oAppServerAddress As String = oSplit(0)
|
||||
Dim oAppServerPort As Integer = 9000
|
||||
If oSplit.Length = 2 Then
|
||||
oAppServerPort = oSplit(1)
|
||||
End If
|
||||
My.Application.Service.Client = New Client(_LogConfig, oAppServerAddress, oAppServerPort)
|
||||
If Not IsNothing(My.Application.Service.Client) Then
|
||||
If My.Application.Service.Client.Connect() Then
|
||||
MyApplication.Service.IsActive = True
|
||||
@@ -188,15 +218,15 @@ Public Class ClassInit
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
Throw New InitException("Error in InitBasicData", ex)
|
||||
Throw New InitException("Error in InitializeService", ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub InitializeIDBDatabase(MyApplication As My.MyApplication)
|
||||
If MyApplication.ModulesActive.Contains(MODULE_ZOOFLOW) Then
|
||||
If My.Database.DBInitialized Then
|
||||
If My.DatabaseECM.DBInitialized Then
|
||||
Dim oSQl = "SELECT * FROM TBDD_CONNECTION WHERE BEZEICHNUNG = 'IDB'"
|
||||
Dim oDatatable As DataTable = My.Database.GetDatatable(oSQl)
|
||||
Dim oDatatable As DataTable = My.DatabaseECM.GetDatatable(oSQl)
|
||||
|
||||
If IsNothing(oDatatable) OrElse oDatatable.Rows.Count = 0 Then
|
||||
_Logger.Warn("No IDB connection entries in TBDD_CONNECTION found!")
|
||||
@@ -209,7 +239,7 @@ Public Class ClassInit
|
||||
End If
|
||||
|
||||
Dim oDataRow As DataRow = oDatatable.Rows.Item(0)
|
||||
Dim oConString = My.Database.GetConnectionString(
|
||||
Dim oConString = My.DatabaseECM.GetConnectionString(
|
||||
oDataRow.Item("SERVER").ToString,
|
||||
oDataRow.Item("DATENBANK").ToString,
|
||||
oDataRow.Item("USERNAME").ToString,
|
||||
@@ -230,7 +260,7 @@ Public Class ClassInit
|
||||
Private Sub InitializeUser(MyApplication As My.MyApplication)
|
||||
Try
|
||||
Dim oSql As String = My.Queries.Common.FNDD_MODULE_INIT(Environment.UserName)
|
||||
Dim oDatatable As DataTable = My.Database.GetDatatable(oSql)
|
||||
Dim oDatatable As DataTable = My.DatabaseECM.GetDatatable(oSql)
|
||||
|
||||
If oDatatable Is Nothing Then
|
||||
Throw New InitException("Benutzer konnte nicht geladen werden!")
|
||||
|
||||
Reference in New Issue
Block a user