private void Traverse(ProcessingStages operation, AggregateUpdateContext aggContext)
        {
            if (m_grouping != null)
            {
                m_grouping.Traverse(ProcessingStages.SortAndFilter, ascending: true, aggContext);
            }
            if (m_hierarchyObjs == null)
            {
                return;
            }
            for (int i = 0; i < m_hierarchyObjs.Count; i++)
            {
                IReference <RuntimeHierarchyObj> reference = m_hierarchyObjs[i];
                using (reference.PinValue())
                {
                    switch (operation)
                    {
                    case ProcessingStages.SortAndFilter:
                        reference.Value().SortAndFilter(aggContext);
                        break;

                    case ProcessingStages.UpdateAggregates:
                        reference.Value().UpdateAggregates(aggContext);
                        break;
                    }
                }
            }
        }
 private void SortAndFilter()
 {
     if (m_report.NeedPostGroupProcessing)
     {
         m_odpContext.SecondPassOperation = (m_report.HasVariables ? SecondPassOperations.Variables : SecondPassOperations.None);
         if (m_report.HasSpecialRecursiveAggregates)
         {
             m_odpContext.SecondPassOperation |= SecondPassOperations.FilteringOrAggregatesOrDomainScope;
         }
         else
         {
             m_odpContext.SecondPassOperation |= (SecondPassOperations.Sorting | SecondPassOperations.FilteringOrAggregatesOrDomainScope);
         }
         AggregateUpdateContext aggContext = new AggregateUpdateContext(m_odpContext, AggregateMode.Aggregates);
         m_dataSetObj.EnterProcessUserSortPhase();
         m_odpContext.DomainScopeContext = new DomainScopeContext();
         m_dataSetObj.SortAndFilter(aggContext);
         m_odpContext.DomainScopeContext = null;
         if (m_report.HasSpecialRecursiveAggregates)
         {
             m_odpContext.SecondPassOperation = SecondPassOperations.Sorting;
             m_dataSetObj.SortAndFilter(aggContext);
         }
         m_dataSetObj.LeaveProcessUserSortPhase();
     }
 }
        internal virtual void CalculateRunningValues(AggregateUpdateContext aggContext)
        {
            if (m_grouping != null)
            {
                m_grouping.Traverse(ProcessingStages.RunningValues, m_expression == null || m_expression.Direction, aggContext);
            }
            if (m_hierarchyObjs == null)
            {
                return;
            }
            bool flag = true;

            for (int i = 0; i < m_hierarchyObjs.Count; i++)
            {
                IReference <RuntimeHierarchyObj> reference = m_hierarchyObjs[i];
                using (reference.PinValue())
                {
                    RuntimeHierarchyObj runtimeHierarchyObj = reference.Value();
                    if (!flag || runtimeHierarchyObj is RuntimeGroupLeafObj)
                    {
                        ((RuntimeGroupLeafObj)runtimeHierarchyObj).TraverseAllLeafNodes(ProcessingStages.RunningValues, aggContext);
                        flag = false;
                    }
                }
            }
        }
Beispiel #4
0
		private void Traverse(ProcessingStages operation, AggregateUpdateContext context)
		{
			if (Count == 0)
			{
				return;
			}
			int num = m_firstCellKey;
			int num2;
			do
			{
				num2 = num;
				IDisposable cleanupRef;
				RuntimeCell andPinCell = GetAndPinCell(num2, out cleanupRef);
				switch (operation)
				{
				case ProcessingStages.SortAndFilter:
					andPinCell.SortAndFilter(context);
					break;
				case ProcessingStages.UpdateAggregates:
					andPinCell.UpdateAggregates(context);
					break;
				default:
					Global.Tracer.Assert(condition: false, "Unknown operation in Traverse");
					break;
				}
				num = andPinCell.NextCell;
				cleanupRef?.Dispose();
			}
			while (num2 != m_lastCellKey);
		}
        private void Traverse(ProcessingStages operation, AggregateUpdateContext context)
        {
            for (int i = 0; i < m_dataRegionObjs.Count; i++)
            {
                RuntimeDataRegionObjReference runtimeDataRegionObjReference = m_dataRegionObjs[i];
                if (!(runtimeDataRegionObjReference != null))
                {
                    continue;
                }
                using (runtimeDataRegionObjReference.PinValue())
                {
                    switch (operation)
                    {
                    case ProcessingStages.SortAndFilter:
                        runtimeDataRegionObjReference.Value().SortAndFilter(context);
                        break;

                    case ProcessingStages.UpdateAggregates:
                        runtimeDataRegionObjReference.Value().UpdateAggregates(context);
                        break;

                    default:
                        Global.Tracer.Assert(condition: false, "Unknown ProcessingStage in Traverse");
                        break;
                    }
                }
            }
        }
