Rework Profiles, Add Validation, Add Placeholders, Add Controls
This commit is contained in:
parent
ad289ae666
commit
9b7c1d0e0a
@ -4,5 +4,5 @@ Public Class Config
|
||||
<ConnectionString>
|
||||
Public Property ConnectionString As String = String.Empty
|
||||
Public Property DBPrefix As String = "DD_ECM"
|
||||
Public Property SearchSQL As String = $"SELECT * FROM {DBPrefix}.[dbo].TBDD_MONITORING_PROFILE WHERE ACTIVE = 1 ORDER BY SEQUENCE"
|
||||
Public Property SearchSQL As String = $"SELECT * FROM {DBPrefix}.[dbo].[TBMON_PROFILE] WHERE ACTIVE = 1 ORDER BY SEQUENCE"
|
||||
End Class
|
||||
|
||||
@ -97,14 +97,19 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\DDMonorepo\Modules.Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Patterns">
|
||||
<HintPath>..\..\DDMonorepo\Modules.Patterns\bin\Debug\DigitalData.Modules.Patterns.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Runtime.Remoting" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Transactions" />
|
||||
@ -116,6 +121,8 @@
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="UIAutomationClient" />
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
|
||||
@ -10,6 +10,27 @@ Public Class SearchLoader
|
||||
Private Database As MSSQLServer
|
||||
|
||||
Public Searches As New List(Of Search)
|
||||
Public Parameters As New List(Of SearchParameter)
|
||||
|
||||
Public Enum ReturnTypeEnum
|
||||
Undefined
|
||||
Table
|
||||
TreeView
|
||||
End Enum
|
||||
|
||||
Public Enum DataTypeEnum
|
||||
Undefined
|
||||
[Boolean]
|
||||
[String]
|
||||
[Integer]
|
||||
[Date]
|
||||
End Enum
|
||||
|
||||
Public Enum ItemTypeEnum
|
||||
Undefined
|
||||
List
|
||||
SQL
|
||||
End Enum
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pConfig As Config, pDatabase As MSSQLServer)
|
||||
MyBase.New(pLogConfig)
|
||||
@ -23,11 +44,18 @@ Public Class SearchLoader
|
||||
Dim oTable = Database.GetDatatable(oSQL)
|
||||
|
||||
For Each oRow As DataRow In oTable.Rows
|
||||
Dim oSearchId = oRow.ItemEx("GUID", 0)
|
||||
Dim oParams = Parameters.
|
||||
Where(Function(param) param.SearchId = oSearchId).
|
||||
ToList()
|
||||
|
||||
Searches.Add(New Search With {
|
||||
.Id = CInt(oRow.Item("GUID")),
|
||||
.Title = oRow.ItemEx("TITLE", ""),
|
||||
.Description = oRow.ItemEx("DESCRIPTION", ""),
|
||||
.TypeName = "Varchar"
|
||||
.Id = oSearchId,
|
||||
.Title = oRow.ItemEx("TITLE", String.Empty),
|
||||
.Description = oRow.ItemEx("CAPTION", String.Empty),
|
||||
.ReturnType = GetReturnType(oRow.ItemEx("RETURN_TYPE", String.Empty)),
|
||||
.SQLCommand = oRow.ItemEx("EXEC_SQL", String.Empty),
|
||||
.Parameters = oParams
|
||||
})
|
||||
Next
|
||||
Catch ex As Exception
|
||||
@ -37,42 +65,98 @@ Public Class SearchLoader
|
||||
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"
|
||||
Public Function GetItemType(pTypeString As String) As ItemTypeEnum
|
||||
Select Case pTypeString
|
||||
Case "LIST"
|
||||
Return ItemTypeEnum.List
|
||||
Case "SQL"
|
||||
Return ItemTypeEnum.SQL
|
||||
Case Else
|
||||
Return ItemTypeEnum.Undefined
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Public Function GetReturnType(pTypeString As String) As ReturnTypeEnum
|
||||
Select Case pTypeString
|
||||
Case "Table"
|
||||
Return ReturnTypeEnum.Table
|
||||
Case "TreeView"
|
||||
Return ReturnTypeEnum.TreeView
|
||||
Case Else
|
||||
Return ReturnTypeEnum.Undefined
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Public Function GetDataType(pTypeString As String) As DataTypeEnum
|
||||
Select Case pTypeString
|
||||
Case "BIT"
|
||||
Return DataTypeEnum.Boolean
|
||||
Case "VARCHAR"
|
||||
Return DataTypeEnum.String
|
||||
Case "INT"
|
||||
Return DataTypeEnum.Integer
|
||||
Case "DATE"
|
||||
Return DataTypeEnum.Date
|
||||
Case Else
|
||||
Return DataTypeEnum.Undefined
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Public Sub LoadSearchParameters()
|
||||
Dim oSQL As String = $"SELECT * FROM TBMON_PROFILE_PARAM WHERE ACTIVE = 1 ORDER BY SEQUENCE"
|
||||
Dim oTable As DataTable = Database.GetDatatable(oSQL)
|
||||
Dim oAttributes As New List(Of SearchAttribute)
|
||||
Dim oParameters As New List(Of SearchParameter)
|
||||
|
||||
For Each oRow As DataRow In oTable.Rows
|
||||
oAttributes.Add(New SearchAttribute With {
|
||||
oParameters.Add(New SearchParameter With {
|
||||
.Id = oRow.ItemEx("GUID", 0),
|
||||
.Caption = oRow.ItemEx("CAPTION", String.Empty),
|
||||
.Title = oRow.ItemEx("CAPTION", String.Empty),
|
||||
.Description = oRow.ItemEx("DESCRIPTION", String.Empty),
|
||||
.DataType = oRow.ItemEx("DATA_TYPE", "VARCHAR")
|
||||
.DataType = GetDataType(oRow.ItemEx("DATA_TYPE", "VARCHAR")),
|
||||
.ItemString = oRow.ItemEx("ITEMS", String.Empty),
|
||||
.ItemType = GetItemType(oRow.ItemEx("ITEM_TYPE", String.Empty)),
|
||||
.Required = oRow.ItemEx("REQUIRED", True),
|
||||
.PatternTitle = oRow.ItemEx("PATTERN", String.Empty),
|
||||
.SearchId = oRow.ItemEx("PROFILE_ID", 0)
|
||||
})
|
||||
Next
|
||||
|
||||
Return oAttributes
|
||||
End Function
|
||||
Parameters = oParameters
|
||||
End Sub
|
||||
|
||||
Public Class Search
|
||||
Public Id As Integer
|
||||
Public Title As String
|
||||
Public Description As String
|
||||
Public TypeName As String
|
||||
Public SQLCommand As String
|
||||
Public ReturnType As ReturnTypeEnum
|
||||
|
||||
Public Parameters As List(Of SearchParameter)
|
||||
|
||||
Public Overrides Function ToString() As String
|
||||
Return Title
|
||||
End Function
|
||||
End Class
|
||||
|
||||
Public Class SearchAttribute
|
||||
Public Class SearchParameter
|
||||
Public Id As Integer
|
||||
Public Caption As String
|
||||
Public Title As String
|
||||
Public PatternTitle As String
|
||||
Public Description As String
|
||||
Public DataType As String
|
||||
Public DataType As DataTypeEnum
|
||||
Public ItemString As String
|
||||
Public ItemType As ItemTypeEnum
|
||||
Public Required As Boolean
|
||||
Public SearchId As Integer
|
||||
|
||||
Public ReadOnly Property HasItems As Boolean
|
||||
Get
|
||||
Return ItemType <> ItemTypeEnum.Undefined
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overrides Function ToString() As String
|
||||
Return Caption
|
||||
Return Title
|
||||
End Function
|
||||
End Class
|
||||
|
||||
|
||||
39
GUIs.Monitor/frmMonitor.Designer.vb
generated
39
GUIs.Monitor/frmMonitor.Designer.vb
generated
@ -70,6 +70,8 @@ Partial Class frmMonitor
|
||||
Me.SvgImageCollection1 = New DevExpress.Utils.SvgImageCollection(Me.components)
|
||||
Me.SplitContainerControl1 = New DevExpress.XtraEditors.SplitContainerControl()
|
||||
Me.SplitContainerControl3 = New DevExpress.XtraEditors.SplitContainerControl()
|
||||
Me.GridControlResults = New DevExpress.XtraGrid.GridControl()
|
||||
Me.GridViewResults = New DevExpress.XtraGrid.Views.Grid.GridView()
|
||||
Me.XtraTabControl3 = New DevExpress.XtraTab.XtraTabControl()
|
||||
Me.XtraTabPageSQL1 = New DevExpress.XtraTab.XtraTabPage()
|
||||
Me.GridControl2 = New DevExpress.XtraGrid.GridControl()
|
||||
@ -86,6 +88,7 @@ Partial Class frmMonitor
|
||||
Me.XtraTabPage3 = New DevExpress.XtraTab.XtraTabPage()
|
||||
Me.XtraTabPage4 = New DevExpress.XtraTab.XtraTabPage()
|
||||
Me.XtraSaveFileDialog1 = New DevExpress.XtraEditors.XtraSaveFileDialog(Me.components)
|
||||
Me.AdornerUIManager2 = New DevExpress.Utils.VisualEffects.AdornerUIManager(Me.components)
|
||||
CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.ApplicationMenu1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.LayoutControl1, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
@ -116,6 +119,8 @@ Partial Class frmMonitor
|
||||
CType(Me.SplitContainerControl3.Panel2, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.SplitContainerControl3.Panel2.SuspendLayout()
|
||||
Me.SplitContainerControl3.SuspendLayout()
|
||||
CType(Me.GridControlResults, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.GridViewResults, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.XtraTabControl3, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.XtraTabControl3.SuspendLayout()
|
||||
Me.XtraTabPageSQL1.SuspendLayout()
|
||||
@ -137,6 +142,7 @@ Partial Class frmMonitor
|
||||
CType(Me.XtraTabControl2, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.XtraTabControl2.SuspendLayout()
|
||||
Me.XtraTabPage3.SuspendLayout()
|
||||
CType(Me.AdornerUIManager2, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'RibbonControl1
|
||||
@ -379,12 +385,12 @@ Partial Class frmMonitor
|
||||
'TreeListResults
|
||||
'
|
||||
Me.TreeListResults.Columns.AddRange(New DevExpress.XtraTreeList.Columns.TreeListColumn() {Me.colState, Me.colICON, Me.colCOLUMN1, Me.colCOLUMN2, Me.colCOLUMN3, Me.colADDED_WHEN, Me.TreeListColumn1, Me.TreeListColumn2, Me.TreeListColumn3, Me.TreeListColumn4, Me.TreeListColumn5, Me.TreeListColumn6, Me.TreeListColumn7, Me.TreeListColumn8})
|
||||
Me.TreeListResults.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
Me.TreeListResults.Location = New System.Drawing.Point(0, 0)
|
||||
Me.TreeListResults.Location = New System.Drawing.Point(23, 13)
|
||||
Me.TreeListResults.MenuManager = Me.RibbonControl1
|
||||
Me.TreeListResults.Name = "TreeListResults"
|
||||
Me.TreeListResults.Size = New System.Drawing.Size(713, 181)
|
||||
Me.TreeListResults.Size = New System.Drawing.Size(313, 158)
|
||||
Me.TreeListResults.TabIndex = 4
|
||||
Me.TreeListResults.Visible = False
|
||||
'
|
||||
'colState
|
||||
'
|
||||
@ -539,6 +545,7 @@ Partial Class frmMonitor
|
||||
'
|
||||
'SplitContainerControl3.Panel1
|
||||
'
|
||||
Me.SplitContainerControl3.Panel1.Controls.Add(Me.GridControlResults)
|
||||
Me.SplitContainerControl3.Panel1.Controls.Add(Me.TreeListResults)
|
||||
Me.SplitContainerControl3.Panel1.Text = "Panel1"
|
||||
'
|
||||
@ -550,6 +557,22 @@ Partial Class frmMonitor
|
||||
Me.SplitContainerControl3.SplitterPosition = 181
|
||||
Me.SplitContainerControl3.TabIndex = 5
|
||||
'
|
||||
'GridControlResults
|
||||
'
|
||||
Me.GridControlResults.Location = New System.Drawing.Point(342, 13)
|
||||
Me.GridControlResults.MainView = Me.GridViewResults
|
||||
Me.GridControlResults.MenuManager = Me.RibbonControl1
|
||||
Me.GridControlResults.Name = "GridControlResults"
|
||||
Me.GridControlResults.Size = New System.Drawing.Size(368, 158)
|
||||
Me.GridControlResults.TabIndex = 5
|
||||
Me.GridControlResults.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridViewResults})
|
||||
Me.GridControlResults.Visible = False
|
||||
'
|
||||
'GridViewResults
|
||||
'
|
||||
Me.GridViewResults.GridControl = Me.GridControlResults
|
||||
Me.GridViewResults.Name = "GridViewResults"
|
||||
'
|
||||
'XtraTabControl3
|
||||
'
|
||||
Me.XtraTabControl3.Dock = System.Windows.Forms.DockStyle.Fill
|
||||
@ -687,6 +710,10 @@ Partial Class frmMonitor
|
||||
'
|
||||
Me.XtraSaveFileDialog1.FileName = "XtraSaveFileDialog1"
|
||||
'
|
||||
'AdornerUIManager2
|
||||
'
|
||||
Me.AdornerUIManager2.Owner = Me
|
||||
'
|
||||
'frmMonitor
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
@ -731,6 +758,8 @@ Partial Class frmMonitor
|
||||
Me.SplitContainerControl3.Panel2.ResumeLayout(False)
|
||||
CType(Me.SplitContainerControl3, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.SplitContainerControl3.ResumeLayout(False)
|
||||
CType(Me.GridControlResults, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.GridViewResults, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.XtraTabControl3, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.XtraTabControl3.ResumeLayout(False)
|
||||
Me.XtraTabPageSQL1.ResumeLayout(False)
|
||||
@ -752,6 +781,7 @@ Partial Class frmMonitor
|
||||
CType(Me.XtraTabControl2, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.XtraTabControl2.ResumeLayout(False)
|
||||
Me.XtraTabPage3.ResumeLayout(False)
|
||||
CType(Me.AdornerUIManager2, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.ResumeLayout(False)
|
||||
Me.PerformLayout()
|
||||
|
||||
@ -819,4 +849,7 @@ Partial Class frmMonitor
|
||||
Friend WithEvents TreeListColumn6 As DevExpress.XtraTreeList.Columns.TreeListColumn
|
||||
Friend WithEvents TreeListColumn7 As DevExpress.XtraTreeList.Columns.TreeListColumn
|
||||
Friend WithEvents TreeListColumn8 As DevExpress.XtraTreeList.Columns.TreeListColumn
|
||||
Friend WithEvents AdornerUIManager2 As DevExpress.Utils.VisualEffects.AdornerUIManager
|
||||
Friend WithEvents GridControlResults As DevExpress.XtraGrid.GridControl
|
||||
Friend WithEvents GridViewResults As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
End Class
|
||||
|
||||
@ -196,4 +196,7 @@
|
||||
<metadata name="XtraSaveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>335, 17</value>
|
||||
</metadata>
|
||||
<metadata name="AdornerUIManager2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>494, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@ -8,6 +8,7 @@ Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Language.Utils
|
||||
Imports DigitalData.Modules.Language
|
||||
Imports DigitalData.Modules.Patterns
|
||||
Imports DevExpress.XtraTab
|
||||
Imports DigitalData.Controls.DocumentViewer
|
||||
Imports DevExpress.XtraEditors
|
||||
@ -20,12 +21,14 @@ Imports DigitalData.GUIs.Monitor.SearchLoader
|
||||
Imports DevExpress.XtraLayout
|
||||
Imports DevExpress.XtraTreeList
|
||||
|
||||
|
||||
Public Class frmMonitor
|
||||
Public Property LogConfig As LogConfig
|
||||
Public Property Logger As Logger
|
||||
Public Property ConfigManager As ConfigManager(Of Config)
|
||||
Public Property Database As MSSQLServer
|
||||
Public Property FormHelper As FormHelper
|
||||
Public Property Patterns As Patterns2
|
||||
|
||||
Private ReadOnly SQLColumns As New List(Of String) From {"SELECT1", "SELECT2", "SELECT3", "SELECT4"}
|
||||
Private ReadOnly DocViewColumns As New List(Of String) From {"DOCVIEW1", "DOCVIEW2"}
|
||||
@ -76,13 +79,17 @@ Public Class frmMonitor
|
||||
}
|
||||
|
||||
Private GridBuilder As GridBuilder
|
||||
Private ControlHelper As Common.ControlHelper
|
||||
|
||||
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")
|
||||
Logger = LogConfig.GetLogger()
|
||||
|
||||
ConfigManager = New ConfigManager(Of Config)(LogConfig, Application.UserAppDataPath, Application.UserAppDataPath, Application.StartupPath)
|
||||
Patterns = New Patterns2(LogConfig)
|
||||
FormHelper = New FormHelper(LogConfig, Me)
|
||||
ControlHelper = New Common.ControlHelper(LogConfig)
|
||||
|
||||
If ConfigManager.Config.ConnectionString = String.Empty Then
|
||||
Dim oSQLConfig As New frmSQLConfig(LogConfig)
|
||||
@ -108,7 +115,7 @@ Public Class frmMonitor
|
||||
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 = New GridBuilder(New List(Of GridView) From {GridView1, GridView2, GridView3, GridView4, GridViewResults})
|
||||
GridBuilder.
|
||||
WithDefaults().
|
||||
WithDefaults(TreeListResults).
|
||||
@ -124,8 +131,10 @@ Public Class frmMonitor
|
||||
HtmlResultViewers = New List(Of RichEditControl) From {RichEditControl1, RichEditControl2}
|
||||
HtmlResultTabs = New List(Of XtraTabPage) From {XtraTabPageHtml1, XtraTabPageHtml2}
|
||||
|
||||
SearchLoader.LoadSearchParameters()
|
||||
LoadSearches()
|
||||
|
||||
|
||||
Dim oLicense = LoadGDPicture()
|
||||
|
||||
For Each oGrid In SQLResultGrids
|
||||
@ -162,43 +171,103 @@ Public Class frmMonitor
|
||||
|
||||
Private Function LoadData() As Boolean
|
||||
Try
|
||||
TreeListResults.DataSource = Nothing
|
||||
GridControlResults.DataSource = Nothing
|
||||
|
||||
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 oSearch As Search = cmbSearches.EditValue
|
||||
Dim oMissingParams = False
|
||||
|
||||
With AdornerUIManager2.ValidationHintProperties
|
||||
.State = VisualEffects.ValidationHintState.Invalid
|
||||
.InvalidState.ShowBorder = True
|
||||
.InvalidState.ShowBackgroundMode = VisualEffects.ValidationHintBackgroundMode.Target
|
||||
End With
|
||||
|
||||
AdornerUIManager2.Hide()
|
||||
AdornerUIManager2.Elements.Clear()
|
||||
|
||||
'Dim oSQL As String = $"EXEC [{ConfigManager.Config.DBPrefix}].[dbo].[PRDD_MONITORING_GET_TREEVIEW_RESULT] '{cmbSearches.EditValue}','irgendwas','irgendwas','irgendwas',1"
|
||||
Dim oSQL As String = oSearch.SQLCommand
|
||||
Dim oControls As New List(Of Control)
|
||||
For Each oItem As LayoutControlItem In ParameterRoot.Items
|
||||
oControls.Add(oItem.Control)
|
||||
|
||||
Dim oParam = oSearch.Parameters.
|
||||
Where(Function(param) param.PatternTitle = oItem.Control.Name).
|
||||
FirstOrDefault()
|
||||
|
||||
If oParam.Required And Not ControlHelper.HasValue(oItem.Control) Then
|
||||
AdornerUIManager2.Elements.Add(New VisualEffects.ValidationHint With {
|
||||
.TargetElement = oItem.Control,
|
||||
.Visible = True
|
||||
})
|
||||
oMissingParams = True
|
||||
End If
|
||||
|
||||
|
||||
Next
|
||||
|
||||
AdornerUIManager2.Show()
|
||||
|
||||
If oMissingParams = True Then
|
||||
|
||||
Return False
|
||||
End If
|
||||
|
||||
oSQL = Patterns.ReplaceControlValues(oSQL, oControls)
|
||||
Dim oTable As DataTable = Database.GetDatatable(oSQL)
|
||||
|
||||
TreeListResults.DataSource = oTable
|
||||
If oSearch.ReturnType = ReturnTypeEnum.TreeView Then
|
||||
GridControlResults.Visible = False
|
||||
GridControlResults.Dock = DockStyle.None
|
||||
|
||||
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
|
||||
TreeListResults.Visible = True
|
||||
TreeListResults.Dock = DockStyle.Fill
|
||||
|
||||
InitTreeList(oMaxLength)
|
||||
TreeListResults.DataSource = oTable
|
||||
|
||||
' 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 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
|
||||
|
||||
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.ToString, String.Empty)
|
||||
Return oValue IsNot Nothing AndAlso (oValue = STATE_WARNING Or oValue = STATE_FAILURE)
|
||||
End Function)
|
||||
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.ToString, String.Empty)
|
||||
Return oValue IsNot Nothing AndAlso (oValue = STATE_WARNING Or oValue = STATE_FAILURE)
|
||||
End Function)
|
||||
Next
|
||||
Else
|
||||
GridControlResults.Visible = True
|
||||
GridControlResults.Dock = DockStyle.Fill
|
||||
|
||||
TreeListResults.Visible = False
|
||||
TreeListResults.Dock = DockStyle.None
|
||||
|
||||
GridControlResults.DataSource = oTable
|
||||
End If
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
@ -288,32 +357,72 @@ Public Class frmMonitor
|
||||
|
||||
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()
|
||||
ParameterRoot.Clear()
|
||||
AdornerUIManager2.Hide()
|
||||
AdornerUIManager2.Elements.Clear()
|
||||
|
||||
For Each oAttribute In oAttributes
|
||||
For Each oParam As SearchParameter In oSearch.Parameters
|
||||
Dim oControl As Control
|
||||
|
||||
Select Case oAttribute.DataType
|
||||
Case "DATE"
|
||||
oControl = New DateEdit
|
||||
Select Case oParam.DataType
|
||||
Case DataTypeEnum.Boolean
|
||||
oControl = New CheckEdit()
|
||||
|
||||
Case DataTypeEnum.Date
|
||||
oControl = New DateEdit()
|
||||
|
||||
Case DataTypeEnum.String
|
||||
Select Case oParam.ItemType
|
||||
Case ItemTypeEnum.List
|
||||
Dim oCombobox = New ComboBoxEdit()
|
||||
Dim oItems = oParam.ItemString.Split(";"c).ToList()
|
||||
oCombobox.Properties.Items.AddRange(oItems)
|
||||
oControl = oCombobox
|
||||
|
||||
Case ItemTypeEnum.SQL
|
||||
Dim oGridCombobox = New LookUpEdit()
|
||||
Dim oSQL = oParam.ItemString
|
||||
Dim oTable = Database.GetDatatable(oSQL)
|
||||
oGridCombobox.Properties.DataSource = oTable
|
||||
oGridCombobox.Properties.DisplayMember = oTable.Columns.Item(0).ColumnName
|
||||
oGridCombobox.Properties.ValueMember = oTable.Columns.Item(0).ColumnName
|
||||
oControl = oGridCombobox
|
||||
|
||||
Case Else
|
||||
oControl = New TextEdit()
|
||||
End Select
|
||||
|
||||
Case Else
|
||||
oControl = New TextEdit
|
||||
oControl = New TextEdit()
|
||||
|
||||
End Select
|
||||
|
||||
oControl.Name = oParam.PatternTitle
|
||||
|
||||
Dim oItem As LayoutControlItem = ParameterRoot.AddItem()
|
||||
oItem.Text = oAttribute.Caption
|
||||
oItem.Text = oParam.Title
|
||||
oItem.Control = oControl
|
||||
oItem.TextLocation = Locations.Top
|
||||
oItem.TextToControlDistance = 3
|
||||
oItem.Padding = New DevExpress.XtraLayout.Utils.Padding(0, 0, 10, 0)
|
||||
Next
|
||||
|
||||
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Function GetParameterItems(pParam As SearchParameter) As Object
|
||||
Select Case pParam.ItemType
|
||||
Case ItemTypeEnum.List
|
||||
Return pParam.ItemString.Split(";"c).ToList()
|
||||
|
||||
Case ItemTypeEnum.SQL
|
||||
Dim oSQL = pParam.ItemString
|
||||
Dim oTable = Database.GetDatatable(oSQL)
|
||||
Return oTable
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Sub TreeListResults_FocusedNodeChanged(sender As Object, e As DevExpress.XtraTreeList.FocusedNodeChangedEventArgs) Handles TreeListResults.FocusedNodeChanged
|
||||
If e.Node Is Nothing Then
|
||||
Exit Sub
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user