MS
This commit is contained in:
parent
40c2024a2e
commit
da5cbb0d3a
@ -66,6 +66,7 @@ Public Class Form1
|
||||
For Each oRow As DataRow In oResult.Rows
|
||||
Dim xmlPath = oRow.Item("XML_PATH")
|
||||
Dim tableName = oRow.Item("TABLE_NAME")
|
||||
Dim tableColumn = oRow.Item("TABLE_COLUMN")
|
||||
Dim description = oRow.Item("DESCRIPTION")
|
||||
Dim isRequired = oRow.Item("IS_REQUIRED")
|
||||
Dim isGrouped = oRow.Item("IS_GROUPED")
|
||||
@ -74,6 +75,7 @@ Public Class Form1
|
||||
Args.PropertyMap.Add(xmlPath, New XmlItemProperty() With {
|
||||
.Description = description,
|
||||
.TableName = tableName,
|
||||
.TableColumn = tableColumn,
|
||||
.IsRequired = isRequired,
|
||||
.IsGrouped = isGrouped,
|
||||
.GroupScope = groupScope
|
||||
|
||||
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.1.0.1")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyVersion("1.2.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.2.0.0")>
|
||||
|
||||
@ -22,7 +22,9 @@ Public Class PropertyValues
|
||||
Public Class ValidProperty
|
||||
Public MessageId As String
|
||||
Public TableName As String
|
||||
Public TableColumn As String
|
||||
|
||||
Public ISRequired As Boolean
|
||||
Public GroupCounter As Integer = -1
|
||||
|
||||
Public Description As String
|
||||
@ -60,11 +62,11 @@ Public Class PropertyValues
|
||||
' get properties as a nested object, see `oPropertyList`
|
||||
For Each oProperty As KeyValuePair(Of String, XmlItemProperty) In oGroup
|
||||
Dim oPropertyValues As List(Of Object)
|
||||
|
||||
_logger.Debug($"Fetching value for itemSpecification [{oProperty.Value.TableColumn}].")
|
||||
Try
|
||||
oPropertyValues = GetPropValue(Document, oProperty.Key)
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Unknown error occurred while fetching property [{0}] in group [{1}]:", oProperty.Value.Description, oGroupScope)
|
||||
_logger.Warn("Unknown error occurred while fetching property/TColumn [{0}] in group [{1}]:", oProperty.Value.TableColumn, oGroupScope)
|
||||
_logger.Error(ex)
|
||||
oPropertyValues = New List(Of Object)
|
||||
End Try
|
||||
@ -92,6 +94,8 @@ Public Class PropertyValues
|
||||
|
||||
For Each oColumn As KeyValuePair(Of XmlItemProperty, List(Of Object)) In oPropertyList
|
||||
Dim oTableName As String = oColumn.Key.TableName
|
||||
Dim oTableColumn As String = oColumn.Key.TableColumn
|
||||
Dim oIsRequired As Boolean = oColumn.Key.IsRequired
|
||||
Dim oPropertyDescription As String = oColumn.Key.Description
|
||||
Dim oRowCounter = oRowIndex + oGlobalGroupCounter + 1
|
||||
If IsNothing(oRowCounter) Then
|
||||
@ -100,27 +104,29 @@ Public Class PropertyValues
|
||||
' Returns nothing if oColumn.Value contains an empty list
|
||||
Dim oPropertyValue = oColumn.Value.ElementAtOrDefault(oRowIndex)
|
||||
|
||||
_logger.Debug("Processing property [{0}].", oPropertyDescription)
|
||||
_logger.Debug("Processing itemSpecification *TableColumn* [{0}].", oTableColumn)
|
||||
|
||||
If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
|
||||
If oColumn.Key.IsRequired Then
|
||||
_logger.Warn($"Property [{oPropertyDescription}] is empty or not found but is required. Continuing with Empty String.")
|
||||
_logger.Warn($"oPropertyValue for specification [{oTableColumn}] is empty or not found but is required. Continuing with Empty String.")
|
||||
oResult.MissingProperties.Add(oPropertyDescription)
|
||||
Else
|
||||
_logger.Debug($"Property [{oPropertyDescription}] is empty or not found. Continuing with Empty String.")
|
||||
_logger.Debug($"oPropertyValue for specification [{oTableColumn}] is empty or not found. Continuing with Empty String.")
|
||||
End If
|
||||
|
||||
oPropertyValue = String.Empty
|
||||
End If
|
||||
|
||||
_logger.Debug("Property [{0}] has value '{1}'", oPropertyDescription, oPropertyValue)
|
||||
_logger.Debug("ItemSpecification [{0}] has value '{1}'", oTableColumn, oPropertyValue)
|
||||
|
||||
oResult.ValidProperties.Add(New ValidProperty() With {
|
||||
.MessageId = MessageId,
|
||||
.Description = oPropertyDescription,
|
||||
.Value = oPropertyValue,
|
||||
.GroupCounter = oRowCounter,
|
||||
.TableName = oTableName
|
||||
.TableName = oTableName,
|
||||
.TableColumn = oTableColumn,
|
||||
.ISRequired = oIsRequired
|
||||
})
|
||||
Next
|
||||
Next
|
||||
@ -131,14 +137,15 @@ Public Class PropertyValues
|
||||
' Iterate through default properties
|
||||
For Each oItem As KeyValuePair(Of String, XmlItemProperty) In oDefaultProperties
|
||||
Dim oPropertyValueList As List(Of Object)
|
||||
Dim oPropertyDescription As String = oItem.Value.Description
|
||||
Dim oTableColumn As String = oItem.Value.TableColumn
|
||||
Dim oPropertyValue As Object = Nothing
|
||||
Dim oTableName = oItem.Value.TableName
|
||||
|
||||
Dim oIsRequired = oItem.Value.IsRequired
|
||||
Dim oDescription = oItem.Value.Description
|
||||
Try
|
||||
oPropertyValueList = GetPropValue(Document, oItem.Key)
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Unknown error occurred while fetching property {0} in group {1}:", oPropertyDescription, oItem.Value.GroupScope)
|
||||
_logger.Warn("Unknown error occurred while fetching specification {0} in group {1}:", oTableColumn, oItem.Value.GroupScope)
|
||||
_logger.Error(ex)
|
||||
oPropertyValueList = New List(Of Object)
|
||||
End Try
|
||||
@ -156,34 +163,36 @@ Public Class PropertyValues
|
||||
|
||||
' This should hopefully show config errors
|
||||
If TypeOf oPropertyValue Is List(Of Object) Then
|
||||
_logger.Warn("Property with Description {0} may be configured incorrectly", oPropertyDescription)
|
||||
_logger.Warn("Item with TableColumn [{0}] may be configured incorrectly", oTableColumn)
|
||||
oPropertyValue = Nothing
|
||||
End If
|
||||
End Select
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Unknown error occurred while processing property {0}:", oPropertyDescription)
|
||||
_logger.Warn("Unknown error occurred while processing specification [{0}]:", oTableColumn)
|
||||
_logger.Error(ex)
|
||||
oPropertyValue = Nothing
|
||||
End Try
|
||||
|
||||
If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
|
||||
If oItem.Value.IsRequired Then
|
||||
_logger.Warn("Property {0} is empty but marked as required! Skipping.", oPropertyDescription)
|
||||
oResult.MissingProperties.Add(oPropertyDescription)
|
||||
_logger.Warn("Specification [{0}] is empty, but marked as required! Skipping.", oTableColumn)
|
||||
oResult.MissingProperties.Add(oTableColumn)
|
||||
Continue For
|
||||
Else
|
||||
_logger.Debug("Property [{0}] is empty or not found. Skipping.", oPropertyDescription)
|
||||
_logger.Debug("oPropertyValue for specification [{0}] is empty or not found. Skipping.", oTableColumn)
|
||||
Continue For
|
||||
End If
|
||||
End If
|
||||
|
||||
oResult.ValidProperties.Add(New ValidProperty() With {
|
||||
.MessageId = MessageId,
|
||||
.Description = oPropertyDescription,
|
||||
.Description = oDescription,
|
||||
.Value = oPropertyValue,
|
||||
.TableName = oTableName
|
||||
})
|
||||
.TableName = oTableName,
|
||||
.TableColumn = oTableColumn,
|
||||
.ISRequired = oIsRequired
|
||||
})
|
||||
Next
|
||||
|
||||
Return oResult
|
||||
@ -202,7 +211,7 @@ Public Class PropertyValues
|
||||
Dim oPropInfo As PropertyInfo = Obj.GetType().GetProperty(PropertyName)
|
||||
|
||||
If IsNothing(oPropInfo) Then
|
||||
_logger.Debug("Property {0} does not exist.", PropertyName)
|
||||
_logger.Debug("Property [{0}] does not exist(1).", PropertyName)
|
||||
Return New List(Of Object)
|
||||
Else
|
||||
Dim oPropValue = oPropInfo.GetValue(Obj, Nothing)
|
||||
@ -224,7 +233,7 @@ Public Class PropertyValues
|
||||
Dim oInfo As PropertyInfo = oType.GetProperty(oPartName)
|
||||
|
||||
If IsNothing(oInfo) OrElse IsNothing(oInfo.GetValue(Obj, Nothing)) Then
|
||||
_logger.Debug("Property {0} does not exist.", oPartName)
|
||||
_logger.Debug("Property {0} does not exist(2).", oPartName)
|
||||
Return New List(Of Object)
|
||||
End If
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
Public Class XmlItemProperty
|
||||
Public TableName As String
|
||||
Public TableColumn As String
|
||||
Public Description As String
|
||||
Public IsRequired As Boolean
|
||||
Public IsGrouped As Boolean
|
||||
|
||||
@ -430,8 +430,9 @@ Public Class ImportZUGFeRDFiles
|
||||
oGroupCounterValue = 0
|
||||
End If
|
||||
|
||||
Dim oCommand = $"INSERT INTO {oProperty.TableName} (REFERENCE_GUID, ITEM_DESCRIPTION, ITEM_VALUE, GROUP_COUNTER) VALUES ('{oMessageId}', '{oProperty.Description}', '{oProperty.Value}', {oGroupCounterValue})"
|
||||
_logger.Debug("Mapping Property [{0}] to value [{1}] . Will be inserted into table {2}", oProperty.Description, oProperty.Value, oProperty.TableName)
|
||||
Dim oCommand = $"INSERT INTO {oProperty.TableName} (REFERENCE_GUID, ITEM_DESCRIPTION, ITEM_VALUE, GROUP_COUNTER,SPEC_NAME,IS_REQUIRED) VALUES
|
||||
('{oMessageId}', '{oProperty.Description}', '{oProperty.Value}', {oGroupCounterValue},'{oProperty.TableColumn}','{oProperty.ISRequired}')"
|
||||
_logger.Debug("Mapping Property [{0}] with value [{1}], Will be inserted into table [{2}]", oProperty.TableColumn, oProperty.Value, oProperty.TableName)
|
||||
' Insert into SQL Server
|
||||
If oArgs.InsertIntoSQLServer = True Then
|
||||
Dim oResult = _mssql.ExecuteNonQuery(oCommand)
|
||||
|
||||
@ -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("1.3.0.1")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyVersion("1.3.0.2")>
|
||||
<Assembly: AssemblyFileVersion("1.3.0.2")>
|
||||
|
||||
@ -51,6 +51,7 @@ namespace ZUGFeRDRESTService
|
||||
{
|
||||
Description = oRow["DESCRIPTION"].ToString(),
|
||||
TableName = oRow["TABLE_NAME"].ToString(),
|
||||
TableColumn = oRow["TABLE_COLUMN"].ToString(),
|
||||
GroupScope = oRow["GROUP_SCOPE"].ToString(),
|
||||
IsRequired = (bool)oRow["IS_REQUIRED"],
|
||||
IsGrouped = (bool)oRow["IS_GROUPED"]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user