DocumentResultList
This commit is contained in:
@@ -51,6 +51,7 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>D:\ProgramFiles\DevExpress 18.1\Components\Bin\Framework\DevExpress.Utils.v18.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraBars.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.XtraEditors.v18.1, Version=18.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>D:\ProgramFiles\DevExpress 18.1\Components\Bin\Framework\DevExpress.XtraEditors.v18.1.dll</HintPath>
|
||||
@@ -115,6 +116,7 @@
|
||||
</Compile>
|
||||
<Compile Include="ProfileFilter.vb" />
|
||||
<Compile Include="ProfileMatch.vb" />
|
||||
<Compile Include="ProfileSearches.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="frmMatch.resx">
|
||||
|
||||
@@ -238,7 +238,7 @@ Public Class ProfileFilter
|
||||
Return oFilteredProfiles
|
||||
End Function
|
||||
|
||||
Public Function FilterProfilesBySearchResults(Profiles As List(Of ProfileData), Database As MSSQLServer, User As UserState) As List(Of ProfileData)
|
||||
Public Function FilterProfilesBySearchResults(Profiles As List(Of ProfileData), Database As MSSQLServer, User As UserState, ClipboardContents As String) As List(Of ProfileData)
|
||||
Dim oProfiles As New List(Of ProfileData)
|
||||
|
||||
For Each oProfile In Profiles
|
||||
@@ -275,6 +275,7 @@ Public Class ProfileFilter
|
||||
|
||||
oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand)
|
||||
oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User)
|
||||
oCountCommand = oPatterns.ReplaceClipboardContents(oCountCommand, ClipboardContents)
|
||||
|
||||
oResultData += NotNull(Of Integer)(Database.GetScalarValue(oCountCommand), 0)
|
||||
Catch ex As Exception
|
||||
@@ -293,6 +294,8 @@ Public Class ProfileFilter
|
||||
|
||||
oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand)
|
||||
oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User)
|
||||
oCountCommand = oPatterns.ReplaceClipboardContents(oCountCommand, ClipboardContents)
|
||||
|
||||
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)
|
||||
|
||||
97
ClipboardWatcher/ProfileSearches.vb
Normal file
97
ClipboardWatcher/ProfileSearches.vb
Normal file
@@ -0,0 +1,97 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.ZooFlow
|
||||
|
||||
Public Class ProfileSearches
|
||||
Private _LogConfig As LogConfig
|
||||
Private _Logger As Logger
|
||||
Private _Environment As Environment
|
||||
Private _Params As ClipboardWatcherParams
|
||||
|
||||
Public Class Search
|
||||
Public DataTable As DataTable
|
||||
Public TabIndex As Integer
|
||||
Public TabCaption As String
|
||||
Public ProfileId As Integer
|
||||
Public SQLCommand As String
|
||||
End Class
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Environment As Environment, Params As ClipboardWatcherParams)
|
||||
_LogConfig = LogConfig
|
||||
_Logger = LogConfig.GetLogger()
|
||||
_Environment = Environment
|
||||
_Params = Params
|
||||
End Sub
|
||||
|
||||
Public Async Function LoadDocumentSearchesAsync() As Task(Of List(Of Search))
|
||||
Return Await Task.Run(AddressOf DoLoadDocumentSearches)
|
||||
End Function
|
||||
|
||||
Private Function DoLoadDocumentSearches() As List(Of Search)
|
||||
Dim oMatchingIds = String.Join(",", _Params.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 = _Environment.Database.GetDatatable(oSQL)
|
||||
Dim oDocSearches As New List(Of Search)
|
||||
Dim oCounter As Integer = 0
|
||||
Dim oPatterns As New Patterns.ClassPatterns(_LogConfig)
|
||||
|
||||
For Each oRow As DataRow In oSearchesDataTable.Rows
|
||||
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 = oPatterns.ReplaceUserValues(oSQL, _Environment.User)
|
||||
oSQL = oPatterns.ReplaceInternalValues(oSQL)
|
||||
oSQL = oPatterns.ReplaceClipboardContents(oSQL, _Params.ClipboardContents)
|
||||
|
||||
Dim oDatatable As DataTable = _Environment.Database.GetDatatable(oSQL, oConnectionId)
|
||||
oDocSearches.Add(New Search() With {
|
||||
.DataTable = oDatatable,
|
||||
.ProfileId = oProfileId,
|
||||
.TabCaption = oTabTitle,
|
||||
.TabIndex = oCounter,
|
||||
.SQLCommand = oSQL
|
||||
})
|
||||
|
||||
oCounter += 1
|
||||
Next
|
||||
|
||||
Return oDocSearches
|
||||
End Function
|
||||
|
||||
Public Async Function LoadDataSearchesAsync() As Task(Of List(Of Search))
|
||||
Return Await Task.Run(AddressOf DoLoadDataSearches)
|
||||
End Function
|
||||
|
||||
Private Function DoLoadDataSearches() As List(Of Search)
|
||||
Dim oMatchingIds = String.Join(",", _Params.MatchingProfiles.Select(Function(p) p.Guid).ToArray())
|
||||
Dim oSQL As String = $"SELECT * FROM TBCW_PROF_DATA_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID in ({oMatchingIds}) ORDER BY TAB_INDEX"
|
||||
Dim oSearchesDataTable = _Environment.Database.GetDatatable(oSQL)
|
||||
Dim oDataSearches As New List(Of Search)
|
||||
Dim oCounter As Integer = 0
|
||||
Dim oPatterns As New Patterns.ClassPatterns(_LogConfig)
|
||||
|
||||
For Each oRow As DataRow In oSearchesDataTable.Rows
|
||||
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 = oPatterns.ReplaceUserValues(oSQL, _Environment.User)
|
||||
oSQL = oPatterns.ReplaceInternalValues(oSQL)
|
||||
|
||||
Dim oDatatable As DataTable = _Environment.Database.GetDatatable(oSQL, oConnectionId)
|
||||
oDataSearches.Add(New Search() With {
|
||||
.DataTable = oDatatable,
|
||||
.ProfileId = oProfileId,
|
||||
.TabCaption = oTabTitle,
|
||||
.TabIndex = oCounter,
|
||||
.SQLCommand = oSQL
|
||||
})
|
||||
|
||||
oCounter += 1
|
||||
Next
|
||||
|
||||
Return oDataSearches
|
||||
End Function
|
||||
End Class
|
||||
@@ -177,52 +177,58 @@ Public Class frmMatch
|
||||
oForm.ShowDialog()
|
||||
End Sub
|
||||
|
||||
Private Sub TileControlMatch_ItemClick(sender As Object, e As TileItemEventArgs) Handles TileControlMatch.ItemClick
|
||||
Private Async Sub TileControlMatch_ItemClick(sender As Object, e As TileItemEventArgs) Handles TileControlMatch.ItemClick
|
||||
Dim oItem As TileItem = e.Item
|
||||
Dim oProfileId As Integer = oItem.Tag
|
||||
|
||||
Dim oProfileSearch As New ProfileSearches(_LogConfig, _Environment, _Params)
|
||||
|
||||
Select Case oItem.Group.Name
|
||||
Case TileGroupData.Name
|
||||
OpenResultForms(oProfileId, ProfileType.DATA_ONLY)
|
||||
'OpenResultForms(oProfileId, ProfileType.DATA_ONLY)
|
||||
|
||||
Case TileGroupDocuments.Name
|
||||
OpenResultForms(oProfileId, ProfileType.DOCS_ONLY)
|
||||
Dim oSearches = Await oProfileSearch.LoadDocumentSearchesAsync()
|
||||
OpenDocumentResults(oProfileId, oSearches)
|
||||
|
||||
Case Else
|
||||
OpenResultForms(oProfileId, ProfileType.ANY)
|
||||
'OpenResultForms(oProfileId, ProfileType.ANY)
|
||||
End Select
|
||||
|
||||
Hide()
|
||||
End Sub
|
||||
|
||||
Private Sub OpenDocumentResults(ProfileId As Integer, Searches As List(Of ProfileSearches.Search))
|
||||
Dim oParams = New ResultListParams()
|
||||
|
||||
For Each oSearch In Searches
|
||||
oParams.Results.Add(New DocumentResult() With {
|
||||
.Datatable = oSearch.DataTable
|
||||
})
|
||||
Next
|
||||
|
||||
Dim oForm As New frmDocumentResultList(_LogConfig, _Environment, oParams)
|
||||
oForm.Show()
|
||||
End Sub
|
||||
|
||||
Private Sub OpenResultForms(ProfileId As Integer, OpenType As ProfileType)
|
||||
Dim oMatchingProfiles As New List(Of ProfileData)
|
||||
'If OpenType = ProfileType.ANY Or OpenType = ProfileType.DOCS_ONLY Then
|
||||
' ' Show Result Document Form
|
||||
' Dim oForm As New frmResult(_LogConfig, _Environment, _Params, frmResult.ResultType.Document)
|
||||
' AddHandler oForm.FormClosed, AddressOf ProfileResultForm_Closed
|
||||
' OpenForms.Add(oForm)
|
||||
|
||||
' TODO: Implement Show All
|
||||
' oForm.Show()
|
||||
'End If
|
||||
|
||||
' Click on specific profile
|
||||
Dim oProfile As ProfileData = _Params.MatchingProfiles.
|
||||
Where(Function(p) p.Guid = ProfileId).
|
||||
First()
|
||||
oMatchingProfiles.Add(oProfile)
|
||||
'If OpenType = ProfileType.ANY Or OpenType = ProfileType.DATA_ONLY Then
|
||||
' ' Show Result Data Form
|
||||
' Dim oForm As New frmResult(_LogConfig, _Environment, _Params, frmResult.ResultType.Data)
|
||||
' AddHandler oForm.FormClosed, AddressOf ProfileResultForm_Closed
|
||||
' OpenForms.Add(oForm)
|
||||
|
||||
If OpenType = ProfileType.ANY Or OpenType = ProfileType.DOCS_ONLY Then
|
||||
' Show Result Document Form
|
||||
Dim oForm As New frmResult(_LogConfig, _Environment, _Params, frmResult.ResultType.Document)
|
||||
AddHandler oForm.FormClosed, AddressOf ProfileResultForm_Closed
|
||||
OpenForms.Add(oForm)
|
||||
|
||||
oForm.Show()
|
||||
End If
|
||||
|
||||
If OpenType = ProfileType.ANY Or OpenType = ProfileType.DATA_ONLY Then
|
||||
' Show Result Data Form
|
||||
Dim oForm As New frmResult(_LogConfig, _Environment, _Params, frmResult.ResultType.Data)
|
||||
AddHandler oForm.FormClosed, AddressOf ProfileResultForm_Closed
|
||||
OpenForms.Add(oForm)
|
||||
|
||||
oForm.Show()
|
||||
End If
|
||||
' oForm.Show()
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
Private Sub ProfileResultForm_Closed(sender As Object, e As FormClosedEventArgs)
|
||||
|
||||
Reference in New Issue
Block a user