MultiTool/EDIDocumentImport/DocumentInfo.vb
2021-08-04 16:16:12 +02:00

40 lines
1.4 KiB
VB.net

Public Class DocumentInfo
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.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