load searches only for clicked profile, acutally filter profiles by search results
This commit is contained in:
parent
c173432b94
commit
44d703fcb2
@ -23,13 +23,14 @@ Public Class ProfileSearches
|
||||
_Params = Params
|
||||
End Sub
|
||||
|
||||
Public Async Function LoadDocumentSearchesAsync() As Task(Of List(Of Search))
|
||||
Return Await Task.Run(AddressOf DoLoadDocumentSearches)
|
||||
Public Async Function LoadDocumentSearchesAsync(ProfileId As Integer) As Task(Of List(Of Search))
|
||||
Return Await Task.Run(Function()
|
||||
Return DoLoadDocumentSearches(ProfileId)
|
||||
End Function)
|
||||
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"
|
||||
Private Function DoLoadDocumentSearches(ProfileId As Integer) As List(Of Search)
|
||||
Dim oSQL As String = $"SELECT * FROM TBCW_PROF_DOC_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID = {ProfileId} ORDER BY TAB_INDEX"
|
||||
Dim oSearchesDataTable = _Environment.Database.GetDatatable(oSQL)
|
||||
Dim oDocSearches As New List(Of Search)
|
||||
Dim oCounter As Integer = 0
|
||||
@ -62,16 +63,17 @@ Public Class ProfileSearches
|
||||
Return oDocSearches
|
||||
End Function
|
||||
|
||||
Public Async Function LoadDataSearchesAsync() As Task(Of List(Of Search))
|
||||
Return Await Task.Run(AddressOf DoLoadDataSearches)
|
||||
Public Async Function LoadDataSearchesAsync(ProfileId As Integer) As Task(Of List(Of Search))
|
||||
Return Await Task.Run(Function()
|
||||
Return DoLoadDataSearches(ProfileId)
|
||||
End Function)
|
||||
End Function
|
||||
|
||||
Private Function DoLoadDataSearches() As List(Of Search)
|
||||
Private Function DoLoadDataSearches(ProfileId As Integer) As List(Of Search)
|
||||
Dim oDataSearches As New List(Of Search)
|
||||
|
||||
Try
|
||||
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 oSQL As String = $"SELECT * FROM TBCW_PROF_DATA_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID = {ProfileId} ORDER BY TAB_INDEX"
|
||||
Dim oSearchesDataTable = _Environment.Database.GetDatatable(oSQL)
|
||||
|
||||
Dim oCounter As Integer = 0
|
||||
|
||||
@ -82,12 +82,12 @@ Public Class frmMatch
|
||||
Dim oProfileSearch As New ProfileSearches(_LogConfig, _Environment, _Params)
|
||||
|
||||
If oProfile.CountData > 0 Then
|
||||
Dim oSearches = Await oProfileSearch.LoadDataSearchesAsync()
|
||||
Dim oSearches = Await oProfileSearch.LoadDataSearchesAsync(oProfile.Guid)
|
||||
OpenDataResults(oProfile, oSearches)
|
||||
Hide()
|
||||
|
||||
ElseIf oProfile.CountDocs > 0 Then
|
||||
Dim oSearches = Await oProfileSearch.LoadDocumentSearchesAsync()
|
||||
Dim oSearches = Await oProfileSearch.LoadDocumentSearchesAsync(oProfile.Guid)
|
||||
OpenDocumentResults(oProfile, oSearches)
|
||||
Hide()
|
||||
|
||||
@ -207,11 +207,11 @@ Public Class frmMatch
|
||||
|
||||
Select Case oItem.Group.Name
|
||||
Case TileGroupData.Name
|
||||
Dim oSearches = Await oProfileSearch.LoadDataSearchesAsync()
|
||||
Dim oSearches = Await oProfileSearch.LoadDataSearchesAsync(oProfileId)
|
||||
OpenDataResults(oProfile, oSearches)
|
||||
|
||||
Case TileGroupDocuments.Name
|
||||
Dim oSearches = Await oProfileSearch.LoadDocumentSearchesAsync()
|
||||
Dim oSearches = Await oProfileSearch.LoadDocumentSearchesAsync(oProfileId)
|
||||
OpenDocumentResults(oProfile, oSearches)
|
||||
|
||||
Case Else
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user