Beispiel #6
0
 public void SortAndFilter(AggregateUpdateContext aggContext)
 {
     if (m_runtimeDataRegions != null)
     {
         m_runtimeDataRegions.SortAndFilter(aggContext);
     }
 }
 public override void UpdateAggregates(AggregateUpdateContext context)
 {
     SetupEnvironment();
     if (RuntimeDataRegionObj.UpdateAggregatesAtScope(context, this, m_dataRegionDef.DataScopeInfo, AggregateUpdateFlags.Both, needsSetupEnvironment: false))
     {
         Traverse(ProcessingStages.UpdateAggregates, context);
     }
 }
 private void PostSortOperations()
 {
     if (m_report.HasPostSortAggregates)
     {
         Dictionary <string, IReference <RuntimeGroupRootObj> > groupCollection = new Dictionary <string, IReference <RuntimeGroupRootObj> >();
         AggregateUpdateContext aggContext = new AggregateUpdateContext(m_odpContext, AggregateMode.PostSortAggregates);
         m_dataSetObj.CalculateRunningValues(groupCollection, aggContext);
     }
 }
 internal override bool SortAndFilter(AggregateUpdateContext aggContext)
 {
     if ((SecondPassOperations.FilteringOrAggregatesOrDomainScope & m_odpContext.SecondPassOperation) != 0 && m_dataRows != null && (m_outerDataAction & DataActions.RecursiveAggregates) != 0)
     {
         ReadRows(DataActions.RecursiveAggregates, null);
         ReleaseDataRows(DataActions.RecursiveAggregates, ref m_dataAction, ref m_dataRows);
     }
     return true;
 }
 internal virtual void UpdateAggregates(AggregateUpdateContext aggContext)
 {
     if (null != m_groupRoot)
     {
         using (m_groupRoot.PinValue())
         {
             m_groupRoot.Value().UpdateAggregates(aggContext);
         }
     }
 }
 internal virtual bool SortAndFilter(AggregateUpdateContext aggContext)
 {
     if (null != m_groupRoot)
     {
         using (m_groupRoot.PinValue())
         {
             return(m_groupRoot.Value().SortAndFilter(aggContext));
         }
     }
     return(true);
 }
 private void PreComputeAggregatesOfAggregates()
 {
     if (m_report.NeedPostGroupProcessing)
     {
         m_odpContext.SecondPassOperation = SecondPassOperations.FilteringOrAggregatesOrDomainScope;
         AggregateUpdateContext aggContext = new AggregateUpdateContext(m_odpContext, AggregateMode.Aggregates);
         m_odpContext.DomainScopeContext = new DomainScopeContext();
         m_dataSetObj.SortAndFilter(aggContext);
         m_odpContext.DomainScopeContext = null;
     }
 }
