Esempio n. 1
0
        public static object ConvertToParameterValue(DataRow input, DataTable dataTable, Parameter paramInfo, DataObjectStore store)
        {
            string variableName = paramInfo.Reference ?? paramInfo.Name;
            object obj;

            if (paramInfo.Value == null)
            {
                obj = DDIHelper.GetVariableValue(store.ModifiedColumns, variableName, input, dataTable, store.IsGetListWorkflow);
            }
            else
            {
                string text = paramInfo.Value as string;
                if (DDIHelper.IsLambdaExpression(text))
                {
                    obj = ExpressionCalculator.CalculateLambdaExpression(ExpressionCalculator.BuildColumnExpression(text), typeof(object), DDIHelper.GetLambdaExpressionDataRow(dataTable), input);
                }
                else
                {
                    VariableReference variableReference = paramInfo.Value as VariableReference;
                    if (variableReference != null)
                    {
                        obj = DDIHelper.GetVariableValue(variableReference, input, dataTable);
                    }
                    else
                    {
                        obj = paramInfo.Value;
                    }
                }
            }
            if (obj == DBNull.Value)
            {
                return(null);
            }
            return(obj);
        }
Esempio n. 2
0
        public override bool IsRunnable(DataRow input, DataTable dataTable, DataObjectStore store)
        {
            if (!base.IsRunnable(input, dataTable, store))
            {
                return(false);
            }
            DDIHelper.CheckDataTableForSingleObject(dataTable);
            object variableValue = DDIHelper.GetVariableValue(store.ModifiedColumns, this.Collection, input, dataTable, store.IsGetListWorkflow);

            return(variableValue is IEnumerable <object> && (variableValue as IEnumerable <object>).Count <object>() > 0);
        }
Esempio n. 3
0
 internal static void SetDefaultValues(DataRow input, DataRow row, DataTable dataTable, Collection <Set> defaultValues)
 {
     if (defaultValues != null)
     {
         foreach (Set set in defaultValues)
         {
             object obj  = set.Value;
             string text = obj as string;
             if (DDIHelper.IsLambdaExpression(text))
             {
                 obj = ExpressionCalculator.CalculateLambdaExpression(ExpressionCalculator.BuildColumnExpression(text), typeof(object), DDIHelper.GetLambdaExpressionDataRow(dataTable), input);
             }
             else
             {
                 VariableReference variableReference = obj as VariableReference;
                 if (variableReference != null)
                 {
                     obj = DDIHelper.GetVariableValue(variableReference, input, dataTable);
                 }
             }
             row[set.Variable] = obj;
         }
     }
 }
Esempio n. 4
0
        public override RunResult Run(DataRow input, DataTable dataTable, DataObjectStore store, Type codeBehind, Workflow.UpdateTableDelegate updateTableDelegate)
        {
            DDIHelper.CheckDataTableForSingleObject(dataTable);
            DataRow              dataRow    = dataTable.Rows[0];
            RunResult            runResult  = new RunResult();
            IList <object>       list       = new List <object>();
            IEnumerable <object> enumerable = DDIHelper.GetVariableValue(store.ModifiedColumns, this.Collection, input, dataTable, store.IsGetListWorkflow) as IEnumerable <object>;

            this.totalItems        = enumerable.Count <object>();
            this.executedItemCount = 0;
            foreach (object obj in enumerable)
            {
                dataRow[this.Item] = obj;
                if (this.Activity.IsRunnable(input, dataTable, store))
                {
                    RunResult runResult2 = this.Activity.RunCore(input, dataTable, store, codeBehind, updateTableDelegate);
                    runResult.DataObjectes.AddRange(runResult2.DataObjectes);
                    this.statusReport = this.statusReport.Concat(this.Activity.GetStatusReport(input, dataTable, store)).ToArray <PowerShellResults>();
                    if (runResult2.ErrorOccur)
                    {
                        list.Add(obj);
                        if (base.ErrorBehavior == ErrorBehavior.Stop && this.Activity.ErrorBehavior == ErrorBehavior.Stop)
                        {
                            runResult.ErrorOccur = true;
                            break;
                        }
                    }
                }
                this.executedItemCount++;
            }
            if (!string.IsNullOrEmpty(this.FailedCollection))
            {
                dataRow[this.FailedCollection] = list;
            }
            return(runResult);
        }