Beispiel #1
0
        public static CriteriaOperator ApplyFilter(string modelRuleFilter, string filterString)
        {
            string criteria = null;

            if (!string.IsNullOrEmpty(modelRuleFilter))
            {
                var criteriaOperator             = CriteriaOperator.Parse(modelRuleFilter);
                var customFunctionValueProcessor = new CustomFunctionValueProcessor();
                customFunctionValueProcessor.Process(criteriaOperator);
                criteria = criteriaOperator.ToString();
                if (!string.IsNullOrEmpty(filterString))
                {
                    criteria = " and " + criteria;
                }
            }

            return(CriteriaOperator.Parse(filterString + criteria));
        }
Beispiel #2
0
 public static void ApplyValue(this IModelDashboardDataSourceParameter parameter,
                               DashboardParameter dashboardParameter)
 {
     if (parameter.IsCustomFunction)
     {
         if (dashboardParameter != null)
         {
             var criteriaOperator             = CriteriaOperator.Parse("Field=" + parameter.ParameterValue);
             var customFunctionValueProcessor = new CustomFunctionValueProcessor();
             customFunctionValueProcessor.Process(criteriaOperator);
             dashboardParameter.Value = ((OperandValue)((BinaryOperator)criteriaOperator).RightOperand).Value;
         }
     }
     else
     {
         var tryToChange = parameter.ParameterValue.TryToChange(dashboardParameter.Type, out var result);
         if (tryToChange)
         {
             dashboardParameter.Value = result;
         }
     }
 }