Namespace Documents Public Class DocumentRow Implements IComparable ''' ''' GUID to match DocumentRow with Row from Grid/DataTable ''' Public Property Id As New Guid ''' ''' Counter to ensure consistency and order when writing XML ''' Public Property SortKey As Integer ''' ''' Tabellen/Elementname aus XML ''' Public Property TableName As String ''' ''' List of Row Values ''' ''' 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