diff --git a/GUIs.Test.ZUGFeRDTest/Form1.vb b/GUIs.Test.ZUGFeRDTest/Form1.vb index 939ce281..9f07700a 100644 --- a/GUIs.Test.ZUGFeRDTest/Form1.vb +++ b/GUIs.Test.ZUGFeRDTest/Form1.vb @@ -32,9 +32,48 @@ Public Class Form1 _zugferd = New ZUGFeRDInterface(_logConfig, _GDPictureLizenz, New ZUGFeRDInterface.ZugferdOptions) End Sub - Private Function LoadPropertyMapFor(Args As WorkerArgs) + 'Private Function LoadPropertyMapFor(Args As WorkerArgs) + ' Try + ' Args.PropertyMap.Clear() + + ' Dim oSQL As String = $"SELECT * FROM TBDD_ZUGFERD_XML_ITEMS WHERE ACTIVE = 1 ORDER BY XML_PATH" + ' Dim oResult As DataTable = _mssql.GetDatatable(oSQL) + + ' For Each oRow As DataRow In oResult.Rows + ' Dim xmlPath As String = oRow.Item("XML_PATH") + ' Dim tableName = oRow.Item("TABLE_NAME") + ' Dim tableColumn = oRow.Item("TABLE_COLUMN") + ' Dim description = oRow.Item("DESCRIPTION") + ' Dim isRequired = oRow.Item("IS_REQUIRED") + ' Dim isGrouped = oRow.Item("IS_GROUPED") + ' Dim groupScope = oRow.Item("GROUP_SCOPE") + ' Dim specification = oRow.Item("SPECIFICATION") + ' Dim oItemType = oRow.Item("ITEM_TYPE") + ' Dim oEN16931_ID = oRow.Item("EN16931_ID") + + ' Args.PropertyMap.Add(xmlPath, New XmlItemProperty() With { + ' .Description = description, + ' .TableName = tableName, + ' .TableColumn = tableColumn, + ' .IsRequired = isRequired, + ' .IsGrouped = isGrouped, + ' .GroupScope = groupScope, + ' .Specification = specification, + ' .ItemType = oItemType, + ' .EN16931_ID = oEN16931_ID + ' }) + ' Next + + ' Return Args + ' Catch ex As Exception + ' _logger.Error(ex) + ' Return Args + ' End Try + 'End Function + + Private Function LoadPropertyMapListFor(Args As WorkerArgs) Try - Args.PropertyMap.Clear() + Args.PropertyMapList.Clear() Dim oSQL As String = $"SELECT * FROM TBDD_ZUGFERD_XML_ITEMS WHERE ACTIVE = 1 ORDER BY XML_PATH" Dim oResult As DataTable = _mssql.GetDatatable(oSQL) @@ -51,7 +90,8 @@ Public Class Form1 Dim oItemType = oRow.Item("ITEM_TYPE") Dim oEN16931_ID = oRow.Item("EN16931_ID") - Args.PropertyMap.Add(xmlPath, New XmlItemProperty() With { + Args.PropertyMapList.Add(New XmlItemProperty() With { + .XMLPath = xmlPath, .Description = description, .TableName = tableName, .TableColumn = tableColumn, @@ -97,7 +137,7 @@ Public Class Form1 .RejectionTemplateId = 1, .MinFileAgeInMinutes = 1 } - args = LoadPropertyMapFor(args) + args = LoadPropertyMapListFor(args) Dim job As New ImportZUGFeRDFiles(_logConfig, _mssql) @@ -145,9 +185,10 @@ Public Class Form1 .AttachmentsSubDirectory = "Attachments", .RejectionTemplateId = 1, .MinFileAgeInMinutes = 1, - .AllowPeppolBISBill3x = True + .AllowPeppolBISBill3x = True, + .AllowZugferd23x = True } - args = LoadPropertyMapFor(args) + args = LoadPropertyMapListFor(args) Dim job As New ImportZUGFeRDFiles(_logConfig, _mssql) @@ -168,7 +209,7 @@ Public Class Form1 .AllowXRechnung = True, .AllowPeppolBISBill3x = True } - oArgs = LoadPropertyMapFor(oArgs) + oArgs = LoadPropertyMapListFor(oArgs) Try If oDialogResult = DialogResult.OK Then @@ -186,9 +227,9 @@ Public Class Form1 oSpecification = ZUGFeRDInterface.ZUGFERD_SPEC_DEFAULT End If - Dim oPropertyMap = oArgs.PropertyMap. - Where(Function(kv) kv.Value.Specification = oSpecification). - ToDictionary(Function(kv) kv.Key, Function(kv) kv.Value) + Dim oPropertyMap = oArgs.PropertyMapList. + Where(Function(kv) kv.Specification = oSpecification). + ToDictionary(Function(kv) kv.XMLPath, Function(kv) kv) Dim oResult2 = _zugferd.PropertyValues.CheckPropertyValues(oResult.SchemaObject, oPropertyMap, "test")