Esempio n. 1
0
        private (IEnumerable <INameValue> head, string query, string data, IEnumerable <IFormDataParameters> conditions) GetEnvironmentInputVariables(IExecutionEnvironment environment, int update)
        {
            IEnumerable <INameValue> head = null;

            if (Headers != null)
            {
                head = Headers.Select(a => new NameValue(ExecutionEnvironment.WarewolfEvalResultToString(environment.Eval(a.Name, update)), ExecutionEnvironment.WarewolfEvalResultToString(environment.Eval(a.Value, update))));
                if (IsFormDataChecked)
                {
                    var headersHelper = new WebRequestHeadersHelper(notEvaluatedHeaders: Headers, evaluatedHeaders: head);
                    head = headersHelper.CalculateFormDataContentType();
                }
            }
            var query = string.Empty;

            if (QueryString != null)
            {
                query = ExecutionEnvironment.WarewolfEvalResultToString(environment.Eval(QueryString, update));
            }
            var postData = string.Empty;

            if (PostData != null && IsManualChecked)
            {
                postData = ExecutionEnvironment.WarewolfEvalResultToString(environment.Eval(PostData, update, true));
            }
            var conditions = new List <IFormDataParameters>();

            if ((Conditions ?? (Conditions = new List <FormDataConditionExpression>())).Any() && IsFormDataChecked)
            {
                _errorsTo  = new ErrorResultTO();
                conditions = Conditions.SelectMany(o => o.Eval(GetArgumentsFunc, _errorsTo.HasErrors())).ToList();
            }

            IEnumerable <string[]> GetArgumentsFunc(string col1s, string col2s, string col3s)
            {
                var col1 = environment.EvalAsList(col1s, 0, true);
                var col2 = environment.EvalAsList(col2s ?? "", 0, true);
                var col3 = environment.EvalAsList(col3s ?? "", 0, true);

                var iter = new WarewolfListIterator();
                var c1   = new WarewolfAtomIterator(col1);
                var c2   = new WarewolfAtomIterator(col2);
                var c3   = new WarewolfAtomIterator(col3);

                iter.AddVariableToIterateOn(c1);
                iter.AddVariableToIterateOn(c2);
                iter.AddVariableToIterateOn(c3);

                while (iter.HasMoreData())
                {
                    var item = new[] { iter.FetchNextValue(c1), iter.FetchNextValue(c2), iter.FetchNextValue(c3) };
                    yield return(item);
                }
                yield break;
            }

            return(head, query, postData, conditions);
        }
Esempio n. 2
0
        private Dev2Decision ParseDecision(IExecutionEnvironment env, Dev2Decision decision)
        {
            var col1 = env.EvalAsList(decision.Col1, 0);
            var col2 = env.EvalAsList(decision.Col2, 0);
            var col3 = env.EvalAsList(decision.Col3, 0);

            return(new Dev2Decision {
                Cols1 = col1, Cols2 = col2, Cols3 = col3, EvaluationFn = decision.EvaluationFn
            });
        }
Esempio n. 3
0
        Dev2Decision ParseDecision(IExecutionEnvironment env, Dev2Decision decision, bool errorIfNull)
        {
            var col1 = env.EvalAsList(decision.Col1, 0, errorIfNull);
            var col2 = env.EvalAsList(decision.Col2 ?? "", 0, errorIfNull);
            var col3 = env.EvalAsList(decision.Col3 ?? "", 0, errorIfNull);

            return(new Dev2Decision {
                Cols1 = col1, Cols2 = col2, Cols3 = col3, EvaluationFn = decision.EvaluationFn
            });
        }
Esempio n. 4
0
        private Dev2Decision ParseDecision(IExecutionEnvironment env, Dev2Decision decision)
        {
            bool errorifnull = !decision.EvaluationFn.ToString().ToLower().Contains("null");
            var  col1        = env.EvalAsList(decision.Col1, 0, errorifnull);
            var  col2        = env.EvalAsList(decision.Col2, 0, errorifnull);
            var  col3        = env.EvalAsList(decision.Col3, 0, errorifnull);

            return(new Dev2Decision {
                Cols1 = col1, Cols2 = col2, Cols3 = col3, EvaluationFn = decision.EvaluationFn
            });
        }
Esempio n. 5
0
 public IEnumerable <DataStorage.WarewolfAtom> EvalAsList(string expression, int update, bool throwsifnotexists) => _inner.EvalAsList(UpdateDataSourceWithIterativeValue(_datasource, update, expression), 0, throwsifnotexists);
Esempio n. 6
0
 public IEnumerable <DataStorage.WarewolfAtom> EvalAsList(string searchCriteria, int update, bool throwsifnotexists = false)
 {
     return(_inner.EvalAsList(UpdateDataSourceWithIterativeValue(_datasource, update, searchCriteria), 0, throwsifnotexists));
 }