Beispiel #13
0
        internal override bool SortAndFilter(AggregateUpdateContext aggContext)
        {
            if (m_odpContext.HasSecondPassOperation(SecondPassOperations.FilteringOrAggregatesOrDomainScope))
            {
                CopyDomainScopeGroupInstancesFromTarget();
            }
            RuntimeGroupingObj grouping = m_grouping;
            bool ascending = DetermineTraversalDirection();
            bool result    = true;
            bool processSecondPassSorting = ProcessSecondPassSorting;
            bool flag = (SecondPassOperations.FilteringOrAggregatesOrDomainScope & m_odpContext.SecondPassOperation) != 0 && (m_hierarchyDef.HasFilters || m_hierarchyDef.HasInnerFilters);

            if (processSecondPassSorting)
            {
                m_expression   = new RuntimeExpressionInfo(m_hierarchyDef.Sorting.SortExpressions, m_hierarchyDef.Sorting.ExprHost, m_hierarchyDef.Sorting.SortDirections, 0);
                m_groupingType = RuntimeGroupingObj.GroupingTypes.Sort;
                m_grouping     = new RuntimeGroupingObjTree(this, m_objectType);
            }
            else if (flag)
            {
                m_groupingType = RuntimeGroupingObj.GroupingTypes.None;
                m_grouping     = new RuntimeGroupingObjLinkedList(this, m_objectType);
            }
            if (flag)
            {
                m_groupFilters = new Filters(Filters.FilterTypes.GroupFilter, (IReference <Microsoft.ReportingServices.ReportProcessing.ReportProcessing.IFilterOwner>)base.SelfReference, m_hierarchyDef.Grouping.Filters, Microsoft.ReportingServices.ReportProcessing.ObjectType.Grouping, m_hierarchyDef.Grouping.Name, m_odpContext, base.Depth + 1);
            }
            m_processingStage = ProcessingStages.SortAndFilter;
            m_lastChild       = null;
            grouping.Traverse(ProcessingStages.SortAndFilter, ascending, aggContext);
            if (flag)
            {
                m_groupFilters.FinishReadingGroups(aggContext);
                if (!processSecondPassSorting && null == m_lastChild)
                {
                    if (m_firstChild != null)
                    {
                        m_firstChild.Free();
                    }
                    m_firstChild = null;
                    result       = false;
                }
            }
            if (grouping != m_grouping)
            {
                grouping.Cleanup();
            }
            return(result);
        }
        internal override bool SortAndFilter(AggregateUpdateContext aggContext)
        {
            SetupEnvironment();
            if (m_userSortTargetInfo != null)
            {
                m_userSortTargetInfo.EnterProcessUserSortPhase(m_odpContext);
            }
            bool num = base.DataRegionDef.ProcessingInnerGrouping == Microsoft.ReportingServices.ReportIntermediateFormat.DataRegion.ProcessingInnerGroupings.Column;

            IReference <RuntimeMemberObj>[] array  = num ? m_outerGroupings : m_innerGroupings;
            IReference <RuntimeMemberObj>[] array2 = num ? m_innerGroupings : m_outerGroupings;
            int rowDomainScopeCount    = base.DataRegionDef.RowDomainScopeCount;
            int columnDomainScopeCount = base.DataRegionDef.ColumnDomainScopeCount;
            DomainScopeContext   domainScopeContext = base.OdpContext.DomainScopeContext;
            AggregateUpdateQueue workQueue          = null;

            if (m_odpContext.HasSecondPassOperation(SecondPassOperations.FilteringOrAggregatesOrDomainScope))
            {
                workQueue = RuntimeDataRegionObj.AggregateOfAggregatesStart(aggContext, this, m_dataRegionDef.DataScopeInfo, m_aggregatesOfAggregates, AggregateUpdateFlags.Both, needsSetupEnvironment: false);
                if (rowDomainScopeCount > 0)
                {
                    domainScopeContext.AddDomainScopes(array, array.Length - rowDomainScopeCount);
                }
                if (columnDomainScopeCount > 0)
                {
                    domainScopeContext.AddDomainScopes(array2, array2.Length - columnDomainScopeCount);
                }
            }
            Traverse(ProcessingStages.SortAndFilter, aggContext);
            base.SortAndFilter(aggContext);
            if (m_odpContext.HasSecondPassOperation(SecondPassOperations.FilteringOrAggregatesOrDomainScope))
            {
                RuntimeDataRegionObj.AggregatesOfAggregatesEnd(this, aggContext, workQueue, m_dataRegionDef.DataScopeInfo, m_aggregatesOfAggregates, updateAggsIfNeeded: true);
                if (rowDomainScopeCount > 0)
                {
                    domainScopeContext.RemoveDomainScopes(array, array.Length - rowDomainScopeCount);
                }
                if (columnDomainScopeCount > 0)
                {
                    domainScopeContext.RemoveDomainScopes(array2, array2.Length - columnDomainScopeCount);
                }
            }
            if (m_userSortTargetInfo != null)
            {
                m_userSortTargetInfo.LeaveProcessUserSortPhase(m_odpContext);
            }
            return(true);
        }
