This commit is contained in:
Jonathan Jenne
2019-09-24 16:53:31 +02:00
parent 16a7d5b915
commit cc2d8cbe33
22 changed files with 655 additions and 70 deletions

View File

@@ -1,9 +1,12 @@
Imports System.Text.RegularExpressions
Imports System.Windows.Forms
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Language.Utils
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Windows
Imports DigitalData.Modules.ZooFlow.Params
Imports DigitalData.Modules.ZooFlow.State
Imports Patterns
Public Class ProfileFilter
Private _ProfileMatch As ProfileMatch
@@ -215,7 +218,7 @@ Public Class ProfileFilter
Next
If oFound Then
oFilteredProfiles.Add(oProfile)
oControls.Add(oControl)
End If
Dim oParent = _ProfileMatch.FindNodeByTag(_TreeView.Nodes, oControl.WindowId & "-WINDOW")
@@ -235,58 +238,76 @@ Public Class ProfileFilter
Return oFilteredProfiles
End Function
'Public Function FilterProfilesBySearchResults(Profiles As List(Of ProfileData), DataSearchTable As DataTable, DocSearchTable As DataTable) As List(Of ProfileData)
' Dim oProfiles As New List(Of ProfileData)
Public Function FilterProfilesBySearchResults(Profiles As List(Of ProfileData), Database As MSSQLServer, User As UserState) As List(Of ProfileData)
Dim oProfiles As New List(Of ProfileData)
' For Each oProfile In Profiles
' Dim oResultDocs As Integer = 0
' Dim oResultData As Integer = 0
For Each oProfile In Profiles
Dim oResultDocs As Integer = 0
Dim oResultData As Integer = 0
' Dim oPatterns As New ClassPatterns(_LogConfig)
' Dim oDataSearches As DataTable = DataSearchTable
' Dim oDocSearches As DataTable = DocSearchTable
Dim oPatterns As New ClassPatterns(_LogConfig)
' For Each oRow As DataRow In oDataSearches.Rows
' Dim oCountCommand = String.Empty
' Try
' oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty)
Dim oDataSearches As DataTable
Dim oDocSearches As DataTable
' If oCountCommand = String.Empty Then
' Continue For
' End If
Try
oDataSearches = 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
' oCountCommand = oPatterns.ReplaceAllValues(oCountCommand, My.Application.User)
' oResultData += NotNull(Of Integer)(My.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
Try
oDocSearches = 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 oDocSearches.Rows
' Dim oCountCommand = String.Empty
' Try
' oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty)
For Each oRow As DataRow In oDataSearches.Rows
Dim oCountCommand = String.Empty
Try
oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty)
' If oCountCommand = String.Empty Then
' Continue For
' End If
If oCountCommand = String.Empty Then
Continue For
End If
' oCountCommand = oPatterns.ReplaceAllValues(oCountCommand, My.Application.User)
' oResultDocs += NotNull(Of Integer)(My.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
oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand)
oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User)
' If oResultData > 0 Or oResultDocs > 0 Then
' oProfile.CountData = oResultData
' oProfile.CountDocs = oResultDocs
' oProfiles.Add(oProfile)
' End If
' Next
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
' Return oProfiles
'End Function
For Each oRow As DataRow In oDocSearches.Rows
Dim oCountCommand = String.Empty
Try
oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty)
If oCountCommand = String.Empty Then
Continue For
End If
oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand)
oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User)
oResultDocs += 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
If oResultData > 0 Or oResultDocs > 0 Then
oProfile.CountData = oResultData
oProfile.CountDocs = oResultDocs
oProfiles.Add(oProfile)
End If
Next
Return oProfiles
End Function
Public Function FilterWindowsByWindowClipboardRegex(Profiles As List(Of ProfileData), ClipboardContents As String) As List(Of ProfileData)
Dim oProfiles As New List(Of ProfileData)