ZooFlow: Admin
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
Imports System.ComponentModel
|
||||
Imports DevExpress.Utils
|
||||
Imports DevExpress.Utils
|
||||
Imports DevExpress.XtraBars.Ribbon
|
||||
Imports DevExpress.XtraEditors.Controls
|
||||
Imports DevExpress.XtraEditors.Repository
|
||||
@@ -8,7 +7,6 @@ Imports DevExpress.XtraGrid.Columns
|
||||
Imports DevExpress.XtraGrid.Views.Grid
|
||||
Imports DevExpress.XtraGrid.Views.Grid.ViewInfo
|
||||
Imports DevExpress.XtraTab
|
||||
Imports DevExpress.XtraTreeList
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class frmAdmin_Start
|
||||
@@ -32,31 +30,50 @@ Public Class frmAdmin_Start
|
||||
Private Const PAGE_META_SOURCE_SQL = "META_SOURCE_SQL"
|
||||
|
||||
Private PrimaryKey As String = Nothing
|
||||
Private AdminItems As New List(Of AdminItem)
|
||||
|
||||
Private AdminItems As New Dictionary(Of String, AdminItem)
|
||||
Private AdminNodes As New Dictionary(Of String, AdminNode) From {
|
||||
{PAGE_IDB_ATTRIBUTES,
|
||||
New AdminNode With {
|
||||
.Title = "IDB Attribute",
|
||||
.[Module] = MODULE_IDB,
|
||||
.Entity = PAGE_IDB_ATTRIBUTES
|
||||
}},
|
||||
{PAGE_IDB_BUSINESS_ENTITIES,
|
||||
New AdminNode With {
|
||||
.Title = "IDB Entitäten",
|
||||
.[Module] = MODULE_IDB,
|
||||
.Entity = PAGE_IDB_BUSINESS_ENTITIES
|
||||
}},
|
||||
{PAGE_META_SOURCE_SQL,
|
||||
New AdminNode With {
|
||||
.Title = "Source SQL",
|
||||
.[Module] = MODULE_META,
|
||||
.Entity = PAGE_META_SOURCE_SQL
|
||||
}},
|
||||
{PAGE_GLOBIX_PROFILES,
|
||||
New AdminNode With {
|
||||
.Title = "Global Indexer Profile",
|
||||
.[Module] = MODULE_GLOBIX,
|
||||
.Entity = PAGE_GLOBIX_PROFILES
|
||||
}},
|
||||
{PAGE_CW_PROFILES,
|
||||
New AdminNode With {
|
||||
.Title = "Clipboard Watcher Profile",
|
||||
.[Module] = MODULE_CW,
|
||||
.Entity = PAGE_CW_PROFILES
|
||||
}}
|
||||
}
|
||||
|
||||
Private CurrentModule As String
|
||||
Private CurrentPage As String
|
||||
Private CurrentItem As AdminItem
|
||||
|
||||
Private Function IsIDBAttributes(Item As AdminItem) As Boolean
|
||||
Return Item.Entity = PAGE_IDB_ATTRIBUTES
|
||||
End Function
|
||||
|
||||
Private Function IsIDBEntities(Item As AdminItem) As Boolean
|
||||
Return Item.Entity = PAGE_IDB_BUSINESS_ENTITIES
|
||||
End Function
|
||||
|
||||
Private Function IsCWPRofiles(Item As AdminItem) As Boolean
|
||||
Return Item.Entity = PAGE_CW_PROFILES
|
||||
End Function
|
||||
|
||||
Private Function IsGLOBIXProfiles(Item As AdminItem) As Boolean
|
||||
Return Item.Entity = PAGE_GLOBIX_PROFILES
|
||||
End Function
|
||||
|
||||
Private Function IsSourceSQL(Item As AdminItem) As Boolean
|
||||
Return Item.Entity = PAGE_META_SOURCE_SQL
|
||||
End Function
|
||||
Private Class AdminNode
|
||||
Public Property Title As String
|
||||
Public Property [Module] As String
|
||||
Public Property Entity As String
|
||||
End Class
|
||||
|
||||
Private Class AdminItem
|
||||
Public Property Guid As Integer
|
||||
@@ -73,8 +90,6 @@ Public Class frmAdmin_Start
|
||||
Load_SQLData()
|
||||
|
||||
TreeListMenu.ExpandAll()
|
||||
|
||||
AddHandler GridControl1.DoubleClick, AddressOf GridControl_DoubleClick
|
||||
End Sub
|
||||
|
||||
Private Function Load_SQLData() As Boolean
|
||||
@@ -100,7 +115,7 @@ Public Class frmAdmin_Start
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
|
||||
AdminItems.Add(oItem)
|
||||
AdminItems.Add(oItem.Entity, oItem)
|
||||
Next
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
@@ -109,37 +124,7 @@ Public Class frmAdmin_Start
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Sub Display_Tab(pPageToDisplay As XtraTabPage)
|
||||
Try
|
||||
If pPageToDisplay.TabControl Is Nothing Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
For Each oDocument As XtraTabPage In pPageToDisplay.TabControl.TabPages
|
||||
If oDocument.Name = pPageToDisplay.Name Then
|
||||
oDocument.PageVisible = True
|
||||
Else
|
||||
oDocument.PageVisible = False
|
||||
End If
|
||||
Next
|
||||
Catch ex As Exception
|
||||
ShowError(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
|
||||
RibbonControl1.SelectedPage = PageToDisplay
|
||||
End If
|
||||
Next
|
||||
Catch ex As Exception
|
||||
ShowError(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub TreeList1_FocusedNodeChanged(sender As Object, e As DevExpress.XtraTreeList.FocusedNodeChangedEventArgs) Handles TreeListMenu.FocusedNodeChanged
|
||||
Private Sub TreeListMenu_FocusedNodeChanged(sender As Object, e As DevExpress.XtraTreeList.FocusedNodeChangedEventArgs) Handles TreeListMenu.FocusedNodeChanged
|
||||
Try
|
||||
If e.Node Is Nothing OrElse e.Node.Tag Is Nothing Then
|
||||
labelTitle.Text = "Start"
|
||||
@@ -148,47 +133,25 @@ Public Class frmAdmin_Start
|
||||
|
||||
CurrentPage = e.Node.Tag.ToString
|
||||
|
||||
Select Case e.Node.Tag.ToString
|
||||
Case PAGE_IDB_START
|
||||
CurrentModule = MODULE_IDB
|
||||
labelTitle.Text = "IDB Übersicht"
|
||||
|
||||
Case PAGE_IDB_ATTRIBUTES
|
||||
CurrentModule = MODULE_IDB
|
||||
labelTitle.Text = "IDB Attribute"
|
||||
If AdminNodes.ContainsKey(CurrentPage) Then
|
||||
Dim oNode = AdminNodes.Item(CurrentPage)
|
||||
CurrentModule = oNode.Module
|
||||
labelTitle.Text = oNode.Title
|
||||
Else
|
||||
MsgBox($"Page [{CurrentPage}] not found in AdminNodes! Exiting." & vbNewLine &
|
||||
"Check your definitions in the TreeList NodeEditor and in SourceSQL", MsgBoxStyle.Critical, Text)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
CurrentItem = AdminItems.Where(AddressOf IsIDBAttributes).FirstOrDefault()
|
||||
Load_Tree(CurrentItem)
|
||||
|
||||
Case PAGE_IDB_BUSINESS_ENTITIES
|
||||
CurrentModule = MODULE_IDB
|
||||
labelTitle.Text = "IDB Entitäten"
|
||||
|
||||
CurrentItem = AdminItems.Where(AddressOf IsIDBEntities).FirstOrDefault()
|
||||
Load_Tree(CurrentItem)
|
||||
|
||||
Case PAGE_GLOBIX_PROFILES
|
||||
CurrentModule = MODULE_GLOBIX
|
||||
labelTitle.Text = "Global Indexer Profile"
|
||||
|
||||
CurrentItem = AdminItems.Where(AddressOf IsGLOBIXProfiles).FirstOrDefault()
|
||||
Load_Tree(CurrentItem)
|
||||
|
||||
Case PAGE_CW_PROFILES
|
||||
CurrentModule = MODULE_CW
|
||||
labelTitle.Text = "Clipboard Watcher Profile"
|
||||
|
||||
CurrentItem = AdminItems.Where(AddressOf IsCWPRofiles).FirstOrDefault()
|
||||
Load_Tree(CurrentItem)
|
||||
|
||||
Case PAGE_META_SOURCE_SQL
|
||||
CurrentModule = MODULE_META
|
||||
labelTitle.Text = "Source SQL"
|
||||
|
||||
CurrentItem = AdminItems.Where(AddressOf IsSourceSQL).FirstOrDefault()
|
||||
Load_Tree(CurrentItem)
|
||||
|
||||
End Select
|
||||
If AdminItems.ContainsKey(CurrentPage) Then
|
||||
CurrentItem = AdminItems.Item(CurrentPage)
|
||||
Load_GridData(CurrentItem)
|
||||
Else
|
||||
MsgBox($"Page [{CurrentPage}] not found in AdminItems! Exiting." & vbNewLine &
|
||||
"Check your definitions in the TreeList NodeEditor and in SourceSQL", MsgBoxStyle.Critical, Text)
|
||||
Exit Sub
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ShowError(ex)
|
||||
End Try
|
||||
@@ -218,7 +181,7 @@ Public Class frmAdmin_Start
|
||||
End With
|
||||
End Sub
|
||||
|
||||
Private Sub Load_Tree(Source As AdminItem)
|
||||
Private Sub Load_GridData(Source As AdminItem)
|
||||
If Source Is Nothing OrElse Source.SQLResult Is Nothing Then
|
||||
Exit Sub
|
||||
End If
|
||||
@@ -281,13 +244,12 @@ Public Class frmAdmin_Start
|
||||
GridView1.BestFitColumns()
|
||||
End Sub
|
||||
|
||||
Private Sub GridControl_DoubleClick(sender As Object, e As EventArgs) Handles GridControl1.DoubleClick
|
||||
Dim oGrid As GridControl = TryCast(sender, GridControl)
|
||||
Dim oView As GridView = oGrid.MainView
|
||||
Dim hitInfo As GridHitInfo = oView.CalcHitInfo(TryCast(e, DXMouseEventArgs).Location)
|
||||
If hitInfo.InRow Then
|
||||
Try
|
||||
Dim oRowView As DataRowView = oView.GetFocusedRow
|
||||
|
||||
Private Sub GridView1_RowClick(sender As Object, e As RowClickEventArgs) Handles GridView1.RowClick
|
||||
Try
|
||||
If e.Clicks = 2 And e.Button = MouseButtons.Left Then
|
||||
Dim oView As GridView = TryCast(sender, GridView)
|
||||
Dim oRowView As DataRowView = oView.GetRow(e.RowHandle)
|
||||
Dim oItem As AdminItem = CurrentItem
|
||||
Dim oGuid = oRowView.Row.Item(oItem.PrimaryKey)
|
||||
|
||||
@@ -308,12 +270,15 @@ Public Class frmAdmin_Start
|
||||
|
||||
Case PAGE_META_SOURCE_SQL
|
||||
Load_SourceSQL(oGuid)
|
||||
|
||||
Case Else
|
||||
MsgBox($"The Form for the Tag [{CurrentPage}] has no Form assigned. Maybe you have a typo in your definitions (Database, NodeEditor)?", MsgBoxStyle.Exclamation, Text)
|
||||
End Select
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ShowError(ex)
|
||||
End Try
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ShowError(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub Load_SourceSQL(PrimaryKey As Integer)
|
||||
@@ -323,8 +288,7 @@ Public Class frmAdmin_Start
|
||||
|
||||
If oForm.HasChanges Then
|
||||
Load_SQLData()
|
||||
Dim oItem As AdminItem = AdminItems.Where(AddressOf IsSourceSQL).FirstOrDefault
|
||||
Load_Tree(oItem)
|
||||
Load_GridData(AdminItems.Item(CurrentPage))
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ShowError(ex)
|
||||
@@ -338,8 +302,7 @@ Public Class frmAdmin_Start
|
||||
|
||||
If oForm.HasChanges Then
|
||||
Load_SQLData()
|
||||
Dim oItem As AdminItem = AdminItems.Where(AddressOf IsIDBAttributes).FirstOrDefault
|
||||
Load_Tree(oItem)
|
||||
Load_GridData(AdminItems.Item(CurrentPage))
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ShowError(ex)
|
||||
@@ -353,8 +316,7 @@ Public Class frmAdmin_Start
|
||||
|
||||
If oForm.HasChanges Then
|
||||
Load_SQLData()
|
||||
Dim oItem As AdminItem = AdminItems.Where(AddressOf IsIDBAttributes).FirstOrDefault
|
||||
Load_Tree(oItem)
|
||||
Load_GridData(AdminItems.Item(CurrentPage))
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ShowError(ex)
|
||||
@@ -368,9 +330,7 @@ Public Class frmAdmin_Start
|
||||
|
||||
If oForm.HasChanges Then
|
||||
Load_SQLData()
|
||||
|
||||
Dim oItem As AdminItem = AdminItems.Where(AddressOf IsCWPRofiles).FirstOrDefault
|
||||
Load_Tree(oItem)
|
||||
Load_GridData(AdminItems.Item(CurrentPage))
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ShowError(ex)
|
||||
@@ -383,9 +343,7 @@ Public Class frmAdmin_Start
|
||||
|
||||
If oForm.HasChanges Then
|
||||
Load_SQLData()
|
||||
|
||||
Dim oItem As AdminItem = AdminItems.Where(AddressOf IsCWPRofiles).FirstOrDefault
|
||||
Load_Tree(oItem)
|
||||
Load_GridData(AdminItems.Item(CurrentPage))
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ShowError(ex)
|
||||
|
||||
Reference in New Issue
Block a user