Пример #1
0
        private string ProcessFilterOperation(FilterOperation filterOp, string sql, string paramName, bool isRange, DynamicParameters paramsList)
        {
            if (filterOp.value == null && !IsUnaryOperator(filterOp.valueOperator))
            {
                return("");
            }

            var parsedSQl = sql.Replace("{{operator}}", QueryInfoHelper.GetSQLOperator(filterOp.valueOperator));

            parsedSQl = parsedSQl.Replace("{{parameter}}",
                                          IsUnaryOperator(filterOp.valueOperator) ? "" : filterOp.ProcessParamName(paramName, isRange)
                                          );

            var paramNamesList = filterOp.GetParamNames(paramName, isRange);

            if (filterOp.valueOperator == OperatorType.In)
            {
                int indexAt             = 0;
                var valueCommaSeperated = filterOp.GetValue <string>();
                var valueList           = valueCommaSeperated.Split(',');
                foreach (var p in paramNamesList)
                {
                    ProcessParameterValueForInOperator(paramsList, filterOp, p, valueList[indexAt]);
                    indexAt++;
                }
            }
            else
            {
                ProcessParameterValue(paramsList, filterOp, paramNamesList[0]);
            }


            return(parsedSQl);
        }