2021-10-29 10:37:04 +02:00

28 lines
1.1 KiB
VB.net

Namespace Documents
Public Class DocumentMatch
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(Schemas.OrderSchema)}
}
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
End Namespace