diff --git a/app/DD_Clipboard_Searcher/DD_Clipboard_Watcher.vbproj b/app/DD_Clipboard_Searcher/DD_Clipboard_Watcher.vbproj
index 6146f86..a8580c2 100644
--- a/app/DD_Clipboard_Searcher/DD_Clipboard_Watcher.vbproj
+++ b/app/DD_Clipboard_Searcher/DD_Clipboard_Watcher.vbproj
@@ -71,6 +71,9 @@
P:\Projekte DIGITAL DATA\DIGITAL DATA - Entwicklung\DLL_Bibliotheken\Digital Data\Controls\DigitalData.Controls.RegexEditor.dll
+
+ ..\..\..\DDMonorepo\GUIs.Common\bin\Debug\DigitalData.GUIs.Common.dll
+
..\..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Config.dll
@@ -82,8 +85,9 @@
False
..\..\..\DDMonorepo\Filesystem\bin\Debug\DigitalData.Modules.Filesystem.dll
-
- P:\Projekte DIGITAL DATA\DIGITAL DATA - Entwicklung\DLL_Bibliotheken\Digital Data\DigitalData.Modules.Language.dll
+
+ False
+ ..\..\..\DDMonorepo\Modules.Language\bin\Debug\DigitalData.Modules.Language.dll
..\..\..\DDMonorepo\Modules.Config\bin\Debug\DigitalData.Modules.Logging.dll
@@ -91,6 +95,9 @@
..\..\..\DDMonorepo\Windows\bin\Debug\DigitalData.Modules.Windows.dll
+
+ ..\..\..\DDMonorepo\Modules.ZooFlow\bin\Debug\DigitalData.Modules.ZooFlow.dll
+
D:\ProgramFiles\GdPicture.NET 14\Redist\GdPicture.NET\GdPicture.NET.14.dll
diff --git a/app/DD_Clipboard_Searcher/frmProfileMatch.vb b/app/DD_Clipboard_Searcher/frmProfileMatch.vb
index 32f7967..71ad9d9 100644
--- a/app/DD_Clipboard_Searcher/frmProfileMatch.vb
+++ b/app/DD_Clipboard_Searcher/frmProfileMatch.vb
@@ -1,6 +1,11 @@
Imports DD_Clipboard_Watcher.ClassProfileFilter
Imports DD_Clipboard_Watcher.ClassConstants
Imports DevExpress.XtraEditors
+Imports DigitalData.GUIs.Common
+Imports DigitalData.Modules
+Imports DigitalData.Modules.Database
+Imports DigitalData.Modules.Language
+Imports DigitalData.Modules.ZooFlow
Public Class frmProfileMatch
Private PrimaryFont As New Font("Segoe UI", 12, FontStyle.Bold)
@@ -9,6 +14,15 @@ Public Class frmProfileMatch
Private OpenForms As New List(Of IResultForm)
Private ShouldHideInitially As Boolean = False
+ Public Class DocumentSearch
+ Public Guid As Integer
+ Public DataTable As DataTable
+ Public TabIndex As Integer
+ Public TabCaption As String
+ Public ProfileId As Integer
+ Public SQLCommand As String
+ End Class
+
Private Enum ProfileType
ANY = 0
DOCS_ONLY = 1
@@ -177,7 +191,41 @@ Public Class frmProfileMatch
Hide()
End Sub
- Private Sub OpenResultForms(ProfileId As Integer, OpenType As ProfileType)
+ Private Async Function LoadSearchesAsync(MatchingProfiles As List(Of ProfileData)) As Task(Of List(Of DocumentSearch))
+ Return Await Task.Run(Function()
+ Return DoLoadSearches(MatchingProfiles)
+ End Function)
+ End Function
+
+ Private Function DoLoadSearches(MatchingProfiles As List(Of ProfileData)) As List(Of DocumentSearch)
+ Dim oMatchingIds = String.Join(",", MatchingProfiles.Select(Function(p) p.Guid).ToArray())
+ Dim oSQL As String = $"SELECT * FROM TBCW_PROF_DOC_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID in ({oMatchingIds}) ORDER BY TAB_INDEX"
+ Dim oSearchesDataTable = Database.GetDatatable(oSQL)
+ Dim oDocSearches As New List(Of DocumentSearch)
+
+ For Each oRow As DataRow In oSearchesDataTable.Rows
+ Dim oGuid As Integer = oRow.Item("GUID")
+ Dim oProfileId As Integer = oRow.Item("PROFILE_ID")
+ Dim oTabTitle As String = oRow.Item("TAB_TITLE")
+ Dim oConnectionId As Integer = oRow.Item("CONN_ID")
+
+ oSQL = oRow.Item("SQL_COMMAND")
+ oSQL = clsPatterns.ReplaceAllValues(oSQL, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_EMAIL, USER_ID, oProfileId)
+
+ Dim oDatatable As DataTable = GetDatatable(oSQL, oConnectionId)
+ oDocSearches.Add(New DocumentSearch() With {
+ .Guid = oGuid,
+ .DataTable = oDatatable,
+ .ProfileId = oProfileId,
+ .TabCaption = oTabTitle,
+ .SQLCommand = oSQL
+ })
+ Next
+
+ Return oDocSearches
+ End Function
+
+ Private Async Sub OpenResultForms(ProfileId As Integer, OpenType As ProfileType)
Dim oMatchingProfiles As New List(Of ProfileData)
' TODO: Implement Show All
@@ -186,13 +234,24 @@ Public Class frmProfileMatch
Dim oProfile As ProfileData = CURRENT_MATCHING_PROFILES.
Where(Function(p) p.Guid = ProfileId).
First()
- oMatchingProfiles.Add(oProfile)
+ oMatchingProfiles.Add(oProfile)
+
+ Dim oSearches As List(Of DocumentSearch) = Await LoadSearchesAsync(oMatchingProfiles)
+ Dim oEnvironment = GetEnvironment()
+ Dim oParams = GetParams(oProfile, oSearches)
If OpenType = ProfileType.ANY Or OpenType = ProfileType.DOCS_ONLY Then
' Show Result Document Form
- Dim oForm As New frmResultDoc(Me, oMatchingProfiles)
- AddHandler oForm.FormClosed, AddressOf ProfileResultForm_Closed
- OpenForms.Add(oForm)
+
+ Dim oForm As New frmDocumentResultList(LogConfig, oEnvironment, oParams)
+ ' TODO: Reopen match form
+ 'AddHandler oForm.FormClosed, AddressOf ProfileResultForm_Closed
+ 'OpenForms.Add(oForm)
+
+
+ 'Dim oForm As New frmResultDoc(Me, oMatchingProfiles)
+ 'AddHandler oForm.FormClosed, AddressOf ProfileResultForm_Closed
+ 'OpenForms.Add(oForm)
oForm.Show()
End If
@@ -207,6 +266,86 @@ Public Class frmProfileMatch
End If
End Sub
+ Private Function GetParams(Profile As ProfileData, DocumentSearches As List(Of DocumentSearch)) As DocumentResultParams
+ Dim oResults As New List(Of DocumentResult)
+
+ For Each oSearch In DocumentSearches
+ oResults.Add(New DocumentResult() With {
+ .Datatable = oSearch.DataTable,
+ .Title = oSearch.TabCaption
+ })
+ Next
+
+ Dim oParams As New DocumentResultParams() With {
+ .WindowGuid = GetWindowId(Profile, DocumentSearches),
+ .Results = oResults
+ }
+
+ Return oParams
+ End Function
+
+ Private Function GetWindowId(Profile As ProfileData, Searches As List(Of DocumentSearch)) As String
+ Dim oNameSlug = Utils.ConvertTextToSlug(Profile.Name)
+ Dim oSearchGuids = Searches.Select(Function(s) s.Guid).ToArray
+ Dim oWindowGuid = $"{Profile.Guid}-{oNameSlug}-{String.Join("-", oSearchGuids)}"
+
+ Return oWindowGuid
+ End Function
+
+ Private Function GetEnvironment() As Environment
+ Dim oUser As New State.UserState() With {
+ .DateFormat = USER_DATE_FORMAT,
+ .Email = USER_EMAIL,
+ .GivenName = USER_PRENAME,
+ .Language = USER_LANGUAGE,
+ .MachineName = System.Environment.MachineName,
+ .ShortName = USER_SHORTNAME,
+ .Surname = USER_SURNAME,
+ .UserId = USER_ID,
+ .UserName = USER_USERNAME
+ }
+
+ Dim oSettings As New State.SettingsState() With {
+ .GdPictureKey = ""
+ }
+
+ Dim oEnvironment As New Environment() With {
+ .Database = Nothing,
+ .Modules = Nothing,
+ .User = oUser,
+ .Settings = oSettings
+ }
+
+ Return oEnvironment
+ End Function
+
+ Private Function GetDatatable(SqlCommand As String, ConnectionId As Integer)
+ Try
+ Dim oRow As MyDataset.TBDD_CONNECTIONRow = DT_CONNECTIONS.AsEnumerable().
+ Where(Function(r) r.GUID = ConnectionId).
+ FirstOrDefault()
+
+ Dim oConnectionType As String = oRow.SQL_PROVIDER
+
+ Select Case oRow.SQL_PROVIDER
+ Case Constants.PROVIDER_MSSQL
+ Dim oSQL As New MSSQLServer(LogConfig, oRow.SERVER, oRow.DATENBANK, oRow.USERNAME, oRow.PASSWORD)
+ Return oSQL.GetDatatable(SqlCommand)
+
+ Case Constants.PROVIDER_ODBC
+ Dim oODBC As New ODBC(LogConfig, oRow.SERVER, oRow.USERNAME, oRow.PASSWORD)
+ Return oODBC.GetDatatable(SqlCommand)
+
+ Case Else
+ Dim oOracle As New Database.Oracle(LogConfig, oRow.SERVER, oRow.DATENBANK, oRow.USERNAME, oRow.PASSWORD)
+ Return oOracle.GetDatatable(SqlCommand)
+ End Select
+ Catch ex As Exception
+ Logger.Error(ex)
+ Return Nothing
+ End Try
+ End Function
+
Private Sub ProfileResultForm_Closed(sender As Object, e As FormClosedEventArgs)
Dim oShouldOpenAgain As Boolean = False
Dim oThisForm = New List(Of IResultForm) From {sender}