Beispiel #15
0
        protected override void CalculateRunningValuesForStaticContents(AggregateUpdateContext aggContext)
        {
            if (!m_processHeading)
            {
                return;
            }
            RuntimeDataTablixGroupRootObjReference runtimeDataTablixGroupRootObjReference = (RuntimeDataTablixGroupRootObjReference)m_hierarchyRoot;

            using (runtimeDataTablixGroupRootObjReference.PinValue())
            {
                Dictionary <string, IReference <RuntimeGroupRootObj> > groupCollection = runtimeDataTablixGroupRootObjReference.Value().GroupCollection;
                RuntimeGroupRootObjReference lastGroup = runtimeDataTablixGroupRootObjReference;
                if (m_groupScopedItems != null)
                {
                    m_groupScopedItems.CalculateRunningValues(groupCollection, lastGroup, aggContext);
                }
            }
        }
 internal static void AggregatesOfAggregatesEnd(IScope scopeObj, AggregateUpdateContext aggContext, AggregateUpdateQueue workQueue, DataScopeInfo dataScopeInfo, BucketedDataAggregateObjs aggregatesOfAggregates, bool updateAggsIfNeeded)
 {
     if (dataScopeInfo == null)
     {
         return;
     }
     if (updateAggsIfNeeded)
     {
         while (aggContext.AdvanceQueue(workQueue))
         {
             scopeObj.UpdateAggregates(aggContext);
         }
     }
     aggContext.RestoreOriginalState(workQueue);
     if (aggContext.Mode == AggregateMode.Aggregates && dataScopeInfo.NeedsSeparateAofAPass && updateAggsIfNeeded)
     {
         scopeObj.UpdateAggregates(aggContext);
     }
 }
Beispiel #17
0
        protected override void TraverseStaticContents(ProcessingStages operation, AggregateUpdateContext context)
        {
            if (m_groupScopedItems != null)
            {
                switch (operation)
                {
                case ProcessingStages.SortAndFilter:
                    m_groupScopedItems.SortAndFilter(context);
                    break;

                case ProcessingStages.UpdateAggregates:
                    m_groupScopedItems.UpdateAggregates(context);
                    break;

                default:
                    Global.Tracer.Assert(condition: false, "Unknown operation in TraverseStaticContents.");
                    break;
                }
            }
        }
