Ejemplo n.º 1
0
 private void CheckParameterForDuplication(string name)
 {
     if (Parameters.ContainsKey(name) || OutputParameters.ContainsKey(name))
     {
         throw new DuplicateNameException("Duplicate parameter '" + name + "'.");
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 设置回传参数
        /// </summary>
        public override Dictionary <string, string> SetViewParameters()
        {
            Dictionary <string, string> result = base.SetViewParameters();

            OutputParameters = OutputParameters ?? new SortedList();
            if (_confirmUser != null)
            {
                SortedList confirmUserParams = new SortedList();
                //是否需要确认包的人编码和信息
                confirmUserParams.Add("confirmUserId", _confirmUser.UserID);
                if (OutputParameters.ContainsKey("confirmUserParams"))
                {
                    OutputParameters["confirmUserParams"] = confirmUserParams;
                }
                else
                {
                    OutputParameters.Add("confirmUserParams", confirmUserParams);
                }
            }
            if (!_isPrintedBCU)
            {
                PrintBCUCode();
            }

            return(result);
        }
        /// <summary>
        /// Casts an output parameter by name to the specified type
        /// </summary>
        /// <typeparam name="TResult">The value of the output parameter</typeparam>
        /// <param name="parameterName">The name of the parameter</param>
        /// <returns>The value of the output parameter</returns>
        public TResult GetOutputParameter <TResult>(string parameterName)
        {
            if (!OutputParameters.ContainsKey(parameterName))
            {
                throw new InvalidOperationException($"No Output parameter named {parameterName} was found");
            }

            return((TResult)OutputParameters[parameterName].Value);
        }
Ejemplo n.º 4
0
 public Dictionary <string, object> PrepareExecution(ProjectState project, List <ActionParameter> parameters)
 {
     OutputParameters = parameters.ToDictionary(ActionParametersDefinition);
     if (OutputParameters.ContainsKey("help"))
     {
         OutputParameters.Remove("help");
     }
     Execute(project, parameters);
     return(OutputParameters);
 }
        public override Dictionary <string, string> SetViewParameters()
        {
            Dictionary <string, string> result = base.SetViewParameters();

            result["ShowParameterUI"] = yesReleaseBtn.IsChecked ? "false" : "true";
            if (yesReleaseBtn.IsChecked)
            {
                SortedList parameter02 = Sl_check["pd_par2"] as SortedList;
                if (parameter02 != null)
                {
                    for (int i = 0; i < parameter02.Count; i++)
                    {
                        string key = parameter02.GetKey(i).ToString();
                        if (key.Contains("_result"))
                        {
                            parameter02[key] = 1;
                        }
                    }
                }
            }

            if (setDataGrid.Rows.Count > 0)
            {
                //BD test does not need to show items.
                if (setDataGrid.Columns.Contains("setBarCodeCol") &&
                    setDataGrid.Rows[0].Cells["setBarCodeCol"].Value != null &&
                    setDataGrid.Rows[0].Cells["setBarCodeCol"].Value.Equals(BarCodeHelper.BDTestSetCode))
                {
                    result["ShowParameterUI"] = "false";
                    SortedList confirmUserParams = new SortedList();
                    //是否需要确认包的人编码和信息
                    confirmUserParams.Add("BDTestResult", yesReleaseBtn.IsChecked.ToString());
                    if (OutputParameters.ContainsKey("BDTestResult"))
                    {
                        OutputParameters["BDTestResult"] = confirmUserParams;
                    }
                    else
                    {
                        OutputParameters.Add("BDTestResult", confirmUserParams);
                    }
                }
            }
            return(result);
        }