Modules.Interfaces: Date/DateTime (yyyy-MM-dd) und Decimal/Numeric-Werte mit CultureInfo.Invariant.Culture speichern.

This commit is contained in:
PitzM 2025-07-04 13:23:57 +02:00
parent 82a95faaaf
commit aee7997cb3
2 changed files with 51 additions and 8 deletions

View File

@ -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

View File

@ -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