예제 #1
0
 protected void FillColumnsBasedOnLambdaExpression(DataRow row, Variable variable)
 {
     if (DDIHelper.IsLambdaExpression(variable.Value as string))
     {
         this.FillColumns(row, this.GetExpressionCalculator().CalculateSpecifiedColumn(variable.Name, row, this.Input));
     }
 }
예제 #2
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);
        }
예제 #3
0
        internal bool IsAccessingVariable(string accessingVariable)
        {
            List <string> list = new List <string>();

            if (this.Value != null)
            {
                VariableReference variableReference = this.Value as VariableReference;
                if (variableReference != null)
                {
                    list.Add(variableReference.Variable);
                }
                else
                {
                    string text = this.Value as string;
                    if (DDIHelper.IsLambdaExpression(text))
                    {
                        list.AddRange(ExpressionCalculator.BuildColumnExpression(text).DependentColumns);
                    }
                }
            }
            else
            {
                list.Add(this.Reference ?? this.Name);
            }
            return(list.Any((string c) => string.Equals(c, accessingVariable, StringComparison.OrdinalIgnoreCase)));
        }
예제 #4
0
        public override RunResult Run(DataRow input, DataTable dataTable, DataObjectStore store, Type codeBehind, Workflow.UpdateTableDelegate updateTableDelegate)
        {
            RunResult result = new RunResult();
            string    text   = this.Value as string;

            if (DDIHelper.IsLambdaExpression(text))
            {
                dataTable.Rows[0][this.Variable] = ExpressionCalculator.CalculateLambdaExpression(ExpressionCalculator.BuildColumnExpression(text), typeof(object), DDIHelper.GetLambdaExpressionDataRow(dataTable), input);
            }
            else
            {
                dataTable.Rows[0][this.Variable] = this.Value;
            }
            return(result);
        }
예제 #5
0
 public int GetResultSizeInt32(DataRow input, DataTable dataTable)
 {
     if (this.resultSizeInt32 == -1 && !string.IsNullOrEmpty(this.ResultSize))
     {
         int num = -1;
         if (DDIHelper.IsLambdaExpression(this.ResultSize))
         {
             num = (int)ExpressionCalculator.CalculateLambdaExpression(ExpressionCalculator.BuildColumnExpression(this.ResultSize), typeof(int), DDIHelper.GetLambdaExpressionDataRow(dataTable), input);
         }
         else
         {
             int.TryParse(this.ResultSize, out num);
         }
         this.resultSizeInt32 = num;
     }
     return(this.resultSizeInt32);
 }
예제 #6
0
        public override List <string> Validate(object target, Service profile)
        {
            List <string> list  = new List <string>();
            string        value = target as string;

            if (DDIHelper.IsLambdaExpression(value))
            {
                foreach (LambdaExpressionRule lambdaExpressionRule in DDIValidLambdaExpressionAttribute.rules)
                {
                    list.AddRange(lambdaExpressionRule.Validate(target, profile));
                    if (list.Count > 0)
                    {
                        break;
                    }
                }
            }
            return(list);
        }
예제 #7
0
        protected override void Initialize(DataRow input, DataTable dataTable)
        {
            base.Initialize(input, dataTable);
            if (string.IsNullOrEmpty(this.MaxProgressBarEventsExpected) || !DDIHelper.IsLambdaExpression(this.MaxProgressBarEventsExpected))
            {
                return;
            }
            MaximumCountProgressCalculator maximumCountProgressCalculator = base.ProgressCalculatorInstance as MaximumCountProgressCalculator;

            if (maximumCountProgressCalculator != null)
            {
                maximumCountProgressCalculator.ProgressRecord.MaxCount = (int)ExpressionCalculator.CalculateLambdaExpression(ExpressionCalculator.BuildColumnExpression(this.MaxProgressBarEventsExpected), typeof(int), DDIHelper.GetLambdaExpressionDataRow(dataTable), input);
                return;
            }
            string message = string.Format("BulkCustomMaximumEventExpectedWorkflow should be used only with MaximumCountProgressCalculator. Current: {0}", (base.ProgressCalculatorInstance == null) ? "<null>" : base.ProgressCalculatorInstance.GetType().Name);

            throw new InvalidOperationException(message);
        }
