Modules/GUIs.Monitor/frmStart.vb
2021-05-17 10:39:15 +02:00

61 lines
2.1 KiB
VB.net

Imports DigitalData.Controls.SQLConfig
Imports DigitalData.Modules.Config
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging
Public Class frmStart
Public Property LogConfig As LogConfig
Public Property ConfigManager As ConfigManager(Of Config)
Public Property Database As MSSQLServer
Private Sub frmStart_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
LogConfig = New LogConfig(LogConfig.PathType.AppData, Nothing, Nothing, "Digital Data", "Monitor")
ConfigManager = New ConfigManager(Of Config)(LogConfig, Application.UserAppDataPath)
Init(LogConfig)
If ConfigManager.Config.ConnectionString = String.Empty Then
Dim oSQLConfig As New frmSQLConfig(LogConfig)
If oSQLConfig.ShowDialog() = DialogResult.OK Then
ConfigManager.Config.ConnectionString = oSQLConfig.ConnectionString
ConfigManager.Save()
Else
ShowErrorMessage("No Database configured. Application will close!")
Application.Exit()
End If
End If
Database = New MSSQLServer(LogConfig, ConfigManager.Config.ConnectionString)
Catch ex As Exception
ShowErrorMessage(ex)
End Try
End Sub
Private Sub buttonSearch_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles buttonSearch.ItemClick
InitTreeList()
LoadData()
End Sub
Private Function LoadData() As Boolean
Try
Dim oSQL As String = "EXEC PRDD_MONITORING_GET_TREEVIEW_RESULT 'TYPE1','sdsdd',2"
Dim oTable As DataTable = Database.GetDatatable(oSQL)
TreeListResults.DataSource = oTable
Return True
Catch ex As Exception
ShowErrorMessage(ex)
Return False
End Try
End Function
Private Sub InitTreeList()
TreeListResults.KeyFieldName = "GUID"
TreeListResults.ParentFieldName = "PARENT_ID"
End Sub
End Class