Imports DigitalData.Modules.Language Imports MultiTool.Common.Winline.WinlineData Namespace Templates Public Class Template Public Property Guid As Integer Public Property Name As String Public Property FileName As String Public Property Description As String Public Property IsImport As Boolean Public Property Parameter1 As String Public Property Parameter2 As String Public Property FinalSQL As String ''' ''' Tabledata from XSD ''' Public Property Tables As New List(Of Table) Public Property InputDirectory As String Public Property OutputDirectory As String Public Property ArchiveDirectory As String Public ReadOnly Property DocType As DocumentType Get Dim oDocType As String = GetParameter("DOCTYPE") Dim oPreselectedDocType As Integer = 0 If oDocType IsNot Nothing Then Integer.TryParse(oDocType, oPreselectedDocType) End If Return [Enum].Parse(GetType(DocumentType), oPreselectedDocType) End Get End Property Public ReadOnly Property PrintDocument As Boolean Get Dim oPrintDocument = GetParameter("PRINT") Dim oDefaultValue = True If oPrintDocument IsNot Nothing Then oDefaultValue = IIf(oPrintDocument = "0", False, True) End If Return oDefaultValue End Get End Property Public ReadOnly Property DocTypeCategory As DocumentTypeCategory Get Select Case DocType Case DocumentType.IncomingOffer, DocumentType.IncomingOrder, DocumentType.IncomingDeliveryNote, DocumentType.IncomingInvoice Return DocumentTypeCategory.Outgoing Case DocumentType.OutgoingOffer, DocumentType.OutgoingOrder, DocumentType.OutgoingDeliveryNote, DocumentType.OutgoingInvoice Return DocumentTypeCategory.Incoming Case Else Return DocumentTypeCategory.Undefined End Select End Get End Property Public ReadOnly Property OutputReportDirectory Get Return IO.Path.Combine(OutputDirectory, "Reports") End Get End Property Public ReadOnly Property OutputWebserviceDirectory Get Return IO.Path.Combine(OutputDirectory, "WebService") End Get End Property Public ReadOnly Property OutputXmlFileDirectory Get Return IO.Path.Combine(OutputDirectory, "XmlFiles") End Get End Property Public Function GetParameter(pName As String) As String Dim oParam1 As String = Utils.NotNull(Parameter1, String.Empty) Dim oParam2 As String = Utils.NotNull(Parameter2, String.Empty) Dim oParamValue1 = TryGetParameter(oParam1, pName) Dim oParamValue2 = TryGetParameter(oParam2, pName) If oParamValue1 IsNot Nothing AndAlso oParamValue1.Item1 = pName Then Return oParamValue1.Item2 End If If oParamValue2 IsNot Nothing AndAlso oParamValue2.Item1 = pName Then Return oParamValue2.Item2 End If Return Nothing End Function Private Function TryGetParameter(pParameterString As String, pName As String) As Tuple(Of String, String) If pParameterString <> String.Empty Then For Each oParameter In pParameterString.Split(",") Dim oSplit = oParameter.Split("=").ToList() If oSplit.Count = 2 AndAlso oSplit.First = pName Then Return New Tuple(Of String, String)(oSplit.First, oSplit.Last) End If Next Return Nothing Else Return Nothing End If End Function ''' ''' Table from XSD ''' Class Table Public Property Name As String Public Property Columns As New List(Of Column) End Class Class Column Public Property Name As String Public Property DataType As Constants.ColumnType ''' ''' Required value from Schema. This value will be written in the ColumnConfig and is not relevant from that point on. ''' Public Property IsRequired As Boolean Public Property Config As FieldConfig Public Overrides Function ToString() As String Return Name End Function End Class End Class End Namespace