ZooFlow: Fix DetailPage, Fix BaseForm, Tweak Appearance

This commit is contained in:
Jonathan Jenne
2021-07-08 14:22:10 +02:00
parent e8c78ad4da
commit 804812e562
20 changed files with 427 additions and 392 deletions

View File

@@ -1,42 +1,38 @@
Imports System.ComponentModel
Imports System.Threading
Imports System.Globalization
Imports DevExpress.XtraSplashScreen
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Filesystem
Imports DigitalData.Modules.Language.Utils
Imports DigitalData.Modules.Logging
Imports DigitalData.Controls.SQLConfig
Imports DigitalData.GUIs.ZooFlow.ClassInitLoader
Imports DigitalData.GUIs.ZooFlow.ClassConstants
Imports System.Threading
Imports System.Globalization
Imports DigitalData.Modules.EDMI.API
Imports DigitalData.Modules.EDMI.API.Constants
Imports DigitalData.Modules.Encryption
Imports DigitalData.GUIs.ZooFlow.ClassConstants
Imports DigitalData.GUIs.ZooFlow.ClassInitLoader
Imports DigitalData.Controls.SQLConfig
Public Class ClassInit
Private _MainForm As frmFlowForm
Private _Logger As Logger
Private _LogConfig As LogConfig
Private _DataASorDB As ClassDataASorDB
Private ReadOnly _MainForm As frmFlowForm
Private ReadOnly _Logger As Logger
Private ReadOnly _LogConfig As LogConfig
Private ReadOnly _DataASorDB As ClassDataASorDB
Private ReadOnly _Database As DatabaseWithFallback
Private _Loader As ClassInitLoader
Public Event Completed As EventHandler
Public Sub New(LogConfig As LogConfig, ParentForm As frmFlowForm)
_MainForm = ParentForm
_Logger = LogConfig.GetLogger()
_LogConfig = LogConfig
_DataASorDB = New ClassDataASorDB(LogConfig)
clsDataASorDB = _DataASorDB
_Logger = LogConfig.GetLogger()
'TODO: Remove when Globix uses DatabaseWithFallback
clsDataASorDB = New ClassDataASorDB(LogConfig)
End Sub
Public Sub InitializeApplication()
' Init Connectivity
' - Database / Service / Application Server
' (Init Licensing)
' Init User
' Init IDB
' Zeile -> Objekt / NameValue List
If Not SetupDatabase() Then
MsgBox("Keine Verbindungs-Informationen hinterlegt. Anwendung wird beendet.", MsgBoxStyle.Critical, _MainForm.Text)
Application.Exit()
@@ -50,7 +46,7 @@ Public Class ClassInit
_Loader.AddStep("Initializing User", AddressOf InitializeUser, True)
_Loader.AddStep("Initializing Language", AddressOf InitializeLanguage, False)
_Loader.AddStep("Initializing 3rd-party licenses", AddressOf Initialize3rdParty, False)
_Loader.AddStep("Initializing Basic Config", AddressOf InitBasicData, False)
_Loader.AddStep("Initializing Basic Config", AddressOf InitBasicConfig, False)
' === Init Schritte definieren
AddHandler _Loader.ProgressChanged, AddressOf ProgressChanged
@@ -60,6 +56,104 @@ Public Class ClassInit
End If
End Sub
#Region "=== Init Steps ==="
Private Sub InitializeDatabase(MyApplication As My.MyApplication)
Dim oConnectionString = MSSQLServer.DecryptConnectionString(My.SystemConfig.ConnectionString)
My.DatabaseECM = New MSSQLServer(My.LogConfig, oConnectionString)
If My.DatabaseECM.DBInitialized = False Then
_Logger.Warn("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
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)
If Not IsNothing(My.Application.Service.Client) Then
If My.Application.Service.Client.Connect() Then
MyApplication.Service.IsActive = True
End If
End If
Catch ex As Exception
_Logger.Error(ex)
Throw New InitException("Error in InitializeService", 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 InitializeUser(MyApplication As My.MyApplication)
Try
Dim oSql As String = My.Queries.Common.FNDD_MODULE_INIT(Environment.UserName)
Dim oDatatable As DataTable = My.DatabaseECM.GetDatatable(oSql)
If oDatatable Is Nothing Then
Throw New InitException("Benutzer konnte nicht geladen werden!")
End If
If oDatatable.Rows.Count <= 1 Then
Throw New InitException("Benutzer konnte nicht gefunden werden!")
End If
For Each oRow As DataRow In oDatatable.Rows
Dim oType As String = oRow("TYPE").ToString
Select Case oType
Case "USER"
HandleUserInfo(MyApplication, oRow)
Case MODULE_CLIPBOARDWATCHER
HandleModuleInfo(MyApplication, oType, oRow)
Case MODULE_GLOBAL_INDEXER
HandleModuleInfo(MyApplication, oType, oRow)
Case MODULE_ZOOFLOW
HandleModuleInfo(MyApplication, oType, oRow)
End Select
Next
Catch ex As Exception
_Logger.Error(ex)
Throw New InitException("Error while initializing user!", ex)
End Try
End Sub
Private Sub InitializeLanguage(MyApplication As My.MyApplication)
Dim oLanguage = MyApplication.User.Language
Dim oDateFormat = MyApplication.User.DateFormat
@@ -70,6 +164,44 @@ Public Class ClassInit
CultureInfo.DefaultThreadCurrentCulture = oCultureInfo
CultureInfo.DefaultThreadCurrentUICulture = oCultureInfo
End Sub
Private Sub Initialize3rdParty(MyApplication As My.MyApplication)
Try
Dim oSql = "Select LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE'"
Dim oDatatable As DataTable = My.DatabaseECM.GetDatatable(oSql)
If oDatatable.Rows.Count = 0 Then
Throw New InitException("Konfiguration konnte nicht geladen werden!")
End If
Dim oRow As DataRow = oDatatable.Rows.Item(0)
MyApplication.Settings.GdPictureKey = NotNull(oRow.Item("LICENSE"), String.Empty)
Catch ex As Exception
_Logger.Error(ex)
Throw New InitException("Error Initialize3rdParty!", ex)
End Try
End Sub
Private Sub InitBasicConfig(MyApplication As My.MyApplication)
Try
My.Tables.DTIDB_COMMON_SQL = My.DatabaseIDB.GetDatatable("SELECT * FROM TBIDB_COMMON_SQL WHERE ACTIVE = 1")
My.Tables.DTIDB_FILESTORE = My.DatabaseIDB.GetDatatable("SELECT * FROM TBIDB_FILESTORE_CONFIG WHERE ACTIVE = 1")
'Get FilesStores
For Each oRow As DataRow In My.Tables.DTIDB_FILESTORE.Rows
Select Case oRow.Item("TITLE").ToString
Case "ARCHIVE"
My.Filestore_Archive = oRow.Item("STORAGE_PATH")
Case "WORK"
My.Filestore_Work = oRow.Item("STORAGE_PATH")
End Select
Next
Catch ex As Exception
_Logger.Error(ex)
Throw New InitException("Error in InitBasicData", ex)
End Try
End Sub
#End Region
Private Function SetupDatabase() As Boolean
If My.SystemConfig.ConnectionString = String.Empty Then
@@ -115,182 +247,6 @@ Public Class ClassInit
End If
End Sub
Private Sub InitializeDatabase(MyApplication As My.MyApplication)
Dim oConnectionString = MSSQLServer.DecryptConnectionString(My.SystemConfig.ConnectionString)
My.DatabaseECM = New MSSQLServer(My.LogConfig, oConnectionString)
If My.DatabaseECM.DBInitialized = False Then
_Logger.Warn("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
Private Sub Initialize3rdParty(MyApplication As My.MyApplication)
Try
Dim oSql = "Select LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE'"
Dim oDatatable As DataTable = My.DatabaseECM.GetDatatable(oSql)
If oDatatable.Rows.Count = 0 Then
Throw New InitException("Konfiguration konnte nicht geladen werden!")
End If
Dim oRow As DataRow = oDatatable.Rows.Item(0)
MyApplication.Settings.GdPictureKey = NotNull(oRow.Item("LICENSE"), String.Empty)
Catch ex As Exception
_Logger.Error(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 = "SELECT * FROM TBIDB_COMMON_SQL WHERE ACTIVE = 1"
My.Tables.DTIDB_COMMON_SQL = _DataASorDB.GetDatatable("IDB", oSQL, "TBIDB_COMMON_SQL", "", "")
oSQL = "SELECT * FROM TBIDB_FILESTORE_CONFIG WHERE ACTIVE = 1"
My.Tables.DTIDB_FILESTORE = _DataASorDB.GetDatatable("IDB", oSQL, "TBIDB_FILESTORE_CONFIG", "", "")
'Get FilesStores
For Each oRow As DataRow In My.Tables.DTIDB_FILESTORE.Rows
Select Case oRow.Item("TITLE").ToString
Case "ARCHIVE"
My.Filestore_Archive = oRow.Item("STORAGE_PATH")
Case "WORK"
My.Filestore_Work = oRow.Item("STORAGE_PATH")
End Select
Next
Catch ex As Exception
_Logger.Error(ex)
Throw New InitException("Error in InitBasicData", ex)
End Try
End Sub
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)
If Not IsNothing(My.Application.Service.Client) Then
If My.Application.Service.Client.Connect() Then
MyApplication.Service.IsActive = True
End If
End If
Catch ex As Exception
_Logger.Error(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.DatabaseECM.DBInitialized Then
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)
If My.DatabaseIDB.DBInitialized = False Then
_Logger.Warn("Could not initialize IDB-Database!")
Throw New InitException("Could not initialize IDB-Database!")
End If
End If
Else
_Logger.Warn("ZooFlow missing from Active Modules!")
Throw New InitException("ZooFlow Modul ist nicht aktiv oder nicht lizensiert!")
End If
End Sub
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.DatabaseECM.GetDatatable(oSql)
If oDatatable Is Nothing Then
Throw New InitException("Benutzer konnte nicht geladen werden!")
End If
If oDatatable.Rows.Count <= 1 Then
Throw New InitException("Benutzer konnte nicht gefunden werden!")
End If
For Each oRow As DataRow In oDatatable.Rows
Dim oType As String = oRow("TYPE").ToString
Select Case oType
Case "USER"
HandleUserInfo(MyApplication, oRow)
Case MODULE_CLIPBOARDWATCHER
HandleModuleInfo(MyApplication, oType, oRow)
Case MODULE_GLOBAL_INDEXER
HandleModuleInfo(MyApplication, oType, oRow)
Case MODULE_ZOOFLOW
HandleModuleInfo(MyApplication, oType, oRow)
End Select
Next
Catch ex As Exception
_Logger.Error(ex)
Throw New InitException("Error while initializing user!", ex)
End Try
End Sub
Private Sub HandleUserInfo(MyApplication As My.MyApplication, Row As DataRow)
Dim oValue As Object = Row.Item("VALUE")
Dim oName As String = Row.Item("NAME").ToString