92 lines
3.0 KiB
VB.net

Imports DigitalData.Modules.Language
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
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 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)
Dim oParamValue2 = TryGetParameter(oParam2)
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) As Tuple(Of String, String)
If pParameterString <> String.Empty Then
Dim oSplit = pParameterString.Split("=").ToList()
If oSplit.Count = 2 Then
Return New Tuple(Of String, String)(oSplit.First, oSplit.Last)
Else
Return Nothing
End If
Else
Return Nothing
End If
End Function
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
''' <summary>
''' Required value from Schema. This value will be written in the ColumnConfig and is not relevant from that point on.
''' </summary>
Public Property IsRequired As Boolean
Public Property Config As TemplateConfigItem
Public Overrides Function ToString() As String
Return Name
End Function
End Class
End Class
End Namespace