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

View File

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