Exemplo n.º 1
0
        private object EvaluateFilterValue(Filter filterDef)
        {
            Global.Tracer.Assert(filterDef.Values != null, "(filterDef.Values != null)");
            Global.Tracer.Assert(filterDef.Values.Count > 0, "(filterDef.Values.Count > 0)");
            VariantResult variantResult = this.m_processingContext.ReportRuntime.EvaluateFilterVariantValue(filterDef, 0, this.m_objectType, this.m_objectName);

            this.ThrowIfErrorOccurred("FilterValue", variantResult.ErrorOccurred, variantResult.FieldStatus);
            return(variantResult.Value);
        }
Exemplo n.º 2
0
 private object[] EvaluateFilterValues(Filter filterDef)
 {
     if (filterDef.Values != null)
     {
         object[] array = new object[filterDef.Values.Count];
         for (int num = filterDef.Values.Count - 1; num >= 0; num--)
         {
             VariantResult variantResult = this.m_processingContext.ReportRuntime.EvaluateFilterVariantValue(filterDef, num, this.m_objectType, this.m_objectName);
             this.ThrowIfErrorOccurred("FilterValues", variantResult.ErrorOccurred, variantResult.FieldStatus);
             array[num] = variantResult.Value;
         }
         return(array);
     }
     return(null);
 }
        public bool EvaluateParameters(out object[] values, out DataFieldStatus fieldStatus)
        {
            bool flag = false;

            fieldStatus = DataFieldStatus.None;
            values      = new object[this.m_aggregateDef.Expressions.Length];
            for (int i = 0; i < this.m_aggregateDef.Expressions.Length; i++)
            {
                VariantResult variantResult = this.m_reportRT.EvaluateAggregateVariantOrBinaryParamExpr(this.m_aggregateDef, i, this);
                values[i] = variantResult.Value;
                flag     |= variantResult.ErrorOccurred;
                if (variantResult.FieldStatus != 0)
                {
                    fieldStatus = variantResult.FieldStatus;
                }
            }
            return(flag);
        }
