Compare commits
8 Commits
a5226a8101
...
Update-Net
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b36459e85 | ||
|
|
09673ffd70 | ||
|
|
bff4ad10c9 | ||
|
|
a409e1fd44 | ||
|
|
c7bb645f94 | ||
|
|
e7a7c45430 | ||
|
|
c0054d41ae | ||
|
|
1d31298d8d |
@@ -45,8 +45,8 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll</HintPath>
|
||||
<Reference Include="DigitalData.Modules.Logging">
|
||||
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="DigitalData.Modules.Logging" version="2.6.5" targetFramework="net462" />
|
||||
<package id="NLog" version="5.0.5" targetFramework="net461" />
|
||||
<package id="NuGet.CommandLine" version="6.13.2" targetFramework="net462" developmentDependency="true" />
|
||||
</packages>
|
||||
@@ -48,16 +48,16 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Modules.Base, Version=1.3.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DigitalData.Modules.Base.1.3.8\lib\net462\DigitalData.Modules.Base.dll</HintPath>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Database, Version=2.3.5.4, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DigitalData.Modules.Database.2.3.5.4\lib\net462\DigitalData.Modules.Database.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Encryption, Version=1.3.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DigitalData.Modules.Encryption.1.3.1\lib\net462\DigitalData.Modules.Encryption.dll</HintPath>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll</HintPath>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
|
||||
@@ -148,9 +148,6 @@
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="README.txt" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>powershell.exe -command "& { &'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }"</PostBuildEvent>
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
BASE MODULE
|
||||
===========
|
||||
|
||||
This module is intended for often used constants and datastructures.
|
||||
Therefor it is important that this module does not have any dependencies on other modules!!
|
||||
@@ -1,9 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="DigitalData.Modules.Base" version="1.3.8" targetFramework="net462" />
|
||||
<package id="DigitalData.Modules.Database" version="2.3.5.4" targetFramework="net462" />
|
||||
<package id="DigitalData.Modules.Encryption" version="1.3.1" targetFramework="net462" />
|
||||
<package id="DigitalData.Modules.Logging" version="2.6.5" targetFramework="net462" />
|
||||
<package id="EntityFramework" version="6.4.4" targetFramework="net462" />
|
||||
<package id="EntityFramework.Firebird" version="6.4.0" targetFramework="net462" />
|
||||
<package id="FirebirdSql.Data.FirebirdClient" version="7.5.0" targetFramework="net462" />
|
||||
|
||||
@@ -470,6 +470,7 @@ Public Class MSSQLServer
|
||||
Dim oTransaction As SqlTransaction = MaybeGetTransaction(pSqlConnection, pTransactionMode, pTransaction)
|
||||
|
||||
Try
|
||||
|
||||
Logger.Debug("ExecuteNonQueryWithConnectionObject: Running Command [{0}] and Parameters [{1}]", pSqlCommandObject.CommandText, GetParameterListAsString(pSqlCommandObject))
|
||||
|
||||
pSqlCommandObject.Connection = pSqlConnection
|
||||
@@ -651,12 +652,10 @@ Public Class MSSQLServer
|
||||
Cast(Of SqlParameter).
|
||||
Select(Function(p) $"({p.ParameterName}={p.Value})").
|
||||
ToList()
|
||||
|
||||
Dim oParamString = String.Join(",", oList)
|
||||
If oParamString.Length > 1000 Then
|
||||
oParamString = oParamString.Substring(1, 1000)
|
||||
End If
|
||||
Return oParamString
|
||||
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@@ -47,11 +47,11 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Modules.Encryption, Version=1.3.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DigitalData.Modules.Encryption.1.3.1\lib\net462\DigitalData.Modules.Encryption.dll</HintPath>
|
||||
<Reference Include="DigitalData.Modules.Encryption">
|
||||
<HintPath>..\Encryption\bin\Debug\DigitalData.Modules.Encryption.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll</HintPath>
|
||||
<Reference Include="DigitalData.Modules.Logging">
|
||||
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
|
||||
|
||||
@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("Modules.Database")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2025")>
|
||||
<Assembly: AssemblyTrademark("2.3.6.0")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
|
||||
@@ -44,6 +44,15 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Modules.Base">
|
||||
<HintPath>..\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Database">
|
||||
<HintPath>..\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging">
|
||||
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
||||
@@ -295,24 +304,6 @@
|
||||
<LastGenOutput>Reference.vb</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Base\Base.vbproj">
|
||||
<Project>{6ea0c51f-c2b1-4462-8198-3de0b32b74f8}</Project>
|
||||
<Name>Base</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Config\Config.vbproj">
|
||||
<Project>{44982f9b-6116-44e2-85d0-f39650b1ef99}</Project>
|
||||
<Name>Config</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Database\Database.vbproj">
|
||||
<Project>{eaf0ea75-5fa7-485d-89c7-b2d843b03a96}</Project>
|
||||
<Name>Database</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Logging\Logging.vbproj">
|
||||
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>powershell.exe -command "& { &'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }"</PostBuildEvent>
|
||||
|
||||
@@ -46,7 +46,8 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll</HintPath>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="DigitalData.Modules.Logging" version="2.6.5" targetFramework="net462" />
|
||||
<package id="NLog" version="5.0.5" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -49,6 +49,18 @@
|
||||
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\BouncyCastle.Cryptography.2.5.0\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Base, Version=1.3.9.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Database, Version=2.3.5.4, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DocumentFormat.OpenXml, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DocumentFormat.OpenXml.3.2.0\lib\net46\DocumentFormat.OpenXml.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -281,20 +293,6 @@
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Base\Base.vbproj">
|
||||
<Project>{6ea0c51f-c2b1-4462-8198-3de0b32b74f8}</Project>
|
||||
<Name>Base</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Database\Database.vbproj">
|
||||
<Project>{eaf0ea75-5fa7-485d-89c7-b2d843b03a96}</Project>
|
||||
<Name>Database</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Logging\Logging.vbproj">
|
||||
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("Modules.Interfaces")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2025")>
|
||||
<Assembly: AssemblyTrademark("2.3.5.0")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.3.5.0")>
|
||||
<Assembly: AssemblyFileVersion("2.3.5.0")>
|
||||
<Assembly: AssemblyVersion("2.3.0.0")>
|
||||
<Assembly: AssemblyFileVersion("2.3.0.0")>
|
||||
|
||||
@@ -19,7 +19,6 @@ Public Class ZUGFeRDInterface
|
||||
Public Const ZUGFERD_SPEC_DEFAULT = "DEFAULT"
|
||||
Public Const ZUGFERD_SPEC_10 = "ZUGFERD_10"
|
||||
Public Const ZUGFERD_SPEC_2x = "ZUGFERD_2x"
|
||||
Public Const ZUGFERD_SPEC_2_3x = "ZUGFERD_2_3x"
|
||||
|
||||
Public Const UBL_SPEC_21 = "UBL_21"
|
||||
|
||||
@@ -61,7 +60,6 @@ Public Class ZUGFeRDInterface
|
||||
Public Property AllowXRechnung_Filename As Boolean = True
|
||||
Public Property AllowZugferd_1_0_Schema As Boolean = True
|
||||
Public Property AllowZugferd_2_x_Schema As Boolean = True
|
||||
Public Property AllowZugferd_2_3_x_Schema As Boolean = True
|
||||
Public Property AllowPeppol_3_x_Schema As Boolean = False
|
||||
End Class
|
||||
|
||||
@@ -132,41 +130,20 @@ Public Class ZUGFeRDInterface
|
||||
AllowedFilenames = oAllowedFilenames
|
||||
End Sub
|
||||
|
||||
Public Function FilterPropertyMap(pPropertyMapList As List(Of XmlItemProperty), pSpecification As String) As Dictionary(Of String, XmlItemProperty)
|
||||
_logger.Debug("Filtering Property map list for Specification [{0}]", pSpecification)
|
||||
Public Function FilterPropertyMap(pPropertyMap As Dictionary(Of String, XmlItemProperty), pSpecification As String) As Dictionary(Of String, XmlItemProperty)
|
||||
_logger.Debug("Filtering Property map for Specification [{0}]", pSpecification)
|
||||
|
||||
If pSpecification = ZUGFERD_SPEC_10 Then
|
||||
Try
|
||||
|
||||
_logger.Debug("Special Case [{0}], including [{1}]", ZUGFERD_SPEC_10, ZUGFERD_SPEC_DEFAULT)
|
||||
|
||||
Dim countElements As Integer = pPropertyMapList.Where(Function(x) x.Specification = pSpecification Or x.Specification = ZUGFERD_SPEC_DEFAULT).Count
|
||||
_logger.Debug("Property map list contains [{0}] elements for specification [{1}]", countElements, pSpecification)
|
||||
|
||||
Return pPropertyMapList.
|
||||
Where(Function(kv) kv.Specification = pSpecification Or kv.Specification = ZUGFERD_SPEC_DEFAULT).
|
||||
ToDictionary(Function(kv) kv.XMLPath, Function(kv) kv)
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
_logger.Debug("Special Case [{0}], including [{1}]", ZUGFERD_SPEC_10, ZUGFERD_SPEC_DEFAULT)
|
||||
Return pPropertyMap.
|
||||
Where(Function(kv) kv.Value.Specification = pSpecification Or kv.Value.Specification = ZUGFERD_SPEC_DEFAULT).
|
||||
ToDictionary(Function(kv) kv.Key, Function(kv) kv.Value)
|
||||
Else
|
||||
|
||||
Try
|
||||
|
||||
Dim countElements As Integer = pPropertyMapList.Where(Function(x) x.Specification = pSpecification).Count
|
||||
_logger.Debug("Property map list contains [{0}] elements for specification [{1}]", countElements, pSpecification)
|
||||
|
||||
Return pPropertyMapList.
|
||||
Where(Function(kv) kv.Specification = pSpecification).
|
||||
ToDictionary(Function(kv) kv.XMLPath, Function(kv) kv)
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
_logger.Debug("Using Specification [{0}]", pSpecification)
|
||||
Return pPropertyMap.
|
||||
Where(Function(kv) kv.Value.Specification = pSpecification).
|
||||
ToDictionary(Function(kv) kv.Key, Function(kv) kv.Value)
|
||||
End If
|
||||
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
Public Function GetSerializedXMLContentFromFile(oFileInfo As FileInfo) As ZugferdResult
|
||||
@@ -271,7 +248,7 @@ Public Class ZUGFeRDInterface
|
||||
Throw ex
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Error while validating eInvoice file with GDPicture")
|
||||
_logger.Warn("Error while validating ZUGFeRD file with GDPicture")
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
@@ -300,7 +277,7 @@ Public Class ZUGFeRDInterface
|
||||
Throw ex
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Error while validating eInvoice file with GDPicture")
|
||||
_logger.Warn("Error while validating ZUGFeRD file with GDPicture")
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
@@ -381,7 +358,6 @@ Public Class ZUGFeRDInterface
|
||||
})
|
||||
End If
|
||||
|
||||
'' Reihenfolge 2.0 muss unverändert bleiben. Älteste Version immer zuerst!
|
||||
If _Options.AllowZugferd_2_x_Schema Then
|
||||
oAllowedTypes.AddRange(New List(Of AllowedType) From {
|
||||
New AllowedType With {
|
||||
@@ -398,22 +374,16 @@ Public Class ZUGFeRDInterface
|
||||
.SchemaType = GetType(Version2_2_FacturX.CrossIndustryInvoiceType),
|
||||
.Specification = ZUGFERD_SPEC_2x,
|
||||
.XMLSchema = XMLSCHEMA_ZUGFERD_22
|
||||
}
|
||||
})
|
||||
End If
|
||||
|
||||
'' Reihenfolge ab 2.3 geändert. Neuste Version immer zuerst
|
||||
If _Options.AllowZugferd_2_3_x_Schema Then
|
||||
oAllowedTypes.AddRange(New List(Of AllowedType) From {
|
||||
New AllowedType With {
|
||||
.SchemaType = GetType(Version2_3_3_FacturX.CrossIndustryInvoiceType),
|
||||
.Specification = ZUGFERD_SPEC_2_3x,
|
||||
.XMLSchema = XMLSCHEMA_ZUGFERD_233
|
||||
},
|
||||
New AllowedType With {
|
||||
.SchemaType = GetType(Version2_3_FacturX.CrossIndustryInvoiceType),
|
||||
.Specification = ZUGFERD_SPEC_2_3x,
|
||||
.Specification = ZUGFERD_SPEC_2x,
|
||||
.XMLSchema = XMLSCHEMA_ZUGFERD_23
|
||||
},
|
||||
New AllowedType With {
|
||||
.SchemaType = GetType(Version2_3_3_FacturX.CrossIndustryInvoiceType),
|
||||
.Specification = ZUGFERD_SPEC_2x,
|
||||
.XMLSchema = XMLSCHEMA_ZUGFERD_233
|
||||
}
|
||||
})
|
||||
End If
|
||||
@@ -472,7 +442,7 @@ Public Class ZUGFeRDInterface
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Dim oMessage = "Datei ist eine ungültige eInvoice Datei oder das Format wird nicht unterstüzt, oder das Format ist deaktiviert."
|
||||
Dim oMessage = "Datei ist eine ungültige ZUGFeRD Datei oder das Format wird nicht unterstüzt, oder das Format ist deaktiviert."
|
||||
Throw New ZUGFeRDExecption(ErrorType.NoValidZugferd, oMessage)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
@@ -3,6 +3,5 @@
|
||||
DateType '1
|
||||
MoneyType '2
|
||||
FileType '3
|
||||
ListType '4 - vgl. Währung
|
||||
|
||||
End Enum
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
Imports System.Globalization
|
||||
Imports System.Reflection
|
||||
Imports System.Reflection
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
@@ -28,7 +27,6 @@ Public Class PropertyValues
|
||||
Public IsRequired As Boolean
|
||||
Public GroupCounter As Integer = -1
|
||||
|
||||
Public EN16931_ID As String
|
||||
Public Description As String
|
||||
Public Value As String
|
||||
Public XMLPath As String
|
||||
@@ -37,7 +35,6 @@ Public Class PropertyValues
|
||||
End Class
|
||||
|
||||
Public Class MissingProperty
|
||||
Public EN16931_ID As String
|
||||
Public Description As String
|
||||
Public XMLPath As String
|
||||
|
||||
@@ -57,7 +54,7 @@ Public Class PropertyValues
|
||||
ToDictionary(Function(Item) Item.Key,
|
||||
Function(Item) Item.Value)
|
||||
|
||||
_logger.Debug("Found {0} ungrouped properties.", oDefaultProperties.Count)
|
||||
_logger.Debug("Found {0} default properties.", oDefaultProperties.Count)
|
||||
|
||||
' PropertyMap items with `IsGrouped = True` are grouped by group scope
|
||||
Dim oGroupedProperties = PropertyMap.
|
||||
@@ -115,14 +112,13 @@ Public Class PropertyValues
|
||||
Dim oPropertyDescription As String = oColumn.Key.Description
|
||||
Dim oPropertyPath As String = oColumn.Key.XMLPath
|
||||
Dim oItemType As Integer = oColumn.Key.ItemType
|
||||
Dim oEN16931Value As String = oColumn.Key.EN16931_ID
|
||||
|
||||
Dim oRowCounter = oRowIndex + oGlobalGroupCounter + 1
|
||||
|
||||
' Returns nothing if oColumn.Value contains an empty list
|
||||
Dim oPropertyValue = oColumn.Value.ElementAtOrDefault(oRowIndex)
|
||||
|
||||
_logger.Debug("Processing itemColumn *TableColumn* [{0}].", oTableColumn)
|
||||
_logger.Debug("Processing itemSpecification *TableColumn* [{0}].", oTableColumn)
|
||||
If oTableColumn = "INVOICE_SELLER_EMAIL" Then
|
||||
Console.WriteLine("INVOICE_SELLER_EMAIL")
|
||||
ElseIf oTableColumn = "INVOICE_POSITION_ARTICLE" Then
|
||||
@@ -130,29 +126,20 @@ Public Class PropertyValues
|
||||
End If
|
||||
If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
|
||||
If oColumn.Key.IsRequired Then
|
||||
_logger.Warn($"{MessageId} - oPropertyValue for column [{oTableColumn}] is empty or not found but is required. Continuing with Empty String.")
|
||||
_logger.Warn($"{MessageId} # oPropertyValue for specification [{oTableColumn}] is empty or not found but is required. Continuing with Empty String.")
|
||||
Dim oMissingProperty = New MissingProperty() With {
|
||||
.EN16931_ID = oEN16931Value,
|
||||
.Description = oPropertyDescription,
|
||||
.XMLPath = oPropertyPath
|
||||
}
|
||||
oResult.MissingProperties.Add(oMissingProperty)
|
||||
Else
|
||||
_logger.Debug($"{MessageId} - oPropertyValue for column [{oTableColumn}] is empty or not found. Continuing with Empty String.")
|
||||
_logger.Debug($"{MessageId} # oPropertyValue for specification [{oTableColumn}] is empty or not found. Continuing with Empty String.")
|
||||
End If
|
||||
|
||||
oPropertyValue = String.Empty
|
||||
End If
|
||||
|
||||
If (oPropertyValue IsNot Nothing) Then
|
||||
Dim logValue As String = oPropertyValue.ToString()
|
||||
If logValue.Length > 50 Then
|
||||
_logger.Debug("Item [{0}] has value '{1}...'", oTableColumn, logValue.Substring(1, 50))
|
||||
Else
|
||||
_logger.Debug("Item [{0}] has value '{1}'", oTableColumn, oPropertyValue)
|
||||
End If
|
||||
|
||||
End If
|
||||
_logger.Debug("ItemSpecification [{0}] has value '{1}'", oTableColumn, oPropertyValue)
|
||||
|
||||
oResult.ValidProperties.Add(New ValidProperty() With {
|
||||
.MessageId = MessageId,
|
||||
@@ -163,8 +150,7 @@ Public Class PropertyValues
|
||||
.TableColumn = oTableColumn,
|
||||
.IsRequired = oIsRequired,
|
||||
.XMLPath = oPropertyPath,
|
||||
.ItemType = oItemType,
|
||||
.EN16931_ID = oEN16931Value
|
||||
.ItemType = oItemType
|
||||
})
|
||||
Next
|
||||
Next
|
||||
@@ -183,12 +169,11 @@ Public Class PropertyValues
|
||||
Dim oIsRequired = oItem.Value.IsRequired
|
||||
Dim oDescription = oItem.Value.Description
|
||||
Dim oItemType = oItem.Value.ItemType
|
||||
Dim oEN16931_ID = oItem.Value.EN16931_ID
|
||||
|
||||
Try
|
||||
oPropertyValueList = GetPropValue(pDocument, oItem.Key)
|
||||
Catch ex As Exception
|
||||
_logger.Warn("{2} - Unknown error occurred while fetching specification [{0}] in group [{1}]:", oTableColumn, oItem.Value.GroupScope, MessageId)
|
||||
_logger.Warn("{2} # Unknown error occurred while fetching specification [{0}] in group [{1}]:", oPropertyDescription, oItem.Value.GroupScope, MessageId)
|
||||
_logger.Warn("ERROR-MESSAGE [{0}]", ex.Message)
|
||||
_logger.Error(ex)
|
||||
oPropertyValueList = New List(Of Object)
|
||||
@@ -207,20 +192,20 @@ Public Class PropertyValues
|
||||
|
||||
' This should hopefully show config errors
|
||||
If TypeOf oPropertyValue Is List(Of Object) Then
|
||||
_logger.Warn("Item with specification [{0}] may be configured incorrectly", oTableColumn)
|
||||
_logger.Warn("Item with specification [{0}] may be configured incorrectly", oPropertyDescription)
|
||||
oPropertyValue = Nothing
|
||||
End If
|
||||
End Select
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Unknown error occurred while processing specification [{0}]:", oTableColumn)
|
||||
_logger.Warn("Unknown error occurred while processing specification [{0}]:", oPropertyDescription)
|
||||
_logger.Error(ex)
|
||||
oPropertyValue = Nothing
|
||||
End Try
|
||||
|
||||
If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
|
||||
If oItem.Value.IsRequired Then
|
||||
_logger.Warn("Specification [{0}] is empty, but marked as required! Skipping.", oTableColumn)
|
||||
_logger.Warn("{0} # Specification [{1}] is empty, but marked as required! Skipping.", MessageId, oPropertyDescription)
|
||||
Dim oMissingProperty = New MissingProperty With
|
||||
{
|
||||
.Description = oPropertyDescription,
|
||||
@@ -229,14 +214,14 @@ Public Class PropertyValues
|
||||
oResult.MissingProperties.Add(oMissingProperty)
|
||||
Continue For
|
||||
Else
|
||||
_logger.Debug("oPropertyValue for specification [{0}] is empty or not found. Skipping.", oTableColumn)
|
||||
_logger.Debug("{0} # oPropertyValue for specification [{1}] is empty or not found. Skipping.", MessageId, oPropertyDescription)
|
||||
|
||||
Continue For
|
||||
End If
|
||||
End If
|
||||
|
||||
' Statt dem Zahlenwert des Enums, wollen wir die Währungsbezeichnung
|
||||
If oTableColumn = "INVOICE_CURRENCY" Or oItemType = 4 Then
|
||||
' Statt dem Zahlenwert des Enums, wollen wir die Währunsgbezeichnung
|
||||
If oTableColumn = "INVOICE_CURRENCY" Then
|
||||
oPropertyValue = oPropertyValue.ToString()
|
||||
End If
|
||||
|
||||
@@ -248,8 +233,7 @@ Public Class PropertyValues
|
||||
.TableColumn = oTableColumn,
|
||||
.IsRequired = oIsRequired,
|
||||
.XMLPath = oPropertyPath,
|
||||
.ItemType = oItemType,
|
||||
.EN16931_ID = oEN16931_ID
|
||||
.ItemType = oItemType
|
||||
})
|
||||
Next
|
||||
|
||||
@@ -296,11 +280,17 @@ Public Class PropertyValues
|
||||
|
||||
Obj = oInfo.GetValue(Obj, Nothing)
|
||||
|
||||
' TODO: This code should check for array properties by itself
|
||||
' and should not rely on the user to
|
||||
'If oInfo.PropertyType.IsArray Then
|
||||
' Obj = Obj(0)
|
||||
'End If
|
||||
|
||||
If oHasIndex Then
|
||||
Obj = Obj(0)
|
||||
End If
|
||||
|
||||
If IsArray(Obj) And Not oHasIndex And oPart <> "Value" Then
|
||||
If IsArray(Obj) And Not oHasIndex Then
|
||||
Dim oCurrentPart As String = oPart
|
||||
Dim oSplitString As String() = New String() {oCurrentPart & "."}
|
||||
Dim oPathFragments = PropertyName.Split(oSplitString, StringSplitOptions.None)
|
||||
@@ -320,56 +310,8 @@ Public Class PropertyValues
|
||||
Next
|
||||
|
||||
Return oResults
|
||||
Else
|
||||
If oPart = "Value" AndAlso Obj IsNot Nothing Then
|
||||
' Der Name des gefundenen Datentyps
|
||||
Dim oObjType = oInfo.PropertyType.FullName
|
||||
|
||||
If oObjType.Equals("System.DateTime", StringComparison.OrdinalIgnoreCase) Then
|
||||
|
||||
Dim d As Date
|
||||
Dim s As String
|
||||
Dim oResult As String
|
||||
|
||||
s = Convert.ToString(Obj)
|
||||
|
||||
If IsDate(s) = True Then
|
||||
' Hier wird das DEFAULT-Format auf yyyyMMdd gesetzt
|
||||
Dim dtfi As DateTimeFormatInfo = CultureInfo.CreateSpecificCulture(CultureInfo.InvariantCulture.Name).DateTimeFormat
|
||||
dtfi.DateSeparator = ""
|
||||
dtfi.ShortDatePattern = "yyyyMMdd"
|
||||
|
||||
d = CDate(s)
|
||||
oResult = d.ToString("d", dtfi)
|
||||
|
||||
'Return New List(Of Object) From {oResult}
|
||||
Dim oRetValue As List(Of Object) = New List(Of Object) From {
|
||||
oResult
|
||||
}
|
||||
|
||||
Return oRetValue
|
||||
|
||||
End If
|
||||
ElseIf oObjType.Equals("System.Decimal", StringComparison.OrdinalIgnoreCase) Then
|
||||
|
||||
Dim oResult As String
|
||||
|
||||
If IsNumeric(Obj) = True Then
|
||||
Dim decValue As Decimal = CDec(Obj)
|
||||
' Es wird immer ein . als Dezimaltrenner verwendet, falls nötig
|
||||
oResult = decValue.ToString(CultureInfo.InvariantCulture)
|
||||
|
||||
'Return New List(Of Object) From {oResult}
|
||||
Dim oRetValue As List(Of Object) = New List(Of Object) From {
|
||||
oResult
|
||||
}
|
||||
|
||||
Return oRetValue
|
||||
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
Return New List(Of Object) From {Obj}
|
||||
@@ -397,20 +339,8 @@ Public Class PropertyValues
|
||||
Select Case oCount
|
||||
Case 0
|
||||
Return Nothing
|
||||
Case 1
|
||||
Dim firstElement As Object
|
||||
firstElement = oList.FirstOrDefault()
|
||||
If firstElement IsNot Nothing AndAlso IsArray(firstElement) Then
|
||||
|
||||
' Attachments sind Byte-Arrays und müssen umgewandelt werden
|
||||
Return Convert.ToBase64String(firstElement)
|
||||
|
||||
Else
|
||||
Return DoGetFinalPropValue(oList.First())
|
||||
End If
|
||||
Case Else
|
||||
Return DoGetFinalPropValue(oList.First())
|
||||
|
||||
End Select
|
||||
|
||||
Return DoGetFinalPropValue(Value)
|
||||
|
||||
@@ -14,7 +14,6 @@ Public Class Validator
|
||||
ValidateDecimalNodes(pResult)
|
||||
ValidateCurrencyNodes(pResult)
|
||||
|
||||
'TODO Validate Datumsfelder
|
||||
Return pResult
|
||||
End Function
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -558,7 +558,7 @@ Namespace ZUGFeRD.Version2_3_FacturX
|
||||
End Set
|
||||
End Property
|
||||
End Class
|
||||
|
||||
|
||||
'''<remarks/>
|
||||
<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.8.3928.0"), _
|
||||
System.SerializableAttribute(), _
|
||||
@@ -566,31 +566,18 @@ Namespace ZUGFeRD.Version2_3_FacturX
|
||||
System.ComponentModel.DesignerCategoryAttribute("code"), _
|
||||
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100")> _
|
||||
Partial Public Class DateTimeType
|
||||
|
||||
'Private itemField As Object
|
||||
|
||||
''''<remarks/>
|
||||
'<System.Xml.Serialization.XmlElementAttribute("DateTime", GetType(Date)), _
|
||||
' System.Xml.Serialization.XmlElementAttribute("DateTimeString", GetType(DateTimeTypeDateTimeString))> _
|
||||
'Public Property Item() As Object
|
||||
' Get
|
||||
' Return Me.itemField
|
||||
' End Get
|
||||
' Set
|
||||
' Me.itemField = value
|
||||
' End Set
|
||||
'End Property
|
||||
|
||||
Private itemField As DateTimeTypeDateTimeString
|
||||
|
||||
|
||||
Private itemField As Object
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlElementAttribute("DateTimeString")>
|
||||
Public Property DateTimeString() As DateTimeTypeDateTimeString
|
||||
<System.Xml.Serialization.XmlElementAttribute("DateTime", GetType(Date)), _
|
||||
System.Xml.Serialization.XmlElementAttribute("DateTimeString", GetType(DateTimeTypeDateTimeString))> _
|
||||
Public Property Item() As Object
|
||||
Get
|
||||
Return Me.itemField
|
||||
End Get
|
||||
Set
|
||||
Me.itemField = Value
|
||||
Me.itemField = value
|
||||
End Set
|
||||
End Property
|
||||
End Class
|
||||
@@ -9431,18 +9418,6 @@ Namespace ZUGFeRD.Version2_3_FacturX
|
||||
<System.Xml.Serialization.XmlEnumAttribute("870")>
|
||||
Item870 = 870
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlEnumAttribute("875")>
|
||||
Item875 = 875
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlEnumAttribute("876")>
|
||||
Item876 = 876
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlEnumAttribute("877")>
|
||||
Item877 = 877
|
||||
|
||||
'''<remarks/>
|
||||
<System.Xml.Serialization.XmlEnumAttribute("890")>
|
||||
Item890 = 890
|
||||
|
||||
@@ -22,14 +22,7 @@
|
||||
''' 0 = Default / Text
|
||||
''' 1 = Datum
|
||||
''' 2 = Gleitkomma
|
||||
''' 3 = Attachment-Felder
|
||||
''' 4 = Elemente einer Liste, vgl Currency
|
||||
''' 3 = Memo-Feld
|
||||
''' </summary>
|
||||
Public ItemType As Integer
|
||||
|
||||
''' <summary>
|
||||
''' BT-Feld-Bezeichnung
|
||||
''' </summary>
|
||||
Public EN16931_ID As String
|
||||
|
||||
End Class
|
||||
@@ -67,18 +67,6 @@
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Base\Base.vbproj">
|
||||
<Project>{6ea0c51f-c2b1-4462-8198-3de0b32b74f8}</Project>
|
||||
<Name>Base</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Config\Config.vbproj">
|
||||
<Project>{44982f9b-6116-44e2-85d0-f39650b1ef99}</Project>
|
||||
<Name>Config</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Database\Database.vbproj">
|
||||
<Project>{eaf0ea75-5fa7-485d-89c7-b2d843b03a96}</Project>
|
||||
<Name>Database</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Interfaces\Interfaces.vbproj">
|
||||
<Project>{ab6f09bf-e794-4f6a-94bb-c97c0ba84d64}</Project>
|
||||
<Name>Interfaces</Name>
|
||||
@@ -125,6 +113,18 @@
|
||||
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\BouncyCastle.Cryptography.2.5.0\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Base, Version=1.3.9.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Config, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Database, Version=2.3.5.4, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DocumentFormat.OpenXml, Version=3.2.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DocumentFormat.OpenXml.3.2.0\lib\net46\DocumentFormat.OpenXml.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("Modules.Jobs")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2025")>
|
||||
<Assembly: AssemblyTrademark("2.9.9.0")>
|
||||
<Assembly: AssemblyTrademark("2.9.3.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -30,5 +30,5 @@ Imports System.Runtime.InteropServices
|
||||
' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
|
||||
<Assembly: AssemblyVersion("2.9.9.0")>
|
||||
<Assembly: AssemblyFileVersion("2.9.9.0")>
|
||||
<Assembly: AssemblyVersion("2.9.4.0")>
|
||||
<Assembly: AssemblyFileVersion("2.9.4.0")>
|
||||
|
||||
@@ -33,6 +33,11 @@ Public Class HashFunctions
|
||||
End If
|
||||
|
||||
' Check if Checksum exists in History Table
|
||||
'Dim oCheckCommand = $"SELECT * FROM TBEDM_ZUGFERD_HISTORY_IN WHERE GUID = (SELECT MAX(GUID) FROM TBEDM_ZUGFERD_HISTORY_IN WHERE UPPER(MD5HASH) = UPPER('{oMD5CheckSum}'))"
|
||||
'Dim oTable As DataTable = _firebird.GetDatatable(oCheckCommand, Firebird.TransactionMode.NoTransaction)
|
||||
|
||||
' Check if Checksum exists in History Table
|
||||
' TODO: WHAT THE FUCK IS THIS
|
||||
Dim oCheckCommand = $"SELECT * FROM TBEMLP_HISTORY WHERE GUID = (SELECT MAX(GUID) FROM TBEMLP_HISTORY WHERE UPPER(MD5HASH) = UPPER('{oMD5CheckSum}'))"
|
||||
Dim oTable As DataTable = Database.GetDatatable(oCheckCommand, MSSQLServer.TransactionMode.NoTransaction)
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ Imports DigitalData.Modules.Interfaces.Exceptions
|
||||
Imports DigitalData.Modules.Interfaces.PropertyValues
|
||||
Imports DigitalData.Modules.Jobs.Exceptions
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports GdPicture14
|
||||
|
||||
Public Class ImportZUGFeRDFiles
|
||||
Implements IJob
|
||||
@@ -28,35 +27,10 @@ Public Class ImportZUGFeRDFiles
|
||||
|
||||
Private Const DIRECTORY_DONT_MOVE = "DIRECTORY_DONT_MOVE"
|
||||
|
||||
Private Const MIME_TYPE_PDF = "application/pdf"
|
||||
Private Const MIME_TYPE_XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
||||
Private Const MIME_TYPE_ODT = "application/vnd.oasis.opendocument.spreadsheet"
|
||||
|
||||
' List of allowed extensions for PDF/A Attachments
|
||||
' This list should not contain xml so the zugferd xml file will be filtered out
|
||||
Private ReadOnly AllowedExtensions As New List(Of String) From {"docx", "doc", "pdf", "xls", "xlsx", "ppt", "pptx", "txt"}
|
||||
|
||||
' List of the Columns we need to store embedded files on disk and database
|
||||
Private ReadOnly EmbeddedFilesColumnNames As List(Of String) = New List(Of String) From {
|
||||
"ATTACHMENT_FILE_FILENAME", "ATTACHMENT_FILE_VALUE", "ATTACHMENT_FILE_MIMECODE"
|
||||
}
|
||||
|
||||
' List of the allowed MIME-Codes
|
||||
' Allowed Values are:
|
||||
'- application/pdf
|
||||
'- application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (xlsx)
|
||||
'- application/vnd.oasis.opendocument.spreadsheet (odt)
|
||||
'- image/jpeg
|
||||
'- image/png
|
||||
'- image/tiff (UBL)
|
||||
'- text/csv
|
||||
'- text/xml (UBL)
|
||||
Private ReadOnly AllowedMimeTypesInEmbeddedFiles As List(Of String) = New List(Of String) From {
|
||||
MIME_TYPE_PDF,
|
||||
MIME_TYPE_XLSX,
|
||||
MIME_TYPE_ODT
|
||||
}
|
||||
|
||||
Private ReadOnly _logger As Logger
|
||||
Private ReadOnly _logConfig As LogConfig
|
||||
Private ReadOnly _filesystem As FilesystemEx
|
||||
@@ -166,6 +140,8 @@ Public Class ImportZUGFeRDFiles
|
||||
' Start a new transaction for each file group.
|
||||
' This way we can rollback database changes for the whole filegroup in case something goes wrong.
|
||||
Dim oSQLConnection As SqlConnection = _mssql.GetConnection()
|
||||
|
||||
|
||||
Dim oSQLTransaction As SqlTransaction = oSQLConnection?.BeginTransaction()
|
||||
|
||||
Dim oConnections As New DatabaseConnections() With {
|
||||
@@ -218,7 +194,7 @@ Public Class ImportZUGFeRDFiles
|
||||
End If
|
||||
|
||||
If oResult.ZugferdFileFound = True Then
|
||||
_logger.Debug("eInvoice File found")
|
||||
_logger.Debug("Zugferd File found")
|
||||
oMD5CheckSum = oResult.MD5Checksum
|
||||
oZUGFeRDCount = oResult.ZugferdFileCount
|
||||
oEmailAttachmentFiles.AddRange(oResult.EmailAttachmentFiles)
|
||||
@@ -335,7 +311,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Dim oBody = String.Format(EmailStrings.EMAIL_TOO_MUCH_FERDS, oEmailData.Subject)
|
||||
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "TooMuchFerdsException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.TooMuchFerdsException, "", "")
|
||||
AddRejectedState(oMessageId, oRejectionCodeString, "Email enthielt mehr als ein eInvoice-Dokument", "", oSQLTransaction)
|
||||
AddRejectedState(oMessageId, oRejectionCodeString, "Email enthielt mehr als ein ZUGFeRD-Dokument", "", oSQLTransaction)
|
||||
|
||||
Catch ex As NoFerdsException
|
||||
_logger.Error(ex)
|
||||
@@ -348,7 +324,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Dim oBody = String.Format(EmailStrings.EMAIL_NO_FERDS, oEmailData.Subject)
|
||||
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "NoFerdsException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.NoFerdsException, "", "")
|
||||
AddRejectedState(oMessageId, oRejectionCodeString, "Email enthielt keine eInvoice-Dokumente", "", oSQLTransaction)
|
||||
AddRejectedState(oMessageId, oRejectionCodeString, "Email enthielt keine ZUGFeRD-Dokumente", "", oSQLTransaction)
|
||||
|
||||
Catch ex As MissingValueException
|
||||
_logger.Error(ex)
|
||||
@@ -367,7 +343,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Dim oEmailData = _file.MoveAndRenameEmailToRejected(oArgs, oMessageId)
|
||||
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "MissingValueException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.MissingValueException, oOrgFilename, oMissingFieldList)
|
||||
AddRejectedState(oMessageId, oRejectionCodeString, "Es fehlten eInvoice-Spezifikationen", "", oSQLTransaction)
|
||||
AddRejectedState(oMessageId, oRejectionCodeString, "Es fehlten ZugferdSpezifikationen", "", oSQLTransaction)
|
||||
|
||||
Catch ex As FileSizeLimitReachedException
|
||||
_logger.Error(ex)
|
||||
@@ -400,7 +376,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Dim oBody = _email.CreateBodyForUnhandledException(oMessageId, ex)
|
||||
Dim oEmailData As New EmailData With {
|
||||
.From = oArgs.ExceptionEmailAddress,
|
||||
.Subject = $"OutOfMemoryException im eInvoice-Parser @ {oMessageId}"
|
||||
.Subject = $"OutOfMemoryException im ZUGFeRD-Parser @ {oMessageId}"
|
||||
}
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "OutOfMemoryException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace)
|
||||
|
||||
@@ -423,7 +399,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Dim oBody = _email.CreateBodyForUnhandledException(oMessageId, ex)
|
||||
Dim oEmailData As New EmailData With {
|
||||
.From = oArgs.ExceptionEmailAddress,
|
||||
.Subject = $"UnhandledException im eInvoice-Parser @ {oMessageId}"
|
||||
.Subject = $"UnhandledException im ZUGFeRD-Parser @ {oMessageId}"
|
||||
}
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "UnhandledException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace)
|
||||
|
||||
@@ -479,7 +455,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Dim oBody = _email.CreateBodyForUnhandledException(oMessageId, ex)
|
||||
Dim oEmailData As New EmailData With {
|
||||
.From = oArgs.ExceptionEmailAddress,
|
||||
.Subject = $"FileMoveException im eInvoice-Parser @ {oMessageId}"
|
||||
.Subject = $"FileMoveException im ZUGFeRD-Parser @ {oMessageId}"
|
||||
}
|
||||
_email.AddToEmailQueueMSSQL(oMessageId, oSQLTransaction, oBody, oEmailData, "FileMoveException", _EmailOutAccountId, oArgs.NamePortal, oArgs.RejectionTemplateId, ErrorCode.UnhandledException, ex.Message, ex.StackTrace)
|
||||
|
||||
@@ -565,21 +541,21 @@ Public Class ImportZUGFeRDFiles
|
||||
Catch ex As ZUGFeRDExecption
|
||||
Select Case ex.ErrorType
|
||||
Case ZUGFeRDInterface.ErrorType.NoZugferd
|
||||
_logger.Info("File [{0}] is not a valid eInvoice document. Skipping.", pFile.Name)
|
||||
_logger.Info("File [{0}] is not a valid ZUGFeRD document. Skipping.", pFile.Name)
|
||||
|
||||
oResult.EmailAttachmentFiles.Add(pFile)
|
||||
Return oResult
|
||||
|
||||
Case ZUGFeRDInterface.ErrorType.UnsupportedFormat
|
||||
_logger.Info("File [{0}/{1}] is an unsupported eInvoice document format!", pFile.Name, ex.XmlFile)
|
||||
_logger.Info("File [{0}/{1}] is an unsupported ZUFeRD document format!", pFile.Name, ex.XmlFile)
|
||||
Throw New UnsupportedFerdException(ex.XmlFile)
|
||||
|
||||
Case ZUGFeRDInterface.ErrorType.NoValidZugferd
|
||||
_logger.Info("File [{0}] is an Incorrectly formatted eInvoice document!", pFile.Name)
|
||||
_logger.Info("File [{0}] is an Incorrectly formatted ZUGFeRD document!", pFile.Name)
|
||||
Throw New InvalidFerdException()
|
||||
|
||||
Case Else
|
||||
_logger.Warn("Unexpected Error occurred while extracting eInvoice Information from file {0}", pFile.Name)
|
||||
_logger.Warn("Unexpected Error occurred while extracting ZUGFeRD Information from file {0}", pFile.Name)
|
||||
Throw ex
|
||||
End Select
|
||||
|
||||
@@ -587,7 +563,7 @@ Public Class ImportZUGFeRDFiles
|
||||
|
||||
Try
|
||||
oDocument.ReceiptFileType = ZUGFeRDInterface.RECEIPT_TYPE_XML
|
||||
Dim sqlResult As Boolean = StoreXMLItemsInDatabase(pMessageId, oDocument, pFile, pConnections, pArgs, oResult)
|
||||
Dim sqlResult As Boolean = StoreXMLItemsInDatabase(pMessageId, oDocument, pFile, pConnections, pArgs)
|
||||
Catch ex As Exception
|
||||
Throw ex
|
||||
End Try
|
||||
@@ -637,21 +613,21 @@ Public Class ImportZUGFeRDFiles
|
||||
Catch ex As ZUGFeRDExecption
|
||||
Select Case ex.ErrorType
|
||||
Case ZUGFeRDInterface.ErrorType.NoZugferd
|
||||
_logger.Info("File [{0}] is not a valid eInvoice document. Skipping.", pFile.Name)
|
||||
_logger.Info("File [{0}] is not a valid ZUGFeRD document. Skipping.", pFile.Name)
|
||||
|
||||
oResult.EmailAttachmentFiles.Add(pFile)
|
||||
Return oResult
|
||||
|
||||
Case ZUGFeRDInterface.ErrorType.UnsupportedFormat
|
||||
_logger.Info("File [{0}/{1}] is an unsupported eInvoice document format!", pFile.Name, ex.XmlFile)
|
||||
_logger.Info("File [{0}/{1}] is an unsupported ZUFeRD document format!", pFile.Name, ex.XmlFile)
|
||||
Throw New UnsupportedFerdException(ex.XmlFile)
|
||||
|
||||
Case ZUGFeRDInterface.ErrorType.NoValidZugferd
|
||||
_logger.Info("File [{0}] is an incorrectly formatted eInvoice document!", pFile.Name)
|
||||
_logger.Info("File [{0}] is an Incorrectly formatted ZUGFeRD document!", pFile.Name)
|
||||
Throw New InvalidFerdException()
|
||||
|
||||
Case Else
|
||||
_logger.Warn("Unexpected Error occurred while extracting eInvoice Information from file {0}", pFile.Name)
|
||||
_logger.Warn("Unexpected Error occurred while extracting ZUGFeRD Information from file {0}", pFile.Name)
|
||||
Throw ex
|
||||
End Select
|
||||
End Try
|
||||
@@ -677,7 +653,7 @@ Public Class ImportZUGFeRDFiles
|
||||
|
||||
Try
|
||||
oDocument.ReceiptFileType = ZUGFeRDInterface.RECEIPT_TYPE_PDF
|
||||
Dim sqlResult As Boolean = StoreXMLItemsInDatabase(pMessageId, oDocument, pFile, pConnections, pArgs, oResult)
|
||||
Dim sqlResult As Boolean = StoreXMLItemsInDatabase(pMessageId, oDocument, pFile, pConnections, pArgs)
|
||||
Catch ex As Exception
|
||||
Throw ex
|
||||
End Try
|
||||
@@ -694,12 +670,12 @@ Public Class ImportZUGFeRDFiles
|
||||
|
||||
End Function
|
||||
|
||||
Private Function StoreXMLItemsInDatabase(pMessageId As String, pDocument As ZUGFeRDInterface.ZugferdResult, pFile As FileInfo, pConnections As DatabaseConnections, pArgs As WorkerArgs, pProcessFileResult As ProcessFileResult) As Boolean
|
||||
Private Function StoreXMLItemsInDatabase(pMessageId As String, pDocument As ZUGFeRDInterface.ZugferdResult, pFile As FileInfo, pConnections As DatabaseConnections, pArgs As WorkerArgs) As Boolean
|
||||
' Check the document against the configured property map and return:
|
||||
' - a List of valid properties
|
||||
' - a List of missing properties
|
||||
|
||||
Dim oPropertyMap As Dictionary(Of String, XmlItemProperty) = _zugferd.FilterPropertyMap(pArgs.PropertyMapList, pDocument.Specification)
|
||||
Dim oPropertyMap = _zugferd.FilterPropertyMap(pArgs.PropertyMap, pDocument.Specification)
|
||||
Dim oCheckResult = _zugferd.PropertyValues.CheckPropertyValues(pDocument.SchemaObject, oPropertyMap, pMessageId)
|
||||
|
||||
_logger.Info("Properties checked: [{0}] missing properties / [{1}] valid properties found.", oCheckResult.MissingProperties.Count, oCheckResult.ValidProperties.Count)
|
||||
@@ -717,359 +693,39 @@ Public Class ImportZUGFeRDFiles
|
||||
Throw New Exception("Bulk Insert failed! Exiting.")
|
||||
End If
|
||||
|
||||
' TODO hier BAUSTELLE
|
||||
' Eingebettete Dateien speichern
|
||||
If HandleEmbeddedAttachments(pMessageId, pDocument, pConnections, oCheckResult, pArgs, pProcessFileResult) = False Then
|
||||
_logger.Debug("Files saving for MessageId [{0}] failed!", pMessageId)
|
||||
End If
|
||||
'If CreateEmbeddedFilesOnDisk(pMessageId, pDocument, pConnections, oCheckResult) = False Then
|
||||
' _logger.Debug("Files saving for MessageId [{0}] failed!", pMessageId)
|
||||
'End If
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Hier werden die Dateianhänge behandelt, die im XML als base64 eingetragen wurden.
|
||||
''' Die zusammengehörigen Knoten müssen über "FILES" gruppiert werden!
|
||||
'''
|
||||
''' Die erwarteten Knoten-Namen sind in der List EmbeddedFilesColumnNames enthalten!
|
||||
''' </summary>
|
||||
Private Function HandleEmbeddedAttachments(pMessageId As String, pDocument As ZUGFeRDInterface.ZugferdResult, pConnections As DatabaseConnections,
|
||||
pCheckResult As CheckPropertyValuesResult, pArgs As WorkerArgs, pProcessFileResult As ProcessFileResult) As Boolean
|
||||
Private Function CreateEmbeddedFilesOnDisk(pMessageId As String, pDocument As ZUGFeRDInterface.ZugferdResult, pConnections As DatabaseConnections, pCheckResult As CheckPropertyValuesResult) As Boolean
|
||||
|
||||
If (pCheckResult Is Nothing) Then
|
||||
_logger.Debug("pCheckResult is empty!")
|
||||
Return True
|
||||
End If
|
||||
|
||||
If (CheckEmbeddedAttachmentEntries(pCheckResult) = False) Then
|
||||
_logger.Debug("No embedded Files in XML found!")
|
||||
Return True
|
||||
End If
|
||||
|
||||
Dim embAttachmentList As List(Of ValidProperty) = pCheckResult.ValidProperties.Where(
|
||||
Function(z)
|
||||
Return EmbeddedFilesColumnNames.Contains(z.TableColumn)
|
||||
End Function
|
||||
).ToList()
|
||||
|
||||
If embAttachmentList Is Nothing OrElse embAttachmentList.Count <= 0 Then
|
||||
_logger.Debug("No Fields for Embedded Files configured!")
|
||||
Return True
|
||||
End If
|
||||
|
||||
' GroupCounter Werte in Hashset eintragen, um distinct Werte zu erhalten
|
||||
Dim oIndexList As HashSet(Of Integer) = New HashSet(Of Integer)
|
||||
For Each resultItem In embAttachmentList
|
||||
oIndexList.Add(resultItem.GroupCounter)
|
||||
Next
|
||||
|
||||
Dim oOutputPath As String = GetOutputPathForEmbeddedAttachments(pArgs)
|
||||
Dim nextAttachmentIndex As Integer = 0
|
||||
nextAttachmentIndex = GetNextAttachmentIndex(pMessageId)
|
||||
If nextAttachmentIndex <= 0 Then
|
||||
nextAttachmentIndex = 1
|
||||
End If
|
||||
|
||||
For Each groupIndex In oIndexList
|
||||
|
||||
Dim oMimeCodeString As String = String.Empty
|
||||
Dim oOrgFilename As String = String.Empty
|
||||
Dim oBase64String As String = String.Empty
|
||||
|
||||
Dim oMimeTypeProperty As ValidProperty = GetIndexProperty(embAttachmentList, groupIndex, "ATTACHMENT_FILE_MIMECODE")
|
||||
|
||||
If oMimeTypeProperty IsNot Nothing AndAlso oMimeTypeProperty.Value.IsNotNullOrEmpty() Then
|
||||
oMimeCodeString = oMimeTypeProperty.Value.ToLower()
|
||||
Else
|
||||
_logger.Debug("Empty MIME-Code! File can not be stored!")
|
||||
Continue For
|
||||
End If
|
||||
|
||||
Dim oFilenameProperty As ValidProperty = GetIndexProperty(embAttachmentList, groupIndex, "ATTACHMENT_FILE_FILENAME")
|
||||
If oFilenameProperty IsNot Nothing AndAlso oFilenameProperty.Value.IsNotNullOrEmpty() Then
|
||||
oOrgFilename = oFilenameProperty.Value
|
||||
Else
|
||||
_logger.Debug("Empty Filename! File can not be stored!")
|
||||
Continue For
|
||||
End If
|
||||
|
||||
Dim oBase64ValueProperty As ValidProperty = GetIndexProperty(embAttachmentList, groupIndex, "ATTACHMENT_FILE_VALUE")
|
||||
If oBase64ValueProperty IsNot Nothing AndAlso oBase64ValueProperty.Value.IsNotNullOrEmpty() Then
|
||||
oBase64String = oBase64ValueProperty.Value
|
||||
Else
|
||||
_logger.Error("Empty base64 String! File can not be stored!")
|
||||
Continue For
|
||||
End If
|
||||
|
||||
Dim newAttachmentFilename = pMessageId + "~attm" + nextAttachmentIndex.ToString
|
||||
|
||||
Dim oFileExtension = GetEmbeddedFileExtension(oMimeTypeProperty.Value)
|
||||
If oFileExtension.IsNotNullOrEmpty() Then
|
||||
newAttachmentFilename += "." + oFileExtension
|
||||
Else
|
||||
_logger.Warn("No extension found! File can not be stored!")
|
||||
Continue For
|
||||
End If
|
||||
|
||||
Dim embeddedFilePath = Path.Combine(oOutputPath, newAttachmentFilename)
|
||||
_logger.Debug("Next Attachment File is [{0}]", embeddedFilePath)
|
||||
If SaveBase64ToDisk(embeddedFilePath, oBase64String) = True Then
|
||||
_logger.Debug("Saved file [{0}] to disk", embeddedFilePath)
|
||||
pProcessFileResult.EmailAttachmentFiles.Add(New FileInfo(embeddedFilePath))
|
||||
Else
|
||||
_logger.Error("Could not save File to Disk!")
|
||||
Dim oReasonString = "Could not save file " + newAttachmentFilename + " to disk."
|
||||
AddRejectedState(pMessageId, oReasonString, "EMBEDDED FILE CONSISTENCY NOT OK", "Info GUI", pConnections.SQLServerTransaction)
|
||||
Continue For
|
||||
End If
|
||||
|
||||
If TestFileOnDisk(embeddedFilePath, oMimeCodeString) = False Then
|
||||
_logger.Error("Could not save File to Disk!")
|
||||
Dim oReasonString = "Validation of file " + newAttachmentFilename + " on disk was NOT succesfully."
|
||||
AddRejectedState(pMessageId, oReasonString, "EMBEDDED FILE CONSISTENCY NOT OK", "Info GUI", pConnections.SQLServerTransaction)
|
||||
Continue For
|
||||
End If
|
||||
|
||||
If InsertAttachmentHistoryEntry(pMessageId, oOrgFilename, embeddedFilePath) = False Then
|
||||
_logger.Error("Could not save attachment Data to DB!")
|
||||
Return False
|
||||
End If
|
||||
|
||||
If InsertEmbeddedFileDataToDB(pMessageId, oBase64String, oOrgFilename, oMimeCodeString, groupIndex) = False Then
|
||||
_logger.Error("Could not save attachment Data to DB!")
|
||||
Return False
|
||||
End If
|
||||
|
||||
nextAttachmentIndex += 1
|
||||
Next
|
||||
' Finde alle Eintraege in pCheckResult mit Item_Type=3
|
||||
' Finde Dateinamen (Index nach ~attm) und Dateityp. Wir speichern nur PDF.
|
||||
' TODO Funktion aufrufen
|
||||
'SaveBase64ToDisk("", "") = False Then
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function TestFileOnDisk(pEmbeddedFilePath As String, pMimeCodeString As String) As Boolean
|
||||
Try
|
||||
If pMimeCodeString = MIME_TYPE_PDF Then
|
||||
Dim oGdPicturePDF As New GdPicturePDF
|
||||
Dim oStatus As GdPictureStatus = oGdPicturePDF.LoadFromFile(pEmbeddedFilePath, True)
|
||||
If oStatus <> GdPictureStatus.OK Then
|
||||
_logger.Error("File [{0}] has no proper state!", pEmbeddedFilePath)
|
||||
Return False
|
||||
End If
|
||||
|
||||
Else
|
||||
' Test other files
|
||||
Dim fileInfo As FileInfo = New FileInfo(pEmbeddedFilePath)
|
||||
If fileInfo.Exists = False Then
|
||||
_logger.Error("Could not find File [{0}] on Disk!", pEmbeddedFilePath)
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function GetEmbeddedFileExtension(pMimeTypeValue As String) As String
|
||||
|
||||
If pMimeTypeValue.IsNullOrEmpty() Then
|
||||
_logger.Warn("Empty MimeCode is not allowed!")
|
||||
Return String.Empty
|
||||
End If
|
||||
|
||||
Select Case pMimeTypeValue.ToLower()
|
||||
Case MIME_TYPE_PDF
|
||||
Return "pdf"
|
||||
Case MIME_TYPE_XLSX
|
||||
Return "xlsx"
|
||||
Case MIME_TYPE_ODT
|
||||
Return "odt"
|
||||
Case "image/jpeg"
|
||||
Return "jpg"
|
||||
Case "image/png"
|
||||
Return "png"
|
||||
Case "image/tiff"
|
||||
Return "tif"
|
||||
Case "text/csv"
|
||||
Return "csv"
|
||||
Case "text/xml"
|
||||
Return "xml"
|
||||
Case Else
|
||||
Return String.Empty
|
||||
End Select
|
||||
|
||||
End Function
|
||||
|
||||
Private Shared Function GetIndexProperty(pListResult As List(Of ValidProperty), pGroupIndex As Integer, pTableColumn As String) As ValidProperty
|
||||
Return pListResult.Where(
|
||||
Function(z)
|
||||
Return z.GroupCounter = pGroupIndex AndAlso z.TableColumn = pTableColumn
|
||||
End Function
|
||||
).FirstOrDefault
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Speichert die Daten inkl. base64-String in die Datenbank
|
||||
''' </summary>
|
||||
Private Function InsertEmbeddedFileDataToDB(pMessageId As String, pItemValue As String, pOrgFilename As String, pMimeType As String, pGroupIndex As Integer) As Boolean
|
||||
Try
|
||||
Dim oCommand = New SqlCommand(
|
||||
"INSERT INTO TBEDMI_ITEM_FILES (
|
||||
REFERENCE_GUID,
|
||||
ITEM_VALUE,
|
||||
ORG_FILENAME,
|
||||
MIME_TYPE,
|
||||
GROUP_INDEX,
|
||||
CREATED_WHO
|
||||
) VALUES (
|
||||
@MESSAGE_ID,
|
||||
@ITEM_VALUE,
|
||||
@ORG_FILENAME,
|
||||
@MIME_TYPE,
|
||||
@GROUP_INDEX,
|
||||
@CREATED_WHO
|
||||
)")
|
||||
|
||||
Dim fileBytes As Byte() = Convert.FromBase64String(pItemValue)
|
||||
|
||||
oCommand.Parameters.Add("MESSAGE_ID", SqlDbType.VarChar, 250).Value = pMessageId
|
||||
oCommand.Parameters.Add("ITEM_VALUE", SqlDbType.VarBinary).Value = fileBytes
|
||||
oCommand.Parameters.Add("ORG_FILENAME", SqlDbType.VarChar, 256).Value = pOrgFilename
|
||||
oCommand.Parameters.Add("MIME_TYPE", SqlDbType.VarChar, 256).Value = pMimeType
|
||||
oCommand.Parameters.Add("GROUP_INDEX", SqlDbType.Int).Value = pGroupIndex
|
||||
oCommand.Parameters.Add("CREATED_WHO", SqlDbType.VarChar, 100).Value = "eInvoice Parser"
|
||||
|
||||
_mssql.ExecuteNonQuery(oCommand)
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Ermittelt den Ausgabepfad für die eingebetteten Anhänge
|
||||
''' </summary>
|
||||
Private Function GetOutputPathForEmbeddedAttachments(pArgs As WorkerArgs) As String
|
||||
Return pArgs.WatchDirectory
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Prüft, ob Embedded Attachments in den XML-Ergebnissen enthalten sind,
|
||||
''' in dem geprüft wird, ob bestimmte MIME-Codes vorhanden sind.
|
||||
''' </summary>
|
||||
''' <param name="pCheckResult"></param>
|
||||
''' <returns></returns>
|
||||
Private Function CheckEmbeddedAttachmentEntries(pCheckResult As CheckPropertyValuesResult) As Boolean
|
||||
|
||||
Try
|
||||
Dim resultList = pCheckResult.ValidProperties.Where(
|
||||
Function(z)
|
||||
Return (z.TableColumn = "ATTACHMENT_FILE_MIMECODE" AndAlso AllowedMimeTypesInEmbeddedFiles.Contains(z.Value.ToLower()))
|
||||
End Function
|
||||
).ToList()
|
||||
|
||||
If resultList.Count > 0 Then
|
||||
_logger.Info("Found [{0}] embedded XML-Attachments.", resultList.Count)
|
||||
Return True
|
||||
Else
|
||||
_logger.Info("No embedded XML-Attachments found.")
|
||||
Return False
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_logger.Error("Error searching pCheckResult! {0}", ex.Message)
|
||||
Return False
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' Speichere base64 als Datei auf der Platte ab.
|
||||
''' </summary>
|
||||
Private Function SaveBase64ToDisk(pExportFilePath As String, pBase64String As String) As Boolean
|
||||
|
||||
Try
|
||||
Dim base64BinaryDataString As String = pBase64String ' Hier Base64-String einfügen
|
||||
Dim binaryDataString As Byte() = System.Convert.FromBase64String(base64BinaryDataString)
|
||||
Dim oFilename As String = pExportFilePath
|
||||
Dim base64BinaryDataString As String = pBase64String
|
||||
Dim binaryDataString As Byte() = Convert.FromBase64String(base64BinaryDataString)
|
||||
|
||||
' Using verwenden, um blockieren der Datei zu verhindern
|
||||
Using fs = New FileStream(oFilename, FileMode.Create, FileAccess.ReadWrite)
|
||||
fs.Write(binaryDataString, 0, binaryDataString.Length)
|
||||
fs.Flush()
|
||||
fs.Close()
|
||||
End Using
|
||||
|
||||
Return True
|
||||
|
||||
Dim Stream As System.IO.FileStream = New System.IO.FileStream(oFilename, System.IO.FileMode.Create)
|
||||
Stream.Write(binaryDataString, 0, binaryDataString.Length)
|
||||
Stream.Close()
|
||||
Catch ex As Exception
|
||||
_logger.Error("Could NOT save File [{0}] to Disk! Exception: [{1}]", pExportFilePath, ex.Message)
|
||||
Return False
|
||||
_logger.Error("Could NOT save File to Disk for MessageId [{0}] !", pExportFilePath)
|
||||
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Die Methode lädt die bisherigen Dateinamen zu einer MessageID
|
||||
''' Die Datei mit dem höchsten Index gibt den folgenden Index vor.
|
||||
''' </summary>
|
||||
''' <returns>Nächster Attachment Index</returns>
|
||||
Private Function GetNextAttachmentIndex(pMessageId As String) As Integer
|
||||
Try
|
||||
Dim oSQL = $"SELECT count(*) FROM TBEMLP_HISTORY_ATTACHMENT WHERE EMAIL_MSGID = '{pMessageId}'"
|
||||
|
||||
Dim sqlResult = _mssql.GetScalarValue(oSQL)
|
||||
If sqlResult = 0 Then
|
||||
sqlResult = 1 ' Kleinster Index = 1
|
||||
End If
|
||||
|
||||
Return sqlResult
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Speichert die Infos zu einem embedded Dateianhang in die DB.
|
||||
''' Mangels EMail-Daten werden die EMail-Felder (FROM, BODY, usw.) nicht gefüllt
|
||||
''' </summary>
|
||||
''' <returns>true, wenn erfolgreich</returns>
|
||||
Private Function InsertAttachmentHistoryEntry(pMessageId As String, pFileName As String, pNewFileName As String) As Boolean
|
||||
|
||||
Try
|
||||
Dim oCommand = New SqlCommand(
|
||||
"INSERT INTO TBEMLP_HISTORY_ATTACHMENT (
|
||||
WORK_PROCESS,
|
||||
EMAIL_MSGID,
|
||||
EMAIL_ATTMT,
|
||||
EMAIL_ATTMT_INDEX,
|
||||
EMAIL_FROM,
|
||||
EMAIL_BODY
|
||||
) VALUES (
|
||||
@WORK_PROCESS,
|
||||
@MESSAGE_ID,
|
||||
@ATTACHMENT,
|
||||
@ATTACHMENT_INDEX,
|
||||
'-',
|
||||
'-'
|
||||
)")
|
||||
|
||||
oCommand.Parameters.Add("WORK_PROCESS", SqlDbType.VarChar, 100).Value = "Attachment Sniffer (Embedded Files)"
|
||||
oCommand.Parameters.Add("MESSAGE_ID", SqlDbType.VarChar, 500).Value = pMessageId
|
||||
oCommand.Parameters.Add("ATTACHMENT", SqlDbType.VarChar, 500).Value = pFileName
|
||||
oCommand.Parameters.Add("ATTACHMENT_INDEX", SqlDbType.VarChar, 500).Value = pNewFileName
|
||||
|
||||
_mssql.ExecuteNonQuery(oCommand)
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Function BulkInsertDataToDatabase(pMessageId As String, pDocument As ZUGFeRDInterface.ZugferdResult, pConnections As DatabaseConnections, pCheckResults As CheckPropertyValuesResult) As Boolean
|
||||
@@ -1115,7 +771,7 @@ Public Class ImportZUGFeRDFiles
|
||||
' Erste Zeile enthält die Spezifikation
|
||||
Dim oFirstRow As DataRow = oDataTable.NewRow()
|
||||
oFirstRow("REFERENCE_GUID") = pMessageId
|
||||
oFirstRow("ITEM_DESCRIPTION") = "Verwendete Spezifikation der E-Rechnung"
|
||||
oFirstRow("ITEM_DESCRIPTION") = "ZUGFeRDSpezifikation"
|
||||
oFirstRow("ITEM_VALUE") = pDocument.Specification
|
||||
oFirstRow("GROUP_COUNTER") = 0
|
||||
oFirstRow("SPEC_NAME") = "ZUGFERD_SPECIFICATION"
|
||||
@@ -1127,7 +783,7 @@ Public Class ImportZUGFeRDFiles
|
||||
' Zweite Zeile enthält das verwendete XML Schema
|
||||
Dim oSecondRow As DataRow = oDataTable.NewRow()
|
||||
oSecondRow("REFERENCE_GUID") = pMessageId
|
||||
oSecondRow("ITEM_DESCRIPTION") = "Verwendetes XML-Schema (XSD) der E-Rechnung"
|
||||
oSecondRow("ITEM_DESCRIPTION") = "ZUGFeRDXMLSchema"
|
||||
oSecondRow("ITEM_VALUE") = pDocument.UsedXMLSchema
|
||||
oSecondRow("GROUP_COUNTER") = 0
|
||||
oSecondRow("SPEC_NAME") = "ZUGFERD_XML_SCHEMA"
|
||||
@@ -1139,7 +795,7 @@ Public Class ImportZUGFeRDFiles
|
||||
' Dritte Zeile enthält das verwendete Datei-Format des Belegs (PDF/XML)
|
||||
Dim oThirdRow As DataRow = oDataTable.NewRow()
|
||||
oThirdRow("REFERENCE_GUID") = pMessageId
|
||||
oThirdRow("ITEM_DESCRIPTION") = "Dateityp der E-Rechnung"
|
||||
oThirdRow("ITEM_DESCRIPTION") = "ReceiptFileType"
|
||||
oThirdRow("ITEM_VALUE") = pDocument.ReceiptFileType
|
||||
oThirdRow("GROUP_COUNTER") = 0
|
||||
oThirdRow("SPEC_NAME") = "RECEIPT_FILE_TYPE"
|
||||
@@ -1155,12 +811,6 @@ Public Class ImportZUGFeRDFiles
|
||||
Continue For
|
||||
End If
|
||||
|
||||
' ItemType = 0 (normale texte) dürfen nicht leer sein
|
||||
If oProperty.ItemType = 0 And oProperty.Value.IsNullOrEmpty Then
|
||||
_logger.Debug("No Mapping for Property [{0}] with empty value, because of ItemType = 0.", oProperty.TableColumn)
|
||||
Continue For
|
||||
End If
|
||||
|
||||
' If GroupCounter is -1, it means this is a default property that can only occur once.
|
||||
' Set the actual inserted value to 0
|
||||
Dim oGroupCounterValue As Integer = oProperty.GroupCounter
|
||||
@@ -1172,22 +822,15 @@ Public Class ImportZUGFeRDFiles
|
||||
_logger.Warn("Value for field [{0}] is longer than 900 characters, will be truncated!", oProperty.TableColumn)
|
||||
End If
|
||||
|
||||
Dim oDescription As String
|
||||
If oProperty.EN16931_ID IsNot Nothing AndAlso oProperty.EN16931_ID.Length > 1 Then
|
||||
oDescription = oProperty.EN16931_ID + " (" + oProperty.Description + ")"
|
||||
Else
|
||||
oDescription = oProperty.Description
|
||||
End If
|
||||
|
||||
Dim oNewRow As DataRow = oDataTable.NewRow()
|
||||
oNewRow("REFERENCE_GUID") = pMessageId
|
||||
oNewRow("ITEM_DESCRIPTION") = oDescription
|
||||
oNewRow("ITEM_VALUE") = oProperty.Value.Truncate(900)
|
||||
oNewRow("ITEM_DESCRIPTION") = oProperty.Description
|
||||
oNewRow("ITEM_VALUE") = oProperty.Value.Truncate(900).Replace("'", "''")
|
||||
oNewRow("GROUP_COUNTER") = oGroupCounterValue
|
||||
oNewRow("SPEC_NAME") = oProperty.TableColumn
|
||||
oNewRow("IS_REQUIRED") = oProperty.IsRequired
|
||||
|
||||
_logger.Debug("Mapping Property [{0}] with value [{1}]", oProperty.TableColumn, oProperty.Value)
|
||||
_logger.Debug("Mapping Property [{0}] with value [{1}]", oProperty.TableColumn, oProperty.Value.Replace("'", "''"))
|
||||
oDataTable.Rows.Add(oNewRow)
|
||||
Next
|
||||
|
||||
@@ -1205,15 +848,6 @@ Public Class ImportZUGFeRDFiles
|
||||
_logger.Warn("Step [{0}] with SQL [{1}] was not successful.", oStep, oDelSQL)
|
||||
End Try
|
||||
|
||||
Try
|
||||
oDelSQL = $"DELETE FROM TBEDMI_ITEM_FILES where REFERENCE_GUID = '{pMessageId}'"
|
||||
oStep = "TBEDMI_ITEM_FILES Delete MessageID Items"
|
||||
Dim retValue As Boolean = _mssql.ExecuteNonQueryWithConnectionObject(oDelSQL, pConnections.SQLServerConnection, MSSQLServer.TransactionMode.ExternalTransaction, pConnections.SQLServerTransaction)
|
||||
Return retValue
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Step [{0}] with SQL [{1}] was not successful.", oStep, oDelSQL)
|
||||
End Try
|
||||
|
||||
Return False
|
||||
End Function
|
||||
|
||||
@@ -1237,10 +871,6 @@ Public Class ImportZUGFeRDFiles
|
||||
Return True
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Fügt neue Datensätze in Tabelle TBEMLP_HISTORY_STATE ein,
|
||||
''' per Prozedur DD_ECM.[dbo].[PRCUST_ADD_HISTORY_STATE]
|
||||
''' </summary>
|
||||
Private Sub AddRejectedState(pMessageID As String, pTitle As String, pTitle1 As String, pComment As String, pTransaction As SqlTransaction)
|
||||
Try
|
||||
'PRCUST_ADD_HISTORY_STATE: @MessageID VARCHAR(250), @TITLE1 VARCHAR(250), @TITLE2 VARCHAR(250)
|
||||
@@ -1250,5 +880,4 @@ Public Class ImportZUGFeRDFiles
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
@@ -12,7 +12,7 @@ Public Class WorkerArgs
|
||||
Public NonZugferdDirectory As String = Nothing
|
||||
|
||||
' Property Parameter
|
||||
Public PropertyMapList As New List(Of XmlItemProperty)
|
||||
Public PropertyMap As New Dictionary(Of String, XmlItemProperty)
|
||||
|
||||
' Email Parameter
|
||||
Public EmailOutProfileId As Integer = 0
|
||||
@@ -31,7 +31,6 @@ Public Class WorkerArgs
|
||||
Public AllowXRechnung As Boolean = True
|
||||
Public AllowZugferd10 As Boolean = True
|
||||
Public AllowZugferd2x As Boolean = True
|
||||
Public AllowZugferd23x As Boolean = True
|
||||
Public AllowPeppolBISBill3x As Boolean = False
|
||||
|
||||
End Class
|
||||
@@ -87,6 +87,7 @@ Public Class XRechnungViewDocument
|
||||
Dim oIndex As Integer = 0
|
||||
Dim oYPlus As Integer = 0
|
||||
Dim oCreateTextBox As Boolean = False
|
||||
Dim oPosRowY As Integer = 0
|
||||
For Each oRow As DataRow In pDTItemValues.Rows
|
||||
Dim Y_eq_lastrow As Boolean = CBool(oRow.Item("Y_eq_lastrow"))
|
||||
Dim oRowCaption As String = oRow.Item("Row_Caption")
|
||||
@@ -129,27 +130,30 @@ Public Class XRechnungViewDocument
|
||||
If oArea = "TYPE" Then
|
||||
oAREACaption = $"{Return_InvType(oItemValue)} [{oItemValue}]"
|
||||
ElseIf oArea = "SELLER" Then
|
||||
oAREACaption = "Verkäufer / Seller:"
|
||||
oAREACaption = "Verkäufer/Seller:"
|
||||
ElseIf oArea = "BUYER" Then
|
||||
oAREACaption = "Käufer / Buyer:"
|
||||
oAREACaption = "Käufer/Buyer:"
|
||||
ElseIf oArea = "POSITION" Then
|
||||
oAREACaption = "Positionen / Positions:"
|
||||
oAREACaption = "Positionen/Positions:"
|
||||
oIsPosition = True
|
||||
ElseIf oArea = "AMOUNT" Then
|
||||
oAREACaption = "Beträge / Amounts:"
|
||||
oAREACaption = "Beträge/Amounts:"
|
||||
oCreateTextBox = True
|
||||
ElseIf oArea = "TAXPOS" Then
|
||||
oAREACaption = "Steuerbeträge / Tax amounts:"
|
||||
oAREACaption = "Steuerbeträge/Tax amounts:"
|
||||
oIsPosition = True
|
||||
ElseIf oArea = "PAYMENT" Then
|
||||
oAREACaption = "Zahlungsinformationen / Payment details:"
|
||||
oAREACaption = "Zahlungsinformationen/Payment details:"
|
||||
ElseIf oArea = "EXEMPTION" Then
|
||||
oAREACaption = "UST.-Befreiungsgrund / Exemption reason:"
|
||||
oAREACaption = "USt.-Befreiungsgrund/Exemption reason:"
|
||||
Else
|
||||
oAREACaption = String.Empty
|
||||
End If
|
||||
|
||||
If Not oAREACaption = String.Empty Then
|
||||
If oArea = "AMOUNT" Then
|
||||
Dim oY = yPosition
|
||||
End If
|
||||
'erste Area-Linie
|
||||
yPosition += 5
|
||||
MyGDPicturePDF.DrawLine(10, yPosition, oWidthLine, yPosition)
|
||||
@@ -186,20 +190,12 @@ Public Class XRechnungViewDocument
|
||||
oIsPosition = True
|
||||
If oItemSPECNAME = "INVOICE_POSITION_AMOUNT" Then
|
||||
oPosCount += 1
|
||||
'oPosTerm = $"{oPosCount}. {oItemValue} * "
|
||||
'oItemValue = oPosTerm
|
||||
'Tabellendarstellung
|
||||
oPosTerm = ""
|
||||
oPosRowY = yPosition
|
||||
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, oPosCount)
|
||||
'
|
||||
'Dim otextBoxYPos As Integer = yPosition - 3.5
|
||||
'MyGDPicturePDF.DrawTextBox(fontResName, 10, otextBoxYPos, 16, YCoo_TextBoxPlus5(otextBoxYPos),
|
||||
' TextAlignment.TextAlignmentFar, TextAlignment.TextAlignmentNear,
|
||||
' oPosCount)
|
||||
|
||||
MyGDPicturePDF.DrawText(fontResName, 19, yPosition, oItemValue)
|
||||
'Tabellendarstellung Ende
|
||||
oDisplay = False
|
||||
' yPosition -= 5
|
||||
End If
|
||||
ElseIf oArea = "TAXPOS" Then
|
||||
oIsPosition = True
|
||||
@@ -219,17 +215,13 @@ Public Class XRechnungViewDocument
|
||||
If oArea = "POSITION" Then
|
||||
If oItemSPECNAME = "INVOICE_POSITION_AMOUNT" Then
|
||||
oPosCount += 1
|
||||
oYPlus = 0
|
||||
'Tabellendarstellung
|
||||
yPosition += 5
|
||||
oYPlus = 0
|
||||
|
||||
oPosTerm = ""
|
||||
MyGDPicturePDF.DrawText(fontResName, 10, yPosition, oPosCount)
|
||||
'otextBoxYPos = yPosition - 3.5
|
||||
'MyGDPicturePDF.DrawTextBox(fontResName, 10, otextBoxYPos, 16, YCoo_TextBoxPlus5(otextBoxYPos),
|
||||
' TextAlignment.TextAlignmentFar, TextAlignment.TextAlignmentNear,
|
||||
' oPosCount)
|
||||
oPosRowY = yPosition
|
||||
MyGDPicturePDF.DrawText(fontResName, 19, yPosition, oItemValue)
|
||||
'Tabellendarstellung Ende
|
||||
oDisplay = False
|
||||
ElseIf oItemSPECNAME = "INVOICE_POSITION_UNIT_TYPE" Then
|
||||
oYPlus = 0
|
||||
@@ -237,11 +229,11 @@ Public Class XRechnungViewDocument
|
||||
MyGDPicturePDF.DrawText(fontResName, 35, yPosition, oUnit)
|
||||
oDisplay = False
|
||||
ElseIf oItemSPECNAME = "INVOICE_POSITION_ARTICLE" Then
|
||||
'Tabellendarstellung
|
||||
oYPlus = 0
|
||||
oPosDesc = ""
|
||||
oPosDesc = oItemValue
|
||||
Dim oYDyn As Integer = yPosition - 5
|
||||
|
||||
Dim oPartsNL As List(Of String) = StringFunctions.SplitTextByNewLine(oItemValue)
|
||||
For Each olinepart As String In oPartsNL
|
||||
Dim oParts As List(Of String) = StringFunctions.SplitText_Length(olinepart, 67)
|
||||
@@ -252,14 +244,15 @@ Public Class XRechnungViewDocument
|
||||
MyGDPicturePDF.DrawText(fontResName, 50, oYDyn, part)
|
||||
Next
|
||||
Next
|
||||
'Tabellendarstellung Ende
|
||||
' oPosTerm += $" {oItemValue}"
|
||||
yPosition = oYDyn
|
||||
oDisplay = False
|
||||
ElseIf oItemSPECNAME = "INVOICE_POSITION_NOTE" Then
|
||||
'Tabellendarstellung
|
||||
Dim cleanedText As String = RemoveNewlinesAndTabs(oItemValue)
|
||||
Dim oParts As List(Of String) = StringFunctions.SplitText_Length(cleanedText, 70)
|
||||
' Durchlaufen der einzelnen Teile in einer Schleife
|
||||
ElseIf oItemSPECNAME = "INVOICE_POSITION_ARTICLE_DESCRIPTION" Or
|
||||
oItemSPECNAME = "INVOICE_POSITION_NOTE" Then
|
||||
_logger.Debug($"oItemSPECNAME: {oItemSPECNAME}")
|
||||
|
||||
'Dim cleanedText As String = RemoveNewlinesAndTabs(oItemValue)
|
||||
'Dim oParts As List(Of String) = StringFunctions.SplitText_Length(cleanedText, 70)
|
||||
'' Durchlaufen der einzelnen Teile in einer Schleife
|
||||
Dim oYDyn As Integer = yPosition
|
||||
Dim oPartsNL As List(Of String) = StringFunctions.SplitTextByNewLine(oItemValue)
|
||||
For Each olinepart As String In oPartsNL
|
||||
@@ -271,37 +264,17 @@ Public Class XRechnungViewDocument
|
||||
MyGDPicturePDF.DrawText(fontResName, 50, oYDyn, part)
|
||||
Next
|
||||
Next
|
||||
yPosition = oYDyn
|
||||
|
||||
'oPosTerm += $" {oItemValue}"
|
||||
oDisplay = False
|
||||
ElseIf oItemSPECNAME = "INVOICE_POSITION_ARTICLE_DESCRIPTION" Then
|
||||
'Tabellendarstellung
|
||||
Dim cleanedText As String = RemoveNewlinesAndTabs(oItemValue)
|
||||
Dim oParts As List(Of String) = StringFunctions.SplitText_Length(cleanedText, 70)
|
||||
' Durchlaufen der einzelnen Teile in einer Schleife
|
||||
Dim oYDyn As Integer = yPosition
|
||||
Dim oPartsNL As List(Of String) = StringFunctions.SplitTextByNewLine(oItemValue)
|
||||
For Each olinepart As String In oPartsNL
|
||||
Dim oPartsPN As List(Of String) = StringFunctions.SplitText_Length(olinepart, 70)
|
||||
' Durchlaufen der einzelnen Teile in einer Schleife
|
||||
For Each part As String In oPartsPN
|
||||
oYDyn += 5
|
||||
oYPlus += 5
|
||||
MyGDPicturePDF.DrawText(fontResName, 50, oYDyn, part)
|
||||
Next
|
||||
Next
|
||||
|
||||
'oPosTerm += $" {oItemValue}"
|
||||
oDisplay = False
|
||||
ElseIf oItemSPECNAME = "INVOICE_TAXPOS_TAX_RATE" Or oItemSPECNAME = "INVOICE_TAXPOS_RATE" Then
|
||||
'Tabellendarstellung
|
||||
MyGDPicturePDF.DrawText(fontResName, 164, yPosition, $"{oItemValue} %")
|
||||
'Tabellendarstellung ENDE
|
||||
' oPosTerm += $" - {oItemValue} %"
|
||||
|
||||
MyGDPicturePDF.DrawText(fontResName, 164, oPosRowY, $"{oItemValue} %")
|
||||
oDisplay = False
|
||||
ElseIf oItemSPECNAME = "INVOICE_POSITION_TAX_AMOUNT" Then
|
||||
'Tabellendarstellung
|
||||
Dim oYPos = yPosition - 3.5
|
||||
|
||||
Dim oYPos = oPosRowY - 3.5
|
||||
Dim oBetrag As Decimal = oItemValue
|
||||
Dim oFormatiert As String = oBetrag.ToString("N2", New Globalization.CultureInfo("de-DE"))
|
||||
|
||||
@@ -309,9 +282,7 @@ Public Class XRechnungViewDocument
|
||||
MyGDPicturePDF.DrawTextBox(fontResName, 177, oYPos, 198, YCoo_TextBoxPlus5(oYPos),
|
||||
TextAlignment.TextAlignmentFar, TextAlignment.TextAlignmentNear,
|
||||
TAXTERM)
|
||||
' MyGDPicturePDF.DrawText(fontResName, 180, yPosition, $"{oItemValue} {oCurrencySymbol}")
|
||||
|
||||
'Tabellendarstellung Ende
|
||||
oDisplay = False
|
||||
End If
|
||||
oItemValue = oPosTerm
|
||||
ElseIf oArea = "HEAD" Then
|
||||
@@ -391,12 +362,12 @@ Public Class XRechnungViewDocument
|
||||
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
'Tabellendarstellung
|
||||
If oItemSPECNAME = "INVOICE_POSITION_TAX_AMOUNT" And oYPlus > 0 Then
|
||||
yPosition += oYPlus - 5
|
||||
End If
|
||||
'Tabellendarstellung Ende
|
||||
'Else
|
||||
' 'Tabellendarstellung
|
||||
' If oItemSPECNAME = "INVOICE_POSITION_TAX_AMOUNT" And oYPlus > 0 Then
|
||||
' yPosition += oYPlus - 5
|
||||
' End If
|
||||
' 'Tabellendarstellung Ende
|
||||
End If
|
||||
oIndex += 1
|
||||
Next
|
||||
|
||||
@@ -44,6 +44,10 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.6.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
||||
@@ -121,12 +125,6 @@
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Logging\Logging.vbproj">
|
||||
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>powershell.exe -command "& { &'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }"</PostBuildEvent>
|
||||
|
||||
@@ -5,6 +5,7 @@ Imports Limilabs.Client
|
||||
Imports Limilabs.Client.IMAP
|
||||
Imports Limilabs.Client.SMTP
|
||||
Imports Microsoft.Identity.Client
|
||||
Imports NLog
|
||||
|
||||
Namespace Mail
|
||||
Public Class MailSession
|
||||
@@ -18,6 +19,7 @@ Namespace Mail
|
||||
Public Const AUTH_SSLTLS = "SSL/TLS"
|
||||
Public Const AUTH_NONE = "NONE"
|
||||
Public Const AUTH_OAUTH2 = "OAUTH2"
|
||||
Public Const SSLProtocol_TLS12 = "TLS12"
|
||||
|
||||
Private Const SMTP_IGNORED_ERRORS As SslPolicyErrors =
|
||||
SslPolicyErrors.RemoteCertificateChainErrors Or ' self-signed
|
||||
@@ -78,12 +80,14 @@ Namespace Mail
|
||||
.AuthType = pAuthType
|
||||
}
|
||||
|
||||
Logger.Debug("Connecting to Server..")
|
||||
Logger.Debug("ConnectToServerWithBasicAuth..")
|
||||
Logger.Debug("Server: [{0}]", oSession.Server)
|
||||
Logger.Debug("Port: [{0}]", oSession.Port)
|
||||
Logger.Debug("User: [{0}]", oSession.User)
|
||||
Logger.Debug("AuthType: [{0}]", oSession.AuthType)
|
||||
|
||||
Logger.Debug($"_Config.TlsVersion.EnableTls1_1 = [{pOptions.EnableTls1_1}]")
|
||||
Logger.Debug($"_Config.TlsVersion.EnableTls1_2 = [{pOptions.EnableTls1_2}]")
|
||||
Logger.Debug($"_Config.TlsVersion.EnableDefault = [{pOptions.EnableDefault}]")
|
||||
_Session = oSession
|
||||
|
||||
Logger.Debug("Initializing Connection with Auth type [{0}].", oSession.AuthType)
|
||||
@@ -128,16 +132,14 @@ Namespace Mail
|
||||
|
||||
' Set TLS Version manually if requested
|
||||
If pOptions.EnableTls1_1 Then
|
||||
Logger.Debug("Enabling TLS Version 1.1")
|
||||
Logger.Debug("Enabling TLS Version 1.1...")
|
||||
Client.SSLConfiguration.EnabledSslProtocols = Client.SSLConfiguration.EnabledSslProtocols Or Security.Authentication.SslProtocols.Tls11
|
||||
End If
|
||||
|
||||
If pOptions.EnableTls1_2 Then
|
||||
Logger.Debug("Enabling TLS Version 1.2")
|
||||
Client.SSLConfiguration.EnabledSslProtocols = Client.SSLConfiguration.EnabledSslProtocols Or Security.Authentication.SslProtocols.Tls12
|
||||
Logger.Debug("Enabling TLS Version 1.2...")
|
||||
Client.SSLConfiguration.EnabledSslProtocols = Security.Authentication.SslProtocols.Tls12
|
||||
End If
|
||||
|
||||
' This is not available in .NET 4.6.2, only in .NET 4.7/4.8
|
||||
'If pOptions.EnableTls1_3 Then
|
||||
' Logger.Debug("Enabling TLS Version 1.3")
|
||||
' oSession.SSLConfiguration.EnabledSslProtocols = oSession.SSLConfiguration.EnabledSslProtocols Or Security.Authentication.SslProtocols.Tls13
|
||||
@@ -189,7 +191,9 @@ Namespace Mail
|
||||
ElseIf Session.AuthType = AUTH_SSLTLS Or Session.AuthType = AUTH_STARTTLS Then
|
||||
|
||||
Try
|
||||
Logger.Debug("Client.SSLConfiguration.EnabledSslProtocols is [{0}]", Client.SSLConfiguration.EnabledSslProtocols.ToString)
|
||||
If pSession.Port = 993 Then
|
||||
Logger.Debug("Port is 993 - So Client.ConnectSSL will be used!")
|
||||
Logger.Debug("Connecting with [STARTTLS/ConnectSSL] on [{0}/{1}]", pSession.Server, pSession.Port)
|
||||
Client.ConnectSSL(pSession.Server, pSession.Port)
|
||||
Else
|
||||
|
||||
@@ -44,8 +44,13 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Modules.Base, Version=1.3.9.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll</HintPath>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Mail">
|
||||
<HintPath>P:\Visual Studio Projekte\Bibliotheken\Limilabs\Mail.dll\Mail.dll</HintPath>
|
||||
@@ -138,12 +143,6 @@
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Base\Base.vbproj">
|
||||
<Project>{6ea0c51f-c2b1-4462-8198-3de0b32b74f8}</Project>
|
||||
<Name>Base</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="MailLicense.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.9.8.0")>
|
||||
<Assembly: AssemblyFileVersion("1.9.8.0")>
|
||||
<Assembly: AssemblyVersion("2.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("2.0.0.0")>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="DigitalData.Modules.Logging" version="2.6.5" targetFramework="net462" />
|
||||
<package id="Microsoft.Identity.Client" version="4.55.0" targetFramework="net462" />
|
||||
<package id="Microsoft.IdentityModel.Abstractions" version="6.22.0" targetFramework="net462" />
|
||||
<package id="NLog" version="5.0.5" targetFramework="net461" />
|
||||
|
||||
@@ -33,8 +33,6 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "ZooFlow", "ZooFlow\ZooFlow.
|
||||
EndProject
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Messaging", "Messaging\Messaging.vbproj", "{AF664D85-0A4B-4BAB-A2F8-83110C06553A}"
|
||||
EndProject
|
||||
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Database.Test", "Database.Test\Database.Test.vbproj", "{91B4DFC0-543C-43A7-A9E0-6817DCA277EC}"
|
||||
EndProject
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Filesystem", "Filesystem\Filesystem.vbproj", "{991D0231-4623-496D-8BD0-9CA906029CBC}"
|
||||
EndProject
|
||||
Global
|
||||
@@ -103,10 +101,6 @@ Global
|
||||
{AF664D85-0A4B-4BAB-A2F8-83110C06553A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AF664D85-0A4B-4BAB-A2F8-83110C06553A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AF664D85-0A4B-4BAB-A2F8-83110C06553A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{91B4DFC0-543C-43A7-A9E0-6817DCA277EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{91B4DFC0-543C-43A7-A9E0-6817DCA277EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{91B4DFC0-543C-43A7-A9E0-6817DCA277EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{91B4DFC0-543C-43A7-A9E0-6817DCA277EC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{991D0231-4623-496D-8BD0-9CA906029CBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{991D0231-4623-496D-8BD0-9CA906029CBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{991D0231-4623-496D-8BD0-9CA906029CBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
||||
@@ -56,6 +56,10 @@
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.ZooFlow, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\ZooFlow\bin\Debug\DigitalData.Modules.ZooFlow.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Interop.WINDREAMLib">
|
||||
<HintPath>P:\Visual Studio Projekte\Bibliotheken\windream\Interop.WINDREAMLib.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
@@ -144,12 +148,6 @@
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ZooFlow\ZooFlow.vbproj">
|
||||
<Project>{81cac44f-3711-4c8f-ae98-e02a7448782a}</Project>
|
||||
<Name>ZooFlow</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -183,6 +183,7 @@ Public Class Helpers
|
||||
Return Convert.ToDateTime(pValue)
|
||||
End If
|
||||
Case INDEX_TYPE_FLOAT
|
||||
pValue = pValue.Replace(".", ",")
|
||||
If pValue = DELETE_ATTRIBUTE_VALUE Then
|
||||
Return Nothing
|
||||
Else
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.9.7.0")>
|
||||
<Assembly: AssemblyFileVersion("1.9.7.0")>
|
||||
<Assembly: AssemblyVersion("1.9.8.0")>
|
||||
<Assembly: AssemblyFileVersion("1.9.8.0")>
|
||||
|
||||
@@ -700,7 +700,7 @@ Public Class Windream
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function NewFileStream(ByVal FilenameSource As String, ByVal FilenameTarget As String, ByVal WMObjecttypeName As String) As Boolean
|
||||
Public Function NewFileStream(ByVal FilenameSource As String, ByVal FilenameTarget As String, ByVal WMObjecttypeName As String, pisGUI As Boolean) As Boolean
|
||||
|
||||
NewDocumentID = 0
|
||||
|
||||
@@ -712,7 +712,7 @@ Public Class Windream
|
||||
|
||||
FilenameTarget = GetNormalizedPath(FilenameTarget, True)
|
||||
|
||||
_logger.Debug($"Preparing to stream file from {FilenameSource} to {FilenameTarget}")
|
||||
_logger.Debug($"Preparing to stream file from [{FilenameSource}] to [{FilenameTarget}]")
|
||||
|
||||
Dim oWMObject As IWMObject6 = Nothing
|
||||
Dim oFileIO As WMFileIO
|
||||
@@ -725,9 +725,16 @@ Public Class Windream
|
||||
|
||||
Try
|
||||
' GetNewWMObjectFS already locks the WMObject
|
||||
_logger.Debug("Creating WMObject for file {0}", FilenameTarget)
|
||||
_logger.Debug("Creating WMObject for file [{0}]", FilenameTarget)
|
||||
oWMObject = Session.GetNewWMObjectFS(WMEntityDocument, FilenameTarget, WMObjectEditModeObject)
|
||||
Catch ex As Exception
|
||||
If ex.Message.Contains("Filename exists!") Then
|
||||
Dim oMsg = $"Could not create a windream - object - A folder or file with the same name already exists in the folder [{oTargetDrive}]"
|
||||
_logger.Warn(oMsg)
|
||||
If pisGUI = True Then
|
||||
MsgBox(oMsg, MsgBoxStyle.Critical, "Error in creating windream-object")
|
||||
End If
|
||||
End If
|
||||
_logger.Error(ex, "WMObject could not be created")
|
||||
Return False
|
||||
End Try
|
||||
|
||||
@@ -44,8 +44,13 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Modules.Base, Version=1.3.8.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll</HintPath>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Interop.WINDREAMLib">
|
||||
<HintPath>P:\Visual Studio Projekte\Bibliotheken\windream\Interop.WINDREAMLib.dll</HintPath>
|
||||
@@ -135,12 +140,6 @@
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Base\Base.vbproj">
|
||||
<Project>{6EA0C51F-C2B1-4462-8198-3DE0B32B74F8}</Project>
|
||||
<Name>Base</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="WMOBRWSLib">
|
||||
<Guid>{25B51999-6DCA-11D4-B815-00104BB52DEA}</Guid>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="DigitalData.Modules.Logging" version="2.6.5" targetFramework="net462" />
|
||||
<package id="NLog" version="5.0.5" targetFramework="net461" />
|
||||
</packages>
|
||||
@@ -44,6 +44,18 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Modules.Database, Version=2.3.5.4, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.EDMI.API, Version=1.6.1.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\EDMIAPI\bin\Debug\DigitalData.Modules.EDMI.API.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
||||
@@ -124,18 +136,6 @@
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Database\Database.vbproj">
|
||||
<Project>{eaf0ea75-5fa7-485d-89c7-b2d843b03a96}</Project>
|
||||
<Name>Database</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\EDMIAPI\EDMI.API.vbproj">
|
||||
<Project>{25017513-0d97-49d3-98d7-ba76d9b251b0}</Project>
|
||||
<Name>EDMI.API</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Logging\Logging.vbproj">
|
||||
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Windows\Windows.vbproj">
|
||||
<Project>{5EFAEF9B-90B9-4F05-9F70-F79AD77FFF86}</Project>
|
||||
<Name>Windows</Name>
|
||||
|
||||
Reference in New Issue
Block a user