Modules.Interfaces: XML_PATH aus Tabelle in Objekt laden, und Wert weiterreichen

This commit is contained in:
PitzM 2024-07-10 14:13:25 +02:00
parent 53768edb23
commit 237cad3a7a
2 changed files with 30 additions and 5 deletions

View File

@ -15,7 +15,7 @@ Public Class PropertyValues
End Sub
Public Class CheckPropertyValuesResult
Public MissingProperties As New List(Of String)
Public MissingProperties As New List(Of MissingProperty)
Public ValidProperties As New List(Of ValidProperty)
End Class
@ -29,6 +29,12 @@ Public Class PropertyValues
Public Description As String
Public Value As String
Public XMLPath As String
End Class
Public Class MissingProperty
Public Description As String
Public XMLPath As String
End Class
Public Function CheckPropertyValues(pDocument As Object, PropertyMap As Dictionary(Of String, XmlItemProperty), MessageId As String) As CheckPropertyValuesResult
@ -98,6 +104,8 @@ Public Class PropertyValues
Dim oTableColumn As String = oColumn.Key.TableColumn
Dim oIsRequired As Boolean = oColumn.Key.IsRequired
Dim oPropertyDescription As String = oColumn.Key.Description
Dim oPropertyPath As String = oColumn.Key.XMLPath
Dim oRowCounter = oRowIndex + oGlobalGroupCounter + 1
' Returns nothing if oColumn.Value contains an empty list
@ -110,7 +118,11 @@ Public Class PropertyValues
If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
If oColumn.Key.IsRequired Then
_logger.Warn($"{MessageId} # oPropertyValue for specification [{oTableColumn}] is empty or not found but is required. Continuing with Empty String.")
oResult.MissingProperties.Add(oPropertyDescription)
Dim oMissingProperty = New MissingProperty() With {
.Description = oPropertyDescription,
.XMLPath = oPropertyPath
}
oResult.MissingProperties.Add(oMissingProperty)
Else
_logger.Debug($"{MessageId} # oPropertyValue for specification [{oTableColumn}] is empty or not found. Continuing with Empty String.")
End If
@ -127,7 +139,8 @@ Public Class PropertyValues
.GroupCounter = oRowCounter,
.TableName = oTableName,
.TableColumn = oTableColumn,
.IsRequired = oIsRequired
.IsRequired = oIsRequired,
.XMLPath = oPropertyPath
})
Next
Next
@ -140,6 +153,7 @@ Public Class PropertyValues
Dim oPropertyValueList As List(Of Object)
Dim oTableColumn As String = oItem.Value.TableColumn
Dim oPropertyDescription As String = oItem.Value.Description
Dim oPropertyPath As String = oItem.Value.XMLPath
Dim oPropertyValue As Object = Nothing
Dim oTableName = oItem.Value.TableName
Dim oIsRequired = oItem.Value.IsRequired
@ -183,7 +197,12 @@ Public Class PropertyValues
If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
If oItem.Value.IsRequired Then
_logger.Warn("{0} # Specification [{1}] is empty, but marked as required! Skipping.", MessageId, oPropertyDescription)
oResult.MissingProperties.Add(oPropertyDescription)
Dim oMissingProperty = New MissingProperty With
{
.Description = oPropertyDescription,
.XMLPath = oPropertyPath
}
oResult.MissingProperties.Add(oMissingProperty)
Continue For
Else
_logger.Debug("{0} # oPropertyValue for specification [{1}] is empty or not found. Skipping.", MessageId, oPropertyDescription)
@ -198,7 +217,8 @@ Public Class PropertyValues
.Value = oPropertyValue,
.TableName = oTableName,
.TableColumn = oTableColumn,
.IsRequired = oIsRequired
.IsRequired = oIsRequired,
.XMLPath = oPropertyPath
})
Next

View File

@ -11,4 +11,9 @@
''' Document version, eg. ZUGFeRD Schema version
''' </summary>
Public Specification As String
''' <summary>
''' XML Pfad, für Anzeige in Ablehnungsmail
''' </summary>
Public XMLPath As String
End Class