Rename Schema to Template , Clean up obsolete files

This commit is contained in:
Jonathan Jenne
2021-11-19 14:16:07 +01:00
parent ee23cdd7e8
commit cc81a77f05
35 changed files with 216 additions and 1083 deletions

View File

@@ -10,8 +10,10 @@ Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging
Imports MultiTool.Shared
Imports MultiTool.Shared.Documents
Imports MultiTool.Shared.Schemas
Imports MultiTool.Shared.Report
Imports MultiTool.Shared.Templates
Imports MultiTool.Shared.Winline
Imports MultiTool.Shared.Winline.Entities
Imports MultiTool.Shared.Constants
Imports MultiTool.Shared.Exceptions
Imports DevExpress.XtraReports.UI
@@ -25,7 +27,7 @@ Public Class frmImportMain
Private Database As MSSQLServer
Private Winline As WinlineData
Private FileEx As DigitalData.Modules.Filesystem.File
Private WebService As WebService
Private WebService As WebServiceData
Private DocumentLoader As DocumentLoader
Private FormHelper As FormHelper
@@ -33,18 +35,18 @@ Public Class frmImportMain
Private GridLoader As GridLoader
Private GridBuilder As GridBuilder
Private ReadOnly CurrentSchema As Schema = Nothing
Private ReadOnly CurrentTemplate As Template = Nothing
' Runtime variables
Private CurrentGrid As GridControl = Nothing
Private CurrentDocument As Document = Nothing
Public Sub New(pLogConfig As LogConfig, pConfigManager As ConfigManager(Of Config), pSchema As Schema)
Public Sub New(pLogConfig As LogConfig, pConfigManager As ConfigManager(Of Config), pTemplate As Template)
InitializeComponent()
LogConfig = pLogConfig
ConfigManager = pConfigManager
CurrentSchema = pSchema
CurrentTemplate = pTemplate
BehaviorManager.Attach(Of PersistenceBehavior)(Me, AddressOf LoadPersistenceSettings)
End Sub
@@ -75,7 +77,7 @@ Public Class frmImportMain
FileEx = New DigitalData.Modules.Filesystem.File(LogConfig)
Winline = New WinlineData(LogConfig, Database, ConfigManager.Config)
WebService = New WebService(LogConfig, ConfigManager.Config, Application.UserAppDataPath)
WebService = New WebServiceData(LogConfig, ConfigManager.Config, Application.UserAppDataPath)
AddHandler WebService.WebServiceProgress, AddressOf WebService_Progress
Catch ex As Exception
@@ -85,7 +87,7 @@ Public Class frmImportMain
txtVersion.Caption = String.Format(My.Resources.frmImportMainExtra.Version__0_, My.Application.Info.Version.ToString)
txtCulture.Caption = String.Format(My.Resources.frmImportMainExtra.Culture___0_, My.Application.UICulture.ToString)
Text = String.Format(My.Resources.frmShared._0____WebService_Multitool_für_WinLine, CurrentSchema.Name)
Text = String.Format(My.Resources.frmShared._0____WebService_Multitool_für_WinLine, CurrentTemplate.Name)
End Sub
Private Async Sub frmImportMain_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
@@ -119,12 +121,7 @@ Public Class frmImportMain
SplashScreenManager.SetWaitFormDescription(My.Resources.frmImportMainExtra.Lade_Vorlagen)
'SchemaLoader.LoadFiles(ConfigManager.Config.SchemaDirectory)
'CurrentSchemaName = SchemaLoader.SchemaList.First().FullName
'CurrentSchema = SchemaLoader.GetSchemaFromFile(CurrentSchemaName)
'CurrentSchema = SchemaLoader.UpdateSchemaWithDatabaseConfiguration(CurrentSchema, SchemaLoader.TemplateConfiguration)
Grids = CreateGridsAndColumns(CurrentSchema)
Grids = CreateGridsAndColumns(CurrentTemplate)
For Each oGrid As GridControl In Grids
AddHandler oGrid.GotFocus, AddressOf Grid_Focus
@@ -141,11 +138,11 @@ Public Class frmImportMain
CurrentGrid = sender
End Sub
Private Function CreateGridsAndColumns(pSchema As Schemas.Schema) As List(Of GridControl)
Private Function CreateGridsAndColumns(pTemplate As Templates.Template) As List(Of GridControl)
Dim oGrids As New List(Of GridControl)
Dim oTableCounter = 0
For Each oTable In pSchema.Tables
For Each oTable In pTemplate.Tables
If oTableCounter = 0 Then
Dim oGrid = GridLoader.GetGridFromElement(GridControl1, oTable)
AddHandler oGrid.DoubleClick, AddressOf Grid_MouseDoubleClick
@@ -203,7 +200,7 @@ Public Class frmImportMain
Dim oDocumentRow = CurrentDocument.Rows.
Where(Function(r) r.Id.ToString = oRow.Item(COLUMN_GUID)).
SingleOrDefault()
Dim oSchemaTable = CurrentSchema.Tables.
Dim oTemplateTable = CurrentTemplate.Tables.
Where(Function(t) t.Name = oGrid.Name).
SingleOrDefault()
@@ -213,7 +210,7 @@ Public Class frmImportMain
oDocumentRow,
CurrentDocument.Mandator,
Winline,
oSchemaTable
oTemplateTable
)
If oForm.ShowDialog() = DialogResult.OK Then
Dim oModifiedRow = oForm.DocumentRow
@@ -241,7 +238,7 @@ Public Class frmImportMain
SplashScreenManager.SetWaitFormDescription(oMessage)
End Sub
If DocumentLoader.LoadFiles(ConfigManager.Config.InputDirectory, CurrentSchema, lookupMandator.EditValue) Then
If DocumentLoader.LoadFiles(ConfigManager.Config.InputDirectory, CurrentTemplate, lookupMandator.EditValue) Then
GridControlFiles.DataSource = Nothing
GridControlFiles.DataSource = DocumentLoader.Files
@@ -276,7 +273,7 @@ Public Class frmImportMain
If oResult = DialogResult.Yes Then
Dim oDocument As Document = GridViewFiles.GetRow(GridViewFiles.FocusedRowHandle)
Dim oNewDocument = DocumentLoader.LoadFile(oDocument.File, CurrentSchema, lookupMandator.EditValue)
Dim oNewDocument = DocumentLoader.LoadFile(oDocument.File, CurrentTemplate, lookupMandator.EditValue)
Dim oIndex = DocumentLoader.Files.IndexOf(oDocument)
DocumentLoader.Files.Item(oIndex) = oNewDocument
@@ -320,7 +317,7 @@ Public Class frmImportMain
Next
' Create initial Datatable for each Root Element
For Each oTable In CurrentSchema.Tables
For Each oTable In CurrentTemplate.Tables
Dim oDataTable As New DataTable()
' This is makes it possible to fetch the DocumentRow later