Rename Shared to Common
This commit is contained in:
93
MultiTool.Common/Documents/DocumentRow.vb
Normal file
93
MultiTool.Common/Documents/DocumentRow.vb
Normal file
@@ -0,0 +1,93 @@
|
||||
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 Function GetValue(pValueType) As String
|
||||
Select Case pValueType
|
||||
Case "Original"
|
||||
Return Original
|
||||
Case "External"
|
||||
Return External
|
||||
Case "Final"
|
||||
Return Final
|
||||
Case Else
|
||||
Return Nothing
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Public ReadOnly Property HasError As Boolean
|
||||
Get
|
||||
Return [Error] <> FieldError.None Or (IsRequired And Final = String.Empty)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Overrides Function ToString() As String
|
||||
Return Final
|
||||
End Function
|
||||
End Class
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
Reference in New Issue
Block a user