85 lines
2.6 KiB
VB.net
85 lines
2.6 KiB
VB.net
Namespace Documents
|
|
Public Class DocumentRow
|
|
Implements IComparable
|
|
|
|
''' <summary>
|
|
''' GUID to match DocumentRow with Row from Grid/DataTable
|
|
''' </summary>
|
|
Public Property Id As New Guid
|
|
''' <summary>
|
|
''' Counter to ensure consistency and order when writing XML
|
|
''' </summary>
|
|
Public Property SortKey As Integer
|
|
|
|
''' <summary>
|
|
''' Tabellen/Elementname aus XML
|
|
''' </summary>
|
|
Public Property TableName As String
|
|
|
|
''' <summary>
|
|
''' List of Row Values
|
|
''' </summary>
|
|
''' <returns></returns>
|
|
Public Property Fields As Dictionary(Of String, FieldValue)
|
|
|
|
Public ReadOnly Property HasErrors As Boolean
|
|
Get
|
|
If Errors.Count > 0 Then
|
|
Return True
|
|
Else
|
|
Return False
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public ReadOnly Property Errors As List(Of String)
|
|
Get
|
|
Return Fields.
|
|
Where(Function(f) f.Value.HasError).
|
|
Select(Function(f) f.Key).ToList()
|
|
End Get
|
|
End Property
|
|
|
|
Public Sub New()
|
|
Id = Guid.NewGuid()
|
|
End Sub
|
|
|
|
Public Function CompareTo(other As Object) As Integer Implements IComparable.CompareTo
|
|
Return SortKey.CompareTo(DirectCast(other, DocumentRow).SortKey)
|
|
End Function
|
|
|
|
Public Enum FieldError
|
|
None
|
|
MissingValue
|
|
AccountNotFound
|
|
ArticleNotFound
|
|
End Enum
|
|
|
|
Public Class FieldValue
|
|
Public Property DataType As Constants.ColumnType = Constants.ColumnType.String
|
|
Public Property [Error] As FieldError = FieldError.None
|
|
Public Property Original As String = ""
|
|
Public Property External As String = ""
|
|
Public Property Final As String = ""
|
|
Public Property IsRequired As Boolean = False
|
|
Public Property IsVirtual As Boolean = False
|
|
Public Property SortKey As Integer = 0
|
|
|
|
Public ReadOnly Property HasError As Boolean
|
|
Get
|
|
Return [Error] <> FieldError.None Or (IsRequired And Final = String.Empty)
|
|
|
|
'Return IsRequired = True And (
|
|
' [Error] <> FieldError.None Or Final = String.Empty
|
|
')
|
|
End Get
|
|
End Property
|
|
|
|
Public Overrides Function ToString() As String
|
|
Return Final
|
|
End Function
|
|
End Class
|
|
End Class
|
|
|
|
End Namespace
|