diff --git a/Interfaces/ZUGFeRDInterface/PropertyValues.vb b/Interfaces/ZUGFeRDInterface/PropertyValues.vb index ed8a8d15..f0cbd003 100644 --- a/Interfaces/ZUGFeRDInterface/PropertyValues.vb +++ b/Interfaces/ZUGFeRDInterface/PropertyValues.vb @@ -1,4 +1,5 @@ -Imports System.Reflection +Imports System.Globalization +Imports System.Reflection Imports System.Text.RegularExpressions Imports DigitalData.Modules.Logging @@ -293,12 +294,6 @@ 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 @@ -323,6 +318,55 @@ 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) Then + ' Hier wird das DEFAULT-Format auf yyyy-MM-dd gesetzt + Dim dtfi As DateTimeFormatInfo = CultureInfo.CreateSpecificCulture(CultureInfo.InvariantCulture.Name).DateTimeFormat + dtfi.DateSeparator = "-" + dtfi.ShortDatePattern = "yyyy/MM/dd" + + 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) 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 diff --git a/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb b/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb index 8bf12f8c..95b9aca9 100644 --- a/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb +++ b/Jobs/ZUGFeRD/ImportZUGFeRDFiles.vb @@ -1177,7 +1177,6 @@ Public Class ImportZUGFeRDFiles Dim oNewRow As DataRow = oDataTable.NewRow() oNewRow("REFERENCE_GUID") = pMessageId oNewRow("ITEM_DESCRIPTION") = oProperty.Description - 'oNewRow("ITEM_VALUE") = oProperty.Value.Truncate(900).Replace("'", "''") oNewRow("ITEM_VALUE") = oProperty.Value.Truncate(900) oNewRow("GROUP_COUNTER") = oGroupCounterValue oNewRow("SPEC_NAME") = oProperty.TableColumn