Consolidate parameter format and logic
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user