Compare commits
2 Commits
b3140c48c5
...
616e35f885
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
616e35f885 | ||
|
|
adad5501f3 |
@ -405,7 +405,8 @@ Namespace Documents
|
||||
Logger.Debug("Running Function: [{0}]", oFunctionName)
|
||||
Logger.Debug("With Parameters: [{0}]", oFunctionParams)
|
||||
|
||||
Dim oParamsDict = ParseFunctionParamsAsDict(oFunctionParams)
|
||||
|
||||
Dim oParamsDict = Parameters.Parse(oFunctionParams)
|
||||
|
||||
If oFunctionName = Constants.FUNCTION_PRICE Then
|
||||
Await SetPrice(oRow, oField.Key, oParamsDict, pDocument, pMandator, pTemplate)
|
||||
@ -432,13 +433,15 @@ Namespace Documents
|
||||
|
||||
Dim oFunctionName = oColumn.Config.FunctionName
|
||||
Dim oFunctionParams = oColumn.Config.FunctionParams
|
||||
Dim oParamsDict = ParseFunctionParamsAsDict(oFunctionParams)
|
||||
|
||||
|
||||
' The code below needs a defined function
|
||||
If oFunctionName = String.Empty Then
|
||||
Continue For
|
||||
End If
|
||||
|
||||
Dim oParamsDict = Parameters.Parse(oFunctionParams)
|
||||
|
||||
' The main identifier will be checked for String.empty and not required.
|
||||
' This makes sure that optional fields do not generate errors.
|
||||
Dim oIdentifier As DocumentRow.FieldValue = oRow.Fields.GetOrDefault(oField.Key)
|
||||
@ -483,7 +486,7 @@ Namespace Documents
|
||||
|
||||
Dim oFunctionName = oColumn.Config.FunctionName
|
||||
Dim oFunctionParams = oColumn.Config.FunctionParams
|
||||
Dim oParamsDict = ParseFunctionParamsAsDict(oFunctionParams)
|
||||
Dim oParamsDict = Parameters.Parse(oFunctionParams)
|
||||
|
||||
If oFunctionName = Constants.FUNCTION_FIELD Then
|
||||
Try
|
||||
@ -707,27 +710,6 @@ Namespace Documents
|
||||
Throw ex
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function ParseFunctionParamsAsDict(pParams As String) As Dictionary(Of String, String)
|
||||
Try
|
||||
Dim oParamsDict As New Dictionary(Of String, String)
|
||||
|
||||
If pParams <> String.Empty Then
|
||||
Dim oParamList = pParams.Split("|").ToList()
|
||||
For Each oParam In oParamList
|
||||
Dim oParamSplit = oParam.Split("=")
|
||||
If oParamSplit.Count = 2 Then
|
||||
oParamsDict.Add(oParamSplit(0), oParamSplit(1))
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
Return oParamsDict
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Return New Dictionary(Of String, String)
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@ -128,6 +128,7 @@
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="Parameters.vb" />
|
||||
<Compile Include="Patterns.vb" />
|
||||
<Compile Include="Report\ReportGenerator.vb" />
|
||||
<Compile Include="Templates\GeneralConfig.vb" />
|
||||
|
||||
49
MultiTool.Common/Parameters.vb
Normal file
49
MultiTool.Common/Parameters.vb
Normal file
@ -0,0 +1,49 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class Parameters
|
||||
''' <summary>
|
||||
''' Parse a list of parameters and return a directory of the parsed parameters.
|
||||
''' </summary>
|
||||
''' <remarks>The special case of SQL Parameters is NOT handled by this function.</remarks>
|
||||
Public Shared Function Parse(pParameters As String) As Dictionary(Of String, String)
|
||||
Try
|
||||
Dim oParamsDict As New Dictionary(Of String, String)
|
||||
|
||||
If pParameters <> String.Empty Then
|
||||
Dim oParamList = pParameters.Split("|").ToList()
|
||||
|
||||
For Each oParam In oParamList
|
||||
Dim oParamSplit = oParam.Split("=")
|
||||
|
||||
If oParamSplit.Count = 2 Then
|
||||
oParamsDict.Add(oParamSplit(0), oParamSplit(1))
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
Return oParamsDict
|
||||
Catch ex As Exception
|
||||
Return New Dictionary(Of String, String)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Shared Function TryGet(pParameters As String, pName As String) As Tuple(Of String, String)
|
||||
Try
|
||||
Dim pParamDict = Parse(pParameters)
|
||||
|
||||
If pParamDict.Count = 0 Then
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
If Not pParamDict.ContainsKey(pName) Then
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Dim oValue = pParamDict.Item(pName)
|
||||
Return New Tuple(Of String, String)(pName, oValue)
|
||||
|
||||
Catch ex As Exception
|
||||
Return Nothing
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
@ -93,8 +93,8 @@ Namespace Templates
|
||||
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)
|
||||
Dim oParamValue1 = Parameters.TryGet(oParam1, pName)
|
||||
Dim oParamValue2 = Parameters.TryGet(oParam2, pName)
|
||||
|
||||
If oParamValue1 IsNot Nothing AndAlso oParamValue1.Item1 = pName Then
|
||||
Return oParamValue1.Item2
|
||||
@ -107,22 +107,6 @@ Namespace Templates
|
||||
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
|
||||
|
||||
''' <summary>
|
||||
''' Table from XSD
|
||||
''' </summary>
|
||||
|
||||
@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("WebService Multitool")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
||||
<Assembly: AssemblyTrademark("1.3.7.0")>
|
||||
<Assembly: AssemblyTrademark("1.3.8.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' indem Sie "*" wie unten gezeigt eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.3.7.0")>
|
||||
<Assembly: AssemblyVersion("1.3.8.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user