MS Amatch Anpassung und DB Log
This commit is contained in:
parent
811613cdea
commit
7c2cf206ab
@ -334,48 +334,50 @@ Public Class ProfileFilter
|
|||||||
Dim oProfiles As New List(Of ProfileData)
|
Dim oProfiles As New List(Of ProfileData)
|
||||||
|
|
||||||
For Each oProfile In Profiles
|
For Each oProfile In Profiles
|
||||||
|
_Logger.Debug($"Checking SearchResults on ProfileID: {oProfile.Guid}")
|
||||||
Dim oResultDocs As Integer = 0
|
Dim oResultDocs As Integer = 0
|
||||||
Dim oResultData As Integer = 0
|
Dim oResultData As Integer = 0
|
||||||
|
|
||||||
Dim oPatterns As New ClassPatterns(_LogConfig)
|
Dim oPatterns As New ClassPatterns(_LogConfig)
|
||||||
|
|
||||||
Dim oDataSearches As DataTable
|
Dim oDTDataSearches As DataTable
|
||||||
Dim oDocSearches As DataTable
|
Dim oDTDocSearches As DataTable
|
||||||
|
|
||||||
Try
|
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
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Continue For
|
Continue For
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
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
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
Continue For
|
Continue For
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
For Each oRow As DataRow In oDataSearches.Rows
|
For Each oRow As DataRow In oDTDataSearches.Rows
|
||||||
Dim oCountCommand = String.Empty
|
Dim oCountCommand = String.Empty
|
||||||
Try
|
Try
|
||||||
oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty)
|
oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty)
|
||||||
|
|
||||||
If oCountCommand = String.Empty Then
|
If oCountCommand = String.Empty Then
|
||||||
|
_Logger.Debug("oCountCommand = String.Empty ==> Continue for")
|
||||||
Continue For
|
Continue For
|
||||||
End If
|
End If
|
||||||
|
|
||||||
oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand)
|
oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand)
|
||||||
oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User)
|
oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User)
|
||||||
oCountCommand = oPatterns.ReplaceClipboardContents(oCountCommand, ClipboardContents)
|
oCountCommand = oPatterns.ReplaceClipboardContents(oCountCommand, ClipboardContents)
|
||||||
|
_Logger.Debug($"Count-Command DATA before execute: [{oCountCommand}]")
|
||||||
oResultData += NotNull(Of Integer)(Database.GetScalarValue(oCountCommand), 0)
|
oResultData += NotNull(Of Integer)(Database.GetScalarValue(oCountCommand), 0)
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Warn("Invalid SQL Query for Counting Data in Profile {0}: {1}", oProfile.Guid, oCountCommand)
|
_Logger.Warn("Invalid SQL Query for Counting Data in Profile {0}: {1}", oProfile.Guid, oCountCommand)
|
||||||
End Try
|
End Try
|
||||||
Next
|
Next
|
||||||
|
|
||||||
For Each oRow As DataRow In oDocSearches.Rows
|
For Each oRow As DataRow In oDTDocSearches.Rows
|
||||||
Dim oCountCommand = String.Empty
|
Dim oCountCommand = String.Empty
|
||||||
Try
|
Try
|
||||||
oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty)
|
oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty)
|
||||||
@ -383,12 +385,15 @@ Public Class ProfileFilter
|
|||||||
If oCountCommand = String.Empty Then
|
If oCountCommand = String.Empty Then
|
||||||
Continue For
|
Continue For
|
||||||
End If
|
End If
|
||||||
|
_Logger.Debug($"Count-Command DOCS BEFORE Replace: {oCountCommand}")
|
||||||
oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand)
|
oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand)
|
||||||
|
' _Logger.Debug($"Count-Command DOCS AFTER ReplaceInternalValues: {oCountCommand}")
|
||||||
oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User)
|
oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User)
|
||||||
|
' _Logger.Debug($"Count-Command DOCS AFTER ReplaceUserValues: {oCountCommand}")
|
||||||
oCountCommand = oPatterns.ReplaceClipboardContents(oCountCommand, ClipboardContents)
|
oCountCommand = oPatterns.ReplaceClipboardContents(oCountCommand, ClipboardContents)
|
||||||
|
_Logger.Debug($"Count-Command DOCS BEFORE execute: {oCountCommand}")
|
||||||
oResultDocs += NotNull(Of Integer)(Database.GetScalarValue(oCountCommand), 0)
|
oResultDocs += NotNull(Of Integer)(Database.GetScalarValue(oCountCommand), 0)
|
||||||
|
_Logger.Debug($"oResultDocs: {oResultDocs}")
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Warn("Invalid SQL Query for Counting Data in Profile {0}: {1}", oProfile.Guid, oCountCommand)
|
_Logger.Warn("Invalid SQL Query for Counting Data in Profile {0}: {1}", oProfile.Guid, oCountCommand)
|
||||||
End Try
|
End Try
|
||||||
@ -401,7 +406,7 @@ Public Class ProfileFilter
|
|||||||
For Each oProfile In Profiles
|
For Each oProfile In Profiles
|
||||||
If oProfile.CountData > 0 Or oProfile.CountDocs > 0 Then
|
If oProfile.CountData > 0 Or oProfile.CountDocs > 0 Then
|
||||||
oProfiles.Add(oProfile)
|
oProfiles.Add(oProfile)
|
||||||
_Logger.Info("Profile {0} matched!", oProfile.Name)
|
_Logger.Info("Profile {0} matched in FilterProfilesBySearchResults!", oProfile.Name)
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
|||||||
@ -70,27 +70,31 @@ Public Class frmMatch
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
If oCreatedTiles = 0 Then
|
If oCreatedTiles = 0 Then
|
||||||
_Logger.Warn("No Results found for ""{0}""", _Params.ClipboardContents)
|
_Logger.Warn("No Tiles Created: No Results found for ""{0}""", _Params.ClipboardContents)
|
||||||
Close()
|
Close()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim oMatchString = IIf(oCreatedTiles = 1, "1 Profil", $"{oCreatedTiles} Profile")
|
Dim oMatchString = IIf(oCreatedTiles = 1, "1 Profil", $"{oCreatedTiles} Profile")
|
||||||
Label1.Text = String.Format(Label1.Text, oMatchString, _Params.ClipboardContents)
|
Label1.Text = String.Format(Label1.Text, oMatchString, _Params.ClipboardContents)
|
||||||
|
_Logger.Debug($"Created Tiles: {oCreatedTiles} ")
|
||||||
If oCreatedTiles = 1 Then
|
If oCreatedTiles = 1 Then
|
||||||
|
|
||||||
Dim oProfile As ProfileData = _Params.MatchingProfiles.First()
|
Dim oProfile As ProfileData = _Params.MatchingProfiles.First()
|
||||||
Dim oProfileSearch As New ProfileSearches(_LogConfig, _Environment, _Params)
|
Dim oProfileSearch As New ProfileSearches(_LogConfig, _Environment, _Params)
|
||||||
|
|
||||||
If oProfile.CountData > 0 Then
|
If oProfile.CountDocs > 0 And oProfile.CountData = 0 Then
|
||||||
Dim oSearches = Await oProfileSearch.LoadDataSearchesAsync(oProfile.Guid)
|
_Logger.Debug($"ONLY Docs")
|
||||||
OpenDataResults(oProfile, oSearches)
|
'ONLY DOCS AND NÒ DATA
|
||||||
Hide()
|
|
||||||
|
|
||||||
ElseIf oProfile.CountDocs > 0 Then
|
|
||||||
Dim oSearches = Await oProfileSearch.LoadDocumentSearchesAsync(oProfile.Guid)
|
Dim oSearches = Await oProfileSearch.LoadDocumentSearchesAsync(oProfile.Guid)
|
||||||
OpenDocumentResults(oProfile, oSearches)
|
OpenDocumentResults(oProfile, oSearches)
|
||||||
Hide()
|
Hide()
|
||||||
|
ElseIf oProfile.CountDocs > 0 And oProfile.CountData > 0 Then
|
||||||
|
_Logger.Debug($"Docs AND Data")
|
||||||
|
ElseIf oProfile.CountDocs = 0 And oProfile.CountData > 0 Then
|
||||||
|
_Logger.Debug($"ONLY Data")
|
||||||
|
Dim oSearches = Await oProfileSearch.LoadDataSearchesAsync(oProfile.Guid)
|
||||||
|
OpenDataResults(oProfile, oSearches)
|
||||||
|
Hide()
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
@ -121,10 +125,13 @@ Public Class frmMatch
|
|||||||
'End If
|
'End If
|
||||||
|
|
||||||
If oProfile.ProfileType = ProfileType.ANY Or oProfile.ProfileType = ProfileType.DOCS_ONLY Then
|
If oProfile.ProfileType = ProfileType.ANY Or oProfile.ProfileType = ProfileType.DOCS_ONLY Then
|
||||||
|
_Logger.Debug("Docs only or ProfileTypeAny")
|
||||||
If oProfile.CountDocs > 0 Then
|
If oProfile.CountDocs > 0 Then
|
||||||
Dim oItem = CreateTile(oProfile, $"{oProfile.CountDocs} Dokumente")
|
Dim oItem = CreateTile(oProfile, $"{oProfile.CountDocs} Dateien")
|
||||||
oDocumentGroup.Items.Add(oItem)
|
oDocumentGroup.Items.Add(oItem)
|
||||||
oCreatedTiles += 1
|
oCreatedTiles += 1
|
||||||
|
Else
|
||||||
|
_Logger.Debug("NO Doc-Results!")
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@ -133,6 +140,8 @@ Public Class frmMatch
|
|||||||
Dim oItem = CreateTile(oProfile, $"{oProfile.CountData} Datensätze")
|
Dim oItem = CreateTile(oProfile, $"{oProfile.CountData} Datensätze")
|
||||||
oDataGroup.Items.Add(oItem)
|
oDataGroup.Items.Add(oItem)
|
||||||
oCreatedTiles += 1
|
oCreatedTiles += 1
|
||||||
|
Else
|
||||||
|
_Logger.Debug("NO Data-Results!")
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|||||||
@ -63,9 +63,23 @@ Public Class MSSQLServer
|
|||||||
Try
|
Try
|
||||||
Dim oConnection As New SqlConnection(CurrentSQLConnectionString)
|
Dim oConnection As New SqlConnection(CurrentSQLConnectionString)
|
||||||
oConnection.Open()
|
oConnection.Open()
|
||||||
|
Dim OMyConnection As New SqlClient.SqlConnection(CurrentSQLConnectionString) 'csb.ConnectionString)
|
||||||
|
Dim csb As New SqlClient.SqlConnectionStringBuilder
|
||||||
|
csb.ConnectionString = CurrentSQLConnectionString
|
||||||
|
Dim constr = OMyConnection.ConnectionString
|
||||||
|
Try
|
||||||
|
constr = constr.Replace(csb.Password, "XXXXX")
|
||||||
|
Catch ex As Exception
|
||||||
|
|
||||||
|
End Try
|
||||||
|
'If constr.Contains("Trusted_Connection=True") = False Then
|
||||||
|
' constr = constr.Replace(csb.Password, "XXXXX")
|
||||||
|
'End If
|
||||||
|
_Logger.Debug($"Following Connectionstring is open: {constr}")
|
||||||
Return oConnection
|
Return oConnection
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
|
|
||||||
Return Nothing
|
Return Nothing
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -94,7 +108,7 @@ Public Class MSSQLServer
|
|||||||
End Using
|
End Using
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
_Logger.Debug("sqlcommand: " & SqlCommand)
|
_Logger.Warn("sqlcommand: " & SqlCommand)
|
||||||
Return Nothing
|
Return Nothing
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -130,7 +144,7 @@ Public Class MSSQLServer
|
|||||||
End Using
|
End Using
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
_Logger.Debug("executeStatement: " & SQLCommand)
|
_Logger.Warn("executeStatement: " & SQLCommand)
|
||||||
Return False
|
Return False
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -165,6 +179,7 @@ Public Class MSSQLServer
|
|||||||
End Using
|
End Using
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
|
_Logger.Warn("SQLQuery: " & SQLQuery)
|
||||||
Return Nothing
|
Return Nothing
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -196,7 +211,7 @@ Public Class MSSQLServer
|
|||||||
End Using
|
End Using
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
_Logger.Debug("executeStatement: " & executeStatement)
|
_Logger.Warn("executeStatement: " & executeStatement)
|
||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user