MS Amatch Anpassung und DB Log

This commit is contained in:
2019-10-31 10:18:22 +01:00
parent 811613cdea
commit 7c2cf206ab
3 changed files with 52 additions and 23 deletions

View File

@@ -334,48 +334,50 @@ Public Class ProfileFilter
Dim oProfiles As New List(Of ProfileData)
For Each oProfile In Profiles
_Logger.Debug($"Checking SearchResults on ProfileID: {oProfile.Guid}")
Dim oResultDocs As Integer = 0
Dim oResultData As Integer = 0
Dim oPatterns As New ClassPatterns(_LogConfig)
Dim oDataSearches As DataTable
Dim oDocSearches As DataTable
Dim oDTDataSearches As DataTable
Dim oDTDocSearches As DataTable
Try
oDataSearches = Database.GetDatatable($"SELECT COUNT_COMMAND FROM TBCW_PROF_DATA_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID = {oProfile.Guid}")
oDTDataSearches = Database.GetDatatable($"SELECT COUNT_COMMAND FROM TBCW_PROF_DATA_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID = {oProfile.Guid}")
Catch ex As Exception
_Logger.Error(ex)
Continue For
End Try
Try
oDocSearches = Database.GetDatatable($"SELECT COUNT_COMMAND FROM TBCW_PROF_DOC_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID = {oProfile.Guid}")
oDTDocSearches = Database.GetDatatable($"SELECT COUNT_COMMAND FROM TBCW_PROF_DOC_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID = {oProfile.Guid}")
Catch ex As Exception
_Logger.Error(ex)
Continue For
End Try
For Each oRow As DataRow In oDataSearches.Rows
For Each oRow As DataRow In oDTDataSearches.Rows
Dim oCountCommand = String.Empty
Try
oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty)
If oCountCommand = String.Empty Then
_Logger.Debug("oCountCommand = String.Empty ==> Continue for")
Continue For
End If
oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand)
oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User)
oCountCommand = oPatterns.ReplaceClipboardContents(oCountCommand, ClipboardContents)
_Logger.Debug($"Count-Command DATA before execute: [{oCountCommand}]")
oResultData += NotNull(Of Integer)(Database.GetScalarValue(oCountCommand), 0)
Catch ex As Exception
_Logger.Warn("Invalid SQL Query for Counting Data in Profile {0}: {1}", oProfile.Guid, oCountCommand)
End Try
Next
For Each oRow As DataRow In oDocSearches.Rows
For Each oRow As DataRow In oDTDocSearches.Rows
Dim oCountCommand = String.Empty
Try
oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty)
@@ -383,12 +385,15 @@ Public Class ProfileFilter
If oCountCommand = String.Empty Then
Continue For
End If
_Logger.Debug($"Count-Command DOCS BEFORE Replace: {oCountCommand}")
oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand)
' _Logger.Debug($"Count-Command DOCS AFTER ReplaceInternalValues: {oCountCommand}")
oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User)
' _Logger.Debug($"Count-Command DOCS AFTER ReplaceUserValues: {oCountCommand}")
oCountCommand = oPatterns.ReplaceClipboardContents(oCountCommand, ClipboardContents)
_Logger.Debug($"Count-Command DOCS BEFORE execute: {oCountCommand}")
oResultDocs += NotNull(Of Integer)(Database.GetScalarValue(oCountCommand), 0)
_Logger.Debug($"oResultDocs: {oResultDocs}")
Catch ex As Exception
_Logger.Warn("Invalid SQL Query for Counting Data in Profile {0}: {1}", oProfile.Guid, oCountCommand)
End Try
@@ -401,7 +406,7 @@ Public Class ProfileFilter
For Each oProfile In Profiles
If oProfile.CountData > 0 Or oProfile.CountDocs > 0 Then
oProfiles.Add(oProfile)
_Logger.Info("Profile {0} matched!", oProfile.Name)
_Logger.Info("Profile {0} matched in FilterProfilesBySearchResults!", oProfile.Name)
End If
Next