Zooflow: Reorganize administration, prepare for user admin section

This commit is contained in:
Jonathan Jenne
2022-02-25 10:33:33 +01:00
parent eaa2e312c7
commit 10e3c43ef1
29 changed files with 190 additions and 82 deletions

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