public override void Update(object[] expressions, IErrorContext iErrorContext) { Global.Tracer.Assert(null != expressions); Global.Tracer.Assert(1 == expressions.Length); object obj = expressions[0]; DataTypeCode typeCode = DataAggregate.GetTypeCode(obj); if (!DataAggregate.IsNull(typeCode)) { if (!DataAggregate.IsVariant(typeCode)) { iErrorContext.Register(ProcessingErrorCode.rsMinMaxOfNonSortableData, Severity.Warning); throw new InvalidOperationException(); } if (this.m_expressionType == DataTypeCode.Null) { this.m_expressionType = typeCode; } else if (typeCode != this.m_expressionType) { iErrorContext.Register(ProcessingErrorCode.rsAggregateOfMixedDataTypes, Severity.Warning); throw new InvalidOperationException(); } if (this.m_currentMax == null) { this.m_currentMax = obj; } else { try { int num = ReportProcessing.CompareTo(this.m_currentMax, obj, this.m_compareInfo, this.m_compareOptions); if (num < 0) { this.m_currentMax = obj; } } catch { iErrorContext.Register(ProcessingErrorCode.rsMinMaxOfNonSortableData, Severity.Warning); } } } }
internal override void Update(object[] expressions, IErrorContext iErrorContext) { Global.Tracer.Assert(expressions != null); Global.Tracer.Assert(1 == expressions.Length); object obj = expressions[0]; DataTypeCode typeCode = DataAggregate.GetTypeCode(obj); if (DataAggregate.IsNull(typeCode)) { return; } if (!DataAggregate.IsVariant(typeCode)) { iErrorContext.Register(ProcessingErrorCode.rsMinMaxOfNonSortableData, Severity.Warning); throw new InvalidOperationException(); } if (m_expressionType == DataTypeCode.Null) { m_expressionType = typeCode; } else if (typeCode != m_expressionType) { iErrorContext.Register(ProcessingErrorCode.rsAggregateOfMixedDataTypes, Severity.Warning); throw new InvalidOperationException(); } if (m_currentMin == null) { m_currentMin = obj; return; } try { if (ReportProcessing.CompareTo(m_currentMin, obj, m_compareInfo, m_compareOptions) > 0) { m_currentMin = obj; } } catch { iErrorContext.Register(ProcessingErrorCode.rsMinMaxOfNonSortableData, Severity.Warning); } }
int IComparer.Compare(object x, object y) { return(ReportProcessing.CompareTo(x, y, this.m_compareInfo, this.m_compareOptions)); }
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); }
int IComparer.Compare(object x, object y) { return(ReportProcessing.CompareTo(y, x, m_compareInfo, m_compareOptions)); }