MultiTool/EDIDocumentImport/DocumentInfo.vb
Jonathan Jenne 3abf4b6e87 WIP
2021-08-16 16:34:55 +02:00

69 lines
2.1 KiB
VB.net

Imports System.IO
Imports EDIDocumentImport.WinLineInfo
Public Class DocumentInfo
Public Class Document
Public File As FileInfo
Public Type As DocumentType
Public Mandator As Mandator
Public Data As Object
Public DataOriginal As Object
Public DataOutput As Object
Public DataString As String
Public Selected As Boolean = False
Public ReadOnly Property FullName As String
Get
Return File?.FullName
End Get
End Property
Public ReadOnly Property Name As String
Get
Return File?.Name
End Get
End Property
End Class
Enum DocumentType
Order ' Auftrag
OrderResponse ' Bestellbestätigung
DispatchNotification ' Lieferavis/ Eingangs Lieferschein
Invoice ' Rechnung
End Enum
Public Class SchemaTypes
Public Property RootSchemaType As Type
Public Property HeadSchemaType As Type
Public Property PositionSchemaType As Type
End Class
Public Shared Property TypeMatchingTable As New Dictionary(Of String, DocumentType) From {
{"orders", DocumentType.Order},
{"ordrsp", DocumentType.OrderResponse},
{"desadv", DocumentType.DispatchNotification},
{"invoic", DocumentType.Invoice}
}
Public Shared Property SchemaMatchingTable As New Dictionary(Of DocumentType, Type) From {
{DocumentType.Order, GetType(Orders.Input.MESOWebService)}
}
Public Shared Function GetDocumentTypeFromTemplateName(pTemplateName As String) As DocumentType
Return TypeMatchingTable.
Where(Function(kv) pTemplateName.Contains(kv.Key)).
Select(Function(kv) kv.Value).
FirstOrDefault()
End Function
Public Shared Function GetDocumentSchemaFromDocumentType(pDocumentType As DocumentType) As Type
Return SchemaMatchingTable.
Where(Function(kv) pDocumentType = kv.Key).
Select(Function(kv) kv.Value).
FirstOrDefault()
End Function
End Class