Beispiel #18
0
        protected override void TraverseCellContents(ProcessingStages operation, AggregateUpdateContext context)
        {
            if (m_cellContents != null)
            {
                switch (operation)
                {
                case ProcessingStages.SortAndFilter:
                    m_cellContents.SortAndFilter(context);
                    break;

                case ProcessingStages.UpdateAggregates:
                    m_cellContents.UpdateAggregates(context);
                    break;

                default:
                    Global.Tracer.Assert(condition: false, "Invalid operation for TraverseCellContents.");
                    break;
                }
            }
        }
        internal static AggregateUpdateQueue AggregateOfAggregatesStart(AggregateUpdateContext aggContext, IDataRowHolder scope, DataScopeInfo dataScopeInfo, BucketedDataAggregateObjs aggregatesOfAggregates, AggregateUpdateFlags updateFlags, bool needsSetupEnvironment)
        {
            if (dataScopeInfo == null)
            {
                return(null);
            }
            AggregateUpdateQueue result = null;

            if (aggContext.Mode == AggregateMode.Aggregates)
            {
                if (dataScopeInfo.NeedsSeparateAofAPass)
                {
                    result = aggContext.ReplaceAggregatesToUpdate(aggregatesOfAggregates);
                }
                else
                {
                    result = aggContext.RegisterAggregatesToUpdate(aggregatesOfAggregates);
                    if (updateFlags != 0)
                    {
                        UpdateAggregatesAtScope(aggContext, scope, dataScopeInfo, updateFlags, needsSetupEnvironment);
                    }
                }
            }
            else if (aggContext.Mode == AggregateMode.PostSortAggregates)
            {
                result = aggContext.RegisterAggregatesToUpdate(aggregatesOfAggregates);
                result = aggContext.RegisterRunningValuesToUpdate(result, dataScopeInfo.RunningValuesOfAggregates);
                if (updateFlags != 0)
                {
                    UpdateAggregatesAtScope(aggContext, scope, dataScopeInfo, updateFlags, needsSetupEnvironment);
                }
            }
            else
            {
                Global.Tracer.Assert(condition: false, "Unknown AggregateMode for AggregateOfAggregatesStart");
            }
            return(result);
        }
        internal override void CalculateRunningValues(Dictionary <string, IReference <RuntimeGroupRootObj> > groupCol, IReference <RuntimeGroupRootObj> lastGroup, AggregateUpdateContext aggContext)
        {
            if (m_dataRegionDef.RunningValues != null && m_runningValues == null && m_previousValues == null)
            {
                AddRunningValues(m_odpContext, m_dataRegionDef.RunningValues, ref m_runningValues, ref m_previousValues, groupCol, lastGroup);
            }
            if (m_dataRegionDef.DataScopeInfo != null)
            {
                List <string> runningValuesInGroup  = null;
                List <string> previousValuesInGroup = null;
                AddRunningValues(m_odpContext, m_dataRegionDef.DataScopeInfo.RunningValuesOfAggregates, ref runningValuesInGroup, ref previousValuesInGroup, groupCol, lastGroup);
            }
            bool flag = m_dataRows != null && FlagUtils.HasFlag(m_dataAction, DataActions.PostSortAggregates);
            AggregateUpdateQueue workQueue = RuntimeDataRegionObj.AggregateOfAggregatesStart(aggContext, this, m_dataRegionDef.DataScopeInfo, m_postSortAggregatesOfAggregates, flag ? AggregateUpdateFlags.ScopedAggregates : AggregateUpdateFlags.Both, needsSetupEnvironment: true);

            if (flag)
            {
                DataActions dataActions = DataActions.PostSortAggregates;
                if (aggContext.LastScopeNeedsRowAggregateProcessing())
                {
                    dataActions |= DataActions.PostSortAggregatesOfAggregates;
                }
                ReadRows(dataActions, aggContext);
                m_dataRows = null;
            }
            int num = (m_outerGroupings != null) ? m_outerGroupings.Length : 0;

            if (num == 0)
            {
                if (m_innerGroupings != null)
                {
                    for (int i = 0; i < m_innerGroupings.Length; i++)
                    {
                        IReference <RuntimeMemberObj> reference = m_innerGroupings[i];
                        using (reference.PinValue())
                        {
                            reference.Value().CalculateRunningValues(groupCol, lastGroup, aggContext);
                        }
                    }
                }
            }
            else
            {
                for (int j = 0; j < num; j++)
                {
                    IReference <RuntimeMemberObj> reference2 = m_outerGroupings[j];
                    bool flag2;
                    using (reference2.PinValue())
                    {
                        RuntimeMemberObj runtimeMemberObj = reference2.Value();
                        runtimeMemberObj.CalculateRunningValues(groupCol, lastGroup, aggContext);
                        flag2 = (runtimeMemberObj.GroupRoot == null);
                    }
                    if (!flag2 || m_innerGroupings == null)
                    {
                        continue;
                    }
                    for (int k = 0; k < m_innerGroupings.Length; k++)
                    {
                        IReference <RuntimeMemberObj> reference3 = m_innerGroupings[k];
                        using (reference3.PinValue())
                        {
                            RuntimeMemberObj runtimeMemberObj2 = reference3.Value();
                            runtimeMemberObj2.PrepareCalculateRunningValues();
                            runtimeMemberObj2.CalculateRunningValues(groupCol, lastGroup, aggContext);
                        }
                    }
                }
            }
            CalculateRunningValuesForTopLevelStaticContents(groupCol, lastGroup, aggContext);
            RuntimeDataRegionObj.AggregatesOfAggregatesEnd(this, aggContext, workQueue, m_dataRegionDef.DataScopeInfo, m_postSortAggregatesOfAggregates, updateAggsIfNeeded: true);
            CalculateDRPreviousAggregates();
            RuntimeRICollection.StoreRunningValues(m_odpContext.ReportObjectModel.AggregatesImpl, m_dataRegionDef.RunningValues, ref m_runningValueValues);
            if (m_dataRegionDef.DataScopeInfo != null)
            {
                RuntimeRICollection.StoreRunningValues(m_odpContext.ReportObjectModel.AggregatesImpl, m_dataRegionDef.DataScopeInfo.RunningValuesOfAggregates, ref m_runningValueOfAggregateValues);
            }
        }
 protected virtual void CalculateRunningValuesForTopLevelStaticContents(Dictionary <string, IReference <RuntimeGroupRootObj> > groupCol, IReference <RuntimeGroupRootObj> lastGroup, AggregateUpdateContext aggContext)
 {
 }
 internal override void CalculateRunningValues(Dictionary <string, IReference <RuntimeGroupRootObj> > groupCol, IReference <RuntimeGroupRootObj> lastGroup, AggregateUpdateContext aggContext)
 {
     Global.Tracer.Assert(condition: false);
 }
 public abstract void UpdateAggregates(AggregateUpdateContext context);
