Exemple #1
0
        private void CreateAggregates(List <Microsoft.ReportingServices.ReportIntermediateFormat.DataAggregateInfo> aggDefs)
        {
            if (aggDefs == null || 0 >= aggDefs.Count)
            {
                return;
            }
            AggregatesImpl aggregatesImpl = m_odpContext.ReportObjectModel.AggregatesImpl;

            for (int i = 0; i < aggDefs.Count; i++)
            {
                Microsoft.ReportingServices.ReportIntermediateFormat.DataAggregateInfo dataAggregateInfo = aggDefs[i];
                Microsoft.ReportingServices.ReportIntermediateFormat.DataAggregateObj  dataAggregateObj  = aggregatesImpl.GetAggregateObj(dataAggregateInfo.Name);
                if (dataAggregateObj == null)
                {
                    dataAggregateObj = new Microsoft.ReportingServices.ReportIntermediateFormat.DataAggregateObj(dataAggregateInfo, m_odpContext);
                    aggregatesImpl.Add(dataAggregateObj);
                }
                if (Microsoft.ReportingServices.ReportIntermediateFormat.DataAggregateInfo.AggregateTypes.Previous != dataAggregateInfo.AggregateType)
                {
                    if (Microsoft.ReportingServices.ReportIntermediateFormat.DataAggregateInfo.AggregateTypes.Aggregate == dataAggregateInfo.AggregateType)
                    {
                        RuntimeDataRegionObj.AddAggregate(ref m_customAggregates, dataAggregateObj);
                    }
                    else
                    {
                        RuntimeDataRegionObj.AddAggregate(ref m_nonCustomAggregates, dataAggregateObj);
                    }
                }
            }
        }
 public override void UpdateAggregates(AggregateUpdateContext context)
 {
     SetupEnvironment();
     if (RuntimeDataRegionObj.UpdateAggregatesAtScope(context, this, m_dataRegionDef.DataScopeInfo, AggregateUpdateFlags.Both, needsSetupEnvironment: false))
     {
         Traverse(ProcessingStages.UpdateAggregates, context);
     }
 }
 public IReference <IDataCorrelation> GetIdcReceiver(IRIFReportDataScope scope)
 {
     if (scope.IsGroup)
     {
         Microsoft.ReportingServices.ReportIntermediateFormat.ReportHierarchyNode rifMember = scope as Microsoft.ReportingServices.ReportIntermediateFormat.ReportHierarchyNode;
         IReference <RuntimeMemberObj>[] memberCollection = GetMemberCollection(rifMember);
         return(RuntimeDataRegionObj.GetGroupRoot(rifMember, memberCollection));
     }
     Microsoft.ReportingServices.ReportIntermediateFormat.DataRegion rifDataRegion = scope as Microsoft.ReportingServices.ReportIntermediateFormat.DataRegion;
     return(GetNestedDataRegion(rifDataRegion));
 }
        internal RuntimeDataTablixObj(IReference <IScope> outerScope, Microsoft.ReportingServices.ReportIntermediateFormat.DataRegion dataTablixDef, ref DataActions dataAction, OnDemandProcessingContext odpContext, bool onePassProcess, Microsoft.ReportingServices.ReportProcessing.ObjectType objectType)
            : base(outerScope, dataTablixDef, ref dataAction, odpContext, onePassProcess, dataTablixDef.RunningValues, objectType, outerScope.Value().Depth + 1)
        {
            ConstructorHelper(ref dataAction, onePassProcess, out bool handleMyDataAction, out DataActions innerDataAction);
            m_innerDataAction = innerDataAction;
            DataActions userSortDataAction = HandleSortFilterEvent();

            ConstructRuntimeStructure(ref innerDataAction, onePassProcess);
            HandleDataAction(handleMyDataAction, innerDataAction, userSortDataAction);
            m_odpContext.CreatedScopeInstance(m_dataRegionDef);
            m_scopeInstanceNumber = RuntimeDataRegionObj.AssignScopeInstanceNumber(m_dataRegionDef.DataScopeInfo);
        }
 private bool NextRegularRow()
 {
     if (m_odpContext.ReportObjectModel.FieldsImpl.AggregationFieldCount == 0)
     {
         m_hasProcessedAggregateRow = true;
         RuntimeDataRegionObj.UpdateAggregates(m_odpContext, m_customAggregates, updateAndSetup: false);
     }
     if (m_odpContext.ReportObjectModel.FieldsImpl.IsAggregateRow)
     {
         ScopeNextAggregateRow(m_userSortTargetInfo);
         return false;
     }
     NextNonAggregateRow();
     return true;
 }
