Normalizing currency for windream

This commit is contained in:
Developer01
2025-12-16 17:21:18 +01:00
parent 2f64dc4b70
commit 55d7e025c9
3 changed files with 83 additions and 54 deletions

View File

@@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben: ' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.7.4.0")> <Assembly: AssemblyVersion("2.7.5.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")> <Assembly: AssemblyFileVersion("1.0.0.0")>
<Assembly: NeutralResourcesLanguage("")> <Assembly: NeutralResourcesLanguage("")>

View File

@@ -77,12 +77,12 @@
<PropertyGroup> <PropertyGroup>
<ApplicationManifest>My Project\app.manifest</ApplicationManifest> <ApplicationManifest>My Project\app.manifest</ApplicationManifest>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<GdPictureAssemblies Include="$(SolutionDir)lib\GdPicture14*.dll" /> <GdPictureAssemblies Include="$(SolutionDir)lib\GdPicture14*.dll" />
</ItemGroup> </ItemGroup>
<Target Name="CopyGdPictureDlls" AfterTargets="Build"> <Target Name="CopyGdPictureDlls" AfterTargets="Build">
<Copy SourceFiles="@(GdPictureAssemblies)" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> <Copy SourceFiles="@(GdPictureAssemblies)" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" />
</Target> </Target>
<ItemGroup> <ItemGroup>
<Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL"> <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> <HintPath>..\packages\BouncyCastle.Cryptography.2.5.0\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
@@ -1036,6 +1036,7 @@
<None Include="FinalIndexDataSet.xss"> <None Include="FinalIndexDataSet.xss">
<DependentUpon>FinalIndexDataSet.xsd</DependentUpon> <DependentUpon>FinalIndexDataSet.xsd</DependentUpon>
</None> </None>
<None Include="frmValidator.v" />
<None Include="My Project\app.manifest" /> <None Include="My Project\app.manifest" />
<None Include="My Project\Application.myapp"> <None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator> <Generator>MyApplicationCodeGenerator</Generator>

View File

