MS nach Nullverweis frmMAtch

This commit is contained in:
SchreiberM 2020-12-28 11:16:04 +01:00
parent ca03492326
commit 93cc0acfbd
2 changed files with 33 additions and 25 deletions

View File

@ -29,7 +29,7 @@ Public Class ProfileSearches
Try
If _Environment.Service.IsActive = True Then
Try
Dim oSplit() As String = _Environment.Service.Address.Split(":")
Dim oSplit() As String = _Environment.Service.Address.Split(";")
Dim oAppServerAddress As String = oSplit(0)
Dim oAppServerPort As Integer = 9000
If oSplit.Length = 2 Then
@ -38,7 +38,7 @@ Public Class ProfileSearches
_Client = New Client(LogConfig, oAppServerAddress, oAppServerPort)
If Not IsNothing(_Client) Then
If _Client.Connect() Then
_Logger.Debug("ProfileSearches: Appserver connected successfully!")
End If
End If
Catch ex As Exception
@ -59,38 +59,41 @@ Public Class ProfileSearches
Private Function DoLoadDocumentSearches(ProfileId As Integer) As List(Of Search)
Dim oSQL As String = $"SELECT * FROM TBCW_PROF_DOC_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID = {ProfileId} ORDER BY TAB_INDEX"
Dim oSearchesDataTable As DataTable
Dim o = _Environment.Service.Address
If _Environment.Service.IsActive = True Then
Dim oTableResult As TableResult = _Client.GetDatatableByName("TBCW_PROF_DOC_SEARCH", $"PROFILE_ID = {ProfileId}", "TAB_INDEX")
oSearchesDataTable = oTableResult.Table
If oSearchesDataTable Is Nothing Then
_Logger.Warn("TBCW_PROF_DOC_SEARCH from ApPServer is nothing: Failover started...")
oSearchesDataTable = _Environment.Database.GetDatatable(oSQL)
End If
Else
oSearchesDataTable = _Environment.Database.GetDatatable(oSQL)
End If
Dim oDocSearches As New List(Of Search)
Dim oCounter As Integer = 0
Dim oPatterns As New ClassPatterns(_LogConfig)
If Not IsNothing(oSearchesDataTable) Then
Dim oCounter As Integer = 0
Dim oPatterns As New ClassPatterns(_LogConfig)
For Each oRow As DataRow In oSearchesDataTable.Rows
Dim oProfileId As Integer = oRow.Item("PROFILE_ID")
Dim oTabTitle As String = oRow.Item("TAB_TITLE")
Dim oConnectionId As Integer = oRow.Item("CONN_ID")
Dim oGuid As Integer = oRow.Item("GUID")
For Each oRow As DataRow In oSearchesDataTable.Rows
Dim oProfileId As Integer = oRow.Item("PROFILE_ID")
Dim oTabTitle As String = oRow.Item("TAB_TITLE")
Dim oConnectionId As Integer = oRow.Item("CONN_ID")
Dim oGuid As Integer = oRow.Item("GUID")
oSQL = oRow.Item("SQL_COMMAND")
oSQL = oPatterns.ReplaceUserValues(oSQL, _Environment.User)
oSQL = oPatterns.ReplaceInternalValues(oSQL)
oSQL = oPatterns.ReplaceClipboardContents(oSQL, _Params.ClipboardContents)
oSQL = oRow.Item("SQL_COMMAND")
oSQL = oPatterns.ReplaceUserValues(oSQL, _Environment.User)
oSQL = oPatterns.ReplaceInternalValues(oSQL)
oSQL = oPatterns.ReplaceClipboardContents(oSQL, _Params.ClipboardContents)
Dim oConnectionString = ProfileUtils.GetConnectionString(_Environment.Database, oConnectionId)
Dim oDatatable As DataTable = _Environment.Database.GetDatatableWithConnection(oSQL, oConnectionString)
Dim oConnectionString = ProfileUtils.GetConnectionString(_Environment.Database, oConnectionId)
Dim oDatatable As DataTable = _Environment.Database.GetDatatableWithConnection(oSQL, oConnectionString)
If oDatatable Is Nothing Then
_Logger.Warn("Error in SQL-Query '{0}'", oSQL)
Continue For
End If
If oDatatable Is Nothing Then
_Logger.Warn("Error in SQL-Query '{0}'", oSQL)
Continue For
End If
oDocSearches.Add(New Search() With {
oDocSearches.Add(New Search() With {
.Guid = oGuid,
.DataTable = oDatatable,
.ProfileId = oProfileId,
@ -99,8 +102,13 @@ Public Class ProfileSearches
.SQLCommand = oSQL
})
oCounter += 1
Next
oCounter += 1
Next
Else
End If
Return oDocSearches
End Function

View File

@ -41,7 +41,7 @@ Public Class ClassConfig
Public Property ConnectionString As String = String.Empty
<GlobalSetting>
Public Property AppServerConfig As String = "172.24.12.39:9000"
Public Property AppServerConfig As String = String.Empty
' === Logging Configuration
Public Property LogDebug As Boolean = False