Exemplo n.º 4
0
        public bool PassFilters(object dataInstance, out bool specialFilter)
        {
            bool flag = true;

            specialFilter = false;
            if (this.m_failFilters)
            {
                return(false);
            }
            if (this.m_filters != null)
            {
                for (int num = this.m_startFilterIndex; num < this.m_filters.Count; num++)
                {
                    Filter filter = this.m_filters[num];
                    if (Filter.Operators.Like == filter.Operator)
                    {
                        StringResult stringResult = this.m_processingContext.ReportRuntime.EvaluateFilterStringExpression(filter, this.m_objectType, this.m_objectName);
                        this.ThrowIfErrorOccurred("FilterExpression", stringResult.ErrorOccurred, stringResult.FieldStatus);
                        Global.Tracer.Assert(null != filter.Values);
                        Global.Tracer.Assert(1 <= filter.Values.Count);
                        StringResult stringResult2 = this.m_processingContext.ReportRuntime.EvaluateFilterStringValue(filter, 0, this.m_objectType, this.m_objectName);
                        this.ThrowIfErrorOccurred("FilterValue", stringResult2.ErrorOccurred, stringResult2.FieldStatus);
                        if (stringResult.Value != null && stringResult2.Value != null)
                        {
                            if (!stringResult.Value.Equals(stringResult2.Value, StringComparison.OrdinalIgnoreCase))
                            {
                                flag = false;
                            }
                        }
                        else if (stringResult.Value != null || stringResult2.Value != null)
                        {
                            flag = false;
                        }
                    }
                    else
                    {
                        VariantResult variantResult = this.m_processingContext.ReportRuntime.EvaluateFilterVariantExpression(filter, this.m_objectType, this.m_objectName);
                        this.ThrowIfErrorOccurred("FilterExpression", variantResult.ErrorOccurred, variantResult.FieldStatus);
                        object value = variantResult.Value;
                        if (filter.Operator == Filter.Operators.Equal || Filter.Operators.NotEqual == filter.Operator || Filter.Operators.GreaterThan == filter.Operator || Filter.Operators.GreaterThanOrEqual == filter.Operator || Filter.Operators.LessThan == filter.Operator || Filter.Operators.LessThanOrEqual == filter.Operator)
                        {
                            object y    = this.EvaluateFilterValue(filter);
                            int    num2 = 0;
                            try
                            {
                                num2 = ReportProcessing.CompareTo(value, y, this.m_processingContext.CompareInfo, this.m_processingContext.ClrCompareOptions);
                            }
                            catch (ReportProcessingException_ComparisonError e)
                            {
                                throw new ReportProcessingException(this.RegisterComparisonError(e));
                            }
                            catch
                            {
                                throw new ReportProcessingException(this.RegisterComparisonError());
                            }
                            if (flag)
                            {
                                switch (filter.Operator)
                                {
                                case Filter.Operators.Equal:
                                    if (num2 != 0)
                                    {
                                        flag = false;
                                    }
                                    break;

                                case Filter.Operators.NotEqual:
                                    if (num2 == 0)
                                    {
                                        flag = false;
                                    }
                                    break;

                                case Filter.Operators.GreaterThan:
                                    if (0 >= num2)
                                    {
                                        flag = false;
                                    }
                                    break;

                                case Filter.Operators.GreaterThanOrEqual:
                                    if (0 > num2)
                                    {
                                        flag = false;
                                    }
                                    break;

                                case Filter.Operators.LessThan:
                                    if (0 <= num2)
                                    {
                                        flag = false;
                                    }
                                    break;

                                case Filter.Operators.LessThanOrEqual:
                                    if (0 < num2)
                                    {
                                        flag = false;
                                    }
                                    break;
                                }
                            }
                        }
                        else if (Filter.Operators.In == filter.Operator)
                        {
                            object[] array = this.EvaluateFilterValues(filter);
                            flag = false;
                            if (array != null)
                            {
                                for (int i = 0; i < array.Length; i++)
                                {
                                    try
                                    {
                                        if (array[i] is ICollection)
                                        {
                                            foreach (object item in (ICollection)array[i])
                                            {
                                                if (ReportProcessing.CompareTo(value, item, this.m_processingContext.CompareInfo, this.m_processingContext.ClrCompareOptions) == 0)
                                                {
                                                    flag = true;
                                                    break;
                                                }
                                            }
                                        }
                                        else if (ReportProcessing.CompareTo(value, array[i], this.m_processingContext.CompareInfo, this.m_processingContext.ClrCompareOptions) == 0)
                                        {
                                            flag = true;
                                        }
                                        if (flag)
                                        {
                                            goto IL_05f9;
                                        }
                                    }
                                    catch (ReportProcessingException_ComparisonError e2)
                                    {
                                        throw new ReportProcessingException(this.RegisterComparisonError(e2));
                                    }
                                    catch
                                    {
                                        throw new ReportProcessingException(this.RegisterComparisonError());
                                    }
                                }
                            }
                        }
                        else if (Filter.Operators.Between == filter.Operator)
                        {
                            object[] array2 = this.EvaluateFilterValues(filter);
                            flag = false;
                            Global.Tracer.Assert(array2 != null && 2 == array2.Length);
                            try
                            {
                                if (0 <= ReportProcessing.CompareTo(value, array2[0], this.m_processingContext.CompareInfo, this.m_processingContext.ClrCompareOptions) && 0 >= ReportProcessing.CompareTo(value, array2[1], this.m_processingContext.CompareInfo, this.m_processingContext.ClrCompareOptions))
                                {
                                    flag = true;
                                }
                            }
                            catch (ReportProcessingException_ComparisonError e3)
                            {
                                throw new ReportProcessingException(this.RegisterComparisonError(e3));
                            }
                            catch
                            {
                                throw new ReportProcessingException(this.RegisterComparisonError());
                            }
                        }
                        else if (Filter.Operators.TopN == filter.Operator || Filter.Operators.BottomN == filter.Operator)
                        {
                            if (this.m_filterInfo == null)
                            {
                                Global.Tracer.Assert(filter.Values != null && 1 == filter.Values.Count);
                                IntegerResult integerResult = this.m_processingContext.ReportRuntime.EvaluateFilterIntegerValue(filter, 0, this.m_objectType, this.m_objectName);
                                this.ThrowIfErrorOccurred("FilterValue", integerResult.ErrorOccurred, integerResult.FieldStatus);
                                int       value2   = integerResult.Value;
                                IComparer comparer = (Filter.Operators.TopN != filter.Operator) ? ((IComparer) new MyBottomComparer(this.m_processingContext.CompareInfo, this.m_processingContext.ClrCompareOptions)) : ((IComparer) new MyTopComparer(this.m_processingContext.CompareInfo, this.m_processingContext.ClrCompareOptions));
                                this.InitFilterInfos(new MySortedListWithMaxSize(comparer, value2, this), num);
                            }
                            this.SortAndSave(value, dataInstance);
                            flag          = false;
                            specialFilter = true;
                        }
                        else if (Filter.Operators.TopPercent == filter.Operator || Filter.Operators.BottomPercent == filter.Operator)
                        {
                            if (this.m_filterInfo == null)
                            {
                                Global.Tracer.Assert(filter.Values != null && 1 == filter.Values.Count);
                                FloatResult floatResult = this.m_processingContext.ReportRuntime.EvaluateFilterIntegerOrFloatValue(filter, 0, this.m_objectType, this.m_objectName);
                                this.ThrowIfErrorOccurred("FilterValue", floatResult.ErrorOccurred, floatResult.FieldStatus);
                                double    value3    = floatResult.Value;
                                IComparer comparer2 = (Filter.Operators.TopPercent != filter.Operator) ? ((IComparer) new MyBottomComparer(this.m_processingContext.CompareInfo, this.m_processingContext.ClrCompareOptions)) : ((IComparer) new MyTopComparer(this.m_processingContext.CompareInfo, this.m_processingContext.ClrCompareOptions));
                                this.InitFilterInfos(new MySortedListWithoutMaxSize(comparer2, this), num);
                                this.m_filterInfo.Percentage = value3;
                            }
                            this.SortAndSave(value, dataInstance);
                            flag          = false;
                            specialFilter = true;
                        }
                    }
                    goto IL_05f9;
IL_05f9:
                    if (!flag)
                    {
                        return(false);
                    }
                }
            }
            return(flag);
        }