diff --git a/GUIs.ZooFlow/Administration/frmAdmin_ClipboardWatcher.vb b/GUIs.ZooFlow/Administration/frmAdmin_ClipboardWatcher.vb index 1460b961..6e05e910 100644 --- a/GUIs.ZooFlow/Administration/frmAdmin_ClipboardWatcher.vb +++ b/GUIs.ZooFlow/Administration/frmAdmin_ClipboardWatcher.vb @@ -67,16 +67,16 @@ Public Class frmAdmin_ClipboardWatcher 'TODO: Diese Codezeile lädt Daten in die Tabelle "DSDD_Stammdaten.TBDD_CONNECTION". Sie können sie bei Bedarf verschieben oder entfernen. Me.TBDD_CONNECTIONTableAdapter.Fill(Me.DSDD_Stammdaten.TBDD_CONNECTION) Try - TBCW_PROFILESTableAdapter.Connection.ConnectionString = My.Database.CurrentSQLConnectionString + TBCW_PROFILESTableAdapter.Connection.ConnectionString = My.DatabaseECM.CurrentSQLConnectionString TBCW_PROFILESTableAdapter.Fill(DBCW_Stammdaten.TBCW_PROFILES, PrimaryKey) - TBCW_PROF_DOC_SEARCHTableAdapter.Connection.ConnectionString = My.Database.CurrentSQLConnectionString + TBCW_PROF_DOC_SEARCHTableAdapter.Connection.ConnectionString = My.DatabaseECM.CurrentSQLConnectionString TBCW_PROF_DOC_SEARCHTableAdapter.Fill(DBCW_Stammdaten.TBCW_PROF_DOC_SEARCH, PrimaryKey) - TBCW_PROF_DATA_SEARCHTableAdapter.Connection.ConnectionString = My.Database.CurrentSQLConnectionString + TBCW_PROF_DATA_SEARCHTableAdapter.Connection.ConnectionString = My.DatabaseECM.CurrentSQLConnectionString TBCW_PROF_DATA_SEARCHTableAdapter.Fill(DBCW_Stammdaten.TBCW_PROF_DATA_SEARCH, PrimaryKey) - TBDD_CONNECTIONTableAdapter.Connection.ConnectionString = My.Database.CurrentSQLConnectionString + TBDD_CONNECTIONTableAdapter.Connection.ConnectionString = My.DatabaseECM.CurrentSQLConnectionString TBDD_CONNECTIONTableAdapter.Fill(DSDD_Stammdaten.TBDD_CONNECTION) ' Configure the GridViews with some default options @@ -220,7 +220,7 @@ Public Class frmAdmin_ClipboardWatcher Dim oTextEdit As TextEdit = sender If e.Button.Tag = BUTTON_SEARCH_SQL Then - Dim oForm As New frmSQLEditor(My.LogConfig, My.Database) With {.SQLString = oTextEdit.EditValue} + Dim oForm As New frmSQLEditor(My.LogConfig, My.DatabaseECM) With {.SQLString = oTextEdit.EditValue} Dim oResult = oForm.ShowDialog() If oResult = DialogResult.OK Then @@ -233,7 +233,7 @@ Public Class frmAdmin_ClipboardWatcher Dim oTextEdit As TextEdit = sender If e.Button.Tag = BUTTON_COUNT_SQL Then - Dim oForm As New frmSQLEditor(My.LogConfig, My.Database) With {.SQLString = oTextEdit.EditValue} + Dim oForm As New frmSQLEditor(My.LogConfig, My.DatabaseECM) With {.SQLString = oTextEdit.EditValue} Dim oResult = oForm.ShowDialog() If oResult = DialogResult.OK Then diff --git a/GUIs.ZooFlow/Administration/frmAdmin_Globix.vb b/GUIs.ZooFlow/Administration/frmAdmin_Globix.vb index a96685a2..7d569f45 100644 --- a/GUIs.ZooFlow/Administration/frmAdmin_Globix.vb +++ b/GUIs.ZooFlow/Administration/frmAdmin_Globix.vb @@ -17,7 +17,7 @@ Public Class frmAdmin_Globix Private Sub frmAdmin_Attribute_Load(sender As Object, e As EventArgs) Handles MyBase.Load Try - TBDD_DOKUMENTARTTableAdapter.Connection.ConnectionString = My.Database.CurrentSQLConnectionString + TBDD_DOKUMENTARTTableAdapter.Connection.ConnectionString = My.DatabaseECM.CurrentSQLConnectionString Me.TBDD_DOKUMENTARTTableAdapter.Fill(Me.GlobixDataset.TBDD_DOKUMENTART, PrimaryKey) Catch ex As Exception ShowErrorMessage(ex) diff --git a/GUIs.ZooFlow/Administration/frmAdmin_Start.vb b/GUIs.ZooFlow/Administration/frmAdmin_Start.vb index 517b2b0c..74a193a7 100644 --- a/GUIs.ZooFlow/Administration/frmAdmin_Start.vb +++ b/GUIs.ZooFlow/Administration/frmAdmin_Start.vb @@ -63,7 +63,7 @@ Public Class frmAdmin_Start Private Function Load_SQLData() As Boolean Try - Dim oTable As DataTable = My.Database.GetDatatable("SELECT * FROM TBZF_ADMIN_SOURCE_SQL") + Dim oTable As DataTable = My.DatabaseECM.GetDatatable("SELECT * FROM TBZF_ADMIN_SOURCE_SQL") DetailForm.DetailDataList.Clear() For Each oRow As DataRow In oTable.Rows @@ -77,7 +77,7 @@ Public Class frmAdmin_Start } Try - oItem.SQLResult = My.Database.GetDatatable(oItem.SQLCommand) + oItem.SQLResult = My.DatabaseECM.GetDatatable(oItem.SQLCommand) Catch ex As Exception oItem.SQLResult = Nothing Logger.Error(ex) diff --git a/GUIs.ZooFlow/ClassConstants.vb b/GUIs.ZooFlow/ClassConstants.vb index eb62ce5a..c472c821 100644 --- a/GUIs.ZooFlow/ClassConstants.vb +++ b/GUIs.ZooFlow/ClassConstants.vb @@ -39,4 +39,6 @@ Public Const IDB_ADDED_WHEN_String_German = "Erstellt Wann" Public Const IDB_ADDED_WHEN_String_Englisch = "Added when" + + Public Const WM_WINDOWPOSCHANGING As Integer = &H46 End Class diff --git a/GUIs.ZooFlow/ClassDataASorDB.vb b/GUIs.ZooFlow/ClassDataASorDB.vb index b2bf726f..0f1a10d5 100644 --- a/GUIs.ZooFlow/ClassDataASorDB.vb +++ b/GUIs.ZooFlow/ClassDataASorDB.vb @@ -24,7 +24,7 @@ Public Class ClassDataASorDB End Try Else If pDB = "DD_ECM" Then - oReturnDT = My.Database.GetDatatable(pSQL) + oReturnDT = My.DatabaseECM.GetDatatable(pSQL) ElseIf pDB = "IDB" Then oReturnDT = My.DatabaseIDB.GetDatatable(pSQL) End If diff --git a/GUIs.ZooFlow/ClassEnvironment.vb b/GUIs.ZooFlow/ClassEnvironment.vb index 506114ae..f3df777f 100644 --- a/GUIs.ZooFlow/ClassEnvironment.vb +++ b/GUIs.ZooFlow/ClassEnvironment.vb @@ -4,7 +4,7 @@ Public Class ClassEnvironment Public Shared Function GetEnvironment() As Environment Dim oEnvironment As New Environment() With { .DatabaseIDB = My.DatabaseIDB, - .Database = My.Database, + .Database = My.DatabaseECM, .Modules = My.Application.Modules, .Service = My.Application.Service, .Settings = My.Application.Settings, diff --git a/GUIs.ZooFlow/ClassIDBData.vb b/GUIs.ZooFlow/ClassIDBData.vb index a160321d..b7e77477 100644 --- a/GUIs.ZooFlow/ClassIDBData.vb +++ b/GUIs.ZooFlow/ClassIDBData.vb @@ -1,4 +1,6 @@ -Imports DigitalData.Modules.Logging +Imports DigitalData.Modules.EDMI.API +Imports DigitalData.Modules.EDMI.API.Constants +Imports DigitalData.Modules.Logging Public Class ClassIDBData Public Property DTVWIDB_BE_ATTRIBUTE As DataTable @@ -9,11 +11,17 @@ Public Class ClassIDBData ''' Array with all Indices Private _Logger As Logger Private _DataASorDB As ClassDataASorDB + Private _Database As DatabaseWithFallback + Public Sub New(LogConfig As LogConfig) _Logger = LogConfig.GetLogger + _Database = New DatabaseWithFallback(LogConfig, My.Application.Service.Client, My.DatabaseECM, My.DatabaseIDB) + _DataASorDB = New ClassDataASorDB(LogConfig) Dim oSQL = $"SELECT * FROM VWIDB_BE_ATTRIBUTE WHERE LANG_ID = {My.Application.User.LanguageID}" - DTVWIDB_BE_ATTRIBUTE = _DataASorDB.GetDatatable("IDB", oSQL, "VWIDB_BE_ATTRIBUTE", $"LANG_ID = {My.Application.User.LanguageID}") + + DTVWIDB_BE_ATTRIBUTE = _Database.GetDatatable("VWIDB_BE_ATTRIBUTE", oSQL, DatabaseType.IDB, $"LANG_ID = {My.Application.User.LanguageID}") + 'DTVWIDB_BE_ATTRIBUTE = _DataASorDB.GetDatatable("IDB", oSQL, "VWIDB_BE_ATTRIBUTE", $"LANG_ID = {My.Application.User.LanguageID}") End Sub Public IDBSystemIndices As List(Of String) Public Function GetIndicesByBE(ByVal pBusinessEntity As String) As List(Of String) diff --git a/GUIs.ZooFlow/ClassInit.vb b/GUIs.ZooFlow/ClassInit.vb index 906d1a7f..6b1da8d5 100644 --- a/GUIs.ZooFlow/ClassInit.vb +++ b/GUIs.ZooFlow/ClassInit.vb @@ -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!") diff --git a/GUIs.ZooFlow/Globix/ClassFilehandle.vb b/GUIs.ZooFlow/Globix/ClassFilehandle.vb index e72133af..40706c2e 100644 --- a/GUIs.ZooFlow/Globix/ClassFilehandle.vb +++ b/GUIs.ZooFlow/Globix/ClassFilehandle.vb @@ -180,7 +180,7 @@ Public Class ClassFilehandle Dim filename_only As String = Path.GetFileName(filename) Dim ins As String = "INSERT INTO TBGI_FILES_USER (FILENAME2WORK, USER@WORK,HANDLE_TYPE,FILENAME_ONLY) VALUES ('" & filename & "','" & Environment.UserName & "','" & handleType & "','" & filename_only & "')" - Return My.Database.ExecuteNonQuery(ins) + Return My.DatabaseECM.ExecuteNonQuery(ins) Catch ex As Exception Return False diff --git a/GUIs.ZooFlow/Globix/ClassHelpers.vb b/GUIs.ZooFlow/Globix/ClassHelpers.vb index 355d91d6..3fdda1b5 100644 --- a/GUIs.ZooFlow/Globix/ClassHelpers.vb +++ b/GUIs.ZooFlow/Globix/ClassHelpers.vb @@ -16,7 +16,7 @@ End Try oSQL = "SELECT * FROM TBGI_FILES_USER WHERE UPPER(FILE_HASH) = UPPER('" & oHash & "') AND WORKED = 0 ORDER BY ADDED_WHEN" - Dim oResult As DataTable = My.Database.GetDatatable(oSQL) + Dim oResult As DataTable = My.DatabaseECM.GetDatatable(oSQL) If oResult Is Nothing Then Return Nothing @@ -24,7 +24,7 @@ If oResult.Rows.Count = 0 Then oSQL = "SELECT * FROM TBGI_HISTORY WHERE UPPER(FILE_HASH) = UPPER('" & oHash & "') ORDER BY ADDED_WHEN" - oResult = My.Database.GetDatatable(oSQL) + oResult = My.DatabaseECM.GetDatatable(oSQL) If oResult Is Nothing Then Return Nothing diff --git a/GUIs.ZooFlow/Globix/GlobixControls.vb b/GUIs.ZooFlow/Globix/GlobixControls.vb index 54ad213c..26ab7b23 100644 --- a/GUIs.ZooFlow/Globix/GlobixControls.vb +++ b/GUIs.ZooFlow/Globix/GlobixControls.vb @@ -101,7 +101,7 @@ Public Class GlobixControls AddHandler oControl.Properties.SelectedValuesChanged, AddressOf Lookup_SelectedValuesChanged - oConnectionString = My.Database.Get_ConnectionStringforID(conid) + oConnectionString = My.DatabaseECM.Get_ConnectionStringforID(conid) If oConnectionString IsNot Nothing And oSql.Length > 0 And SQLSuggestion = True Then _Logger.Debug("Connection String (redacted): [{0}]", oConnectionString.Substring(0, 30)) @@ -109,7 +109,7 @@ Public Class GlobixControls If Patterns.HasComplexPatterns(oSql) Then _Logger.Debug("sql enthält Platzhalter und wird erst während der Laufzeit gefüllt!", False) Else - Dim oDatatable = My.Database.GetDatatableWithConnection(oSql, oConnectionString) + Dim oDatatable = My.DatabaseECM.GetDatatableWithConnection(oSql, oConnectionString) oControl.Properties.DataSource = oDatatable End If Else @@ -190,7 +190,7 @@ Public Class GlobixControls Try Dim indexname = cmb.Name.Replace("cmb", "") Dim sql = "SELECT GUID,NAME,SQL_RESULT FROM TBDD_INDEX_MAN where SUGGESTION = 1 AND SQL_RESULT like '%@" & indexname & "%' and DOK_ID = " & My.Application.Globix.CURRENT_DOCTYPE_ID & " ORDER BY SEQUENCE" - Dim DT As DataTable = My.Database.GetDatatable(sql) + Dim DT As DataTable = My.DatabaseECM.GetDatatable(sql) If Not IsNothing(DT) Then If DT.Rows.Count > 0 Then Dim cmbname = "cmb" & DT.Rows(0).Item("NAME") @@ -217,7 +217,7 @@ Public Class GlobixControls Dim NewDataset As New DataSet Dim i As Integer - Dim DT_INDEX As DataTable = My.Database.GetDatatable("select * FROM TBDD_INDEX_MAN WHERE GUID = " & INDEX_GUID) + Dim DT_INDEX As DataTable = My.DatabaseECM.GetDatatable("select * FROM TBDD_INDEX_MAN WHERE GUID = " & INDEX_GUID) If IsNothing(DT_INDEX) Then Exit Sub End If @@ -231,7 +231,7 @@ Public Class GlobixControls Dim cmb As ComboBox = ctrl Dim sql As String = sql_result.ToString.ToUpper.Replace("@" & SearchString.ToUpper, Resultvalue) - connectionString = My.Database.Get_ConnectionStringforID(conid) + connectionString = My.DatabaseECM.Get_ConnectionStringforID(conid) If connectionString Is Nothing = False Then 'SQL Befehl füllt die Auswahlliste @@ -402,7 +402,7 @@ Public Class GlobixControls Dim oMeta = DirectCast(Control.Tag, ControlMeta) Dim oIndexName As String = oMeta.IndexName Dim oSQL = $"SELECT * FROM TBDD_INDEX_MAN WHERE SQL_RESULT LIKE '%{oIndexName}%'" - Dim oDatatable As DataTable = My.Database.GetDatatable(oSQL) + Dim oDatatable As DataTable = My.DatabaseECM.GetDatatable(oSQL) If Not IsNothing(oDatatable) Then _Logger.Debug("Found [{0}] depending controls for [{1}]", oDatatable.Rows.Count, Control.Name) @@ -439,8 +439,8 @@ Public Class GlobixControls Exit Sub End If - Dim oConnectionString = My.Database.Get_ConnectionStringforID(SqlConnectionId) - Dim oDatatable As DataTable = My.Database.GetDatatableWithConnection(SqlCommand, oConnectionString) + Dim oConnectionString = My.DatabaseECM.Get_ConnectionStringforID(SqlConnectionId) + Dim oDatatable As DataTable = My.DatabaseECM.GetDatatableWithConnection(SqlCommand, oConnectionString) Dim oFoundControl As Control = Nothing For Each oControl As Control In Panel.Controls diff --git a/GUIs.ZooFlow/Globix/frmGlobixAdministration.vb b/GUIs.ZooFlow/Globix/frmGlobixAdministration.vb index 12a68967..941a3526 100644 --- a/GUIs.ZooFlow/Globix/frmGlobixAdministration.vb +++ b/GUIs.ZooFlow/Globix/frmGlobixAdministration.vb @@ -39,7 +39,7 @@ Public Class frmGlobixAdministration Private Sub frmGlobixAdministration_Load(sender As Object, e As EventArgs) Handles Me.Load Try - Me.TBDD_DOKUMENTARTTableAdapter.Connection.ConnectionString = My.Database.CurrentSQLConnectionString + Me.TBDD_DOKUMENTARTTableAdapter.Connection.ConnectionString = My.DatabaseECM.CurrentSQLConnectionString 'Me.TBDD_EINGANGSARTENTableAdapter.Connection.ConnectionString = MyConnectionString 'Me.TBDD_MODULESTableAdapter.Connection.ConnectionString = MyConnectionString 'Me.TBDD_DOKART_MODULETableAdapter.Connection.ConnectionString = MyConnectionString diff --git a/GUIs.ZooFlow/Globix/frmGlobixBasicConfig.vb b/GUIs.ZooFlow/Globix/frmGlobixBasicConfig.vb index bcac58f4..1272fbde 100644 --- a/GUIs.ZooFlow/Globix/frmGlobixBasicConfig.vb +++ b/GUIs.ZooFlow/Globix/frmGlobixBasicConfig.vb @@ -35,7 +35,7 @@ Public Class frmGlobixBasicConfig Sub CheckFolder(pMypath As String, FOLDER_TYPE As String) Try If pMypath = "" Then - My.Database.ExecuteNonQuery("DELETE FROM TBGI_FOLDERWATCH_USER WHERE USER_ID = " & My.Application.User.UserId & " AND FOLDER_TYPE = '" & FOLDER_TYPE & "'") + My.DatabaseECM.ExecuteNonQuery("DELETE FROM TBGI_FOLDERWATCH_USER WHERE USER_ID = " & My.Application.User.UserId & " AND FOLDER_TYPE = '" & FOLDER_TYPE & "'") If FOLDER_TYPE = "SCAN" Then My.Application.Globix.CURRENT_SCAN_FOLDERWATCH = "" My.UIConfig.Globix.FolderWatchScanStarted = False @@ -67,15 +67,15 @@ Public Class frmGlobixBasicConfig Exit Sub End Try - Dim folderwatch = My.Database.GetScalarValue("SELECT GUID FROM TBGI_FOLDERWATCH_USER WHERE USER_ID = " & My.Application.User.UserId & " AND FOLDER_TYPE = '" & FOLDER_TYPE & "'") + Dim folderwatch = My.DatabaseECM.GetScalarValue("SELECT GUID FROM TBGI_FOLDERWATCH_USER WHERE USER_ID = " & My.Application.User.UserId & " AND FOLDER_TYPE = '" & FOLDER_TYPE & "'") Dim oSql As String If folderwatch Is Nothing Then oSql = "INSERT INTO TBGI_FOLDERWATCH_USER (USER_ID, FOLDER_PATH, FOLDER_TYPE, ADDED_WHO) VALUES (" & My.Application.User.UserId & ",'" & pMypath & "','" & FOLDER_TYPE & "','" & My.Application.User.UserName & "')" Else oSql = "UPDATE TBGI_FOLDERWATCH_USER SET FOLDER_PATH = '" & pMypath & "', CHANGED_WHO = '" & My.Application.User.UserName & "' where GUID = " & folderwatch End If - If My.Database.ExecuteNonQuery(oSql) Then - folderwatch = My.Database.GetScalarValue("SELECT FOLDER_PATH FROM TBGI_FOLDERWATCH_USER WHERE USER_ID = " & My.Application.User.UserId & " AND FOLDER_TYPE = '" & FOLDER_TYPE & "'") + If My.DatabaseECM.ExecuteNonQuery(oSql) Then + folderwatch = My.DatabaseECM.GetScalarValue("SELECT FOLDER_PATH FROM TBGI_FOLDERWATCH_USER WHERE USER_ID = " & My.Application.User.UserId & " AND FOLDER_TYPE = '" & FOLDER_TYPE & "'") If FOLDER_TYPE = "SCAN" Then My.Application.Globix.CURRENT_SCAN_FOLDERWATCH = folderwatch @@ -102,12 +102,12 @@ Public Class frmGlobixBasicConfig clsFW = New ClassFolderwatcher() Try oReload = True - Dim oFolderwatch = My.Database.GetScalarValue("SELECT FOLDER_PATH FROM TBGI_FOLDERWATCH_USER WHERE FOLDER_TYPE = 'DEFAULT' AND USER_ID = " & My.Application.User.UserId) + Dim oFolderwatch = My.DatabaseECM.GetScalarValue("SELECT FOLDER_PATH FROM TBGI_FOLDERWATCH_USER WHERE FOLDER_TYPE = 'DEFAULT' AND USER_ID = " & My.Application.User.UserId) If Not oFolderwatch Is Nothing Then My.Application.Globix.CurrentFolderWatchPath = oFolderwatch End If Me.txtFolderWatch.Text = My.Application.Globix.CurrentFolderWatchPath - Dim oSCANFolderwatch = My.Database.GetScalarValue("SELECT FOLDER_PATH FROM TBGI_FOLDERWATCH_USER WHERE FOLDER_TYPE = 'SCAN' AND USER_ID = " & My.Application.User.UserId) + Dim oSCANFolderwatch = My.DatabaseECM.GetScalarValue("SELECT FOLDER_PATH FROM TBGI_FOLDERWATCH_USER WHERE FOLDER_TYPE = 'SCAN' AND USER_ID = " & My.Application.User.UserId) If Not oSCANFolderwatch Is Nothing Then My.Application.Globix.CURRENT_SCAN_FOLDERWATCH = oSCANFolderwatch End If diff --git a/GUIs.ZooFlow/Globix/frmGlobix_Index.vb b/GUIs.ZooFlow/Globix/frmGlobix_Index.vb index 1b1128f7..4c30333f 100644 --- a/GUIs.ZooFlow/Globix/frmGlobix_Index.vb +++ b/GUIs.ZooFlow/Globix/frmGlobix_Index.vb @@ -86,7 +86,7 @@ Public Class frmGlobix_Index Try My.Application.Globix.CURRENT_ISATTACHMENT = False - DropType = My.Database.GetScalarValue("SELECT HANDLE_TYPE FROM TBGI_FILES_USER WHERE GUID = " & My.Application.Globix.CURRENT_WORKFILE_GUID).ToString + DropType = My.DatabaseECM.GetScalarValue("SELECT HANDLE_TYPE FROM TBGI_FILES_USER WHERE GUID = " & My.Application.Globix.CURRENT_WORKFILE_GUID).ToString My.Application.Globix.CURR_DELETE_ORIGIN = My.UIConfig.Globix.DeleteOriginalFile SourceDeleteItem.Enabled = True @@ -175,7 +175,7 @@ Public Class frmGlobix_Index My.Application.Globix.DTTBGI_REGEX_DOCTYPE = _DataASorDB.GetDatatable("DD_ECM", oSQL, "DTTBGI_REGEX_DOCTYPE", "", "") oSQL = "SELECT * FROM TBDD_INDEX_MAN_POSTPROCESSING" My.Application.Globix.CURR_INDEX_MAN_POSTPROCESSING = _DataASorDB.GetDatatable("DD_ECM", oSQL, "TBDD_INDEX_MAN_POSTPROCESSING", "", "") - MULTIFILES = My.Database.GetScalarValue("SELECT COUNT(*) FROM TBGI_FILES_USER WHERE WORKED = 0 AND GUID <> " & My.Application.Globix.CURRENT_WORKFILE_GUID & " AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')") + MULTIFILES = My.DatabaseECM.GetScalarValue("SELECT COUNT(*) FROM TBGI_FILES_USER WHERE WORKED = 0 AND GUID <> " & My.Application.Globix.CURRENT_WORKFILE_GUID & " AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')") My.Application.Globix.MULTIINDEXING_ACTIVE = False If MULTIFILES > 0 Then If My.Application.User.Language = "de-DE" Then @@ -228,7 +228,7 @@ Public Class frmGlobix_Index End Sub Private Sub SkipItem_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles SkipItem.ItemClick - My.Database.ExecuteNonQuery($"DELETE FROM TBGI_FILES_USER WHERE GUID = {My.Application.Globix.CURRENT_WORKFILE_GUID}") + My.DatabaseECM.ExecuteNonQuery($"DELETE FROM TBGI_FILES_USER WHERE GUID = {My.Application.Globix.CURRENT_WORKFILE_GUID}") CancelAttempts = 2 Close() End Sub @@ -497,7 +497,7 @@ Public Class frmGlobix_Index Dim oMeta = DirectCast(pControl.Tag, ControlMeta) Dim oIndexName As String = oMeta.IndexName Dim oSQL = $"SELECT * FROM TBDD_INDEX_MAN WHERE SQL_RESULT LIKE '%{oIndexName}%' AND DOK_ID = {My.Application.Globix.CURRENT_DOCTYPE_ID}" - Dim oDatatable As DataTable = My.Database.GetDatatable(oSQL) + Dim oDatatable As DataTable = My.DatabaseECM.GetDatatable(oSQL) If Not IsNothing(oDatatable) Then _Logger.Debug("Found [{0}] depending controls for [{1}]", oDatatable.Rows.Count, pControl.Name) @@ -533,7 +533,7 @@ Public Class frmGlobix_Index Dim oConnectionString = GetConnectionString(SqlConnectionId) - Dim oDatatable As DataTable = My.Database.GetDatatableWithConnection(pSqlCommand, oConnectionString) + Dim oDatatable As DataTable = My.DatabaseECM.GetDatatableWithConnection(pSqlCommand, oConnectionString) Dim oFoundControl As Control = Nothing For Each oControl As Control In pnlIndex.Controls @@ -596,7 +596,7 @@ Public Class frmGlobix_Index pSQLCommand = _Patterns.ReplaceInternalValues(pSQLCommand) pSQLCommand = _Patterns.ReplaceUserValues(pSQLCommand, My.Application.Globix.CURRENT_DOCTYPE_ID) - Dim oDatatable = My.Database.GetDatatableWithConnection(pSQLCommand, oConnectionString) + Dim oDatatable = My.DatabaseECM.GetDatatableWithConnection(pSQLCommand, oConnectionString) Return oDatatable End If Else @@ -703,7 +703,7 @@ Public Class frmGlobix_Index Try My.Application.Globix.ABORT_INDEXING = True Dim sql As String = $"SELECT * FROM TBGI_FILES_USER WHERE WORKED = 0 AND UPPER(USER@WORK) = UPPER('{My.Application.User.UserName}')" - Dim DT As DataTable = My.Database.GetDatatable(sql) + Dim DT As DataTable = My.DatabaseECM.GetDatatable(sql) Dim anz = DT.Rows.Count For Each Filerow As DataRow In DT.Rows @@ -722,7 +722,7 @@ Public Class frmGlobix_Index End If Next 'Zuerst die Daten des Ablaufs löschen - If My.Database.ExecuteNonQuery($"DELETE FROM TBGI_FILES_USER WHERE UPPER(USER@WORK) = UPPER('{My.Application.User.UserName}')") = True Then + If My.DatabaseECM.ExecuteNonQuery($"DELETE FROM TBGI_FILES_USER WHERE UPPER(USER@WORK) = UPPER('{My.Application.User.UserName}')") = True Then If containsfw_file = True Then If My.Application.User.Language = "de-DE" Then MsgBox("Der Indexierungsprozess beinhaltete (auch) Dateien per Folderwatch!" & vbNewLine & "Diese Dateien wurden nicht gelöscht und verbleiben im Folderwatch-Verzeichnis!" & vbNewLine & "Bitte verschieben Sie die Dateien ggfls.", MsgBoxStyle.Information, "Achtung - Hinweis:") @@ -789,7 +789,7 @@ Public Class frmGlobix_Index 'Die erste Datei indexieren If WORK_FILE() = True Then 'Und nun die folgenden - Dim DTFiles2Work As DataTable = My.Database.GetDatatable("SELECT * FROM TBGI_FILES_USER WHERE WORKED = 0 AND GUID <> " & My.Application.Globix.CURRENT_WORKFILE_GUID & " AND UPPER(USER@WORK) = UPPER('" & My.Application.User.UserName & "')") + Dim DTFiles2Work As DataTable = My.DatabaseECM.GetDatatable("SELECT * FROM TBGI_FILES_USER WHERE WORKED = 0 AND GUID <> " & My.Application.Globix.CURRENT_WORKFILE_GUID & " AND UPPER(USER@WORK) = UPPER('" & My.Application.User.UserName & "')") If Not DTFiles2Work Is Nothing Then Dim err = False For Each filerow As DataRow In DTFiles2Work.Rows @@ -876,7 +876,7 @@ Public Class frmGlobix_Index My.Application.Globix.CURRENT_LASTDOCTYPE = oDokart.Name _Logger.Info("Datei '" & My.Application.Globix.CURRENT_NEWFILENAME & "' erfolgreich erzeugt.") Dim oDEL As String = "DELETE FROM TBGI_FILES_USER WHERE GUID = " & My.Application.Globix.CURRENT_WORKFILE_GUID - My.Database.ExecuteNonQuery(oDEL) + My.DatabaseECM.ExecuteNonQuery(oDEL) If My.Application.Globix.CURR_DELETE_ORIGIN = True Then _Logger.Info("Datei [" & My.Application.Globix.CURRENT_WORKFILE & "] wird gelöscht.") @@ -1151,20 +1151,20 @@ Public Class frmGlobix_Index Dim tempCur_WF = My.Application.Globix.CURRENT_WORKFILE.Replace("'", "''") Dim tempCur_New_FN = My.Application.Globix.CURRENT_NEWFILENAME.Replace("'", "''") Insert_String = sql_history_INSERT_INTO & ",ADDED_WHO) VALUES ('" & tempCur_WF & "','" & tempCur_New_FN & "'" & sql_history_Index_Values & ",'" & Environment.UserDomainName & "\" & Environment.UserName & "')" - My.Database.ExecuteNonQuery(Insert_String) + My.DatabaseECM.ExecuteNonQuery(Insert_String) If DropType.Contains("MSG") Or DropType = "|ATTMNTEXTRACTED|" Or DropType = "|OUTLOOK_ATTACHMENT|" Then If My.Application.Globix.CURRENT_MESSAGEID <> "" Then Dim max As String = "SELECT MAX(GUID) FROM TBGI_HISTORY" - Dim GUID = My.Database.GetScalarValue(max) + Dim GUID = My.DatabaseECM.GetScalarValue(max) Try If GUID > 0 Then Dim sqlUpdate As String If DropType = "|ATTMNTEXTRACTED|" Or DropType = "|OUTLOOK_ATTACHMENT|" Then sqlUpdate = "Update TBGI_HISTORY SET ATTACHMENT = 1, MSG_ID = '" & My.Application.Globix.CURRENT_MESSAGEID & "' WHERE GUID = " & GUID - My.Database.ExecuteNonQuery(sqlUpdate) + My.DatabaseECM.ExecuteNonQuery(sqlUpdate) Else sqlUpdate = "Update TBGI_HISTORY SET ATTACHMENT = 0, MSG_ID = '" & My.Application.Globix.CURRENT_MESSAGEID & "' WHERE GUID = " & GUID - My.Database.ExecuteNonQuery(sqlUpdate) + My.DatabaseECM.ExecuteNonQuery(sqlUpdate) End If End If Catch ex As Exception @@ -1251,19 +1251,19 @@ Public Class frmGlobix_Index Dim tempCur_WF = My.Application.Globix.CURRENT_WORKFILE.Replace("'", "''") Dim tempCur_New_FN = My.Application.Globix.CURRENT_NEWFILENAME.Replace("'", "''") Insert_String = sql_history_INSERT_INTO & ",ADDED_WHO,ADDED_WHERE) VALUES ('" & tempCur_WF & "','" & tempCur_New_FN & "'" & sql_history_Index_Values & ",'" & Environment.UserDomainName & "\" & Environment.UserName & "','" & Environment.MachineName & "')" - If My.Database.ExecuteNonQuery(Insert_String) = True Then + If My.DatabaseECM.ExecuteNonQuery(Insert_String) = True Then If My.Application.Globix.CURRENT_MESSAGEID <> "" Then Dim oMax As String = "SELECT MAX(GUID) FROM TBGI_HISTORY" - Dim oGUID = My.Database.GetScalarValue(oMax) + Dim oGUID = My.DatabaseECM.GetScalarValue(oMax) Try If oGUID > 0 Then Dim oSql As String If My.Application.Globix.CURRENT_ISATTACHMENT = True Then oSql = "Update TBGI_HISTORY SET ATTACHMENT = 1, MSG_ID = '" & My.Application.Globix.CURRENT_MESSAGEID & "' WHERE GUID = " & oGUID - My.Database.GetScalarValue(oSql) + My.DatabaseECM.GetScalarValue(oSql) Else oSql = "Update TBGI_HISTORY SET ATTACHMENT = 0, MSG_ID = '" & My.Application.Globix.CURRENT_MESSAGEID & "' WHERE GUID = " & oGUID - My.Database.GetScalarValue(oSql) + My.DatabaseECM.GetScalarValue(oSql) End If End If Catch ex As Exception @@ -1773,7 +1773,7 @@ Public Class frmGlobix_Index Private Function SetAttachmentIndices() Dim indexierung_erfolgreich As Boolean = True Try - Dim DT As DataTable = My.Database.GetDatatable("SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = 'DEFAULT'") + Dim DT As DataTable = My.DatabaseECM.GetDatatable("SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = 'DEFAULT'") If DT.Rows.Count = 1 Then If Not My.Application.Globix.CURRENT_MESSAGEID Is Nothing Then @@ -1825,7 +1825,7 @@ Public Class frmGlobix_Index If oRow.Item("SQL_CHECK").ToString <> String.Empty Then Dim connectionString As String Dim sql As String - connectionString = My.Database.Get_ConnectionStringforID(oRow.Item("CONNECTION_ID")) + connectionString = My.DatabaseECM.Get_ConnectionStringforID(oRow.Item("CONNECTION_ID")) If connectionString <> "" Then Dim sqlscalar = oRow.Item("SQL_CHECK") Select Case oRow.Item("DATENTYP") @@ -1841,7 +1841,7 @@ Public Class frmGlobix_Index ' ergebnis = ClassDatabase.OracleExecute_Scalar(sql, connectionString) 'Else 'MSQL - ergebnis = My.Database.GetScalarValueWithConnection(sql, connectionString) + ergebnis = My.DatabaseECM.GetScalarValueWithConnection(sql, connectionString) ' End If Select Case ergebnis @@ -2008,7 +2008,7 @@ Public Class frmGlobix_Index Function GetAutomaticIndexSQLValue(SQLCommand As String, vconnectionID As Integer, vProvider As String) As String Try Dim oConnectionString As String - oConnectionString = My.Database.Get_ConnectionStringforID(vconnectionID) + oConnectionString = My.DatabaseECM.Get_ConnectionStringforID(vconnectionID) If oConnectionString <> "" Then 'NEU Dim oErgebnis @@ -2016,7 +2016,7 @@ Public Class frmGlobix_Index 'If vProvider.ToLower = "oracle" Then 'oErgebnis = My.Database.leExecute_Scalar(SQLCommand, oConnectionString) 'Else 'im Moment nur SQL-Server - oErgebnis = My.Database.GetScalarValueWithConnection(SQLCommand, oConnectionString) + oErgebnis = My.DatabaseECM.GetScalarValueWithConnection(SQLCommand, oConnectionString) 'End If _Logger.Debug("SQL-ConnectionString: " & oConnectionString.Substring(0, oConnectionString.LastIndexOf("="))) If oErgebnis Is Nothing Then @@ -2121,7 +2121,7 @@ Public Class frmGlobix_Index End If Next - Dim DT As DataTable = My.Database.GetDatatable("SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = 'DEFAULT'") + Dim DT As DataTable = My.DatabaseECM.GetDatatable("SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX WHERE OBJECTTYPE = 'DEFAULT'") If IsNothing(DT) Then _Logger.Info("SELECT * FROM TBGI_OBJECTTYPE_EMAIL_INDEX RESULTED in NOTHING") Return False diff --git a/GUIs.ZooFlow/Globix/frmGlobix_IndexFileList.vb b/GUIs.ZooFlow/Globix/frmGlobix_IndexFileList.vb index 4f1e000a..96c37e51 100644 --- a/GUIs.ZooFlow/Globix/frmGlobix_IndexFileList.vb +++ b/GUIs.ZooFlow/Globix/frmGlobix_IndexFileList.vb @@ -2,7 +2,7 @@ Private Sub frmGlobixIndexFileList_Load(sender As Object, e As EventArgs) Handles Me.Load Try Dim oSQL = $"Select * From TBGI_FILES_USER Where WORKED = 0 And (UPPER([USER@WORK]) = UPPER('{My.Application.User.UserName}'))" - Dim oDT As DataTable = My.Database.GetDatatable(oSQL) + Dim oDT As DataTable = My.DatabaseECM.GetDatatable(oSQL) If oDT.Rows.Count > 0 Then CheckedListBox1.DataSource = oDT CheckedListBox1.DisplayMember = oDT.Columns("FILENAME_ONLY").ColumnName diff --git a/GUIs.ZooFlow/MyApplication.vb b/GUIs.ZooFlow/MyApplication.vb index 4268eef3..ca6c1bfb 100644 --- a/GUIs.ZooFlow/MyApplication.vb +++ b/GUIs.ZooFlow/MyApplication.vb @@ -2,7 +2,7 @@ Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Database Imports DigitalData.Modules.ZooFlow - +Imports DigitalData.Modules.EDMI.API Namespace My ''' @@ -28,10 +28,16 @@ Namespace My Property LogConfig As LogConfig Property MainForm As frmAdmin_Start Property SearchForm As frmSearchStart - Property Database As MSSQLServer + +#Region "Database" + Property Database As DatabaseWithFallback + Property DatabaseECM As MSSQLServer Property DatabaseIDB As MSSQLServer + Property Tables As New ClassTables Property Queries As New ClassQueries +#End Region + Property Filestore_Work As String Property Filestore_Archive As String End Module @@ -56,7 +62,7 @@ Namespace My Public Function GetEnvironment() As Environment Return New Environment With { - .Database = My.Database, + .Database = My.DatabaseECM, .DatabaseIDB = My.DatabaseIDB, .Modules = My.Application.Modules, .Service = My.Application.Service, diff --git a/GUIs.ZooFlow/Search/frmFlowSearch.vb b/GUIs.ZooFlow/Search/frmFlowSearch.vb index 27fccc65..d43ef1d2 100644 --- a/GUIs.ZooFlow/Search/frmFlowSearch.vb +++ b/GUIs.ZooFlow/Search/frmFlowSearch.vb @@ -1,10 +1,12 @@ -Imports DigitalData.Modules.Logging -Imports DevExpress.XtraEditors -Imports DigitalData.GUIs.Common +Imports DevExpress.XtraEditors Imports DevExpress.XtraSplashScreen Imports DevExpress.XtraBars -Imports DigitalData.GUIs.ZooFlow.ClassConstants Imports DevExpress.Utils +Imports DigitalData.GUIs.Common +Imports DigitalData.GUIs.ZooFlow.ClassConstants +Imports DigitalData.Modules.EDMI.API +Imports DigitalData.Modules.EDMI.API.Constants +Imports DigitalData.Modules.Logging Public Class frmFlowSearch Private Logger As Logger @@ -12,26 +14,26 @@ Public Class frmFlowSearch Private FontLargeNormal As New Font("Segoe UI", 10) Private SecondaryFontBold As New Font("Segoe UI", 8, FontStyle.Bold) Private SecondaryFont As New Font("Segoe UI", 8) - Dim oLastAttribute As String = "" - Dim oAttributeCount As Integer = 1 - Dim BASE_SEARCHCommand As String + Private oLastAttribute As String = "" + Private oAttributeCount As Integer = 1 + Private BaseSearchCommand As String Private LastSearchForm As frmDocumentResultList - Private ASorDB As ClassDataASorDB + Private Database As DatabaseWithFallback Private EventtoggleChange As Boolean = False - - Private SEARCH_FACT_DATE As String = "MONTH(OBJ.ADDED_WHEN) <> 13" - Private SEARCH_FACT_DATE_ATTRIBUTE = "ADDED_WHEN" Private Language_Term_Object As String Private LIMITATION_DATE As Boolean = False Private TOGGLE_Change As Boolean = False Private CATEGORIES_SELECTED As String = "" + Private SEARCH_FACT_DATE As String = "MONTH(OBJ.ADDED_WHEN) <> 13" + Private SEARCH_FACT_DATE_ATTRIBUTE = "ADDED_WHEN" + Public Sub New(pBaseSearchSql As String) ' Dieser Aufruf ist für den Designer erforderlich. InitializeComponent() - BASE_SEARCHCommand = pBaseSearchSql - ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. + + BaseSearchCommand = pBaseSearchSql Logger = My.LogConfig.GetLogger() - ASorDB = New ClassDataASorDB(My.LogConfig) + Database = New DatabaseWithFallback(My.LogConfig, My.Application.Service.Client, My.DatabaseECM, My.DatabaseIDB) If My.Application.User.Language = "de-DE" Then Language_Term_Object = "Objekte" Else @@ -43,7 +45,11 @@ Public Class frmFlowSearch RibbonControl1.Minimized = True TileControlMatch.Groups.Clear() Dim oSQL = "select DISTINCT TERM_VALUE AS CATEGORY ,ATTRIBUTE_ID from VWIDB_CATEGORIES_PER_OBJECT_AND_LANGUAGE WHERE LANGUAGE_ID = @LANGUAGE_ID ORDER BY TERM_VALUE" - Dim oDTCategory As DataTable = ASorDB.GetDatatable("IDB", $"SELECT 'NONE' as CATEGORY", "VWIDB_CATEGORIES_PER_OBJECT_AND_LANGUAGE", "", "CATEGORY") + + + 'Dim oDTCategory As DataTable = ASorDB.GetDatatable("IDB", $"SELECT 'NONE' as CATEGORY", "VWIDB_CATEGORIES_PER_OBJECT_AND_LANGUAGE", "", "CATEGORY") + Dim oDTCategory As DataTable = Database.GetDatatable("VWIDB_CATEGORIES_PER_OBJECT_AND_LANGUAGE", "SELECT 'NONE' as CATEGORY", DatabaseType.IDB, "", "CATEGORY") + If Not IsNothing(oDTCategory) Then CheckedListBoxCategories.DataSource = oDTCategory CheckedListBoxCategories.DisplayMember = "CATEGORY" @@ -53,7 +59,9 @@ Public Class frmFlowSearch Else cmbAttributeDate.Items.Add(IDB_ADDED_WHEN_String_Englisch) End If - Dim oDT As DataTable = ASorDB.GetDatatable("IDB", $"SELECT * FROM VWIDB_BE_ATTRIBUTE WHERE TYPE_ID = 5 AND LANG_ID = {My.Application.User.LanguageID}", "VWIDB_BE_ATTRIBUTE", $"TYPE_ID = 5 AND LANG_ID = {My.Application.User.LanguageID}") + 'Dim oDT As DataTable = ASorDB.GetDatatable("IDB", $"SELECT * FROM VWIDB_BE_ATTRIBUTE WHERE TYPE_ID = 5 AND LANG_ID = {My.Application.User.LanguageID}", "VWIDB_BE_ATTRIBUTE", $"TYPE_ID = 5 AND LANG_ID = {My.Application.User.LanguageID}") + Dim oDT As DataTable = Database.GetDatatable("VWIDB_BE_ATTRIBUTE", $"SELECT * FROM VWIDB_BE_ATTRIBUTE WHERE TYPE_ID = 5 AND LANG_ID = {My.Application.User.LanguageID}", DatabaseType.IDB, $"TYPE_ID = 5 AND LANG_ID = {My.Application.User.LanguageID}") + For Each oRow As DataRow In oDT.Rows cmbAttributeDate.Items.Add(oRow.Item("ATTR_TITLE")) Next @@ -90,7 +98,7 @@ Public Class frmFlowSearch Dim oSearchValue = Trim(txtSearchTerm.Text) oLastAttribute = "" - Dim oSQL = BASE_SEARCHCommand.Replace("@SEARCH_STRING", oSearchValue) + Dim oSQL = BaseSearchCommand.Replace("@SEARCH_STRING", oSearchValue) If SEARCH_FACT_DATE_ATTRIBUTE = "ADDED_WHEN" Then @@ -213,7 +221,7 @@ Public Class frmFlowSearch Dim oEnvironment As New Modules.ZooFlow.Environment() With { .User = My.Application.User, .Modules = My.Application.Modules, - .Database = My.Database, + .Database = My.DatabaseECM, .DatabaseIDB = My.DatabaseIDB, .Settings = My.Application.Settings, .Service = My.Application.Service @@ -365,7 +373,10 @@ Public Class frmFlowSearch Dim oSplit = oItem.Tag.ToString.Split("|") Try oHandle = SplashScreenManager.ShowOverlayForm(Me) - Dim oDT As DataTable = ASorDB.GetDatatable("IDB", $"SELECT * FROM VWIDB_BE_ATTRIBUTE WHERE ATTR_ID = {oSplit(1)} AND LANG_ID = {My.Application.User.LanguageID}", "VWIDB_BE_ATTRIBUTE", $"ATTR_ID = {oSplit(1)} AND LANG_ID = {My.Application.User.LanguageID}") + + 'Dim oDT As DataTable = ASorDB.GetDatatable("IDB", $"SELECT * FROM VWIDB_BE_ATTRIBUTE WHERE ATTR_ID = {oSplit(1)} AND LANG_ID = {My.Application.User.LanguageID}", "VWIDB_BE_ATTRIBUTE", $"ATTR_ID = {oSplit(1)} AND LANG_ID = {My.Application.User.LanguageID}") + Dim oDT As DataTable = Database.GetDatatable("VWIDB_BE_ATTRIBUTE", $"SELECT * FROM VWIDB_BE_ATTRIBUTE WHERE ATTR_ID = {oSplit(1)} AND LANG_ID = {My.Application.User.LanguageID}", DatabaseType.IDB, $"ATTR_ID = {oSplit(1)} AND LANG_ID = {My.Application.User.LanguageID}") + Dim oType = oDT.Rows(0).Item("TYPE_NAME") Dim oEXECSQL = $"EXEC PRFLOW_SEARCH_GET_RESULT_PER_TILE {oSplit(0)},{My.Application.User.UserId},'{oType}',{oSplit(1)},'{My.Application.User.Language}'" Dim oDTOBJECT_RESULT As DataTable = My.DatabaseIDB.GetDatatable(oEXECSQL) diff --git a/GUIs.ZooFlow/Search/frmSearchStart.vb b/GUIs.ZooFlow/Search/frmSearchStart.vb index c16ed6fe..82bfbdbd 100644 --- a/GUIs.ZooFlow/Search/frmSearchStart.vb +++ b/GUIs.ZooFlow/Search/frmSearchStart.vb @@ -942,7 +942,7 @@ Public Class frmSearchStart Dim oEnvironment As New Modules.ZooFlow.Environment() With { .User = My.Application.User, .Modules = My.Application.Modules, - .Database = My.Database, + .Database = My.DatabaseECM, .DatabaseIDB = My.DatabaseIDB, .Settings = My.Application.Settings, .Service = My.Application.Service diff --git a/GUIs.ZooFlow/frmFlowForm.vb b/GUIs.ZooFlow/frmFlowForm.vb index 92469531..1c780955 100644 --- a/GUIs.ZooFlow/frmFlowForm.vb +++ b/GUIs.ZooFlow/frmFlowForm.vb @@ -49,7 +49,7 @@ Public Class frmFlowForm Private IndexForm As frmGlobix_Index Private AdminForm As frmAdmin_Start Private Const mSnapOffset As Integer = 35 - Private Const WM_WINDOWPOSCHANGING As Integer = &H46 + ' Events Public Event ClipboardChanged As EventHandler(Of IDataObject) @@ -77,6 +77,8 @@ Public Class frmFlowForm ' === Initialize AppServer Database Connection with Failover AppServerOrDB = New ClassDataASorDB(My.LogConfig) + + ' === Initialization === Init = New ClassInit(My.LogConfig, Me) AddHandler Init.Completed, AddressOf Init_Completed @@ -327,7 +329,7 @@ Public Class frmFlowForm Try Dim oSql As String = "SELECT FOLDER_PATH FROM TBGI_FOLDERWATCH_USER WHERE FOLDER_TYPE = 'SCAN' AND USER_ID = " & My.Application.User.UserId - Dim oFolderwatchScanPath = My.Database.GetScalarValue(oSql) + Dim oFolderwatchScanPath = My.DatabaseECM.GetScalarValue(oSql) oFolderwatchScanPath = IIf(IsDBNull(oFolderwatchScanPath), "", oFolderwatchScanPath) @@ -565,7 +567,7 @@ Public Class frmFlowForm End If 'Erstmal alles löschen - My.Database.ExecuteNonQuery("DELETE FROM TBGI_FILES_USER WHERE UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')") + My.DatabaseECM.ExecuteNonQuery("DELETE FROM TBGI_FILES_USER WHERE UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')") If FileDrop.Drop_File(e) = True Then TimerCheckDroppedFiles.Start() @@ -590,7 +592,7 @@ Public Class frmFlowForm End Sub Sub Globix_Check_Dropped_Files() Try - My.Database.ExecuteNonQuery("DELETE FROM TBGI_FILES_USER WHERE WORKED = 1 AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')") + My.DatabaseECM.ExecuteNonQuery("DELETE FROM TBGI_FILES_USER WHERE WORKED = 1 AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')") Dim i As Integer For Each Str As Object In FileDrop.files_dropped @@ -610,7 +612,7 @@ Public Class frmFlowForm Dim sql As String = "SELECT * FROM TBGI_FILES_USER WHERE WORKED = 0 AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')" My.Application.Globix.DTACTUAL_FILES = Nothing - My.Application.Globix.DTACTUAL_FILES = My.Database.GetDatatable(sql) + My.Application.Globix.DTACTUAL_FILES = My.DatabaseECM.GetDatatable(sql) My.Application.Globix.ABORT_INDEXING = False Dim oOnlyFilesFromFilesystem = True @@ -624,7 +626,7 @@ Public Class frmFlowForm If My.Application.Globix.DTACTUAL_FILES.Rows.Count > 1 And oOnlyFilesFromFilesystem = False Then frmGlobix_IndexFileList.ShowDialog() My.Application.Globix.DTACTUAL_FILES = Nothing - My.Application.Globix.DTACTUAL_FILES = My.Database.GetDatatable(sql) + My.Application.Globix.DTACTUAL_FILES = My.DatabaseECM.GetDatatable(sql) End If For Each oFileRow As DataRow In My.Application.Globix.DTACTUAL_FILES.Rows @@ -797,7 +799,7 @@ Public Class frmFlowForm If My.Application.Globix.Folderwatchstarted = True Or My.UIConfig.Globix.FolderWatchScanStarted = True Then 'Prüfen ob alle Files abgearbeitet wurden Dim sql = "SELECT * FROM TBGI_FILES_USER WHERE WORKED = 0 AND HANDLE_TYPE like '%|FW%' AND UPPER(USER@WORK) = UPPER('" & Environment.UserName & "')" - My.Application.Globix.DTACTUAL_FILES = My.Database.GetDatatable(sql) + My.Application.Globix.DTACTUAL_FILES = My.DatabaseECM.GetDatatable(sql) If My.Application.Globix.DTACTUAL_FILES.Rows.Count > 0 Then My.Application.Globix.ABORT_INDEXING = False @@ -821,7 +823,7 @@ Public Class frmFlowForm Else Logger.Info(" File not existing - Row will be deleted!") Dim oDel = String.Format("DELETE FROM TBGI_FILES_USER WHERE GUID = {0}", FILEGUID) - My.Database.ExecuteNonQuery(oDel) + My.DatabaseECM.ExecuteNonQuery(oDel) End If Else Logger.Info(" file '" & row.Item(1).ToString & "' could not be opened exclusively - fileInUse!") diff --git a/Modules.EDMIAPI/Client.vb b/Modules.EDMIAPI/Client.vb index 3498a658..bc965558 100644 --- a/Modules.EDMIAPI/Client.vb +++ b/Modules.EDMIAPI/Client.vb @@ -8,6 +8,8 @@ Public Class Client Private Const INVALID_OBEJCT_ID As Long = 0 Private Const KIND_TYPE_DOC = "DOC" + Public Const DEFAULT_SERVICE_PORT = 9000 + Private ReadOnly _logger As Logger Private ReadOnly _channelFactory As ChannelFactory(Of IEDMIServiceChannel) Private ReadOnly _IPAddressServer As String @@ -27,6 +29,22 @@ Public Class Client Public AccessRight As AccessRight End Class + Public Shared Function ParseServiceAddress(AddressWithOptionalPort As String) As Tuple(Of String, Integer) + Dim oSplit() As String = AddressWithOptionalPort.Split(":"c) + Dim oAppServerAddress As String = oSplit(0) + Dim oAppServerPort As Integer + + If oSplit.Length = 2 Then + If Integer.TryParse(oSplit(1), oAppServerPort) Then + oAppServerPort = DEFAULT_SERVICE_PORT + End If + Else + oAppServerPort = DEFAULT_SERVICE_PORT + End If + + Return New Tuple(Of String, Integer)(oAppServerAddress, oAppServerPort) + End Function + ''' ''' Creates a new EDMI Client object ''' diff --git a/Modules.EDMIAPI/Constants.vb b/Modules.EDMIAPI/Constants.vb new file mode 100644 index 00000000..70a6e7e7 --- /dev/null +++ b/Modules.EDMIAPI/Constants.vb @@ -0,0 +1,6 @@ +Public Class Constants + Public Enum DatabaseType + ECM + IDB + End Enum +End Class diff --git a/Modules.EDMIAPI/DataWithFallback.vb b/Modules.EDMIAPI/DatabaseWithFallback.vb similarity index 85% rename from Modules.EDMIAPI/DataWithFallback.vb rename to Modules.EDMIAPI/DatabaseWithFallback.vb index eaa2f564..e630308a 100644 --- a/Modules.EDMIAPI/DataWithFallback.vb +++ b/Modules.EDMIAPI/DatabaseWithFallback.vb @@ -1,20 +1,15 @@ Imports DigitalData.Modules.Database Imports DigitalData.Modules.EDMI.API +Imports DigitalData.Modules.EDMI.API.Constants Imports DigitalData.Modules.EDMI.API.EDMIServiceReference Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Language.Utils -Public Class DataWithFallback - Private _Logger As Logger - Private _Client As Client - Private _DatabaseEDM As MSSQLServer - Private _DatabaseIDB As MSSQLServer - Private _Type As DatabaseType - - Public Enum DatabaseType - ECM - IDB - End Enum +Public Class DatabaseWithFallback + Private ReadOnly _Logger As Logger + Private ReadOnly _Client As Client + Private ReadOnly _DatabaseEDM As MSSQLServer + Private ReadOnly _DatabaseIDB As MSSQLServer Public Sub New(LogConfig As LogConfig, Client As Client, DatabaseECM As MSSQLServer, DatabaseIDB As MSSQLServer) _Logger = LogConfig.GetLogger() @@ -23,7 +18,7 @@ Public Class DataWithFallback _DatabaseIDB = DatabaseIDB End Sub - Public Function GetDatatable(DataTable As String, FilterExpression As String, SortByColumn As String, FallbackSQL As String, FallbackType As DatabaseType, Optional ForceFallback As Boolean = False) As DataTable + Public Function GetDatatable(DataTable As String, FallbackSQL As String, FallbackType As Constants.DatabaseType, Optional FilterExpression As String = "", Optional SortByColumn As String = "", Optional ForceFallback As Boolean = False) As DataTable Try Dim oResult As DataTable = Nothing diff --git a/Modules.EDMIAPI/DataWithFallback/UserData.vb b/Modules.EDMIAPI/DatabaseWithFallback/UserData.vb similarity index 100% rename from Modules.EDMIAPI/DataWithFallback/UserData.vb rename to Modules.EDMIAPI/DatabaseWithFallback/UserData.vb diff --git a/Modules.EDMIAPI/EDMI.API.vbproj b/Modules.EDMIAPI/EDMI.API.vbproj index 95b88971..6c5717a4 100644 --- a/Modules.EDMIAPI/EDMI.API.vbproj +++ b/Modules.EDMIAPI/EDMI.API.vbproj @@ -80,7 +80,8 @@ Reference.svcmap - + + True @@ -96,7 +97,7 @@ Settings.settings True - +