ZUGFeRDTest: Update
This commit is contained in:
@@ -59,8 +59,8 @@ Public Class Form1
|
||||
Return args
|
||||
End Function
|
||||
|
||||
Private Function LoadPropertyMapFor(Args As WorkerArgs, Specification As String)
|
||||
Dim oSQL As String = $"SELECT * FROM TBEDM_XML_ITEMS WHERE SPECIFICATION = '{Specification}' AND ACTIVE = True ORDER BY XML_PATH"
|
||||
Private Function LoadPropertyMapFor(Args As WorkerArgs)
|
||||
Dim oSQL As String = $"SELECT * FROM TBEDM_XML_ITEMS WHERE ACTIVE = True ORDER BY XML_PATH"
|
||||
Dim oResult As DataTable = _firebird.GetDatatable(oSQL)
|
||||
|
||||
For Each oRow As DataRow In oResult.Rows
|
||||
@@ -71,6 +71,7 @@ Public Class Form1
|
||||
Dim isRequired = oRow.Item("IS_REQUIRED")
|
||||
Dim isGrouped = oRow.Item("IS_GROUPED")
|
||||
Dim groupScope = oRow.Item("GROUP_SCOPE")
|
||||
Dim specification = oRow.Item("SPECIFICATION")
|
||||
|
||||
Args.PropertyMap.Add(xmlPath, New XmlItemProperty() With {
|
||||
.Description = description,
|
||||
@@ -78,7 +79,8 @@ Public Class Form1
|
||||
.TableColumn = tableColumn,
|
||||
.IsRequired = isRequired,
|
||||
.IsGrouped = isGrouped,
|
||||
.GroupScope = groupScope
|
||||
.GroupScope = groupScope,
|
||||
.Specification = specification
|
||||
})
|
||||
Next
|
||||
|
||||
@@ -92,10 +94,10 @@ Public Class Form1
|
||||
.NamePortal = "TEST FROM FORM"
|
||||
}
|
||||
args = LoadFolderConfig(args)
|
||||
args = LoadPropertyMapFor(args, "DEFAULT")
|
||||
args = LoadPropertyMapFor(args)
|
||||
args.InsertIntoSQLServer = True
|
||||
|
||||
Dim job As New Jobs.ImportZUGFeRDFiles(_logConfig, _firebird, 1, "TEST", _mssql)
|
||||
Dim job As New Jobs.ImportZUGFeRDFiles(_logConfig, _firebird, _mssql)
|
||||
|
||||
job.Start(args)
|
||||
End Sub
|
||||
@@ -115,17 +117,29 @@ Public Class Form1
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
|
||||
Dim oResult = OpenFileDialog1.ShowDialog()
|
||||
Dim oArgs As New WorkerArgs()
|
||||
oArgs = LoadPropertyMapFor(oArgs, "DEFAULT")
|
||||
Public Sub WriteLog(pMessage As String, ParamArray pParams As String())
|
||||
ListBox1.Items.Add(String.Format(pMessage, pParams))
|
||||
End Sub
|
||||
|
||||
If oResult = DialogResult.OK Then
|
||||
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
|
||||
Dim oDialogResult = OpenFileDialog1.ShowDialog()
|
||||
Dim oArgs As New WorkerArgs()
|
||||
oArgs = LoadPropertyMapFor(oArgs)
|
||||
|
||||
If oDialogResult = DialogResult.OK Then
|
||||
Dim oDoc = _zugferd.ValidateZUGFeRDFileWithGDPicture(OpenFileDialog1.FileName)
|
||||
Dim oZUGFERD = _zugferd.SerializeZUGFeRDDocument(oDoc)
|
||||
Dim oResult = _zugferd.SerializeZUGFeRDDocument(oDoc)
|
||||
Console.WriteLine()
|
||||
|
||||
Dim oResult2 = _zugferd.PropertyValues.CheckPropertyValues(oZUGFERD, oArgs.PropertyMap, "test")
|
||||
Dim oPropertyMap = oArgs.PropertyMap.
|
||||
Where(Function(kv) kv.Value.Specification = oResult.Specification).
|
||||
ToDictionary(Function(kv) kv.Key, Function(kv) kv.Value)
|
||||
|
||||
Dim oResult2 = _zugferd.PropertyValues.CheckPropertyValues(oResult.SchemaObject, oPropertyMap, "test")
|
||||
|
||||
For Each Prop In oResult2.MissingProperties
|
||||
WriteLog("Missing Property: [{0}]", Prop)
|
||||
Next
|
||||
|
||||
Console.WriteLine()
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user