165 lines
5.6 KiB
VB.net
165 lines
5.6 KiB
VB.net
Imports DevExpress.Utils
|
|
Imports DevExpress.XtraBars.Docking2010.Views
|
|
Imports DevExpress.XtraBars.Ribbon
|
|
Imports DevExpress.XtraGrid
|
|
Imports DevExpress.XtraGrid.Views.Grid
|
|
Imports DevExpress.XtraGrid.Views.Grid.ViewInfo
|
|
Imports DevExpress.XtraTab
|
|
Imports DigitalData.Modules.Logging
|
|
|
|
Public Class frmAdmin_Start
|
|
Private Const IDB_START = "IDB_START"
|
|
Private Const IDB_ATTRIBUTES = "IDB_ATTRIBUTES"
|
|
Private Const IDB_BUSINESS_ENTITY = "IDB_BUSINESS_ENTITY"
|
|
Private Const GLOBIX = "GLOBIX"
|
|
Private Const CLIPBOARD_WATCHER = "CLIPBOARD_WATCHER"
|
|
|
|
Private Logger As Logger
|
|
Private PrimaryKey As String = Nothing
|
|
|
|
Private SourceCommands As New Dictionary(Of String, SourceSql)
|
|
Private CurrentPage As String
|
|
|
|
|
|
Private Class SourceSql
|
|
Public Title As String
|
|
Public SQL As String
|
|
Public PrimaryKey As String
|
|
End Class
|
|
|
|
Private Sub frmAdministration_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
Logger = My.LogConfig.GetLogger
|
|
|
|
Load_SourceSql()
|
|
|
|
TreeListMenu.ExpandAll()
|
|
|
|
' Show Tab Header in Development, hide when running the app
|
|
XtraTabControl.ShowTabHeader = DefaultBoolean.False
|
|
End Sub
|
|
|
|
Private Sub Load_SourceSql()
|
|
Dim oTable As DataTable = My.Database.GetDatatable("SELECT * FROM TBZF_ADMIN_SOURCE_SQL")
|
|
|
|
For Each oRow As DataRow In oTable.Rows
|
|
Dim oSource As New SourceSql With {
|
|
.PrimaryKey = oRow.Item("PK_COLUMN"),
|
|
.SQL = oRow.Item("SQL_COMMAND"),
|
|
.Title = oRow.Item("ENTITY_TITLE")
|
|
}
|
|
|
|
SourceCommands.Add(oRow.Item("ENTITY_TITLE"), oSource)
|
|
Next
|
|
End Sub
|
|
|
|
Sub Display_Tab(pPageToDisplay As XtraTabPage, pTabControl As XtraTabControl)
|
|
Try
|
|
For Each oDocument As XtraTabPage In pTabControl.TabPages
|
|
If oDocument.Name = pPageToDisplay.Name Then
|
|
oDocument.PageVisible = True
|
|
Else
|
|
oDocument.PageVisible = False
|
|
End If
|
|
Next
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
End Try
|
|
End Sub
|
|
|
|
Sub Display_RibbonPage(PageToDisplay As RibbonPage)
|
|
Try
|
|
For Each oPage As RibbonPage In RibbonControl1.Pages
|
|
If oPage.Name = PageToDisplay.Name Then
|
|
oPage.Visible = True
|
|
Else
|
|
oPage.Visible = False
|
|
End If
|
|
Next
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub TreeList1_FocusedNodeChanged(sender As Object, e As DevExpress.XtraTreeList.FocusedNodeChangedEventArgs) Handles TreeListMenu.FocusedNodeChanged
|
|
If e.Node Is Nothing OrElse e.Node.Tag Is Nothing Then
|
|
Exit Sub
|
|
End If
|
|
|
|
CurrentPage = e.Node.Tag.ToString
|
|
Dim oSource As SourceSql = SourceCommands.Item(CurrentPage)
|
|
|
|
Select Case e.Node.Tag.ToString
|
|
Case IDB_START
|
|
Display_Tab(XtraTabPage_IDB, XtraTabControl)
|
|
|
|
Case IDB_ATTRIBUTES
|
|
Display_Tab(XtraTabPage_IDB, XtraTabControl)
|
|
Display_Tab(XtraTabPageIDB_Attributes_New, XtraTabControlIDB)
|
|
|
|
Dim oTable As DataTable = My.Database.GetDatatable(oSource.SQL)
|
|
Load_Grid(oTable, oSource.PrimaryKey, GridAttributes)
|
|
|
|
Case IDB_BUSINESS_ENTITY
|
|
'DisplayTab(XtraTabPage_Entities)
|
|
|
|
Case GLOBIX
|
|
Display_Tab(XtraTabPage_GlobalIndexer, XtraTabControl)
|
|
Display_RibbonPage(RibbonPage_GlobalIndexer)
|
|
|
|
Case CLIPBOARD_WATCHER
|
|
Display_Tab(XtraTabPage_ClipboardWatcher, XtraTabControl)
|
|
Display_RibbonPage(RibbonPage_ClipboardWatcher)
|
|
|
|
End Select
|
|
End Sub
|
|
|
|
Private Sub Load_Grid(DataSource As DataTable, PrimaryKey As String, GridControl As GridControl)
|
|
Try
|
|
Me.PrimaryKey = PrimaryKey
|
|
|
|
GridControl.DataSource = DataSource
|
|
GridControl.ForceInitialize()
|
|
|
|
Dim oGridView = DirectCast(GridControl.DefaultView, GridView)
|
|
|
|
With oGridView.OptionsBehavior
|
|
.Editable = False
|
|
.ReadOnly = True
|
|
End With
|
|
|
|
With oGridView.OptionsView
|
|
.ShowAutoFilterRow = True
|
|
End With
|
|
|
|
oGridView.BestFitColumns()
|
|
|
|
Catch ex As Exception
|
|
MsgBox("Fehler beim Laden.", MsgBoxStyle.Critical, Text)
|
|
Logger.Error(ex)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub ViewAttributes_DoubleClick(sender As Object, e As EventArgs) Handles ViewAttributes.DoubleClick
|
|
Dim view As GridView = TryCast(sender, GridView)
|
|
Dim hitInfo As GridHitInfo = view.CalcHitInfo((TryCast(e, DXMouseEventArgs)).Location)
|
|
If hitInfo.InDataRow Then
|
|
Try
|
|
Dim oRow As DataRow = ViewAttributes.GetFocusedDataRow
|
|
Dim oPrimaryKey As Integer = oRow.Item(PrimaryKey)
|
|
Dim oForm As New frmAdmin_Attribute(oPrimaryKey)
|
|
|
|
GridView1.ShowLoadingPanel()
|
|
oForm.ShowDialog()
|
|
GridView1.HideLoadingPanel()
|
|
|
|
If oForm.HasChanges Then
|
|
Dim oSource As SourceSql = SourceCommands.Item(CurrentPage)
|
|
Dim oTable As DataTable = My.Database.GetDatatable(oSource.SQL)
|
|
Load_Grid(oTable, oSource.PrimaryKey, GridAttributes)
|
|
End If
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
End Try
|
|
End If
|
|
End Sub
|
|
End Class |