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);
        }
        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);
            }
        }