@@ -3585,33 +3585,53 @@ Public Class frmValidator
For Each Zeile As Object In oValueFromSource For Each Zeile As Object In oValueFromSource
MyValidationLogger.Debug($"vektorrow Value {Zeile.ToString}...") MyValidationLogger.Debug($"vektorrow Value {Zeile.ToString}...")
oColValuesfromSource = Split(Zeile, PMDelimiter) oColValuesfromSource = Split(Zeile, PMDelimiter)
'If oColValuesfromSource.Length >= 1 Then
' Continue For
'End If
Dim oNewRow = oDataSource.NewRow() Dim oNewRow = oDataSource.NewRow()
MyValidationLogger.Debug("Creating new row..") MyValidationLogger.Debug("Creating new row..")
For index = 0 To oDTColumnsPerDevExGrid.Rows.Count - 1 For index = 0 To oDTColumnsPerDevExGrid.Rows.Count - 1
Dim rawValue As String = If(index < oColValuesfromSource.Length, oColValuesfromSource(index), String.Empty) Dim rawValue As String = If(index < oColValuesfromSource.Length, oColValuesfromSource(index), String.Empty)
Dim targetColumn As DataColumn = oDataSource.Columns(index) Dim targetColumn As DataColumn = oDataSource.Columns(index)
Dim colName As String = targetColumn.ColumnName
Dim colType As String = targetColumn.DataType.FullName
MyValidationLogger.Debug("Column Index {0}", index) ' Detailliertes Debug vor der Zuweisung
If oColValuesfromSource.Length > index Then MyValidationLogger.Debug("Grid row assign: RowIdx={0}, ColIdx={1}, ColName={2}, ColType={3}, RawValue=[{4}], IsEmpty={5}",
MyValidationLogger.Debug("Value: {0}", oColValuesfromSource(index)) oDataSource.Rows.Count, index, colName, colType, rawValue, String.IsNullOrWhiteSpace(rawValue))
oNewRow.Item(index) = oColValuesfromSource(index)
Else Try
MyValidationLogger.Debug("Value: String.Empty") If oColValuesfromSource.Length > index Then
oNewRow.Item(index) = String.Empty oNewRow.Item(index) = oColValuesfromSource(index)
End If Else
If colType = "System.Double" Or colType = "System.Int32" Or colType = "System.Int64" Then
' Numerische Spalten können nicht mit Empty befüllt werden
oNewRow.Item(index) = 0
Else
oNewRow.Item(index) = String.Empty
End If
End If
Catch ex As Exception
' Ausführliches Logging bei Fehlern inkl. aktuell bekannter Metadaten
MyValidationLogger.Warn("Grid row assign FAILED RowIdx = {0}, ColIdx={1}, ColName={2}, ColType={3}, RawValue=[{4}]",
oDataSource.Rows.Count, index, colName, colType, rawValue)
MyValidationLogger.Error(ex)
' Optional: weitere Kontexthilfe z.B. ob Spalte DBNull erlaubt
Try
MyValidationLogger.Debug("Column.AllowDBNull={0}, Column.MaxLength={1}", targetColumn.AllowDBNull, targetColumn.MaxLength)
Catch
End Try
' Fehler weiterwerfen, damit ursprüngliches Verhalten erhalten bleibt
Throw
End Try
Next Next
MyValidationLogger.Debug("Adding row to grid..") MyValidationLogger.Debug("Adding row To grid..")
oDataSource.Rows.Add(oNewRow) oDataSource.Rows.Add(oNewRow)
Next Next
Else Else
If oValueType = "System.String" Then If oValueType = "System.String" Then
MyValidationLogger.Debug($"IDB Fill Grid [{oControl.Name}] with String") MyValidationLogger.Debug($"IDB Fill Grid [{oControl.Name}] With String")
MyValidationLogger.Debug($"oValueFromSource [{oValueFromSource}] - PMDelimiter[{PMDelimiter}]") MyValidationLogger.Debug($"oValueFromSource [{oValueFromSource}] - PMDelimiter[{PMDelimiter}]")
oColValuesfromSource = Split(oValueFromSource.ToString, PMDelimiter) oColValuesfromSource = Split(oValueFromSource.ToString, PMDelimiter)
@@ -3620,7 +3640,7 @@ Public Class frmValidator
End If End If
Dim oRowData As New List(Of Object) Dim oRowData As New List(Of Object)
MyValidationLogger.Debug(String.Format("Now creating the rows for DevexpressGrid ...")) MyValidationLogger.Debug(String.Format("Now creating the rows For DevexpressGrid ..."))
Dim oMSG = "" Dim oMSG = ""
Try Try
For index = 1 To oColValuesfromSource.Length For index = 1 To oColValuesfromSource.Length
@@ -3633,9 +3653,9 @@ Public Class frmValidator
oRowData.Add(oConvertedValue) oRowData.Add(oConvertedValue)
Next Next
Catch ex As Exception Catch ex As Exception
MyValidationLogger.Warn(String.Format("Unexpected error while working on IDB Fill GridControl: {0}", oControl.Name)) MyValidationLogger.Warn(String.Format("Unexpected Error While working On IDB Fill GridControl {0}", oControl.Name))
If Not oMSG = String.Empty Then If Not oMSG = String.Empty Then
MyValidationLogger.Warn(String.Format("oMSG: {0}", oMSG)) MyValidationLogger.Warn(String.Format("oMSG {0}", oMSG))
End If End If
MyValidationLogger.Error(ex) MyValidationLogger.Error(ex)
End Try End Try
@@ -3646,14 +3666,14 @@ Public Class frmValidator
ElseIf oValueType = "System.Data.DataTable" Then ElseIf oValueType = "System.Data.DataTable" Then
Dim oMyDatatable As DataTable = oValueFromSource Dim oMyDatatable As DataTable = oValueFromSource
MyValidationLogger.Debug($"IDB Fill Grid [{oControl.Name}] with Datatable - Rows: " & oMyDatatable.Rows.Count) MyValidationLogger.Debug($"IDB Fill Grid [{oControl.Name}] With Datatable - Rows " & oMyDatatable.Rows.Count)
For Each oRow As DataRow In oMyDatatable.Rows For Each oRow As DataRow In oMyDatatable.Rows
Try Try
MyValidationLogger.Debug($"IDB ROW Vector {oRow.Item(0).ToString}...") MyValidationLogger.Debug($"IDB ROW Vector {oRow.Item(0).ToString}...")
oColValuesfromSource = Split(oRow.Item(0).ToString, PMDelimiter) oColValuesfromSource = Split(oRow.Item(0).ToString, PMDelimiter)
If oColValuesfromSource.Length > 8 Then If oColValuesfromSource.Length > 8 Then
MyValidationLogger.Warn("Fill Grid with DatatableSplit Error - Max 8 columns can be configured!") MyValidationLogger.Warn("Fill Grid With DatatableSplit Error - Max 8 columns can be configured!")
End If End If
MyValidationLogger.Debug($"oColValuesfromSource splitted - Length ({oColValuesfromSource.Length.ToString})") MyValidationLogger.Debug($"oColValuesfromSource splitted - Length ({oColValuesfromSource.Length.ToString})")
Dim oRowData As New List(Of Object) Dim oRowData As New List(Of Object)
@@ -3661,16 +3681,16 @@ Public Class frmValidator
For index = 1 To oColValuesfromSource.Length For index = 1 To oColValuesfromSource.Length
Try Try
Dim oColumnType = oDTColumnsPerDevExGrid.Rows.Item(index - 1).Item("TYPE_COLUMN") Dim oColumnType = oDTColumnsPerDevExGrid.Rows.Item(index - 1).Item("TYPE_COLUMN")
MyValidationLogger.Debug($"oColumnType of DGView-Column ({oColumnType.ToString})...") MyValidationLogger.Debug($"oColumnType Of DGView-Column ({oColumnType.ToString})...")
Dim oConvertedValue = ClassFormat.GetConvertedValue(oColValuesfromSource(index - 1), oColumnType) Dim oConvertedValue = ClassFormat.GetConvertedValue(oColValuesfromSource(index - 1), oColumnType)
oRowData.Add(oConvertedValue) oRowData.Add(oConvertedValue)
Catch ex As Exception Catch ex As Exception
MyValidationLogger.Warn($"Error while converting/adding Value to oRowData: " & ex.Message) MyValidationLogger.Warn($"Error While converting/adding Value To oRowData " & ex.Message)
End Try End Try
Next Next
oDataSource.Rows.Add(oRowData.ToArray()) oDataSource.Rows.Add(oRowData.ToArray())
Catch ex As Exception Catch ex As Exception
MyValidationLogger.Warn($"Error while adding datarow [{oRow.Item(0).ToString}] to Grid: " & ex.Message) MyValidationLogger.Warn($"Error While adding datarow [{oRow.Item(0).ToString}] To Grid " & ex.Message)
End Try End Try
@@ -3679,7 +3699,7 @@ Public Class frmValidator
End If End If
Else Else
MyValidationLogger.Info($"DevExpressGrid: There are no columns configured/listed for control {oControlId}.") MyValidationLogger.Info($"DevExpressGrid There are no columns configured/listed For control {oControlId}.")
End If End If
Case Else Case Else
@@ -3695,7 +3715,7 @@ Public Class frmValidator
Next Next
End Select End Select
Else Else
MyValidationLogger.Warn($"Could not load Devexpress.Grid [{oControl.Name }] as omytype is [{oValueType}]!") MyValidationLogger.Warn($"Could Not load Devexpress.Grid [{oControl.Name }] As omytype Is [{oValueType}]!")
End If End If
@@ -3736,10 +3756,10 @@ Public Class frmValidator
End If End If
Catch ex As Exception Catch ex As Exception
MyValidationLogger.Error(ex) MyValidationLogger.Error(ex)
MyValidationLogger.Info(">> Unexpected error in FillIndexValues(GridControl: " & oMyGridControl.Name & "): " & ex.Message, True) MyValidationLogger.Info(">> Unexpected Error In FillIndexValues(GridControl " & oMyGridControl.Name & ") " & ex.Message, True)
MyValidationLogger.Info(">> Controltype: " & oControlType) MyValidationLogger.Info(">> Controltype " & oControlType)
MyValidationLogger.Info(">> Attributname: " & oIndexName) MyValidationLogger.Info(">> Attributname " & oIndexName)
errormessage = "Unexpected error in FillIndexValues(Combobox: " & oMyGridControl.Name & "): " & vbNewLine & ex.Message & vbNewLine & "Check Logfile" errormessage = "Unexpected Error In FillIndexValues(Combobox " & oMyGridControl.Name & ") " & vbNewLine & ex.Message & vbNewLine & "Check Logfile"
My.Settings.Save() My.Settings.Save()
frmError.ShowDialog() frmError.ShowDialog()
End Try End Try
@@ -3749,15 +3769,15 @@ Public Class frmValidator
MyValidationLogger.Debug("Loading checkbox...") MyValidationLogger.Debug("Loading checkbox...")
oControlType = "CheckBox" oControlType = "CheckBox"
If oSourceIndexName = "" Then If oSourceIndexName = "" Then
MsgBox("Attention wrong configuration:" & vbNewLine & "for control " & oControl.Name & " no INDEX configured!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical, ADDITIONAL_TITLE) MsgBox("Attention wrong configuration" & vbNewLine & "For control " & oControl.Name & " no INDEX configured!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical, ADDITIONAL_TITLE)
Exit For Exit For
End If End If
If oSourceIndexName Is Nothing = False Then If oSourceIndexName Is Nothing = False Then
Dim myCheckBox As CheckBox = oControl Dim myCheckBox As CheckBox = oControl
If oLoadIndex = False Or {"@@DISPLAY_ONLY", "DD PM-ONLY FOR DISPLAY"}.Contains(oSourceIndexName) Then If oLoadIndex = False Or {"@@DISPLAY_ONLY", "DD PM-ONLY For DISPLAY"}.Contains(oSourceIndexName) Then
MyValidationLogger.Debug($" oControl {oControl.Name}: Indexwert soll nicht geladen werden.") MyValidationLogger.Debug($" oControl {oControl.Name} Indexwert soll nicht geladen werden.")
Exit Select Exit Select
End If End If
@@ -3771,7 +3791,7 @@ Public Class frmValidator
MyValidationLogger.Debug($"..Now GetVariableValue({oSourceIndexName})...") MyValidationLogger.Debug($"..Now GetVariableValue({oSourceIndexName})...")
oValueFromSource = GetVariableValuefromSource(oSourceIndexName, oIDBTyp, oIDBOverride) oValueFromSource = GetVariableValuefromSource(oSourceIndexName, oIDBTyp, oIDBOverride)
Catch ex As Exception Catch ex As Exception
MyValidationLogger.Warn($"Could not get the windreamValue for CheckboxIndex: {oSourceIndexName} [{ex.Message}]") MyValidationLogger.Warn($"Could Not Get the windreamValue For CheckboxIndex {oSourceIndexName} [{ex.Message}]")
End Try End Try
End If End If
@@ -3780,19 +3800,19 @@ Public Class frmValidator
If oValueFromSource Is Nothing Then If oValueFromSource Is Nothing Then
MyValidationLogger.Info(">> Zurückgegebener Wert des Wertes für Checkbox mit Indexname '" & oIndexName & "' ist nothing. Checking defaultvalue") MyValidationLogger.Info(">> Zurückgegebener Wert des Wertes für Checkbox mit Indexname '" & oIndexName & "' ist nothing. Checking defaultvalue")
MyValidationLogger.Debug(">> Zurückgegebener Wert des Wertes für Checkbox mit Indexname '" & oIndexName & "' ist nothing. Checking defaultvalue") MyValidationLogger.Debug(">> Zurückgegebener Wert des Wertes für Checkbox mit Indexname '" & oIndexName & "' ist nothing. Checking defaultvalue")
If oDefaultValue <> String.Empty Then If oDefaultValue <> String.Empty Then
MyValidationLogger.Info($"Using Default value [{oDefaultValue}]") MyValidationLogger.Info($"Using Default value [{oDefaultValue}]")
MyValidationLogger.Debug($"Using Default value [{oDefaultValue}]") MyValidationLogger.Debug($"Using Default value [{oDefaultValue}]")
myCheckBox.Checked = CBool(oDefaultValue) myCheckBox.Checked = CBool(oDefaultValue)
Exit Select Exit Select
Else Else
MyValidationLogger.Debug("No Default Value for Checkbox - so using false!") MyValidationLogger.Debug("No Default Value for Checkbox - so using false!")
myCheckBox.CheckState = CheckState.Indeterminate myCheckBox.CheckState = CheckState.Indeterminate
End If End If
Else Else
MyValidationLogger.Debug("oValueFromSource: " & oValueFromSource.ToString) MyValidationLogger.Debug("oValueFromSource: " & oValueFromSource.ToString)
If oValueFromSource.ToString = "" Then If oValueFromSource.ToString = "" Then
MyValidationLogger.Info(">> Versuch, default Value zu laden") MyValidationLogger.Info(">> Versuch, default Value zu laden")
If oDefaultValue <> String.Empty Then If oDefaultValue <> String.Empty Then
@@ -5705,12 +5725,20 @@ Public Class frmValidator
Dim oValueList As New List(Of String) Dim oValueList As New List(Of String)
For Each item As Object In oRow.ItemArray For Each item As Object In oRow.ItemArray
item = ObjectEx.NotNull(item, String.Empty) Dim normalized As Object = ObjectEx.NotNull(item, String.Empty)
' Convert to string using InvariantCulture, so converting back from string does not screw up values If TypeOf normalized Is IFormattable AndAlso Not TypeOf normalized Is String Then
If TypeOf item IsNot String Then Dim provider As IFormatProvider =
item = String.Format(CultureInfo.InvariantCulture, "{0}", item) If(TypeOf normalized Is Decimal OrElse
TypeOf normalized Is Double OrElse
TypeOf normalized Is Single,
CultureInfo.CurrentCulture,
CultureInfo.InvariantCulture)
MyValidationLogger.Debug("Normalizing value [{0}]", normalized.ToString)
normalized = DirectCast(normalized, IFormattable).ToString(Nothing, provider)
End If End If
oValueList.Add(item)
oValueList.Add(normalized)
Next Next
str = String.Join(PMDelimiter, oValueList.ToArray) str = String.Join(PMDelimiter, oValueList.ToArray)