WIP
This commit is contained in:
@@ -45,7 +45,7 @@ Namespace Documents
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property Name As String
|
||||
Public ReadOnly Property FileName As String
|
||||
Get
|
||||
Return File?.Name
|
||||
End Get
|
||||
|
||||
@@ -137,7 +137,7 @@ Namespace Documents
|
||||
' The first level of Elements are the document Rows
|
||||
Dim oTopLevelElements As List(Of XElement) = oRootElement.Elements.ToList
|
||||
Dim oDocumentRows As New List(Of DocumentRow)
|
||||
Dim oSortKey As Integer = 0
|
||||
Dim oRowSortKey As Integer = 0
|
||||
|
||||
' TODO: Somehow add all fields in the correct order
|
||||
'
|
||||
@@ -147,12 +147,14 @@ Namespace Documents
|
||||
'
|
||||
' leads to unordered fields.
|
||||
For Each oTopLevelElement As XElement In oTopLevelElements
|
||||
Dim oColumnSortKey = 0
|
||||
Dim oFields As New Dictionary(Of String, DocumentRow.FieldValue)
|
||||
Dim oSubElements = oTopLevelElement.Descendants().ToList()
|
||||
Dim oTable = pSchema.Tables.
|
||||
Where(Function(t) t.Name = oTopLevelElement.Name).
|
||||
FirstOrDefault()
|
||||
|
||||
|
||||
For Each oColumn In oTable.Columns
|
||||
Dim oSubElement = oSubElements.
|
||||
Where(Function(e) e.Name = oColumn.Name).
|
||||
@@ -172,7 +174,8 @@ Namespace Documents
|
||||
.Original = oValue,
|
||||
.Final = oValue,
|
||||
.DataType = oColumn.DataType,
|
||||
.Required = oRequired
|
||||
.Required = oRequired,
|
||||
.SortKey = oColumnSortKey
|
||||
})
|
||||
Else
|
||||
Dim oColumnError = DocumentRow.FieldError.None
|
||||
@@ -181,9 +184,12 @@ Namespace Documents
|
||||
End If
|
||||
|
||||
oFields.Add(oColumn.Name, New DocumentRow.FieldValue With {
|
||||
.[Error] = oColumnError
|
||||
.[Error] = oColumnError,
|
||||
.SortKey = oColumnSortKey
|
||||
})
|
||||
End If
|
||||
|
||||
oColumnSortKey += 1
|
||||
Next
|
||||
|
||||
'For Each oSubElement As XElement In oSubElements
|
||||
@@ -229,12 +235,12 @@ Namespace Documents
|
||||
|
||||
' Create a DocumentRow object for each Top Level Element
|
||||
Dim oRow = New DocumentRow With {
|
||||
.SortKey = oSortKey,
|
||||
.SortKey = oRowSortKey,
|
||||
.Name = oTopLevelElement.Name.ToString,
|
||||
.Fields = oFields
|
||||
}
|
||||
|
||||
oSortKey += 1
|
||||
oRowSortKey += 1
|
||||
oDocumentRows.Add(oRow)
|
||||
Next
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
Public Property External As String = ""
|
||||
Public Property Final As String = ""
|
||||
Public Property Required As Boolean = False
|
||||
Public Property SortKey As Integer = 0
|
||||
|
||||
Public ReadOnly Property HasError As Boolean
|
||||
Get
|
||||
|
||||
Reference in New Issue
Block a user