Exemplo n.º 1
0
        internal override void Update(object[] expressions, IErrorContext iErrorContext)
        {
            object obj = expressions[0];

            Microsoft.ReportingServices.ReportProcessing.DataAggregate.DataTypeCode typeCode = DataAggregate.GetTypeCode(obj);
            if (DataAggregate.IsNull(typeCode))
            {
                return;
            }
            if (!DataAggregate.IsVariant(typeCode) || DataTypeUtility.IsSpatial(typeCode))
            {
                iErrorContext.Register(ProcessingErrorCode.rsMinMaxOfNonSortableData, Severity.Warning);
                throw new ReportProcessingException(ErrorCode.rsInvalidOperation);
            }
            if (m_currentMax == null)
            {
                m_currentMax     = obj;
                m_expressionType = typeCode;
                return;
            }
            bool validComparisonResult;
            int  num = m_comparer.Compare(m_currentMax, obj, throwExceptionOnComparisonFailure: false, extendedTypeComparisons: false, out validComparisonResult);

            if (!validComparisonResult)
            {
                if (typeCode != m_expressionType)
                {
                    iErrorContext.Register(ProcessingErrorCode.rsAggregateOfMixedDataTypes, Severity.Warning);
                    throw new ReportProcessingException(ErrorCode.rsInvalidOperation);
                }
                iErrorContext.Register(ProcessingErrorCode.rsMinMaxOfNonSortableData, Severity.Warning);
            }
            else if (num < 0)
            {
                m_currentMax     = obj;
                m_expressionType = typeCode;
            }
        }
Exemplo n.º 2
0
        internal override void Update(object[] expressions, IErrorContext iErrorContext)
        {
            object doubleOrDecimalData = expressions[0];

            Microsoft.ReportingServices.ReportProcessing.DataAggregate.DataTypeCode doubleOrDecimalType = DataAggregate.GetTypeCode(doubleOrDecimalData);
            if (!DataAggregate.IsNull(doubleOrDecimalType))
            {
                if (!DataTypeUtility.IsNumeric(doubleOrDecimalType))
                {
                    iErrorContext.Register(ProcessingErrorCode.rsAggregateOfNonNumericData, Severity.Warning);
                    throw new ReportProcessingException(ErrorCode.rsInvalidOperation);
                }
                DataAggregate.ConvertToDoubleOrDecimal(doubleOrDecimalType, doubleOrDecimalData, out doubleOrDecimalType, out doubleOrDecimalData);
                if (m_expressionType == Microsoft.ReportingServices.ReportProcessing.DataAggregate.DataTypeCode.Null)
                {
                    m_expressionType = doubleOrDecimalType;
                }
                else if (doubleOrDecimalType != m_expressionType)
                {
                    iErrorContext.Register(ProcessingErrorCode.rsAggregateOfMixedDataTypes, Severity.Warning);
                    throw new ReportProcessingException(ErrorCode.rsInvalidOperation);
                }
                if (m_currentTotal == null)
                {
                    m_currentTotalType = doubleOrDecimalType;
                    m_currentTotal     = doubleOrDecimalData;
                }
                else
                {
                    m_currentTotal = DataAggregate.Add(m_currentTotalType, m_currentTotal, doubleOrDecimalType, doubleOrDecimalData);
                }
            }
        }