653 lines
24 KiB
VB.net
653 lines
24 KiB
VB.net
Imports DevExpress.XtraGrid
|
|
Imports DevExpress.XtraGrid.Views.Grid
|
|
Imports DevExpress.XtraTreeList.Nodes
|
|
Imports DigitalData.Controls.SQLConfig
|
|
Imports DigitalData.GUIs.Common
|
|
Imports DigitalData.Modules.Config
|
|
Imports DigitalData.Modules.Database
|
|
Imports DigitalData.Modules.Logging
|
|
Imports DigitalData.Modules.Language.Utils
|
|
Imports DigitalData.Modules.Language
|
|
Imports DevExpress.XtraTab
|
|
Imports DigitalData.Controls.DocumentViewer
|
|
Imports DevExpress.XtraEditors
|
|
Imports DevExpress.XtraRichEdit
|
|
Imports DevExpress.XtraTreeList.Columns
|
|
Imports DevExpress.XtraEditors.Repository
|
|
Imports DevExpress.Utils
|
|
Imports DevExpress.XtraEditors.Controls
|
|
Imports DigitalData.GUIs.Monitor.SearchLoader
|
|
Imports DevExpress.XtraLayout
|
|
Imports DevExpress.XtraTreeList
|
|
|
|
Public Class frmMonitor
|
|
Public Property LogConfig As LogConfig
|
|
Public Property ConfigManager As ConfigManager(Of Config)
|
|
Public Property Database As MSSQLServer
|
|
|
|
Private ReadOnly SQLColumns As New List(Of String) From {"SELECT1", "SELECT2", "SELECT3", "SELECT4"}
|
|
Private ReadOnly DocViewColumns As New List(Of String) From {"DOCVIEW1", "DOCVIEW2"}
|
|
Private ReadOnly HtmlViewColumns As New List(Of String) From {"HTML1", "HTML2"}
|
|
Private ReadOnly DataColumns As List(Of String) = SQLColumns.
|
|
Concat(DocViewColumns).
|
|
Concat(HtmlViewColumns).
|
|
ToList
|
|
|
|
Private ReadOnly DisplayColumns As New List(Of String) From {"COLUMN1", "COLUMN2", "COLUMN3", "ADDED_WHEN", "STATE", "ICON"}
|
|
|
|
Private SearchLoader As SearchLoader
|
|
|
|
|
|
Private SQLResultGrids As List(Of GridControl)
|
|
Private SQLResultTabs As List(Of XtraTabPage)
|
|
Private ActiveSQLResultGrid As GridControl
|
|
|
|
Private FileResultViewers As List(Of DocumentViewer)
|
|
Private FileResultTabs As List(Of XtraTabPage)
|
|
|
|
Private HtmlResultViewers As List(Of RichEditControl)
|
|
Private HtmlResultTabs As List(Of XtraTabPage)
|
|
|
|
Private Const STATE_SUCCESS As String = "SUCCESS"
|
|
Private Const STATE_FAILURE As String = "FAILURE"
|
|
Private Const STATE_WARNING As String = "WARNING"
|
|
Private Const STATE_WAITING As String = "WAITING"
|
|
Private Const STATE_HIGHLIGHT As String = "HIGHLIGHT"
|
|
|
|
|
|
Private Enum NodeImage
|
|
[Default] = 0
|
|
SQL = 1
|
|
File = 2
|
|
Mail = 3
|
|
Success = 4
|
|
Failure = 5
|
|
Warning = 6
|
|
Waiting = 7
|
|
User = 8
|
|
Highlight = 9
|
|
End Enum
|
|
|
|
Private ReadOnly StateIcons As New Dictionary(Of String, NodeImage) From {
|
|
{STATE_SUCCESS, NodeImage.Success},
|
|
{STATE_FAILURE, NodeImage.Failure}
|
|
}
|
|
|
|
Private GridBuilder As GridBuilder
|
|
|
|
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, Application.UserAppDataPath, Application.StartupPath)
|
|
|
|
InitializeBaseForm(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()
|
|
Application.Restart()
|
|
Else
|
|
ShowErrorMessage("No Database configured. Application will close!")
|
|
Application.Exit()
|
|
|
|
End If
|
|
End If
|
|
If ConfigManager.Config.DBPrefix <> "" Then
|
|
If ConfigManager.Config.SearchSQL.Contains("@IDB_PRAEFIX") Then
|
|
Dim oREPLACE = ConfigManager.Config.SearchSQL.Replace("@IDB_PRAEFIX", ConfigManager.Config.DBPrefix)
|
|
ConfigManager.Config.SearchSQL = oREPLACE
|
|
ConfigManager.Save()
|
|
End If
|
|
Console.WriteLine(ConfigManager.Config.SearchSQL)
|
|
|
|
End If
|
|
Dim oConnectionString = MSSQLServer.DecryptConnectionString(ConfigManager.Config.ConnectionString)
|
|
Database = New MSSQLServer(LogConfig, oConnectionString)
|
|
SearchLoader = New SearchLoader(LogConfig, ConfigManager.Config, Database)
|
|
GridBuilder = New GridBuilder(New List(Of GridView) From {GridView1, GridView2, GridView3, GridView4})
|
|
GridBuilder.
|
|
WithDefaults().
|
|
WithDefaults(TreeListResults).
|
|
WithReadOnlyOptions().
|
|
WithReadOnlyOptions(TreeListResults)
|
|
|
|
SQLResultGrids = New List(Of GridControl) From {GridControl1, GridControl2, GridControl3, GridControl4}
|
|
SQLResultTabs = New List(Of XtraTabPage) From {XtraTabPageSQL1, XtraTabPageSQL2, XtraTabPageSQL3, XtraTabPageSQL4}
|
|
|
|
FileResultViewers = New List(Of DocumentViewer) From {DocumentViewer1, DocumentViewer2}
|
|
FileResultTabs = New List(Of XtraTabPage) From {XtraTabPageFile1, XtraTabPageFile2}
|
|
|
|
HtmlResultViewers = New List(Of RichEditControl) From {RichEditControl1, RichEditControl2}
|
|
HtmlResultTabs = New List(Of XtraTabPage) From {XtraTabPageHtml1, XtraTabPageHtml2}
|
|
|
|
LoadSearches()
|
|
|
|
Dim oLicense = LoadGDPicture()
|
|
|
|
For Each oGrid In SQLResultGrids
|
|
AddHandler oGrid.Enter, Sub()
|
|
ActiveSQLResultGrid = oGrid
|
|
BarButtonItem2.Enabled = True
|
|
End Sub
|
|
|
|
AddHandler oGrid.Leave, Sub()
|
|
ActiveSQLResultGrid = Nothing
|
|
BarButtonItem2.Enabled = False
|
|
End Sub
|
|
Next
|
|
|
|
|
|
For Each oViewer As DocumentViewer In FileResultViewers
|
|
oViewer.Init(LogConfig, oLicense)
|
|
Next
|
|
SplitContainerControl3.Collapsed = True
|
|
SplitContainerControl2.Collapsed = True
|
|
Catch ex As Exception
|
|
ShowErrorMessage(ex)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Function LoadGDPicture() As String
|
|
Dim oSQL = "SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE'"
|
|
Return Database.GetScalarValue(oSQL)
|
|
End Function
|
|
|
|
Private Sub buttonSearch_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles buttonSearch.ItemClick
|
|
LoadData()
|
|
End Sub
|
|
|
|
Private Function LoadData() As Boolean
|
|
Try
|
|
If cmbSearches.EditValue Is Nothing Then
|
|
Return False
|
|
End If
|
|
|
|
Dim oSQL As String = $"EXEC [{ConfigManager.Config.DBPrefix}].[dbo].[PRDD_MONITORING_GET_TREEVIEW_RESULT] '{cmbSearches.EditValue}','irgendwas','irgendwas','irgendwas',1"
|
|
Dim oTable As DataTable = Database.GetDatatable(oSQL)
|
|
|
|
TreeListResults.DataSource = oTable
|
|
|
|
Dim oMaxLength = 0
|
|
For Each oRow As DataRow In oTable.Rows
|
|
Dim oProcess = oRow.Item("COLUMN1")
|
|
Dim oLength = oProcess.ToString.Length
|
|
If oLength > oMaxLength Then
|
|
oMaxLength = oLength
|
|
End If
|
|
Next
|
|
|
|
InitTreeList(oMaxLength)
|
|
|
|
' Show all columns in DisplayColumns List
|
|
For Each oColumn In TreeListResults.Columns
|
|
oColumn.Visible = DisplayColumns.Contains(oColumn.FieldName)
|
|
If oColumn.FieldName = "ADDED_WHEN" Then
|
|
oColumn.Format.FormatType = FormatType.DateTime
|
|
oColumn.Format.FormatString = "dd.MM.yyyy HH:MM:ss"
|
|
End If
|
|
Next
|
|
|
|
Dim oStateColumn As TreeListColumn = TreeListResults.Columns.Item("STATE")
|
|
For Each oNode As TreeListNode In TreeListResults.Nodes
|
|
ExpandNodes(oNode, Function(n)
|
|
Dim oObjectValue = n.GetValue(oStateColumn)
|
|
Dim oValue As String = NotNull(oObjectValue, String.Empty)
|
|
Return oValue IsNot Nothing AndAlso (oValue = STATE_WARNING Or oValue = STATE_FAILURE)
|
|
End Function)
|
|
Next
|
|
|
|
Return True
|
|
Catch ex As Exception
|
|
ShowErrorMessage(ex)
|
|
Return False
|
|
End Try
|
|
End Function
|
|
|
|
Private Sub LoadSearches()
|
|
Try
|
|
SearchLoader.LoadSearches()
|
|
|
|
cmbSearches.Properties.Items.Clear()
|
|
cmbSearches.Properties.Items.AddRange(SearchLoader.Searches)
|
|
Catch ex As Exception
|
|
ShowErrorMessage(ex)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub InitTreeList(pMaxLength As Integer)
|
|
TreeListResults.KeyFieldName = "GUID"
|
|
TreeListResults.ParentFieldName = "PARENT_ID"
|
|
|
|
Dim oStateEdit As New RepositoryItemImageComboBox With {
|
|
.SmallImages = SvgImageCollection1,
|
|
.GlyphAlignment = HorzAlignment.Near
|
|
}
|
|
oStateEdit.Buttons.Clear()
|
|
oStateEdit.Items.AddRange(New List(Of ImageComboBoxItem) From {
|
|
New ImageComboBoxItem("Success", "SUCCESS", NodeImage.Success),
|
|
New ImageComboBoxItem("Failure", "FAILURE", NodeImage.Failure),
|
|
New ImageComboBoxItem("Warning", "WARNING", NodeImage.Warning),
|
|
New ImageComboBoxItem("Waiting", "WAITING", NodeImage.Waiting),
|
|
New ImageComboBoxItem("Default", "DEFAULT", NodeImage.Default),
|
|
New ImageComboBoxItem("User", "USER", NodeImage.User),
|
|
New ImageComboBoxItem("Highlight", "HIGHLIGHT", NodeImage.Highlight)
|
|
})
|
|
|
|
Dim oIconEdit As New RepositoryItemImageComboBox With {
|
|
.SmallImages = SvgImageCollection1,
|
|
.GlyphAlignment = HorzAlignment.Near
|
|
}
|
|
oStateEdit.Buttons.Clear()
|
|
oStateEdit.Items.AddRange(New List(Of ImageComboBoxItem) From {
|
|
New ImageComboBoxItem("Email", "MAIL", NodeImage.Mail),
|
|
New ImageComboBoxItem("SQL", "SQL", NodeImage.SQL),
|
|
New ImageComboBoxItem("File", "FILE", NodeImage.File)
|
|
})
|
|
|
|
Dim oColumn1 = TreeListResults.Columns.Item("COLUMN1")
|
|
Dim oStateColumn = TreeListResults.Columns.Item("STATE")
|
|
Dim oIconColumn = TreeListResults.Columns.Item("ICON")
|
|
|
|
oColumn1.VisibleIndex = 0
|
|
oStateColumn.VisibleIndex = 1
|
|
oIconColumn.VisibleIndex = 2
|
|
|
|
Dim oColumnLength = pMaxLength * 5
|
|
With oColumn1
|
|
.MinWidth = oColumnLength
|
|
.MaxWidth = oColumnLength
|
|
.Width = oColumnLength
|
|
.OptionsColumn.AllowSize = False
|
|
End With
|
|
|
|
With oStateColumn
|
|
.ColumnEdit = oStateEdit
|
|
.MaxWidth = 25
|
|
.MinWidth = 25
|
|
.Width = 25
|
|
.Caption = " "
|
|
.OptionsColumn.AllowSize = False
|
|
.ImageOptions.Image = SvgImageCollection1.GetImage(NodeImage.Success)
|
|
End With
|
|
|
|
With oIconColumn
|
|
.ColumnEdit = oStateEdit
|
|
.MaxWidth = 25
|
|
.MinWidth = 25
|
|
.Width = 25
|
|
.Caption = " "
|
|
.OptionsColumn.AllowSize = False
|
|
.ImageOptions.Image = SvgImageCollection1.GetImage(NodeImage.SQL)
|
|
End With
|
|
|
|
End Sub
|
|
|
|
Private Sub cmbSearches_SelectedValueChanged(sender As Object, e As EventArgs) Handles cmbSearches.SelectedValueChanged
|
|
Dim oSearch As Search = CType(cmbSearches.SelectedItem, Search)
|
|
Dim oAttributes = SearchLoader.LoadSearchAttributes(oSearch.Id)
|
|
|
|
ParameterRoot.Items.Clear()
|
|
|
|
For Each oAttribute In oAttributes
|
|
Dim oControl As Control
|
|
|
|
Select Case oAttribute.DataType
|
|
Case "DATE"
|
|
oControl = New DateEdit
|
|
|
|
Case Else
|
|
oControl = New TextEdit
|
|
|
|
End Select
|
|
|
|
Dim oItem As LayoutControlItem = ParameterRoot.AddItem()
|
|
oItem.Text = oAttribute.Caption
|
|
oItem.Control = oControl
|
|
oItem.TextLocation = Locations.Top
|
|
oItem.TextToControlDistance = 3
|
|
oItem.Padding = New DevExpress.XtraLayout.Utils.Padding(0, 0, 10, 0)
|
|
Next
|
|
|
|
End Sub
|
|
|
|
Private Sub TreeListResults_FocusedNodeChanged(sender As Object, e As DevExpress.XtraTreeList.FocusedNodeChangedEventArgs) Handles TreeListResults.FocusedNodeChanged
|
|
If e.Node Is Nothing Then
|
|
Exit Sub
|
|
End If
|
|
|
|
Try
|
|
Dim oValues As Dictionary(Of String, String) = GetValuesFromNode(e.Node, DataColumns)
|
|
|
|
Dim oSQLCommands = oValues.
|
|
Where(Function(v) v.Key.StartsWith("SELECT")).
|
|
Where(Function(v) v.Value IsNot Nothing).
|
|
ToDictionary(Function(v) v.Key, Function(v) v.Value)
|
|
|
|
Dim oFilePaths = oValues.
|
|
Where(Function(v) v.Key.StartsWith("DOCVIEW")).
|
|
Where(Function(v) v.Value IsNot Nothing).
|
|
ToDictionary(Function(v) v.Key, Function(v) v.Value)
|
|
|
|
Dim oHtmlDocuments = oValues.
|
|
Where(Function(v) v.Key.StartsWith("HTML")).
|
|
Where(Function(v) v.Value IsNot Nothing).
|
|
ToDictionary(Function(v) v.Key, Function(v) v.Value)
|
|
|
|
Dim oAllTabs = SQLResultTabs.
|
|
Concat(FileResultTabs).
|
|
Concat(HtmlResultTabs)
|
|
For Each oTabPage In oAllTabs
|
|
oTabPage.PageVisible = False
|
|
Next
|
|
|
|
SplitContainerControl3.Collapsed = True
|
|
SplitContainerControl2.Collapsed = True
|
|
|
|
For Each oSQLCommand As KeyValuePair(Of String, String) In oSQLCommands
|
|
Try
|
|
Dim oExtracted = ExtractTitle(oSQLCommand.Value)
|
|
Dim oCommand = oExtracted.Item1
|
|
Dim oTitle = oExtracted.Item2
|
|
|
|
Dim oTable As DataTable = Database.GetDatatable(oCommand)
|
|
|
|
If oTable Is Nothing Then
|
|
Continue For
|
|
End If
|
|
|
|
Dim oGridIndex = Integer.Parse(oSQLCommand.Key.Last()) - 1
|
|
Dim oGridControl As GridControl = SQLResultGrids.Item(oGridIndex)
|
|
|
|
FillResultGrid(oGridControl, oTable, oTitle)
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
Continue For
|
|
End Try
|
|
Next
|
|
|
|
For Each oFile As KeyValuePair(Of String, String) In oFilePaths
|
|
Try
|
|
Dim oExtracted = ExtractTitle(oFile.Value)
|
|
Dim oPath = oExtracted.Item1
|
|
Dim oTitle = oExtracted.Item2
|
|
|
|
If oPath Is Nothing Then
|
|
Continue For
|
|
End If
|
|
|
|
If Not IO.File.Exists(oPath) Then
|
|
Continue For
|
|
End If
|
|
|
|
Dim oViewerIndex = Integer.Parse(oFile.Key.Last()) - 1
|
|
Dim oViewer As DocumentViewer = FileResultViewers.Item(oViewerIndex)
|
|
|
|
FillResultViewer(oViewer, oPath, oTitle)
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
Continue For
|
|
End Try
|
|
Next
|
|
|
|
For Each oFile As KeyValuePair(Of String, String) In oHtmlDocuments
|
|
Try
|
|
Dim oExtracted = ExtractTitle(oFile.Value)
|
|
Dim oHtml = oExtracted.Item1
|
|
Dim oTitle = oExtracted.Item2
|
|
|
|
If oHtml Is Nothing Then
|
|
Continue For
|
|
End If
|
|
|
|
Dim oViewerIndex = Integer.Parse(oFile.Key.Last()) - 1
|
|
Dim oViewer As RichEditControl = HtmlResultViewers.Item(oViewerIndex)
|
|
|
|
FillResultHtmlViewer(oViewer, oHtml, oTitle)
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
Continue For
|
|
End Try
|
|
Next
|
|
Catch ex As Exception
|
|
ShowErrorMessage(ex)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Function ExtractTitle(Value As String) As Tuple(Of String, String)
|
|
If Value.Contains("|"c) Then
|
|
Dim oSplit = Value.Split("|"c).ToList
|
|
Dim oValue = oSplit.First()
|
|
Dim oTitle = oSplit.Item(1)
|
|
|
|
Return New Tuple(Of String, String)(oValue, oTitle)
|
|
End If
|
|
|
|
Return New Tuple(Of String, String)(Value, Nothing)
|
|
End Function
|
|
|
|
Private Sub ExpandNodes(RootNode As TreeListNode, Condition As Predicate(Of TreeListNode))
|
|
For Each oNode As TreeListNode In RootNode.Nodes
|
|
ExpandNodes(oNode, Condition)
|
|
|
|
If Condition(oNode) = True Then
|
|
oNode.Expand()
|
|
ExpandParentNode(oNode)
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
Private Sub ExpandParentNode(ChildNode As TreeListNode)
|
|
If ChildNode.ParentNode IsNot Nothing Then
|
|
ChildNode.ParentNode.Expand()
|
|
ExpandParentNode(ChildNode.ParentNode)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub FillResultHtmlViewer(RichEditControl As RichEditControl, Html As String, Title As String)
|
|
RichEditControl.HtmlText = Html
|
|
|
|
Dim oTabPage = DirectCast(RichEditControl.Parent, XtraTabPage)
|
|
oTabPage.PageVisible = True
|
|
oTabPage.Text = NotNull(Title, oTabPage.Text)
|
|
|
|
XtraTabControl1.SelectedTabPage = oTabPage
|
|
End Sub
|
|
|
|
Private Sub FillResultViewer(DocumentViewer As DocumentViewer, Path As String, Title As String)
|
|
DocumentViewer.LoadFile(Path)
|
|
|
|
Dim oTabPage = DirectCast(DocumentViewer.Parent, XtraTabPage)
|
|
oTabPage.PageVisible = True
|
|
oTabPage.Text = NotNull(Title, oTabPage.Text)
|
|
|
|
XtraTabControl1.SelectedTabPage = oTabPage
|
|
End Sub
|
|
|
|
Private Sub FillResultGrid(GridControl As GridControl, Table As DataTable, Title As String)
|
|
GridControl.DataSource = Table
|
|
|
|
Dim oTabPage = DirectCast(GridControl.Parent, XtraTabPage)
|
|
oTabPage.PageVisible = True
|
|
oTabPage.Text = NotNull(Title, oTabPage.Text)
|
|
|
|
XtraTabControl3.SelectedTabPage = oTabPage
|
|
End Sub
|
|
|
|
Private Function GetValuesFromNode(Node As TreeListNode, ColumnNames As List(Of String)) As Dictionary(Of String, String)
|
|
Dim oValues As New Dictionary(Of String, String)
|
|
|
|
For Each oColumnName In ColumnNames
|
|
Dim oValue = MaybeGetValueForColumn(Node, oColumnName)
|
|
oValues.Add(oColumnName, oValue)
|
|
Next
|
|
|
|
Return oValues
|
|
End Function
|
|
|
|
Private Function MaybeGetValueForColumn(Node As TreeListNode, FieldName As String) As String
|
|
Dim oColumn = TreeListResults.Columns.Item(FieldName)
|
|
|
|
If oColumn Is Nothing Then
|
|
Return Nothing
|
|
End If
|
|
|
|
Dim oValue = Node.GetValue(oColumn)?.ToString
|
|
|
|
If oValue Is String.Empty Then
|
|
Return Nothing
|
|
Else
|
|
Return oValue
|
|
End If
|
|
End Function
|
|
|
|
Private Sub TreeListResults_CustomDrawNodeCell(sender As Object, e As DevExpress.XtraTreeList.CustomDrawNodeCellEventArgs) Handles TreeListResults.CustomDrawNodeCell
|
|
Dim oColumn = TreeListResults.Columns.Item("STATE")
|
|
Dim oState = NotNull(e.Node.GetValue(oColumn), Nothing)
|
|
|
|
If oState Is Nothing Then
|
|
Exit Sub
|
|
End If
|
|
|
|
Dim oColor As Color = Nothing
|
|
|
|
Select Case oState.ToString
|
|
Case STATE_SUCCESS
|
|
oColor = Color.LightGreen
|
|
Case STATE_FAILURE
|
|
oColor = Color.LightCoral
|
|
Case STATE_WARNING
|
|
oColor = Color.Yellow
|
|
Case STATE_WAITING
|
|
oColor = Color.LightSkyBlue
|
|
End Select
|
|
|
|
e.Appearance.BackColor = oColor
|
|
e.Appearance.Options.UseBackColor = True
|
|
e.Handled = False
|
|
End Sub
|
|
|
|
Private Sub TreeListResults_GetStateImage(sender As Object, e As DevExpress.XtraTreeList.GetStateImageEventArgs) Handles TreeListResults.GetStateImage
|
|
'Dim oValues As Dictionary(Of String, String) = GetValuesFromNode(e.Node, DataColumns)
|
|
'Dim oSQLCommands = oValues.
|
|
' Where(Function(v) v.Key.StartsWith("SELECT")).
|
|
' Where(Function(v) v.Value IsNot Nothing).
|
|
' Count()
|
|
|
|
'Dim oFilePaths = oValues.
|
|
' Where(Function(v) v.Key.StartsWith("DOCVIEW")).
|
|
' Where(Function(v) v.Value IsNot Nothing).
|
|
' Count()
|
|
|
|
'Dim oHtmlDocuments = oValues.
|
|
' Where(Function(v) v.Key.StartsWith("HTML")).
|
|
' Where(Function(v) v.Value IsNot Nothing).
|
|
' Count()
|
|
|
|
'Dim oIconColumn = TreeListResults.Columns.Item("ICON")
|
|
'Dim oIcon = NotNull(e.Node.GetValue(oIconColumn), Nothing)
|
|
'Dim oStateColumn = TreeListResults.Columns.Item("STATE")
|
|
'Dim oState = NotNull(e.Node.GetValue(oStateColumn), Nothing)
|
|
|
|
'If oSQLCommands > 0 Then
|
|
' e.NodeImageIndex = NodeImage.SQL
|
|
'ElseIf oFilePaths > 0 Then
|
|
' e.NodeImageIndex = NodeImage.File
|
|
'ElseIf oHtmlDocuments > 0 Then
|
|
' e.NodeImageIndex = NodeImage.Mail
|
|
'Else
|
|
' If oState IsNot Nothing AndAlso StateIcons.ContainsKey(oState) Then
|
|
' Dim oIconIndex = StateIcons.Item(oState)
|
|
' e.NodeImageIndex = oIconIndex
|
|
' Else
|
|
' e.NodeImageIndex = NodeImage.Default
|
|
' End If
|
|
'End If
|
|
End Sub
|
|
|
|
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
|
|
Dim oSQLConfig As New frmSQLConfig(LogConfig) With {
|
|
.ConnectionString = ConfigManager.Config.ConnectionString
|
|
}
|
|
|
|
If oSQLConfig.ShowDialog() = DialogResult.OK Then
|
|
ConfigManager.Config.ConnectionString = oSQLConfig.ConnectionString
|
|
ConfigManager.Save()
|
|
|
|
Database = New MSSQLServer(LogConfig, oSQLConfig.ConnectionString)
|
|
|
|
LoadSearches()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick
|
|
If ActiveSQLResultGrid IsNot Nothing Then
|
|
XtraSaveFileDialog1.Filter = "Excel Files (*.xlsx)|*.xlsx"
|
|
|
|
If XtraSaveFileDialog1.ShowDialog() = DialogResult.OK Then
|
|
ActiveSQLResultGrid.ExportToXlsx(XtraSaveFileDialog1.FileName)
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub BarButtonItem3_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem3.ItemClick
|
|
XtraSaveFileDialog1.Filter = "Excel Files (*.xlsx)|*.xlsx"
|
|
|
|
If XtraSaveFileDialog1.ShowDialog() = DialogResult.OK Then
|
|
TreeListResults.ExportToXlsx(XtraSaveFileDialog1.FileName)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub frmMonitor_KeyUp(sender As Object, e As KeyEventArgs) Handles Me.KeyUp
|
|
If e.KeyCode = Keys.F5 Then
|
|
Debug.Write("Debug.Write")
|
|
Console.WriteLine("Console.WriteLine")
|
|
Debug.Print("Debug.Print")
|
|
LoadData()
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Private Sub TreeListResults_MouseClick(sender As Object, e As MouseEventArgs) Handles TreeListResults.MouseClick
|
|
Dim oInfo As TreeListHitInfo = TreeListResults.CalcHitInfo(New Point(e.X, e.Y))
|
|
|
|
If oInfo.InRowCell Then
|
|
Dim oNode = oInfo.Node
|
|
Dim oValues As Dictionary(Of String, String) = GetValuesFromNode(oNode, DataColumns)
|
|
Console.WriteLine()
|
|
|
|
Dim oShouldToggleSQL = False
|
|
Dim oShouldToggleFile = False
|
|
|
|
For Each oValue As KeyValuePair(Of String, String) In oValues
|
|
If oValue.Key.Contains("SELECT") AndAlso oValue.Value IsNot Nothing Then
|
|
oShouldToggleSQL = True
|
|
Exit For
|
|
End If
|
|
Next
|
|
|
|
For Each oValue As KeyValuePair(Of String, String) In oValues
|
|
If oValue.Key.Contains("DOCVIEW") AndAlso oValue.Value IsNot Nothing Then
|
|
oShouldToggleFile = True
|
|
Exit For
|
|
End If
|
|
|
|
If oValue.Key.Contains("HTML") AndAlso oValue.Value IsNot Nothing Then
|
|
oShouldToggleFile = True
|
|
Exit For
|
|
End If
|
|
Next
|
|
|
|
If oShouldToggleSQL Then
|
|
SplitContainerControl3.Collapsed = Not SplitContainerControl3.Collapsed
|
|
End If
|
|
|
|
If oShouldToggleFile Then
|
|
SplitContainerControl2.Collapsed = Not SplitContainerControl2.Collapsed
|
|
End If
|
|
End If
|
|
End Sub
|
|
End Class
|
|
|