Change Name to MultiTool
This commit is contained in:
28
MultiTool.Shared/Documents/DocumentMatch.vb
Normal file
28
MultiTool.Shared/Documents/DocumentMatch.vb
Normal file
@@ -0,0 +1,28 @@
|
||||
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
|
||||
Reference in New Issue
Block a user