80 lines
2.3 KiB
VB.net
80 lines
2.3 KiB
VB.net
Imports DigitalData.Modules.Base
|
|
Imports DigitalData.Modules.Database
|
|
Imports DigitalData.Modules.Logging
|
|
Imports DigitalData.Modules.Language
|
|
|
|
Public Class SearchLoader
|
|
Inherits BaseClass
|
|
|
|
Private Config As Config
|
|
Private Database As MSSQLServer
|
|
|
|
Public Searches As New List(Of Search)
|
|
|
|
Public Sub New(pLogConfig As LogConfig, pConfig As Config, pDatabase As MSSQLServer)
|
|
MyBase.New(pLogConfig)
|
|
Config = pConfig
|
|
Database = pDatabase
|
|
End Sub
|
|
|
|
Public Sub LoadSearches()
|
|
Try
|
|
Dim oSQL = Config.SearchSQL
|
|
Dim oTable = Database.GetDatatable(oSQL)
|
|
|
|
For Each oRow As DataRow In oTable.Rows
|
|
Searches.Add(New Search With {
|
|
.Id = CInt(oRow.Item("GUID")),
|
|
.Title = oRow.ItemEx("TITLE", ""),
|
|
.Description = oRow.ItemEx("DESCRIPTION", ""),
|
|
.TypeName = "Varchar"
|
|
})
|
|
Next
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
Throw ex
|
|
|
|
End Try
|
|
End Sub
|
|
|
|
Public Function LoadSearchAttributes(pSearchId As Integer) As List(Of SearchAttribute)
|
|
Dim oSQL As String = $"SELECT * FROM TBDD_MONITORING_PROFILE_ATTRIBUTES WHERE ACTIVE = 1 AND MONITOR_PROFILE_ID = {pSearchId} ORDER BY SEQUENCE"
|
|
Dim oTable As DataTable = Database.GetDatatable(oSQL)
|
|
Dim oAttributes As New List(Of SearchAttribute)
|
|
|
|
For Each oRow As DataRow In oTable.Rows
|
|
oAttributes.Add(New SearchAttribute With {
|
|
.Id = oRow.Item("GUID"),
|
|
.Caption = oRow.Item("CAPTION"),
|
|
.Description = oRow.Item("DESCRIPTION"),
|
|
.DataType = oRow.Item("DATA_TYPE")
|
|
})
|
|
Next
|
|
|
|
Return oAttributes
|
|
End Function
|
|
|
|
Public Class Search
|
|
Public Id As Integer
|
|
Public Title As String
|
|
Public Description As String
|
|
Public TypeName As String
|
|
|
|
Public Overrides Function ToString() As String
|
|
Return Title
|
|
End Function
|
|
End Class
|
|
|
|
Public Class SearchAttribute
|
|
Public Id As Integer
|
|
Public Caption As String
|
|
Public Description As String
|
|
Public DataType As String
|
|
|
|
Public Overrides Function ToString() As String
|
|
Return Caption
|
|
End Function
|
|
End Class
|
|
|
|
End Class
|