This commit is contained in:
SchreiberM 2022-02-25 14:43:52 +01:00
commit 454fb2f778
29 changed files with 190 additions and 82 deletions

View File

@ -8,7 +8,6 @@
Public Const PAGE_IDB_OBJECT_STORES = "IDB_OBJECT_STORES"
Public Const PAGE_IDB_DOCTYPE_CONFIG = "IDB_DOCTYPE_CONFIG"
Public Const MODULE_GI = "GLOBIX"
Public Const PAGE_GI_PROFILES = "GI_PROFILES"
Public Const PAGE_GI_RELATIONS = "GI_RELATIONS"
@ -19,6 +18,9 @@
Public Const MODULE_META = "META"
Public Const PAGE_META_SOURCE_SQL = "META_SOURCE_SQL"
Public Const MODULE_USERS = "USERS"
Public Const PAGE_USERS_USERLIST = "USERS_USERLIST"
Public Const COLUMN_NAME_ACTIVE = "ACTIVE"

View File

@ -1,5 +1,6 @@
Imports DigitalData.GUIs.ZooFlow.Administration.ClassConstants
Imports DigitalData.Modules.Base
Imports DigitalData.Modules.Language
Public Class ClassDetailForm
Inherits BaseClass
@ -8,68 +9,65 @@ Public Class ClassDetailForm
Public ReadOnly Property DetailDataList As New Dictionary(Of String, DetailData)
Public ReadOnly Property DetailSettingsList As New Dictionary(Of String, DetailSettings) From {
{PAGE_IDB_ATTRIBUTES, ' This Key will be matched with the Entity Id from the Database
New DetailSettings With {
{PAGE_IDB_ATTRIBUTES, New DetailSettings With {
.GridTitle = "Attribute", ' This will be shown above the Data Grid
.NewRecordTitle = "Neues Attribut", ' This will be shown on the "New" Button
.[Module] = MODULE_IDB,
.Entity = PAGE_IDB_ATTRIBUTES
.Entity = PAGE_IDB_ATTRIBUTES ' This Key will be matched with the Entity Id from the Database
}},
{PAGE_IDB_BUSINESS_ENTITIES,
New DetailSettings With {
{PAGE_IDB_BUSINESS_ENTITIES, New DetailSettings With {
.GridTitle = "BusinessEntity",
.NewRecordTitle = "New BusinessEntity",
.[Module] = MODULE_IDB,
.Entity = PAGE_IDB_BUSINESS_ENTITIES
}},
{PAGE_IDB_OBJECT_STORES, ' This Key will be matched with the Entity Id from the Database
New DetailSettings With {
.GridTitle = "Object-Stores", ' This will be shown above the Data Grid
.NewRecordTitle = "New Object Store", ' This will be shown on the "New" Button
{PAGE_IDB_OBJECT_STORES, New DetailSettings With {
.GridTitle = "Object-Stores",
.NewRecordTitle = "New Object Store",
.[Module] = MODULE_IDB,
.Entity = PAGE_IDB_OBJECT_STORES
}},
{PAGE_META_SOURCE_SQL,
New DetailSettings With {
{PAGE_META_SOURCE_SQL, New DetailSettings With {
.GridTitle = "Source SQL",
.NewRecordTitle = "New Source SQL",
.[Module] = MODULE_META,
.Entity = PAGE_META_SOURCE_SQL
}},
{PAGE_GI_PROFILES,
New DetailSettings With {
{PAGE_GI_PROFILES, New DetailSettings With {
.GridTitle = "Global Indexer Profile",
.NewRecordTitle = "New GLOBIX profile",
.[Module] = MODULE_GI,
.Entity = PAGE_GI_PROFILES
}},
{PAGE_CW_PROFILES,
New DetailSettings With {
{PAGE_CW_PROFILES, New DetailSettings With {
.GridTitle = "Clipboard Watcher Profile",
.NewRecordTitle = "New CW profile",
.[Module] = MODULE_CW,
.Entity = PAGE_CW_PROFILES
}},
{PAGE_IDB_ATTRIBUTE_REL,
New DetailSettings With {
{PAGE_IDB_ATTRIBUTE_REL, New DetailSettings With {
.GridTitle = "Attribute-Relations",
.NewRecordTitle = "",
.[Module] = MODULE_IDB,
.Entity = PAGE_IDB_ATTRIBUTES
}},
{PAGE_GI_RELATIONS,
New DetailSettings With {
{PAGE_GI_RELATIONS, New DetailSettings With {
.GridTitle = "Globix profile-relations",
.NewRecordTitle = "",
.[Module] = MODULE_GI,
.Entity = PAGE_GI_RELATIONS
}},
{PAGE_IDB_DOCTYPE_CONFIG,
New DetailSettings With {
{PAGE_IDB_DOCTYPE_CONFIG, New DetailSettings With {
.GridTitle = "Doctype Configuration",
.NewRecordTitle = "New Configuration",
.[Module] = MODULE_IDB,
.Entity = PAGE_IDB_DOCTYPE_CONFIG
}},
{PAGE_USERS_USERLIST, New DetailSettings With {
.GridTitle = "Benutzer Übersicht",
.NewRecordTitle = "Neuer Benutzer",
.[Module] = MODULE_USERS,
.Entity = PAGE_USERS_USERLIST
}}
}
@ -77,6 +75,42 @@ Public Class ClassDetailForm
MyBase.New(LogConfig)
End Sub
Public Function LoadData() As Boolean
Try
Dim oTable As DataTable = My.DatabaseECM.GetDatatable("SELECT * FROM TBZF_ADMIN_SOURCE_SQL WHERE SCOPE = 'OVERVIEW'")
DetailDataList.Clear()
For Each oRow As DataRow In oTable.Rows
Dim oCHeck = oRow.Item("ENTITY_TITLE").ToString
Dim oItem As New ClassDetailForm.DetailData With {
.Guid = CInt(oRow.Item("GUID")),
.ParentId = CInt(oRow.Item("PARENT_ID")),
.Entity = oRow.Item("ENTITY_TITLE").ToString,
.Scope = oRow.Item("SCOPE").ToString,
.SQLCommand = oRow.Item("SQL_COMMAND").ToString.Replace("@LANG_CODE", My.Application.User.Language),
.PrimaryKey = Utils.NotNull(oRow.Item("PK_COLUMN"), String.Empty)
}
Try
oItem.SQLResult = My.DatabaseECM.GetDatatable(oItem.SQLCommand)
Catch ex As Exception
oItem.SQLResult = Nothing
Logger.Error(ex)
End Try
Dim oKey As String = oItem.Entity & "-" & oItem.Scope
DetailDataList.Add(oKey, oItem)
Next
Return True
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
Public Function Handle_OpenDetail(PrimaryKey As Integer, Page As String, IsInsert As Boolean) As Boolean
Select Case Page
Case PAGE_IDB_ATTRIBUTES
@ -103,17 +137,22 @@ Public Class ClassDetailForm
Case PAGE_META_SOURCE_SQL
Load_SourceSQL(PrimaryKey, IsInsert)
Return True
Case PAGE_IDB_ATTRIBUTE_REL
Dim oForm As New frmAdmin_IDBBERelations
oForm.ShowDialog()
Return True
Case PAGE_GI_RELATIONS
Dim oForm As New frmAdmin_GlobixRelations
oForm.ShowDialog()
Return True
Case PAGE_IDB_DOCTYPE_CONFIG
Dim oForm As New frmAdmin_DoctypeConfig(PrimaryKey) With {.IsInsert = IsInsert}
oForm.ShowDialog()
Return True
Case Else
Return False
End Select

View File

@ -0,0 +1,12 @@
Namespace DetailForms
Public Class DetailForm
Public Property Data As DetailFormData
Public Property Settings As DetailFormSettings
Public ReadOnly Property Key As String
Get
Return Data.Entity & "-" & Data.Scope
End Get
End Property
End Class
End Namespace

View File

@ -0,0 +1,11 @@
Namespace DetailForms
Public Class DetailFormData
Public Property Guid As Integer
Public Property ParentId As Integer
Public Property Entity As String
Public Property Scope As String
Public Property PrimaryKey As String
Public Property SQLCommand As String
Public Property SQLResult As DataTable
End Class
End Namespace

View File

@ -0,0 +1,8 @@
Namespace DetailForms
Public Class DetailFormSettings
Public Property GridTitle As String
Public Property [Module] As String
Public Property Entity As String
Public Property NewRecordTitle As String
End Class
End Namespace

View File

@ -0,0 +1,59 @@
Imports DigitalData.Modules.Base
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Language
Namespace DetailForms
Public Class Loader
Inherits BaseClass
Public Forms As New Dictionary(Of String, DetailForm)
Public Sub New(pLogConfig As LogConfig)
MyBase.New(pLogConfig)
End Sub
Public Function Load_SQLData() As Boolean
Try
Dim oTable As DataTable = My.DatabaseECM.GetDatatable("SELECT * FROM TBZF_ADMIN_SOURCE_SQL WHERE SCOPE = 'OVERVIEW'")
Forms.Clear()
For Each oRow As DataRow In oTable.Rows
Dim oCHeck = oRow.Item("ENTITY_TITLE").ToString
' TODO: Do a proper replace lol
Dim oSQL As String = oRow.Item("SQL_COMMAND").ToString.Replace("@LANG_CODE", My.Application.User.Language)
Dim oForm As New DetailForm() With {
.Data = New DetailFormData With {
.Guid = CInt(oRow.Item("GUID")),
.ParentId = CInt(oRow.Item("PARENT_ID")),
.Entity = oRow.Item("ENTITY_TITLE").ToString,
.Scope = oRow.Item("SCOPE").ToString,
.SQLCommand = oRow.Item("SQL_COMMAND").ToString.Replace("@LANG_CODE", My.Application.User.Language),
.PrimaryKey = oRow.ItemEx(("PK_COLUMN"), String.Empty)
}
}
Try
oForm.Data.SQLResult = My.DatabaseECM.GetDatatable(oForm.Data.SQLCommand)
Catch ex As Exception
oForm.Data.SQLResult = Nothing
Logger.Error(ex)
End Try
Dim oKey As String = oForm.Key
Forms.Add(oKey, oForm)
Next
Return True
Catch ex As Exception
Logger.Error(ex)
Return False
End Try
End Function
End Class
End Namespace

View File

@ -27,14 +27,21 @@ Public Class frmAdmin_Start
DetailForm = New ClassDetailForm(My.LogConfig)
AddHandler DetailForm.DetailFormClosed, AddressOf DetailForm_Closed
Load_SQLData()
DetailForm.LoadData()
TreeListMenu.ExpandAll()
End Sub
Private Sub DetailForm_Closed(sender As Object, e As IAdminForm)
If e.HasChanges Then
Load_SQLData()
Load_GridData(DetailForm.DetailDataList.Item(CurrentPage))
If e.HasChanges And CurrentPage IsNot Nothing Then
DetailForm.LoadData()
Dim oKey = $"{CurrentPage}-OVERVIEW"
If DetailForm.DetailDataList.ContainsKey(oKey) Then
Load_GridData(DetailForm.DetailDataList.Item(oKey))
Else
MsgBox($"Could not load data for Page [{oKey}] because it does not exist!", MsgBoxStyle.Critical, Text)
End If
End If
End Sub
@ -73,40 +80,6 @@ Public Class frmAdmin_Start
Return True
End Function
Private Function Load_SQLData() As Boolean
Try
Dim oTable As DataTable = My.DatabaseECM.GetDatatable("SELECT * FROM TBZF_ADMIN_SOURCE_SQL WHERE SCOPE = 'OVERVIEW'")
DetailForm.DetailDataList.Clear()
For Each oRow As DataRow In oTable.Rows
Dim oCHeck = oRow.Item("ENTITY_TITLE").ToString
Dim oItem As New ClassDetailForm.DetailData With {
.Guid = CInt(oRow.Item("GUID")),
.ParentId = CInt(oRow.Item("PARENT_ID")),
.Entity = oRow.Item("ENTITY_TITLE").ToString,
.Scope = oRow.Item("SCOPE").ToString,
.SQLCommand = oRow.Item("SQL_COMMAND").ToString.Replace("@LANG_CODE", My.Application.User.Language),
.PrimaryKey = NotNull(oRow.Item("PK_COLUMN"), String.Empty)
}
Try
oItem.SQLResult = My.DatabaseECM.GetDatatable(oItem.SQLCommand)
Catch ex As Exception
oItem.SQLResult = Nothing
Logger.Error(ex)
End Try
Dim oKey As String = oItem.Entity & "-" & oItem.Scope
DetailForm.DetailDataList.Add(oKey, oItem)
Next
Return True
Catch ex As Exception
ShowErrorMessage(ex)
Return False
End Try
End Function
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 OrElse e.Node.Tag = String.Empty Then
@ -247,7 +220,7 @@ Public Class frmAdmin_Start
End Function
Private Sub BarButtonItem9_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem9.ItemClick
Load_SQLData()
DetailForm.LoadData()
ShowStatus("Source SQL neu geladen")
End Sub

View File

@ -153,16 +153,20 @@
<Compile Include="Administration\ClassDetailPage.vb" />
<Compile Include="Administration\ClassGIDatatables.vb" />
<Compile Include="Administration\ClassValidation.vb" />
<Compile Include="Administration\frmAdmin_DoctypeConfig.Designer.vb">
<Compile Include="Administration\DetailForms\DetailFormData.vb" />
<Compile Include="Administration\DetailForms\DetailForm.vb" />
<Compile Include="Administration\DetailForms\DetailFormSettings.vb" />
<Compile Include="Administration\DetailForms\Loader.vb" />
<Compile Include="Administration\IDB\frmAdmin_DoctypeConfig.Designer.vb">
<DependentUpon>frmAdmin_DoctypeConfig.vb</DependentUpon>
</Compile>
<Compile Include="Administration\frmAdmin_DoctypeConfig.vb">
<Compile Include="Administration\IDB\frmAdmin_DoctypeConfig.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Administration\frmAdmin_GlobixRelations.Designer.vb">
<Compile Include="Administration\Globix\frmAdmin_GlobixRelations.Designer.vb">
<DependentUpon>frmAdmin_GlobixRelations.vb</DependentUpon>
</Compile>
<Compile Include="Administration\frmAdmin_GlobixRelations.vb">
<Compile Include="Administration\Globix\frmAdmin_GlobixRelations.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Administration\frmAdmin_ClipboardWatcher.Designer.vb">
@ -171,28 +175,28 @@
<Compile Include="Administration\frmAdmin_ClipboardWatcher.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Administration\frmAdmin_IDBAttribute.Designer.vb">
<Compile Include="Administration\IDB\frmAdmin_IDBAttribute.Designer.vb">
<DependentUpon>frmAdmin_IDBAttribute.vb</DependentUpon>
</Compile>
<Compile Include="Administration\frmAdmin_IDBAttribute.vb">
<Compile Include="Administration\IDB\frmAdmin_IDBAttribute.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Administration\frmAdmin_IDBEntity.Designer.vb">
<Compile Include="Administration\IDB\frmAdmin_IDBEntity.Designer.vb">
<DependentUpon>frmAdmin_IDBEntity.vb</DependentUpon>
</Compile>
<Compile Include="Administration\frmAdmin_IDBEntity.vb">
<Compile Include="Administration\IDB\frmAdmin_IDBEntity.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Administration\frmAdmin_IDBObjectStore.Designer.vb">
<Compile Include="Administration\IDB\frmAdmin_IDBObjectStore.Designer.vb">
<DependentUpon>frmAdmin_IDBObjectStore.vb</DependentUpon>
</Compile>
<Compile Include="Administration\frmAdmin_IDBObjectStore.vb">
<Compile Include="Administration\IDB\frmAdmin_IDBObjectStore.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Administration\frmAdmin_IDBBERelations.Designer.vb">
<Compile Include="Administration\IDB\frmAdmin_IDBBERelations.Designer.vb">
<DependentUpon>frmAdmin_IDBBERelations.vb</DependentUpon>
</Compile>
<Compile Include="Administration\frmAdmin_IDBBERelations.vb">
<Compile Include="Administration\IDB\frmAdmin_IDBBERelations.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Administration\frmSQLDesigner.Designer.vb">
@ -202,10 +206,10 @@
<SubType>Form</SubType>
</Compile>
<Compile Include="Administration\IAdminForm.vb" />
<Compile Include="Administration\frmAdmin_Globix.Designer.vb">
<Compile Include="Administration\Globix\frmAdmin_Globix.Designer.vb">
<DependentUpon>frmAdmin_Globix.vb</DependentUpon>
</Compile>
<Compile Include="Administration\frmAdmin_Globix.vb">
<Compile Include="Administration\Globix\frmAdmin_Globix.vb">
<SubType>Form</SubType>
</Compile>
<Compile Include="Administration\frmAdmin_SourceSQL.Designer.vb">
@ -401,25 +405,25 @@
<EmbeddedResource Include="Administration\frmAdmin_ClipboardWatcher.resx">
<DependentUpon>frmAdmin_ClipboardWatcher.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Administration\frmAdmin_DoctypeConfig.resx">
<EmbeddedResource Include="Administration\IDB\frmAdmin_DoctypeConfig.resx">
<DependentUpon>frmAdmin_DoctypeConfig.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Administration\frmAdmin_GlobixRelations.resx">
<EmbeddedResource Include="Administration\Globix\frmAdmin_GlobixRelations.resx">
<DependentUpon>frmAdmin_GlobixRelations.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Administration\frmAdmin_IDBAttribute.resx">
<EmbeddedResource Include="Administration\IDB\frmAdmin_IDBAttribute.resx">
<DependentUpon>frmAdmin_IDBAttribute.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Administration\frmAdmin_IDBEntity.resx">
<EmbeddedResource Include="Administration\IDB\frmAdmin_IDBEntity.resx">
<DependentUpon>frmAdmin_IDBEntity.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Administration\frmAdmin_Globix.resx">
<EmbeddedResource Include="Administration\Globix\frmAdmin_Globix.resx">
<DependentUpon>frmAdmin_Globix.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Administration\frmAdmin_IDBObjectStore.resx">
<EmbeddedResource Include="Administration\IDB\frmAdmin_IDBObjectStore.resx">
<DependentUpon>frmAdmin_IDBObjectStore.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Administration\frmAdmin_IDBBERelations.resx">
<EmbeddedResource Include="Administration\IDB\frmAdmin_IDBBERelations.resx">
<DependentUpon>frmAdmin_IDBBERelations.vb</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Administration\frmAdmin_SourceSQL.resx">