This commit is contained in:
Developer01
2025-12-23 13:01:06 +01:00
42 changed files with 2448 additions and 594 deletions

View File

@@ -1,6 +1,8 @@
Imports System.IO
Imports System.Data
Imports System.IO
Imports System.Reflection
Imports System.Security.Cryptography
Imports System.Windows.Forms
Imports DigitalData.Modules.Config
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Interfaces
@@ -21,11 +23,16 @@ Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
_logConfig = New LogConfig(LogConfig.PathType.CustomPath, Application.StartupPath & "\Log", Nothing, My.Application.Info.CompanyName, My.Application.Info.ProductName) With {
Dim oLogPath = Path.Combine(Application.StartupPath, "Log")
_logConfig = New LogConfig(LogConfig.PathType.CustomPath, oLogPath, Nothing, My.Application.Info.CompanyName, My.Application.Info.ProductName) With {
.Debug = True
}
_logger = _logConfig.GetLogger()
_mssql = New MSSQLServer(_logConfig, My.Settings.MSSQL_CONNECTIONSTRING)
Dim oCS = My.Settings.MSSQL_CONNECTIONSTRING
If Not oCS.Contains("TrustServerCertificate") Then
oCS += ";TrustServerCertificate=true"
End If
_mssql = New MSSQLServer(_logConfig, oCS)
_GDPictureVersion = "11.2024"
_GDPictureLizenz = ConfigDbFunct.GetProductLicense("GDPICTURE", _GDPictureVersion, _logConfig, My.Settings.MSSQL_CONNECTIONSTRING)
@@ -92,14 +99,14 @@ Public Class Form1
Dim oEN16931_ID = oRow.Item("EN16931_ID")
Args.PropertyMapList.Add(New XmlItemProperty() With {
.XMLPath = xmlPath,
.Description = description,
.TableName = tableName,
.TableColumn = tableColumn,
.IsRequired = isRequired,
.IsGrouped = isGrouped,
.GroupScope = groupScope,
.Specification = specification,
.xmlPath = xmlPath,
.description = description,
.tableName = tableName,
.tableColumn = tableColumn,
.isRequired = isRequired,
.isGrouped = isGrouped,
.groupScope = groupScope,
.specification = specification,
.ItemType = oItemType,
.EN16931_ID = oEN16931_ID
})
@@ -152,9 +159,41 @@ Public Class Form1
If oResult = DialogResult.OK Then
Try
Dim oDoc = _zugferd.ValidateZUGFeRDFileWithGDPicture(OpenFileDialog1.FileName)
Dim oDoc = _zugferd.ValidateZUGFeRDFileWithGDPicture(OpenFileDialog1.FileName, True)
Dim oZFResult = _zugferd.ValidateZUGFeRDDocument(oDoc)
Dim oZUGFERD = _zugferd.SerializeZUGFeRDDocument(oDoc)
Console.WriteLine()
WriteLog("Specification: " & oZFResult.Specification)
'WriteLog("XML-Schema: " & oResult.UsedXMLSchema)
WriteLog("Embedded File Name: " & oZFResult.DataFileName)
Dim oSpecification = oZFResult.Specification
If oSpecification = ZUGFeRDInterface.ZUGFERD_SPEC_10 Then
oSpecification = ZUGFeRDInterface.ZUGFERD_SPEC_DEFAULT
End If
Dim oPropertyMap = oArgs.PropertyMapList.
Where(Function(kv) kv.Specification = oSpecification).
ToDictionary(Function(kv) kv.XMLPath, Function(kv) kv)
Dim oResult2 = _zugferd.PropertyValues.CheckPropertyValues(oZFResult.SchemaObject, oPropertyMap, "test")
WriteLog("Valid Properties: [{0}]", oResult2.ValidProperties.Count)
For Each Prop In oResult2.ValidProperties
If Prop.Value.Length > 250 Then
WriteLog("Property: [{0}] = [{1}]", Prop.Description, Prop.Value.Substring(0, 250))
Else
WriteLog("Property: [{0}] = [{1}]", Prop.Description, Prop.Value)
End If
Next
WriteLog("--------------------------------")
WriteLog("Missing Properties: [{0}]", oResult2.MissingProperties.Count)
For Each Prop In oResult2.MissingProperties
WriteLog("Missing Property: [{0}]", Prop.ToString) ''Prop.Description
Next
WriteLog("--------------------------------")
Catch ex As DigitalData.Modules.Interfaces.Exceptions.ZUGFeRDExecption
Dim oErrorCode = GetRejectionCodeNumber(ex.ErrorCode)
Dim oMessage = oErrorCode + " - (" + ex.ErrorCode.ToString() + ") - " + ex.Message
@@ -162,6 +201,7 @@ Public Class Form1
Catch ex As Exception
MsgBox(ex.Message)
End Try
MsgBox("Finished - check log")
End If
End Sub
@@ -220,7 +260,7 @@ Public Class Form1
Try
If oDialogResult = DialogResult.OK Then
Dim oDoc = _zugferd.ValidateZUGFeRDFileWithGDPicture(OpenFileDialog1.FileName)
Dim oDoc = _zugferd.ValidateZUGFeRDFileWithGDPicture(OpenFileDialog1.FileName, True)
Dim oResult = _zugferd.ValidateZUGFeRDDocument(oDoc)
oResult = _zugferd.SerializeZUGFeRDDocument(oDoc)
@@ -375,6 +415,10 @@ Public Class Form1
End Function
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Process.Start(_logConfig.LogDirectory)
Process.Start("explorer.exe", _logConfig.LogDirectory)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Process.Start("explorer.exe", System.Windows.Forms.Application.UserAppDataPath())
End Sub
End Class