add DataResultList
This commit is contained in:
@@ -67,34 +67,47 @@ Public Class ProfileSearches
|
||||
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")
|
||||
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 oSearchesDataTable = _Environment.Database.GetDatatable(oSQL)
|
||||
|
||||
oSQL = oRow.Item("SQL_COMMAND")
|
||||
oSQL = oPatterns.ReplaceUserValues(oSQL, _Environment.User)
|
||||
oSQL = oPatterns.ReplaceInternalValues(oSQL)
|
||||
Dim oCounter As Integer = 0
|
||||
Dim oPatterns As New Patterns.ClassPatterns(_LogConfig)
|
||||
|
||||
Dim oDatatable As DataTable = _Environment.Database.GetDatatable(oSQL, oConnectionId)
|
||||
oDataSearches.Add(New Search() With {
|
||||
.DataTable = oDatatable,
|
||||
.ProfileId = oProfileId,
|
||||
.TabCaption = oTabTitle,
|
||||
.TabIndex = oCounter,
|
||||
.SQLCommand = oSQL
|
||||
})
|
||||
For Each oRow As DataRow In oSearchesDataTable.Rows
|
||||
Try
|
||||
Dim oProfileId As Integer = oRow.Item("PROFILE_ID")
|
||||
Dim oTabTitle As String = oRow.Item("TAB_TITLE")
|
||||
Dim oConnectionId As Integer = oRow.Item("CONN_ID")
|
||||
|
||||
oCounter += 1
|
||||
Next
|
||||
oSQL = oRow.Item("SQL_COMMAND")
|
||||
oSQL = oPatterns.ReplaceUserValues(oSQL, _Environment.User)
|
||||
oSQL = oPatterns.ReplaceInternalValues(oSQL)
|
||||
|
||||
Return oDataSearches
|
||||
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
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
Next
|
||||
|
||||
Return oDataSearches.
|
||||
Where(Function(s) Not IsNothing(s.DataTable)).
|
||||
ToList()
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
Return oDataSearches
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user