Beispiel #24
0
 protected override void CalculateInnerRunningValues(Dictionary <string, IReference <RuntimeGroupRootObj> > groupCol, IReference <RuntimeGroupRootObj> lastGroup, AggregateUpdateContext aggContext)
 {
     if (m_cellContents != null)
     {
         m_cellContents.CalculateRunningValues(groupCol, lastGroup, aggContext);
     }
 }
 internal virtual void CalculateRunningValues(Dictionary <string, IReference <RuntimeGroupRootObj> > groupCol, IReference <RuntimeGroupRootObj> lastGroup, AggregateUpdateContext aggContext)
 {
     if (null != m_groupRoot)
     {
         using (m_groupRoot.PinValue())
         {
             m_groupRoot.Value().CalculateRunningValues(groupCol, lastGroup, aggContext);
         }
     }
 }
 public override void UpdateAggregates(AggregateUpdateContext aggContext)
 {
     Traverse(ProcessingStages.UpdateAggregates, aggContext);
 }
 internal abstract bool SortAndFilter(AggregateUpdateContext aggContext);
 internal abstract void CalculateRunningValues(Dictionary <string, IReference <RuntimeGroupRootObj> > groupCol, IReference <RuntimeGroupRootObj> lastGroup, AggregateUpdateContext aggContext);
 internal static bool UpdateAggregatesAtScope(AggregateUpdateContext aggContext, IDataRowHolder scope, DataScopeInfo scopeInfo, AggregateUpdateFlags updateFlags, bool needsSetupEnvironment)
 {
     return(aggContext.UpdateAggregates(scopeInfo, scope, updateFlags, needsSetupEnvironment));
 }
 internal override bool SortAndFilter(AggregateUpdateContext aggContext)
 {
     Traverse(ProcessingStages.SortAndFilter, aggContext);
     return(true);
 }