Commit
This commit is contained in:
commit
a56d5b06b9
9
.gitignore
vendored
9
.gitignore
vendored
@ -259,3 +259,12 @@ paket-files/
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
/GUIs.Test.ZUGFeRDTest/Form1.vb
|
||||
/GUIs.Test.ZUGFeRDTest/Form1.resx
|
||||
/GUIs.Test.ZUGFeRDTest/Form1.Designer.vb
|
||||
/GUIs.Test.ZUGFeRDTest/Form1.vb
|
||||
/GUIs.Test.ZUGFeRDTest/Form1.resx
|
||||
/GUIs.Test.ZUGFeRDTest/Form1.Designer.vb
|
||||
/GUIs.Test.ZUGFeRDTest/Form1.vb
|
||||
/GUIs.Test.ZUGFeRDTest/Form1.resx
|
||||
/GUIs.Test.ZUGFeRDTest/Form1.Designer.vb
|
||||
|
||||
@ -46,7 +46,7 @@
|
||||
</DevExpress.LookAndFeel.Design.AppSettings>
|
||||
</applicationSettings>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<AssemblyName>DigitalData.GUIs.MonoRepoUtils</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>WindowsForms</MyType>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
|
||||
2
ConfigCreator/My Project/Settings.Designer.vb
generated
2
ConfigCreator/My Project/Settings.Designer.vb
generated
@ -15,7 +15,7 @@ Option Explicit On
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0"), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
|
||||
</startup>
|
||||
</configuration>
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<AssemblyName>DigitalData.Controls.DocumentViewer</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
|
||||
@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("DocumentViewer")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2023")>
|
||||
<Assembly: AssemblyTrademark("1.9.0.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.8.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.8.0.0")>
|
||||
<Assembly: AssemblyVersion("1.9.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.9.0.0")>
|
||||
|
||||
@ -15,7 +15,7 @@ Option Explicit On
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0"), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<AssemblyName>DigitalData.Controls.LookupGrid</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
|
||||
@ -15,7 +15,7 @@ Option Explicit On
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0"), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<AssemblyName>DigitalData.GUIs.ClipboardWatcher</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
|
||||
@ -15,7 +15,7 @@ Option Explicit On
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0"), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
@ -57,4 +57,4 @@
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<AssemblyName>DigitalData.GUIs.Common</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
|
||||
@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("Common")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
||||
<Assembly: AssemblyTrademark("2.4.1.0")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2023")>
|
||||
<Assembly: AssemblyTrademark("2.5.0.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.4.1.0")>
|
||||
<Assembly: AssemblyFileVersion("2.4.1.0")>
|
||||
<Assembly: AssemblyVersion("2.5.0.0")>
|
||||
<Assembly: AssemblyFileVersion("2.5.0.0")>
|
||||
|
||||
2
GUIs.Common/My Project/Settings.Designer.vb
generated
2
GUIs.Common/My Project/Settings.Designer.vb
generated
@ -15,7 +15,7 @@ Option Explicit On
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0"), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
@ -53,4 +53,4 @@
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<AssemblyName>DigitalData.GUIs.GlobalIndexer</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
|
||||
@ -15,7 +15,7 @@ Option Explicit On
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0"), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
|
||||
</startup>
|
||||
<userSettings>
|
||||
<TestGUI.My.MySettings>
|
||||
|
||||
@ -22,7 +22,7 @@ Namespace My.Resources
|
||||
'''<summary>
|
||||
''' Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
|
||||
'''</summary>
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0"), _
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0"), _
|
||||
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
|
||||
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
|
||||
|
||||
@ -15,7 +15,7 @@ Option Explicit On
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.4.0.0"), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<AssemblyName>TestGUI</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>WindowsForms</MyType>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
@ -109,7 +109,7 @@
|
||||
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Quartz, Version=3.5.0.0, Culture=neutral, PublicKeyToken=f6b8c98a402cc8a4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Quartz.3.5.0\lib\net472\Quartz.dll</HintPath>
|
||||
<HintPath>..\packages\Quartz.3.5.0\lib\net462\Quartz.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<packages>
|
||||
<package id="Microsoft.Extensions.Logging.Abstractions" version="2.1.1" targetFramework="net461" />
|
||||
<package id="NLog" version="5.0.5" targetFramework="net472" />
|
||||
<package id="Quartz" version="3.5.0" targetFramework="net472" />
|
||||
<package id="Quartz" version="3.5.0" targetFramework="net462" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net461" />
|
||||
<package id="System.Diagnostics.DiagnosticSource" version="4.7.1" targetFramework="net461" />
|
||||
<package id="System.Memory" version="4.5.4" targetFramework="net461" />
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
|
||||
</startup>
|
||||
<applicationSettings>
|
||||
<ZUGFeRDTest.My.MySettings>
|
||||
|
||||
@ -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,19 +117,45 @@ Public Class Form1
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub WriteLog(pMessage As String, ParamArray pParams As String())
|
||||
ListBox1.Items.Add(String.Format(pMessage, pParams))
|
||||
End Sub
|
||||
|
||||
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
|
||||
Dim oResult = OpenFileDialog1.ShowDialog()
|
||||
Dim oDialogResult = OpenFileDialog1.ShowDialog()
|
||||
Dim oArgs As New WorkerArgs()
|
||||
oArgs = LoadPropertyMapFor(oArgs, "DEFAULT")
|
||||
oArgs = LoadPropertyMapFor(oArgs)
|
||||
|
||||
If oResult = DialogResult.OK Then
|
||||
If oDialogResult = DialogResult.OK Then
|
||||
Dim oDoc = _zugferd.ValidateZUGFeRDFileWithGDPicture(OpenFileDialog1.FileName)
|
||||
Dim oZUGFERD = _zugferd.SerializeZUGFeRDDocument(oDoc)
|
||||
Console.WriteLine()
|
||||
Dim oResult = _zugferd.SerializeZUGFeRDDocument(oDoc)
|
||||
|
||||
Dim oResult2 = _zugferd.PropertyValues.CheckPropertyValues(oZUGFERD, oArgs.PropertyMap, "test")
|
||||
WriteLog("Specification: " & oResult.Specification)
|
||||
WriteLog("Embedded File Name: " & oResult.DataFileName)
|
||||
|
||||
Console.WriteLine()
|
||||
Dim oSpecification = oResult.Specification
|
||||
|
||||
If oSpecification = ZUGFeRDInterface.ZUGFERD_SPEC_10 Then
|
||||
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 oResult2 = _zugferd.PropertyValues.CheckPropertyValues(oResult.SchemaObject, oPropertyMap, "test")
|
||||
|
||||
WriteLog("Valid Properties: [{0}]", oResult2.ValidProperties.Count)
|
||||
For Each Prop In oResult2.ValidProperties
|
||||
WriteLog("Property: [{0}] = [{1}]", Prop.Description, Prop.Value)
|
||||
Next
|
||||
|
||||
WriteLog("Missing Properties: [{0}]", oResult2.MissingProperties.Count)
|
||||
For Each Prop In oResult2.MissingProperties
|
||||
WriteLog("Missing Property: [{0}]", Prop)
|
||||
Next
|
||||
|
||||
WriteLog("--------------------------------")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ Option Explicit On
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0"), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<AssemblyName>ZUGFeRDTest</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>WindowsForms</MyType>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
@ -48,7 +48,7 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Modules.Database, Version=2.2.7.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="DigitalData.Modules.Database, Version=2.3.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||
</Reference>
|
||||
@ -68,15 +68,14 @@
|
||||
<HintPath>..\packages\FirebirdSql.Data.FirebirdClient.7.5.0\lib\net452\FirebirdSql.Data.FirebirdClient.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.7.10\lib\net45\NLog.dll</HintPath>
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.1.0\lib\net46\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Transactions" />
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="FirebirdSql.Data.FirebirdClient" version="7.5.0" targetFramework="net461" />
|
||||
<package id="NLog" version="4.7.10" targetFramework="net461" />
|
||||
<package id="NLog" version="5.1.0" targetFramework="net461" />
|
||||
</packages>
|
||||
@ -3,7 +3,7 @@
|
||||
<configSections>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
|
||||
@ -16,4 +16,13 @@ Public Class Config
|
||||
Public Property SQLServerTestConnectionString As String = ""
|
||||
|
||||
Public Property Debug As Boolean = False
|
||||
|
||||
Public Class TlsConfig
|
||||
Public Property EnableDefault As Boolean = True
|
||||
Public Property EnableTls1_1 As Boolean = False
|
||||
Public Property EnableTls1_2 As Boolean = False
|
||||
End Class
|
||||
|
||||
|
||||
Public Property TlsVersion As New TlsConfig
|
||||
End Class
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<AssemblyName>DDEmailService</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Console</MyType>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
|
||||
@ -348,7 +348,13 @@ Public Class EmailService
|
||||
|
||||
' ======= Connect to server =======
|
||||
|
||||
Dim oResult = _MailSender.ConnectToServer(oAccount.Server, oAccount.Port, oAccount.Username, oAccount.Password, oAccount.AuthType)
|
||||
Dim oOptions As New MailSender.MailSenderOptions() With {
|
||||
.EnableTls1_1 = _Config.TlsVersion.EnableTls1_1,
|
||||
.EnableTls1_2 = _Config.TlsVersion.EnableTls1_2,
|
||||
.EnableDefault = _Config.TlsVersion.EnableDefault
|
||||
}
|
||||
|
||||
Dim oResult = _MailSender.ConnectToServer(oAccount.Server, oAccount.Port, oAccount.Username, oAccount.Password, oAccount.AuthType, oOptions)
|
||||
|
||||
If oResult = False Then
|
||||
_Logger.Warn("Could not connect to server. Skipping.")
|
||||
|
||||
@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("DDEmailService")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
||||
<Assembly: AssemblyTrademark("1.5.1.0")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2023")>
|
||||
<Assembly: AssemblyTrademark("1.5.2.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.5.1.0")>
|
||||
<Assembly: AssemblyVersion("1.5.2.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
|
||||
@ -15,7 +15,7 @@ Option Explicit On
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0"), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
@ -11,4 +11,4 @@
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
<AssemblyName>DDEDMLicenseService</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Console</MyType>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<WcfConfigValidationEnabled>True</WcfConfigValidationEnabled>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
|
||||
@ -15,7 +15,7 @@ Option Explicit On
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0"), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<configSections>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
|
||||
@ -35,9 +35,10 @@
|
||||
Public Property RejectionTransferTimeUnit As String = "HOUR"
|
||||
Public Property RejectionTransferTimeValue As Integer = 12
|
||||
|
||||
Public Property AllowFacturX As Boolean = True
|
||||
Public Property AllowXRechnung As Boolean = True
|
||||
|
||||
Public Property AllowFacturX As Boolean = False
|
||||
Public Property AllowXRechnung As Boolean = False
|
||||
Public Property AllowZugferd10 As Boolean = True
|
||||
Public Property AllowZugferd2x As Boolean = True
|
||||
End Class
|
||||
|
||||
Public Class FirebirdConfig
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
<AssemblyName>DDZUGFeRDService</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Console</MyType>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
|
||||
@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("DDZUGFeRDService")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
||||
<Assembly: AssemblyTrademark("2.2.0.0")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2023")>
|
||||
<Assembly: AssemblyTrademark("2.3.3.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.2.0.0")>
|
||||
<Assembly: AssemblyFileVersion("2.2.0.0")>
|
||||
<Assembly: AssemblyVersion("2.3.3.0")>
|
||||
<Assembly: AssemblyFileVersion("2.3.3.0")>
|
||||
|
||||
@ -15,7 +15,7 @@ Option Explicit On
|
||||
Namespace My
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0"), _
|
||||
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0"), _
|
||||
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits Global.System.Configuration.ApplicationSettingsBase
|
||||
|
||||
@ -53,11 +53,13 @@ Public Class ThreadRunner
|
||||
.NamePortal = _config.Config.PORTAL_NAME,
|
||||
.EmailOutProfileId = _config.Config.MSSQLEmailOutAccountID,
|
||||
.AllowFacturX = _config.Config.Custom.AllowFacturX,
|
||||
.AllowXRechnung = _config.Config.Custom.AllowXRechnung
|
||||
.AllowXRechnung = _config.Config.Custom.AllowXRechnung,
|
||||
.AllowZugferd10 = _config.Config.Custom.AllowZugferd10,
|
||||
.AllowZugferd2x = _config.Config.Custom.AllowZugferd2x
|
||||
}
|
||||
|
||||
oArgs = LoadFolderConfig(oArgs)
|
||||
oArgs = LoadPropertyMapFor(oArgs, "DEFAULT")
|
||||
oArgs = LoadPropertyMap(oArgs)
|
||||
|
||||
' Use MSSQL Server if available
|
||||
If Not IsNothing(_mssql) Then
|
||||
@ -243,18 +245,19 @@ Public Class ThreadRunner
|
||||
Return pArgs
|
||||
End Function
|
||||
|
||||
Private Function LoadPropertyMapFor(pArgs As WorkerArgs, pSpecification As String) As WorkerArgs
|
||||
Dim oSQL As String = $"SELECT * FROM TBEDM_XML_ITEMS WHERE SPECIFICATION = '{pSpecification}' AND ACTIVE = True ORDER BY XML_PATH"
|
||||
Dim oResult As DataTable = _firebird.GetDatatable(oSQL)
|
||||
Private Function LoadPropertyMap(pArgs As WorkerArgs) 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 row As DataRow In oResult.Rows
|
||||
Dim oXmlPath = row.Item("XML_PATH")
|
||||
Dim oTableName = row.Item("TABLE_NAME")
|
||||
Dim oTableColumn = row.Item("TABLE_COLUMN")
|
||||
Dim oDescription = row.Item("DESCRIPTION")
|
||||
Dim oIsRequired = row.Item("IS_REQUIRED")
|
||||
Dim oIsGrouped = row.Item("IS_GROUPED")
|
||||
Dim oGroupScope = row.Item("GROUP_SCOPE")
|
||||
For Each oRow As DataRow In oResult.Rows
|
||||
Dim oXmlPath = oRow.Item("XML_PATH")
|
||||
Dim oTableName = oRow.Item("TABLE_NAME")
|
||||
Dim oTableColumn = oRow.Item("TABLE_COLUMN")
|
||||
Dim oDescription = oRow.Item("DESCRIPTION")
|
||||
Dim oIsRequired = oRow.Item("IS_REQUIRED")
|
||||
Dim oIsGrouped = oRow.Item("IS_GROUPED")
|
||||
Dim oGroupScope = oRow.Item("GROUP_SCOPE")
|
||||
Dim oSpecification = oRow.Item("SPECIFICATION")
|
||||
|
||||
pArgs.PropertyMap.Add(oXmlPath, New XmlItemProperty() With {
|
||||
.Description = oDescription,
|
||||
@ -262,7 +265,8 @@ Public Class ThreadRunner
|
||||
.TableColumn = oTableColumn,
|
||||
.IsRequired = oIsRequired,
|
||||
.IsGrouped = oIsGrouped,
|
||||
.GroupScope = oGroupScope
|
||||
.GroupScope = oGroupScope,
|
||||
.Specification = oSpecification
|
||||
})
|
||||
Next
|
||||
|
||||
|
||||
@ -5,10 +5,20 @@
|
||||
public string Name { get; set; }
|
||||
public string LogPath { get; set; }
|
||||
public string MSSQLConnectionString { get; set; }
|
||||
|
||||
public string MaxFileSizeInMegabytes { get; set; }
|
||||
public ZugferdConfig Zugferd { get; set; }
|
||||
public FirebirdConfig Firebird { get; set; }
|
||||
}
|
||||
|
||||
public class ZugferdConfig
|
||||
{
|
||||
public bool AllowFacturX { get; set; } = false;
|
||||
public bool AllowXRechnung { get; set; } = false;
|
||||
public bool AllowZugferd10 { get; set; } = true;
|
||||
public bool AllowZugferd2x { get; set; } = true;
|
||||
|
||||
}
|
||||
|
||||
public class FirebirdConfig
|
||||
{
|
||||
public string Datasource { get; set; }
|
||||
|
||||
@ -9,6 +9,7 @@ using static DigitalData.Modules.Interfaces.Exceptions;
|
||||
using static DigitalData.Modules.Interfaces.ZUGFeRDInterface;
|
||||
using static DigitalData.Modules.Interfaces.PropertyValues;
|
||||
using System.Data.SqlClient;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace ZUGFeRDRESTService.Controllers
|
||||
{
|
||||
@ -22,19 +23,29 @@ namespace ZUGFeRDRESTService.Controllers
|
||||
public const string ADDED_WHO = "ZUGFeRD REST Service";
|
||||
public const string MESSAGEID_DOMAIN = "test.wisag.de";
|
||||
|
||||
private const int MAX_FILE_SIZE_DEFAULT = 25;
|
||||
|
||||
private readonly ZUGFeRDInterface _zugferd;
|
||||
private readonly IDatabase _database;
|
||||
|
||||
private readonly DigitalData.Modules.Logging.LogConfig _logConfig;
|
||||
private readonly DigitalData.Modules.Logging.Logger _logger;
|
||||
private readonly DigitalData.Modules.Filesystem.File _file;
|
||||
|
||||
private readonly PropertyValues _props;
|
||||
private readonly Dictionary<String, XmlItemProperty> _propertyMap;
|
||||
private readonly Dictionary<string, XmlItemProperty> _propertyMap = new Dictionary<string, XmlItemProperty>();
|
||||
|
||||
public ValidationController(ILogging logging, IDatabase database)
|
||||
private int _MaxFileSizeInMegabytes;
|
||||
private bool _AllowFacturX;
|
||||
private bool _AllowXRechnung;
|
||||
private bool _AllowZugferd2x;
|
||||
private bool _AllowZugferd10;
|
||||
|
||||
public ValidationController(ILogging logging, IDatabase database, IConfiguration Config)
|
||||
{
|
||||
_logConfig = logging.LogConfig;
|
||||
_logger = _logConfig.GetLogger();
|
||||
_file = new DigitalData.Modules.Filesystem.File(_logConfig);
|
||||
|
||||
_logger.Debug("Validation Controller initializing");
|
||||
|
||||
@ -42,14 +53,75 @@ namespace ZUGFeRDRESTService.Controllers
|
||||
var oGDPictureKey = database.GetGDPictureKey();
|
||||
var oPropertyMap = database.GetPropertyMap();
|
||||
|
||||
_propertyMap = oPropertyMap;
|
||||
// Read config file and assign all option flags related to
|
||||
// - Zugferd files
|
||||
// - Filesizes
|
||||
ParseConfig(Config);
|
||||
|
||||
_zugferd = new ZUGFeRDInterface(_logConfig, oGDPictureKey);
|
||||
_zugferd = new ZUGFeRDInterface(_logConfig, oGDPictureKey, new ZugferdOptions()
|
||||
{
|
||||
AllowFacturX_Filename = _AllowFacturX,
|
||||
AllowXRechnung_Filename = _AllowXRechnung,
|
||||
AllowZugferd_1_0_Schema = _AllowZugferd10,
|
||||
AllowZugferd_2_x_Schema = _AllowZugferd2x
|
||||
});
|
||||
_props = new PropertyValues(_logConfig);
|
||||
|
||||
_logger.Debug("Property Map initial: [{0}] entries found.", oPropertyMap.Count);
|
||||
|
||||
if (_AllowZugferd10 == true)
|
||||
_propertyMap = oPropertyMap.
|
||||
Where(kv => kv.Value.Specification == ZUGFERD_SPEC_10 || kv.Value.Specification == ZUGFERD_SPEC_DEFAULT).
|
||||
Concat(_propertyMap).
|
||||
ToDictionary(kv => kv.Key, kv => kv.Value);
|
||||
|
||||
if (_AllowZugferd2x == true)
|
||||
_propertyMap = oPropertyMap.
|
||||
Where(kv => kv.Value.Specification == ZUGFERD_SPEC_2x).
|
||||
Concat(_propertyMap).
|
||||
ToDictionary(kv => kv.Key, kv => kv.Value);
|
||||
|
||||
_logger.Debug("Property Map filtered: [{0}] entries found.", _propertyMap.Count);
|
||||
|
||||
_logger.Debug("Validation Controller initialized!");
|
||||
}
|
||||
|
||||
private void ParseConfig(IConfiguration Config)
|
||||
{
|
||||
var oAppConfig = Config.GetSection("Config");
|
||||
var oZugferdConfig = oAppConfig.GetSection("Zugferd");
|
||||
|
||||
if (!bool.TryParse(oZugferdConfig["AllowFacturX"], out _AllowFacturX))
|
||||
{
|
||||
_logger.Info("Configuration AllowFacturX was not set. Using default value [{0}]", false);
|
||||
_AllowFacturX = false;
|
||||
}
|
||||
|
||||
if (!bool.TryParse(oZugferdConfig["AllowXRechnung"], out _AllowXRechnung))
|
||||
{
|
||||
_logger.Info("Configuration AllowXRechnung was not set. Using default value [{0}]", false);
|
||||
_AllowXRechnung = false;
|
||||
}
|
||||
|
||||
if (!bool.TryParse(oZugferdConfig["AllowZugferd2x"], out _AllowZugferd2x))
|
||||
{
|
||||
_logger.Info("Configuration Zugferd2x was not set. Using default value [{0}]", false);
|
||||
_AllowZugferd2x = false;
|
||||
}
|
||||
|
||||
if (!bool.TryParse(oZugferdConfig["AllowZugferd10"], out _AllowZugferd10))
|
||||
{
|
||||
_logger.Info("Configuration Zugferd10 was not set. Using default value [{0}]", true);
|
||||
_AllowZugferd10 = true;
|
||||
}
|
||||
|
||||
if (!int.TryParse(oAppConfig["MaxFileSizeInMegabytes"], out _MaxFileSizeInMegabytes))
|
||||
{
|
||||
_logger.Info("Configuration MaxFileSizeInMegabytes was not set. Using default value [{0}]", MAX_FILE_SIZE_DEFAULT);
|
||||
_MaxFileSizeInMegabytes = MAX_FILE_SIZE_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// POST: /api/validation
|
||||
/// </summary>
|
||||
@ -60,43 +132,66 @@ namespace ZUGFeRDRESTService.Controllers
|
||||
{
|
||||
_logger.Info("Start processing request to ValidationController");
|
||||
|
||||
object oDocument;
|
||||
PropertyValues.CheckPropertyValuesResult oResult = new PropertyValues.CheckPropertyValuesResult();
|
||||
ZugferdResult oZugferdResult;
|
||||
CheckPropertyValuesResult oPropertyResult = new CheckPropertyValuesResult();
|
||||
|
||||
try
|
||||
{
|
||||
using Stream oStream = file.OpenReadStream();
|
||||
{
|
||||
_logger.Info("Checking Filesize of file [{0}]", file.FileName);
|
||||
|
||||
long maxFileSize = _MaxFileSizeInMegabytes * 1024 * 1024;
|
||||
bool oFileSizeIsOK = file.Length < maxFileSize;
|
||||
|
||||
if (oFileSizeIsOK == false)
|
||||
{
|
||||
throw new ZUGFeRDExecption(ErrorType.FileTooBig, "FileTooBig");
|
||||
}
|
||||
|
||||
_logger.Info("Extracting ZUGFeRD Data from file [{0}]", file.FileName);
|
||||
|
||||
oDocument = _zugferd.ExtractZUGFeRDFileWithGDPicture(oStream);
|
||||
oZugferdResult = _zugferd.ExtractZUGFeRDFileWithGDPicture(oStream);
|
||||
|
||||
_logger.Info("Detected Specification was: [{0}]", oZugferdResult.Specification);
|
||||
|
||||
var oFilteredPropertyMap = _zugferd.FilterPropertyMap(_propertyMap, oZugferdResult.Specification);
|
||||
|
||||
if (oFilteredPropertyMap.Count == 0)
|
||||
{
|
||||
_logger.Warn("No properties found in property map for specification [{0}]", oZugferdResult.Specification);
|
||||
throw new ZUGFeRDExecption(ErrorType.UnsupportedFormat, "Unsupported Format");
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Debug("Property map contains [{0}] entries for specification [{1}]", oFilteredPropertyMap.Count, oZugferdResult.Specification);
|
||||
}
|
||||
|
||||
_logger.Info("Starting structural check against the database.");
|
||||
|
||||
oResult = _props.CheckPropertyValues(oDocument, _propertyMap, "MESSAGEID");
|
||||
oPropertyResult = _props.CheckPropertyValues(oZugferdResult.SchemaObject, oFilteredPropertyMap, "MESSAGEID");
|
||||
|
||||
var oRequiredProperties = _propertyMap.
|
||||
var oRequiredProperties = oFilteredPropertyMap.
|
||||
Where(prop => { return prop.Value.IsRequired == true; }).
|
||||
Select(prop => { return prop.Value.Description; })
|
||||
.ToList();
|
||||
Select(prop => { return prop.Value.Description; }).
|
||||
ToList();
|
||||
|
||||
_logger.Debug("Found [{0}] required properties", oRequiredProperties.Count);
|
||||
_logger.Debug(string.Join(",", oRequiredProperties.ToArray()));
|
||||
|
||||
_logger.Info("Result of checking against the database: {0} valid properties, {1} missing properties",
|
||||
oResult.ValidProperties.Count, oResult.MissingProperties.Count);
|
||||
oPropertyResult.ValidProperties.Count, oPropertyResult.MissingProperties.Count);
|
||||
|
||||
if (oResult.MissingProperties.Count > 0)
|
||||
if (oPropertyResult.MissingProperties.Count > 0)
|
||||
{
|
||||
throw new ZUGFeRDExecption(ErrorType.MissingProperties,
|
||||
"Die hochgeladene Datei ist eine gültige ZUGFeRD-Rechnung, allerdings fehlen benötigte Daten.");
|
||||
throw new ZUGFeRDExecption(ErrorType.MissingProperties, "Missing Properties");
|
||||
}
|
||||
|
||||
Tuple<bool, string> oValidateResult = ValidateBuyerOrderReference(oResult.ValidProperties);
|
||||
Tuple<bool, string> oValidateResult = ValidateBuyerOrderReference(oPropertyResult.ValidProperties);
|
||||
|
||||
if (oValidateResult.Item1 == false)
|
||||
{
|
||||
throw new ZUGFeRDExecption(ErrorType.UnknownError, "Die hochgeladene Datei kann nicht validiert werden, weil ein unbekannter Fehler aufgetreten ist.");
|
||||
throw new ZUGFeRDExecption(ErrorType.UnknownError, "Unknown Error");
|
||||
}
|
||||
|
||||
string oValidateResultString = oValidateResult.Item2;
|
||||
@ -136,7 +231,9 @@ namespace ZUGFeRDRESTService.Controllers
|
||||
ErrorType.NoValidFile => "Die hochgeladene Datei ist keine gültige Datei.",
|
||||
ErrorType.NoZugferd => "Die hochgeladene Datei ist keine ZUGFeRD-Rechnung.",
|
||||
ErrorType.NoValidZugferd => "Die hochgeladene Datei ist keine gültige ZUGFeRD-Rechnung.",
|
||||
ErrorType.MissingProperties => "Die hochgeladene Datei ist keine gültige ZUGFeRD-Rechnung, es fehlen einige Metadaten",
|
||||
ErrorType.MissingProperties => "Die hochgeladene Datei ist keine gültige ZUGFeRD-Rechnung, es fehlen einige Metadaten.",
|
||||
ErrorType.FileTooBig => string.Format("Die hochgeladene Datei überschreitet die zulässige Dateigröße [{0}].", _MaxFileSizeInMegabytes),
|
||||
ErrorType.UnsupportedFormat => "Die hochgeladene Datei enthält ein falsches oder nicht unterstütztes ZUGFeRD Format.",
|
||||
_ => "Die hochgeladene Datei kann nicht validiert werden.",
|
||||
};
|
||||
|
||||
@ -144,7 +241,7 @@ namespace ZUGFeRDRESTService.Controllers
|
||||
List<string> oErrors = ex.ErrorType switch
|
||||
{
|
||||
// Errors contains the list of missing fields
|
||||
ErrorType.MissingProperties => oResult.MissingProperties,
|
||||
ErrorType.MissingProperties => oPropertyResult.MissingProperties,
|
||||
_ => new List<string>()
|
||||
};
|
||||
|
||||
@ -239,7 +336,7 @@ namespace ZUGFeRDRESTService.Controllers
|
||||
new SqlParameter("@CREATEDWHO", ADDED_WHO),
|
||||
new SqlParameter("@GROUP_COUNTER", pProperty.GroupCounter),
|
||||
new SqlParameter("@SPEC_NAME", pProperty.TableColumn),
|
||||
new SqlParameter("@IS_REQUIRED", pProperty.ISRequired)
|
||||
new SqlParameter("@IS_REQUIRED", pProperty.IsRequired)
|
||||
};
|
||||
|
||||
var oCommand = new SqlCommand(oSql);
|
||||
|
||||
@ -14,11 +14,12 @@ namespace ZUGFeRDRESTService
|
||||
{
|
||||
public class Database: IDatabase
|
||||
{
|
||||
private DigitalData.Modules.Logging.Logger _Logger = null;
|
||||
private string _gdPictureKey = null;
|
||||
private Dictionary<string, XmlItemProperty> _propertyMap = null;
|
||||
|
||||
private const string QUERY_GET_GDPICTURE_KEY = "SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = 'GDPICTURE'";
|
||||
private const string QUERY_GET_PROPERTY_MAP = "SELECT * FROM TBEDM_XML_ITEMS WHERE SPECIFICATION = '{0}' AND ACTIVE = True ORDER BY XML_PATH";
|
||||
private const string QUERY_GET_PROPERTY_MAP = "SELECT * FROM TBEDM_XML_ITEMS WHERE ACTIVE = True ORDER BY XML_PATH";
|
||||
|
||||
public MSSQLServer MSSQL { get; set; }
|
||||
public Firebird Firebird { get; set; }
|
||||
@ -42,6 +43,8 @@ namespace ZUGFeRDRESTService
|
||||
|
||||
oLogger.Debug("MSSQL Connection: [{0}]", MSSQL.CurrentConnectionString);
|
||||
oLogger.Debug("Firebird Connection: [{0}]", Firebird.ConnectionString);
|
||||
|
||||
_Logger = oLogger;
|
||||
}
|
||||
|
||||
public string GetGDPictureKey()
|
||||
@ -52,12 +55,16 @@ namespace ZUGFeRDRESTService
|
||||
return _gdPictureKey;
|
||||
}
|
||||
|
||||
public Dictionary<String, XmlItemProperty> GetPropertyMap()
|
||||
public Dictionary<string, XmlItemProperty> GetPropertyMap()
|
||||
{
|
||||
if (_propertyMap == null)
|
||||
{
|
||||
_Logger.Debug("Property map does not exist, creating.");
|
||||
|
||||
_propertyMap = new Dictionary<string, XmlItemProperty>();
|
||||
var oDatatable = Firebird.GetDatatable(string.Format(QUERY_GET_PROPERTY_MAP, "DEFAULT"));
|
||||
var oDatatable = Firebird.GetDatatable(QUERY_GET_PROPERTY_MAP);
|
||||
|
||||
_Logger.Debug("Datatable Rows: [{0}]", oDatatable.Rows);
|
||||
|
||||
foreach (DataRow oRow in oDatatable.Rows)
|
||||
{
|
||||
@ -68,11 +75,17 @@ namespace ZUGFeRDRESTService
|
||||
TableColumn = oRow["TABLE_COLUMN"].ToString(),
|
||||
GroupScope = oRow["GROUP_SCOPE"].ToString(),
|
||||
IsRequired = (bool)oRow["IS_REQUIRED"],
|
||||
IsGrouped = (bool)oRow["IS_GROUPED"]
|
||||
IsGrouped = (bool)oRow["IS_GROUPED"],
|
||||
Specification = oRow["SPECIFICATION"].ToString()
|
||||
});
|
||||
}
|
||||
} else
|
||||
{
|
||||
_Logger.Debug("Property map already exists, returning.");
|
||||
}
|
||||
|
||||
_Logger.Debug("Returning Property Map with [{0}] entries.", _propertyMap.Count);
|
||||
|
||||
return _propertyMap;
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,6 +21,9 @@
|
||||
<Reference Include="DigitalData.Modules.Database">
|
||||
<HintPath>..\..\..\DDModules\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Filesystem">
|
||||
<HintPath>..\..\..\DDModules\Filesystem\bin\Debug\DigitalData.Modules.Filesystem.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Interfaces">
|
||||
<HintPath>..\..\..\DDModules\Interfaces\bin\Debug\DigitalData.Modules.Interfaces.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@ -17,6 +17,13 @@
|
||||
"Database": "<FIREBIRDSERVER-IP>:<FIREBIRDSERVER-DBPATH>",
|
||||
"Username": "<FIREBIRDSERVER-USERNAME>",
|
||||
"Password": "<FIREBIRDSERVER-PASSWORD>"
|
||||
}
|
||||
},
|
||||
"Zugferd": {
|
||||
"AllowZugferd10": true,
|
||||
"AllowZugferd2x": false,
|
||||
"AllowFacturX": false,
|
||||
"AllowXRechnung": false
|
||||
},
|
||||
"MaxFileSizeInMegabytes": 25
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user