Exemple #6
0
 private void CreateCells(IReference <RuntimeDataRegionObj> containingScopeRef, OnDemandProcessingContext odpContext, DataRegionInstance dataRegionInstance, bool isOuterGroup, IReference <RuntimeDataTablixGroupRootObj> currOuterGroupRoot, ScopeInstance parentInstance, IReference <RuntimeMemberObj>[] innerMembers, IReference <RuntimeDataTablixGroupLeafObj> innerGroupLeafRef)
 {
     using (containingScopeRef.PinValue())
     {
         RuntimeDataRegionObj runtimeDataRegionObj = containingScopeRef.Value();
         if (runtimeDataRegionObj is RuntimeDataTablixGroupLeafObj)
         {
             ((RuntimeDataTablixGroupLeafObj)runtimeDataRegionObj).CreateStaticCells(dataRegionInstance, parentInstance, currOuterGroupRoot, isOuterGroup, m_staticLeafCellIndexes, innerMembers, innerGroupLeafRef);
         }
         else
         {
             ((RuntimeDataTablixObj)runtimeDataRegionObj).CreateOutermostStaticCells(dataRegionInstance, isOuterGroup, innerMembers, innerGroupLeafRef);
         }
     }
 }
        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 RuntimeRDLDataRegionObj(IReference<IScope> outerScope, Microsoft.ReportingServices.ReportIntermediateFormat.DataRegion dataRegionDef, ref DataActions dataAction, OnDemandProcessingContext odpContext, bool onePassProcess, List<Microsoft.ReportingServices.ReportIntermediateFormat.RunningValueInfo> runningValues, Microsoft.ReportingServices.ReportProcessing.ObjectType objectType, int level)
     : base(odpContext, objectType, level)
 {
     m_dataRegionDef = dataRegionDef;
     m_outerScope = outerScope;
     RuntimeDataRegionObj.CreateAggregates(m_odpContext, dataRegionDef.Aggregates, ref m_nonCustomAggregates, ref m_customAggregates);
     if (dataRegionDef.DataScopeInfo != null)
     {
         RuntimeDataRegionObj.CreateAggregates(m_odpContext, dataRegionDef.DataScopeInfo.AggregatesOfAggregates, ref m_aggregatesOfAggregates);
     }
     if (dataRegionDef.Filters != null)
     {
         m_filters = new Filters(Filters.FilterTypes.DataRegionFilter, (IReference<Microsoft.ReportingServices.ReportProcessing.ReportProcessing.IFilterOwner>)base.SelfReference, dataRegionDef.Filters, dataRegionDef.ObjectType, dataRegionDef.Name, m_odpContext, level + 1);
         return;
     }
     m_outerDataAction = dataAction;
     m_dataAction = dataAction;
     dataAction = DataActions.None;
 }
 public override void ReadRow(DataActions dataAction, ITraversalContext context)
 {
     if (DataActions.UserSort == dataAction)
     {
         RuntimeDataRegionObj.CommonFirstRow(m_odpContext, ref m_firstRowIsAggregate, ref m_firstRow);
         CommonNextRow(m_dataRows);
         return;
     }
     if (DataActions.AggregatesOfAggregates == dataAction)
     {
         ((AggregateUpdateContext)context).UpdateAggregatesForRow();
         return;
     }
     if (FlagUtils.HasFlag(dataAction, DataActions.PostSortAggregatesOfAggregates))
     {
         ((AggregateUpdateContext)context).UpdateAggregatesForRow();
     }
     if (m_dataRegionDef.ProcessCellRunningValues)
     {
         return;
     }
     if (FlagUtils.HasFlag(dataAction, DataActions.PostSortAggregates))
     {
         if (m_postSortAggregates != null)
         {
             RuntimeDataRegionObj.UpdateAggregates(m_odpContext, m_postSortAggregates, updateAndSetup: false);
         }
         if (m_runningValues != null)
         {
             UpdateRunningValues(m_odpContext, m_runningValues);
         }
     }
     if (m_outerScope != null && (dataAction & m_outerDataAction) != 0)
     {
         using (m_outerScope.PinValue())
         {
             m_outerScope.Value().ReadRow(dataAction, context);
         }
     }
 }
        internal void RegisterSortFilterExpressionScope(IReference <IScope> containerRef, IReference <RuntimeDataRegionObj> scopeRef, bool[] isSortFilterExpressionScope)
        {
            List <IReference <RuntimeSortFilterEventInfo> > runtimeSortFilterInfo = m_runtimeSortFilterInfo;

            if (runtimeSortFilterInfo == null || isSortFilterExpressionScope == null || scopeRef == null)
            {
                return;
            }
            List <object>[] array = null;
            using (scopeRef.PinValue())
            {
                RuntimeDataRegionObj runtimeDataRegionObj = scopeRef.Value();
                using (containerRef.PinValue())
                {
                    IScope scope = containerRef.Value();
                    for (int i = 0; i < runtimeSortFilterInfo.Count; i++)
                    {
                        if (!isSortFilterExpressionScope[i] || !runtimeDataRegionObj.IsTargetForSort(i, detailSort: false) || !runtimeDataRegionObj.TargetScopeMatched(i, detailSort: false))
                        {
                            continue;
                        }
                        IReference <RuntimeSortFilterEventInfo> reference = runtimeSortFilterInfo[i];
                        using (reference.PinValue())
                        {
                            RuntimeSortFilterEventInfo runtimeSortFilterEventInfo = reference.Value();
                            if (array == null && runtimeSortFilterEventInfo.EventSource.UserSort.GroupsInSortTarget != null)
                            {
                                int index = 0;
                                array = new List <object> [runtimeSortFilterEventInfo.EventSource.UserSort.GroupsInSortTarget.Count];
                                runtimeDataRegionObj.GetScopeValues(runtimeSortFilterEventInfo.EventTarget, array, ref index);
                            }
                            runtimeSortFilterEventInfo.RegisterSortFilterExpressionScope(ref scope.SortFilterExpressionScopeInfoIndices[i], scopeRef, array, i);
                        }
                    }
                }
            }
        }
 void IDataRowSortOwner.PostDataRowSortNextRow()
 {
     RuntimeDataRegionObj.CommonFirstRow(m_odpContext, ref m_firstRowIsAggregate, ref m_firstRow);
     ScopeNextNonAggregateRow(m_nonCustomAggregates, m_dataRows);
 }
 public IOnDemandMemberInstanceReference GetFirstMemberInstance(Microsoft.ReportingServices.ReportIntermediateFormat.ReportHierarchyNode rifMember)
 {
     IReference <RuntimeMemberObj>[] memberCollection = GetMemberCollection(rifMember);
     return(RuntimeDataRegionObj.GetFirstMemberInstance(rifMember, memberCollection));
 }
 protected void ConstructorHelper(ref DataActions dataAction, bool onePassProcess, out bool handleMyDataAction, out DataActions innerDataAction)
 {
     innerDataAction    = m_dataAction;
     handleMyDataAction = false;
     if (onePassProcess)
     {
         if (m_dataRegionDef.RunningValues != null && 0 < m_dataRegionDef.RunningValues.Count)
         {
             RuntimeDataRegionObj.CreateAggregates(m_odpContext, m_dataRegionDef.RunningValues, ref m_nonCustomAggregates);
         }
         RuntimeDataRegionObj.CreateAggregates(m_odpContext, m_dataRegionDef.PostSortAggregates, ref m_nonCustomAggregates);
         RuntimeDataRegionObj.CreateAggregates(m_odpContext, m_dataRegionDef.CellPostSortAggregates, ref m_nonCustomAggregates);
     }
     else
     {
         if (m_dataRegionDef.RunningValues != null && 0 < m_dataRegionDef.RunningValues.Count)
         {
             m_dataAction |= DataActions.PostSortAggregates;
         }
         if (m_dataRegionDef.PostSortAggregates != null && m_dataRegionDef.PostSortAggregates.Count != 0)
         {
             RuntimeDataRegionObj.CreateAggregates(m_odpContext, m_dataRegionDef.PostSortAggregates, ref m_postSortAggregates);
             m_dataAction      |= DataActions.PostSortAggregates;
             handleMyDataAction = true;
         }
         if (m_dataRegionDef.DataScopeInfo != null)
         {
             DataScopeInfo dataScopeInfo = m_dataRegionDef.DataScopeInfo;
             if (dataScopeInfo.PostSortAggregatesOfAggregates != null && !dataScopeInfo.PostSortAggregatesOfAggregates.IsEmpty)
             {
                 RuntimeDataRegionObj.CreateAggregates(m_odpContext, dataScopeInfo.PostSortAggregatesOfAggregates, ref m_postSortAggregatesOfAggregates);
             }
             if (dataScopeInfo.HasAggregatesToUpdateAtRowScope)
             {
                 m_dataAction      |= DataActions.AggregatesOfAggregates;
                 handleMyDataAction = true;
             }
         }
         if (handleMyDataAction)
         {
             innerDataAction = DataActions.None;
         }
         else
         {
             innerDataAction = m_dataAction;
         }
     }
     m_inDataRowSortPhase = (m_dataRegionDef.Sorting != null && m_dataRegionDef.Sorting.ShouldApplySorting);
     if (m_inDataRowSortPhase)
     {
         m_sortedDataRowTree     = new BTree(this, m_odpContext, m_depth);
         m_dataRowSortExpression = new RuntimeExpressionInfo(m_dataRegionDef.Sorting.SortExpressions, m_dataRegionDef.Sorting.ExprHost, m_dataRegionDef.Sorting.SortDirections, 0);
         m_odpContext.AddSpecialDataRowSort((IReference <IDataRowSortOwner>)base.SelfReference);
     }
     m_dataRegionDef.ResetInstanceIndexes();
     m_outerGroupingCounters = new int[m_dataRegionDef.OuterGroupingDynamicMemberCount];
     for (int i = 0; i < m_outerGroupingCounters.Length; i++)
     {
         m_outerGroupingCounters[i] = -1;
     }
 }
        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);
            }
        }