예제 #8
0
        internal static List <string> GetOutputDepVariables(DataColumn column)
        {
            List <string> list     = new List <string>();
            Variable      variable = column.ExtendedProperties["Variable"] as Variable;

            if (variable != null)
            {
                string text = variable.Value as string;
                if (DDIHelper.IsLambdaExpression(text))
                {
                    list = ExpressionCalculator.BuildColumnExpression(text).DependentColumns;
                }
                else
                {
                    list.AddRange(DDIHelper.GetCodeBehindRegisteredDepVariables(column));
                }
            }
            return(list);
        }
예제 #9
0
        internal static DataColumn CreateColumn(Variable profile, Dictionary <string, List <string> > rbacMetaData, DataObjectStore store)
        {
            DataColumn         dataColumn = new DataColumn(profile.Name);
            Type               type       = null;
            PropertyDefinition value      = null;

            if (profile.PersistWholeObject)
            {
                type = store.GetDataObjectType(profile.DataObjectName);
            }
            else
            {
                store.RetrievePropertyInfo(profile.DataObjectName, profile.MappingProperty, out type, out value);
            }
            dataColumn.DataType = (profile.Type ?? typeof(object));
            Type type2;

            if ((type2 = profile.Type) == null)
            {
                type2 = (type ?? typeof(object));
            }
            profile.Type = type2;
            dataColumn.ExtendedProperties.Add("Variable", profile);
            dataColumn.ExtendedProperties.Add("RealDataType", profile.Type);
            dataColumn.ExtendedProperties.Add("PropertyDefinition", value);
            if (rbacMetaData != null && rbacMetaData.ContainsKey(profile.Name))
            {
                dataColumn.ExtendedProperties.Add("RbacMetaData", rbacMetaData[profile.Name]);
            }
            if (profile.Value != null)
            {
                string value2 = profile.Value as string;
                if (DDIHelper.IsLambdaExpression(value2))
                {
                    dataColumn.ExtendedProperties["LambdaExpression"] = profile.Value;
                }
                else
                {
                    dataColumn.DefaultValue = profile.Value;
                }
            }
            return(dataColumn);
        }
예제 #10
0
        public bool IsRunnable(DataRow input, DataTable dataTable)
        {
            DataObjectStore dataObjectStore = dataTable.ExtendedProperties["DataSourceStore"] as DataObjectStore;

            if (this.Type == ParameterType.RunOnModified)
            {
                if (this.Value != null)
                {
                    VariableReference variableReference = this.Value as VariableReference;
                    if (variableReference != null && !dataObjectStore.ModifiedColumns.Contains(variableReference.Variable))
                    {
                        return(false);
                    }
                    string text = this.Value as string;
                    if (DDIHelper.IsLambdaExpression(text))
                    {
                        List <string> dependentColumns = ExpressionCalculator.BuildColumnExpression(text).DependentColumns;
                        bool          flag             = false;
                        foreach (string item in dependentColumns)
                        {
                            if (dataObjectStore != null && dataObjectStore.ModifiedColumns.Contains(item))
                            {
                                flag = true;
                                break;
                            }
                        }
                        if (!flag)
                        {
                            return(false);
                        }
                    }
                }
                else if (!dataObjectStore.ModifiedColumns.Contains(this.Reference ?? this.Name))
                {
                    return(false);
                }
            }
            if (!string.IsNullOrEmpty(this.Condition))
            {
                return((bool)ExpressionCalculator.CalculateLambdaExpression(ExpressionCalculator.BuildColumnExpression(this.Condition), typeof(bool), DDIHelper.GetLambdaExpressionDataRow(dataTable), input));
            }
            return(this.runnableTester == null || this.runnableTester.IsRunnable(input, dataTable));
        }
예제 #11
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;
         }
     }
 }