protected Hashtable GetScopeNames(RuntimeDataRegionObjReference currentScope, string targetScope, out int level)
        {
            level = -1;
            Hashtable hashtable = new Hashtable();
            IScope    scope     = null;

            for (IReference <IScope> reference = currentScope; reference != null; reference = scope.GetOuterScope(includeSubReportContainingScope: false))
            {
                scope = reference.Value();
                string scopeName = scope.GetScopeName();
                if (scopeName != null)
                {
                    Microsoft.ReportingServices.ReportIntermediateFormat.Grouping grouping = null;
                    if (scope is RuntimeGroupLeafObj)
                    {
                        grouping = ((RuntimeGroupLeafObj)scope).GroupingDef;
                        if (-1 == level && scopeName.Equals(targetScope))
                        {
                            level = grouping.RecursiveLevel;
                        }
                    }
                    hashtable.Add(scopeName, grouping);
                }
                else if (scope is RuntimeTablixCell && -1 == level)
                {
                    level = scope.RecursiveLevel(targetScope);
                }
            }
            return(hashtable);
        }
        protected Hashtable GetScopeNames(RuntimeDataRegionObjReference currentScope, Dictionary <string, object> nameValuePairs)
        {
            Hashtable hashtable = new Hashtable();
            IScope    scope     = null;

            for (IReference <IScope> reference = currentScope; reference != null; reference = scope.GetOuterScope(includeSubReportContainingScope: false))
            {
                scope = reference.Value();
                string scopeName = scope.GetScopeName();
                if (scopeName != null)
                {
                    Microsoft.ReportingServices.ReportIntermediateFormat.Grouping grouping = null;
                    if (scope is RuntimeGroupLeafObj)
                    {
                        grouping = ((RuntimeGroupLeafObj)scope).GroupingDef;
                        AddGroupNameValuePair(m_odpContext, grouping, nameValuePairs);
                    }
                    hashtable.Add(scopeName, grouping);
                }
                else if (scope is RuntimeTablixCell)
                {
                    scope.GetGroupNameValuePairs(nameValuePairs);
                }
            }
            return(hashtable);
        }
        protected Hashtable GetScopeNames(RuntimeDataRegionObjReference currentScope, string targetScope, out bool inScope)
        {
            inScope = false;
            Hashtable hashtable = new Hashtable();
            IScope    scope     = null;

            for (IReference <IScope> reference = currentScope; reference != null; reference = scope.GetOuterScope(includeSubReportContainingScope: false))
            {
                scope = reference.Value();
                string scopeName = scope.GetScopeName();
                if (scopeName != null)
                {
                    if (!inScope && scopeName.Equals(targetScope))
                    {
                        inScope = true;
                    }
                    Microsoft.ReportingServices.ReportIntermediateFormat.Grouping value = null;
                    if (scope is RuntimeGroupLeafObj)
                    {
                        value = ((RuntimeGroupLeafObj)scope).GroupingDef;
                    }
                    hashtable.Add(scopeName, value);
                }
                else if (scope is RuntimeTablixCell && !inScope)
                {
                    inScope = scope.InScope(targetScope);
                }
            }
            return(hashtable);
        }
Beispiel #4
0
 protected InternalStreamingOdpDynamicMemberLogicBase(DataRegionMember memberDef, OnDemandProcessingContext odpContext)
 {
     m_memberDef = memberDef;
     m_sorting   = m_memberDef.DataRegionMemberDefinition.Sorting;
     m_grouping  = m_memberDef.DataRegionMemberDefinition.Grouping;
     m_memberGroupAndSortExpressionFlag = m_memberDef.DataRegionMemberDefinition.MemberGroupAndSortExpressionFlag;
     m_odpContext = odpContext;
 }
Beispiel #5
0
        internal GroupExpressionCollection(Microsoft.ReportingServices.ReportIntermediateFormat.Grouping grouping)
        {
            if (grouping == null || grouping.GroupExpressions == null)
            {
                m_list = new List <ReportVariantProperty>();
                return;
            }
            int count = grouping.GroupExpressions.Count;

            m_list = new List <ReportVariantProperty>(count);
            for (int i = 0; i < count; i++)
            {
                m_list.Add(new ReportVariantProperty(grouping.GroupExpressions[i]));
            }
        }
Beispiel #6
0
 private void CopyDomainScopeGroupInstancesFromTarget()
 {
     Microsoft.ReportingServices.ReportIntermediateFormat.Grouping grouping = HierarchyDef.Grouping;
     if (grouping != null && grouping.DomainScope != null)
     {
         IReference <RuntimeGroupRootObj> value;
         bool condition = base.OdpContext.DomainScopeContext.DomainScopes.TryGetValue(grouping.ScopeIDForDomainScope, out value);
         Global.Tracer.Assert(condition, "DomainScopes should contain the target group root for the specified group");
         using (value.PinValue())
         {
             RuntimeGroupRootObj runtimeGroupRootObj = value.Value();
             ProcessingStage = ProcessingStages.Grouping;
             runtimeGroupRootObj.m_grouping.CopyDomainScopeGroupInstances(this);
             ProcessingStage = ProcessingStages.SortAndFilter;
         }
     }
 }
 internal void InsertToSortTree(RuntimeGroupLeafObjReference groupLeaf)
 {
     using (m_hierarchyRoot.PinValue())
     {
         RuntimeGroupRootObj runtimeGroupRootObj = (RuntimeGroupRootObj)m_hierarchyRoot.Value();
         Microsoft.ReportingServices.ReportIntermediateFormat.Grouping grouping = runtimeGroupRootObj.HierarchyDef.Grouping;
         if (runtimeGroupRootObj.ProcessSecondPassSorting)
         {
             Global.Tracer.Assert(m_grouping != null, "(m_grouping != null)");
             runtimeGroupRootObj.LastChild = groupLeaf;
             Global.Tracer.Assert(grouping != null, "(null != groupingDef)");
             object keyValue = m_odpContext.ReportRuntime.EvaluateRuntimeExpression(m_expression, Microsoft.ReportingServices.ReportProcessing.ObjectType.Grouping, grouping.Name, "Sort");
             m_grouping.NextRow(keyValue);
         }
         else
         {
             Global.Tracer.Assert(runtimeGroupRootObj.HierarchyDef.HasFilters || runtimeGroupRootObj.HierarchyDef.HasInnerFilters, "(groupRoot.HierarchyDef.HasFilters || groupRoot.HierarchyDef.HasInnerFilters)");
             AddChild(groupLeaf);
         }
     }
 }
        protected void MatchSortFilterScope(IReference <IScope> outerScope, Microsoft.ReportingServices.ReportIntermediateFormat.Grouping groupDef, object groupExprValue, int groupExprIndex)
        {
            if (m_odpContext.RuntimeSortFilterInfo == null || groupDef.SortFilterScopeInfo == null)
            {
                return;
            }
            List <IReference <RuntimeSortFilterEventInfo> > runtimeSortFilterInfo = m_odpContext.RuntimeSortFilterInfo;

            for (int i = 0; i < runtimeSortFilterInfo.Count; i++)
            {
                List <object> list = groupDef.SortFilterScopeInfo[i];
                if (list != null && outerScope.Value().TargetScopeMatched(i, detailSort: false))
                {
                    if (m_odpContext.ProcessingComparer.Compare(list[groupExprIndex], groupExprValue) != 0)
                    {
                        groupDef.SortFilterScopeMatched[i] = false;
                    }
                }
                else
                {
                    groupDef.SortFilterScopeMatched[i] = false;
                }
            }
        }
 internal bool PopulateRuntimeSortFilterEventInfo(OnDemandProcessingContext odpContext, Microsoft.ReportingServices.ReportIntermediateFormat.DataSet myDataSet)
 {
     if (odpContext.TopLevelContext.UserSortFilterInfo == null || odpContext.TopLevelContext.UserSortFilterInfo.OdpSortInfo == null || odpContext.TopLevelContext.OldSortFilterEventInfo == null)
     {
         return(false);
     }
     if (-1 != m_dataSetGlobalID)
     {
         return(false);
     }
     m_runtimeSortFilterInfo = null;
     EventInformation.OdpSortEventInfo odpSortInfo = odpContext.TopLevelContext.UserSortFilterInfo.OdpSortInfo;
     for (int i = 0; i < odpSortInfo.Count; i++)
     {
         string uniqueNameAt = odpSortInfo.GetUniqueNameAt(i);
         Microsoft.ReportingServices.ReportIntermediateFormat.SortFilterEventInfo sortFilterEventInfo = odpContext.TopLevelContext.OldSortFilterEventInfo[uniqueNameAt];
         if (sortFilterEventInfo == null || sortFilterEventInfo.EventSource.UserSort == null)
         {
             continue;
         }
         int num = sortFilterEventInfo.EventSource.UserSort.SubReportDataSetGlobalId;
         if (-1 == num)
         {
             num = sortFilterEventInfo.EventSource.UserSort.DataSet.GlobalID;
         }
         if (num == myDataSet.GlobalID)
         {
             if (m_runtimeSortFilterInfo == null)
             {
                 m_runtimeSortFilterInfo = new List <IReference <RuntimeSortFilterEventInfo> >();
             }
             RuntimeSortFilterEventInfo runtimeSortFilterEventInfo = new RuntimeSortFilterEventInfo(sortFilterEventInfo.EventSource, uniqueNameAt, odpSortInfo.GetSortDirectionAt(i), sortFilterEventInfo.EventSourceScopeInfo, odpContext, (m_currentContainingScope == null) ? 1 : m_currentContainingScope.Value().Depth);
             runtimeSortFilterEventInfo.SelfReference.UnPinValue();
             m_runtimeSortFilterInfo.Add(runtimeSortFilterEventInfo.SelfReference);
         }
     }
     if (m_runtimeSortFilterInfo != null)
     {
         int count = m_runtimeSortFilterInfo.Count;
         for (int j = 0; j < count; j++)
         {
             IReference <RuntimeSortFilterEventInfo> reference = m_runtimeSortFilterInfo[j];
             using (reference.PinValue())
             {
                 RuntimeSortFilterEventInfo runtimeSortFilterEventInfo2 = reference.Value();
                 IInScopeEventSource        eventSource = runtimeSortFilterEventInfo2.EventSource;
                 Microsoft.ReportingServices.ReportIntermediateFormat.ISortFilterScope sortExpressionScope = eventSource.UserSort.SortExpressionScope;
                 if (sortExpressionScope != null)
                 {
                     sortExpressionScope.IsSortFilterExpressionScope = SetSortFilterInfo(sortExpressionScope.IsSortFilterExpressionScope, count, j);
                 }
                 Microsoft.ReportingServices.ReportIntermediateFormat.ISortFilterScope sortTarget = eventSource.UserSort.SortTarget;
                 if (sortTarget != null)
                 {
                     sortTarget.IsSortFilterTarget = SetSortFilterInfo(sortTarget.IsSortFilterTarget, count, j);
                 }
                 if (eventSource.ContainingScopes != null && 0 < eventSource.ContainingScopes.Count)
                 {
                     int num2 = 0;
                     int num3 = 0;
                     for (int k = 0; k < eventSource.ContainingScopes.Count; k++)
                     {
                         Microsoft.ReportingServices.ReportIntermediateFormat.Grouping grouping = eventSource.ContainingScopes[k];
                         if (grouping != null && grouping.IsDetail)
                         {
                             continue;
                         }
                         List <object> list = runtimeSortFilterEventInfo2.SortSourceScopeInfo[num2];
                         if (grouping != null)
                         {
                             if (grouping.SortFilterScopeInfo == null)
                             {
                                 grouping.SortFilterScopeInfo = new List <object> [count];
                                 for (int l = 0; l < count; l++)
                                 {
                                     grouping.SortFilterScopeInfo[l] = null;
                                 }
                                 grouping.SortFilterScopeIndex = new int[count];
                                 for (int m = 0; m < count; m++)
                                 {
                                     grouping.SortFilterScopeIndex[m] = -1;
                                 }
                             }
                             grouping.SortFilterScopeInfo[j]  = list;
                             grouping.SortFilterScopeIndex[j] = num2;
                         }
                         else
                         {
                             List <Microsoft.ReportingServices.ReportIntermediateFormat.SubReport> detailScopeSubReports = eventSource.UserSort.DetailScopeSubReports;
                             Microsoft.ReportingServices.ReportIntermediateFormat.ReportItem       reportItem            = (detailScopeSubReports == null || num3 >= detailScopeSubReports.Count) ? eventSource.Parent : detailScopeSubReports[num3++].Parent;
                             while (reportItem != null && !reportItem.IsDataRegion)
                             {
                                 reportItem = reportItem.Parent;
                             }
                             Global.Tracer.Assert(reportItem.IsDataRegion, "(parent.IsDataRegion)");
                             Microsoft.ReportingServices.ReportIntermediateFormat.DataRegion dataRegion = (Microsoft.ReportingServices.ReportIntermediateFormat.DataRegion)reportItem;
                             if (dataRegion.SortFilterSourceDetailScopeInfo == null)
                             {
                                 dataRegion.SortFilterSourceDetailScopeInfo = new int[count];
                                 for (int n = 0; n < count; n++)
                                 {
                                     dataRegion.SortFilterSourceDetailScopeInfo[n] = -1;
                                 }
                             }
                             Global.Tracer.Assert(list != null && 1 == list.Count, "(null != scopeValues && 1 == scopeValues.Count)");
                             dataRegion.SortFilterSourceDetailScopeInfo[j] = (int)list[0];
                         }
                         num2++;
                     }
                 }
                 Microsoft.ReportingServices.ReportIntermediateFormat.GroupingList groupsInSortTarget = eventSource.UserSort.GroupsInSortTarget;
                 if (groupsInSortTarget != null)
                 {
                     for (int num4 = 0; num4 < groupsInSortTarget.Count; num4++)
                     {
                         groupsInSortTarget[num4].NeedScopeInfoForSortFilterExpression = SetSortFilterInfo(groupsInSortTarget[num4].NeedScopeInfoForSortFilterExpression, count, j);
                     }
                 }
                 List <int> peerSortFilters = eventSource.GetPeerSortFilters(create: false);
                 if (peerSortFilters == null || peerSortFilters.Count == 0)
                 {
                     continue;
                 }
                 if (runtimeSortFilterEventInfo2.PeerSortFilters == null)
                 {
                     runtimeSortFilterEventInfo2.PeerSortFilters = new Hashtable();
                 }
                 for (int num5 = 0; num5 < peerSortFilters.Count; num5++)
                 {
                     if (eventSource.ID != peerSortFilters[num5])
                     {
                         runtimeSortFilterEventInfo2.PeerSortFilters.Add(peerSortFilters[num5], null);
                     }
                 }
             }
         }
     }
     return(true);
 }
 internal static void AddGroupNameValuePair(OnDemandProcessingContext odpContext, Microsoft.ReportingServices.ReportIntermediateFormat.Grouping grouping, Dictionary <string, object> nameValuePairs)
 {
     if (grouping == null)
     {
         return;
     }
     Global.Tracer.Assert(grouping.GroupExpressions != null && 0 < grouping.GroupExpressions.Count);
     Microsoft.ReportingServices.ReportIntermediateFormat.ExpressionInfo expressionInfo = grouping.GroupExpressions[0];
     if (expressionInfo.Type != Microsoft.ReportingServices.ReportIntermediateFormat.ExpressionInfo.Types.Field)
     {
         return;
     }
     try
     {
         FieldImpl fieldImpl = odpContext.ReportObjectModel.FieldsImpl[expressionInfo.IntValue];
         if (fieldImpl.FieldDef != null)
         {
             object value = fieldImpl.Value;
             if (!nameValuePairs.ContainsKey(fieldImpl.FieldDef.DataField))
             {
                 nameValuePairs.Add(fieldImpl.FieldDef.DataField, (value is DBNull) ? null : value);
             }
         }
     }
     catch (Exception e)
     {
         if (AsynchronousExceptionDetection.IsStoppingException(e))
         {
             throw;
         }
     }
 }
        internal override void NextRow()
        {
            bool flag = true;
            RuntimeGroupRootObj runtimeGroupRootObj = null;

            using (m_hierarchyRoot.PinValue())
            {
                if (m_hierarchyRoot is RuntimeGroupRootObjReference)
                {
                    runtimeGroupRootObj = (RuntimeGroupRootObj)m_hierarchyRoot.Value();
                    if (ProcessingStages.SortAndFilter == runtimeGroupRootObj.ProcessingStage)
                    {
                        flag = false;
                    }
                }
                if (m_hierarchyObjs != null)
                {
                    if (flag)
                    {
                        IReference <RuntimeHierarchyObj> reference = m_hierarchyObjs[0];
                        Global.Tracer.Assert(reference != null, "(null != hierarchyObj)");
                        using (reference.PinValue())
                        {
                            reference.Value().NextRow();
                        }
                    }
                    else if (runtimeGroupRootObj != null)
                    {
                        RuntimeGroupLeafObjReference lastChild = runtimeGroupRootObj.LastChild;
                        Global.Tracer.Assert(null != lastChild, "(null != groupLastChild)");
                        m_hierarchyObjs.Add(lastChild);
                    }
                }
                else
                {
                    if (m_grouping == null)
                    {
                        return;
                    }
                    Microsoft.ReportingServices.ReportProcessing.ObjectType objectType = runtimeGroupRootObj.HierarchyDef.DataRegionDef.ObjectType;
                    string             name               = runtimeGroupRootObj.HierarchyDef.DataRegionDef.Name;
                    string             propertyName       = "GroupExpression";
                    DomainScopeContext domainScopeContext = base.OdpContext.DomainScopeContext;
                    DomainScopeContext.DomainScopeInfo domainScopeInfo = null;
                    if (domainScopeContext != null)
                    {
                        domainScopeInfo = domainScopeContext.CurrentDomainScope;
                    }
                    object obj;
                    if (domainScopeInfo == null)
                    {
                        obj = ((m_expression != null) ? m_odpContext.ReportRuntime.EvaluateRuntimeExpression(m_expression, objectType, name, propertyName) : ((object)m_odpContext.ReportObjectModel.FieldsImpl.GetRowIndex()));
                    }
                    else
                    {
                        domainScopeInfo.MoveNext();
                        obj = domainScopeInfo.CurrentKey;
                    }
                    if (runtimeGroupRootObj != null && flag)
                    {
                        Microsoft.ReportingServices.ReportIntermediateFormat.Grouping grouping = runtimeGroupRootObj.HierarchyDef.Grouping;
                        if (runtimeGroupRootObj.SaveGroupExprValues)
                        {
                            grouping.CurrentGroupExpressionValues.Add(obj);
                        }
                        MatchSortFilterScope(runtimeGroupRootObj.SelfReference, grouping, obj, m_expression.ExpressionIndex);
                    }
                    m_grouping.NextRow(obj);
                    domainScopeInfo?.MovePrevious();
                    return;
                }
            }
        }
        internal object PublishClone(AutomaticSubtotalContext context, ReportHierarchyNode owner)
        {
            Grouping grouping = (Grouping)MemberwiseClone();

            grouping.m_isClone = true;
            grouping.m_ID      = context.GenerateID();
            grouping.m_owner   = owner;
            if (DomainScope != null)
            {
                grouping.DomainScope = context.GetNewScopeName(DomainScope);
                if (string.CompareOrdinal(DomainScope, grouping.DomainScope) != 0)
                {
                    context.DomainScopeGroups.Add(grouping);
                }
                else
                {
                    grouping.m_scopeIDForDomainScope = Owner.DataScopeInfo.ScopeID;
                }
            }
            context.AddAggregateHolder(grouping);
            Global.Tracer.Assert(m_name != null);
            grouping.m_name = context.CreateAndRegisterUniqueGroupName(m_name, m_isClone);
            context.AddSortTarget(grouping.m_name, grouping);
            CloneGroupExpressions(context, grouping);
            if (m_groupLabel != null)
            {
                grouping.m_groupLabel = (ExpressionInfo)m_groupLabel.PublishClone(context);
            }
            if (m_sortDirections != null)
            {
                grouping.m_sortDirections = new List <bool>(m_sortDirections.Count);
                foreach (bool sortDirection in m_sortDirections)
                {
                    grouping.m_sortDirections.Add(sortDirection);
                }
            }
            grouping.m_aggregates          = new List <DataAggregateInfo>();
            grouping.m_recursiveAggregates = new List <DataAggregateInfo>();
            grouping.m_postSortAggregates  = new List <DataAggregateInfo>();
            if (m_filters != null)
            {
                grouping.m_filters = new List <Filter>(m_filters.Count);
                foreach (Filter filter in m_filters)
                {
                    grouping.m_filters.Add((Filter)filter.PublishClone(context));
                }
            }
            if (m_parent != null)
            {
                grouping.m_parent = new List <ExpressionInfo>(m_parent.Count);
                foreach (ExpressionInfo item in m_parent)
                {
                    grouping.m_parent.Add((ExpressionInfo)item.PublishClone(context));
                }
            }
            if (m_dataElementName != null)
            {
                grouping.m_dataElementName = (string)m_dataElementName.Clone();
            }
            if (m_userSortExpressions != null)
            {
                grouping.m_userSortExpressions = new List <ExpressionInfo>(m_userSortExpressions.Count);
                foreach (ExpressionInfo userSortExpression in m_userSortExpressions)
                {
                    grouping.m_userSortExpressions.Add((ExpressionInfo)userSortExpression.PublishClone(context));
                }
            }
            if (m_variables != null)
            {
                grouping.m_variables = new List <Variable>(m_variables.Count);
                foreach (Variable variable in m_variables)
                {
                    grouping.m_variables.Add((Variable)variable.PublishClone(context));
                }
            }
            if (m_nonDetailSortFiltersInScope != null)
            {
                grouping.m_nonDetailSortFiltersInScope = new InScopeSortFilterHashtable(m_nonDetailSortFiltersInScope.Count);
                foreach (DictionaryEntry item2 in m_nonDetailSortFiltersInScope)
                {
                    List <int> obj  = (List <int>)item2.Value;
                    List <int> list = new List <int>(obj.Count);
                    foreach (int item3 in obj)
                    {
                        list.Add(item3);
                    }
                    grouping.m_nonDetailSortFiltersInScope.Add(item2.Key, list);
                }
            }
            if (m_detailSortFiltersInScope != null)
            {
                grouping.m_detailSortFiltersInScope = new InScopeSortFilterHashtable(m_detailSortFiltersInScope.Count);
                foreach (DictionaryEntry item4 in m_detailSortFiltersInScope)
                {
                    List <int> obj2  = (List <int>)item4.Value;
                    List <int> list2 = new List <int>(obj2.Count);
                    foreach (int item5 in obj2)
                    {
                        list2.Add(item5);
                    }
                    grouping.m_detailSortFiltersInScope.Add(item4.Key, list2);
                }
            }
            if (m_pageBreak != null)
            {
                grouping.m_pageBreak = (PageBreak)m_pageBreak.PublishClone(context);
            }
            if (m_pageName != null)
            {
                grouping.m_pageName = (ExpressionInfo)m_pageName.PublishClone(context);
            }
            return(grouping);
        }
Beispiel #13
0
        private bool NextRegularRow()
        {
            UpdateDataRegionGroupRootInfo();
            if (!ProcessThisRow())
            {
                return(false);
            }
            DomainScopeContext domainScopeContext = base.OdpContext.DomainScopeContext;

            DomainScopeContext.DomainScopeInfo domainScopeInfo = null;
            if (domainScopeContext != null)
            {
                domainScopeInfo = domainScopeContext.CurrentDomainScope;
            }
            if (domainScopeInfo != null)
            {
                domainScopeInfo.MoveNext();
                m_currentGroupExprValue = domainScopeInfo.CurrentKey;
            }
            else if (m_expression != null)
            {
                m_currentGroupExprValue = EvaluateGroupExpression(m_expression, "Group");
            }
            else
            {
                m_currentGroupExprValue = m_odpContext.ReportObjectModel.FieldsImpl.GetRowIndex();
            }
            Microsoft.ReportingServices.ReportIntermediateFormat.Grouping grouping = m_hierarchyDef.Grouping;
            if (SaveGroupExprValues)
            {
                grouping.CurrentGroupExpressionValues = new List <object>(1);
                grouping.CurrentGroupExpressionValues.Add(m_currentGroupExprValue);
            }
            if (m_isDetailGroup)
            {
                if (m_detailUserSortTargetInfo != null)
                {
                    ProcessDetailSort();
                }
                else
                {
                    m_grouping.NextRow(m_currentGroupExprValue, hasParent: false, null);
                }
            }
            else
            {
                if (m_odpContext.RuntimeSortFilterInfo != null)
                {
                    int count = m_odpContext.RuntimeSortFilterInfo.Count;
                    if (grouping.SortFilterScopeMatched == null)
                    {
                        grouping.SortFilterScopeMatched = new bool[count];
                    }
                    for (int i = 0; i < count; i++)
                    {
                        grouping.SortFilterScopeMatched[i] = true;
                    }
                }
                MatchSortFilterScope(m_outerScope, grouping, m_currentGroupExprValue, 0);
                object parentKey = null;
                bool   flag      = m_parentExpression != null;
                if (flag)
                {
                    parentKey = EvaluateGroupExpression(m_parentExpression, "Parent");
                }
                m_grouping.NextRow(m_currentGroupExprValue, flag, parentKey);
            }
            domainScopeInfo?.MovePrevious();
            return(true);
        }
Beispiel #14
0
 protected RuntimeGroupRootObj(IReference <IScope> outerScope, Microsoft.ReportingServices.ReportIntermediateFormat.ReportHierarchyNode hierarchyDef, DataActions dataAction, OnDemandProcessingContext odpContext, Microsoft.ReportingServices.ReportProcessing.ObjectType objectType)
     : base(odpContext, objectType, outerScope.Value().Depth + 1)
 {
     m_hierarchyRoot = (RuntimeHierarchyObjReference)m_selfReference;
     m_outerScope    = outerScope;
     m_hierarchyDef  = hierarchyDef;
     Microsoft.ReportingServices.ReportIntermediateFormat.Grouping grouping = hierarchyDef.Grouping;
     Global.Tracer.Assert(grouping != null, "(null != groupDef)");
     m_isDetailGroup = grouping.IsDetail;
     if (m_isDetailGroup)
     {
         m_expression = null;
     }
     else
     {
         m_expression = new RuntimeExpressionInfo(grouping.GroupExpressions, grouping.ExprHost, grouping.SortDirections, 0);
     }
     if (m_odpContext.RuntimeSortFilterInfo != null)
     {
         int count = m_odpContext.RuntimeSortFilterInfo.Count;
         using (outerScope.PinValue())
         {
             IScope scope = outerScope.Value();
             for (int i = 0; i < count; i++)
             {
                 IReference <RuntimeSortFilterEventInfo> reference = m_odpContext.RuntimeSortFilterInfo[i];
                 using (reference.PinValue())
                 {
                     RuntimeSortFilterEventInfo runtimeSortFilterEventInfo = reference.Value();
                     if (runtimeSortFilterEventInfo.EventSource.ContainingScopes != null && runtimeSortFilterEventInfo.EventSource.ContainingScopes.Count != 0 && !runtimeSortFilterEventInfo.HasEventSourceScope && (!m_isDetailGroup || !runtimeSortFilterEventInfo.EventSource.IsSubReportTopLevelScope))
                     {
                         continue;
                     }
                     bool flag = false;
                     if (m_isDetailGroup)
                     {
                         if (!scope.TargetForNonDetailSort && IsTargetForSort(i, detailSort: true) && runtimeSortFilterEventInfo.EventTarget != base.SelfReference && scope.TargetScopeMatched(i, detailSort: true))
                         {
                             flag = true;
                             if (m_detailUserSortTargetInfo == null)
                             {
                                 m_detailUserSortTargetInfo = new RuntimeUserSortTargetInfo((IReference <IHierarchyObj>)base.SelfReference, i, reference);
                             }
                             else
                             {
                                 m_detailUserSortTargetInfo.AddSortInfo((IReference <IHierarchyObj>)base.SelfReference, i, reference);
                             }
                         }
                     }
                     else if (grouping.IsSortFilterExpressionScope != null)
                     {
                         flag = (grouping.IsSortFilterExpressionScope[i] && m_odpContext.UserSortFilterContext.InProcessUserSortPhase(i) && TargetScopeMatched(i, detailSort: false));
                     }
                     if (flag)
                     {
                         if (m_builtinSortOverridden == null)
                         {
                             m_builtinSortOverridden = new bool[count];
                         }
                         m_builtinSortOverridden[i] = true;
                     }
                 }
             }
         }
     }
     if (m_detailUserSortTargetInfo != null)
     {
         m_groupingType = RuntimeGroupingObj.GroupingTypes.DetailUserSort;
     }
     else if (grouping.GroupAndSort && !BuiltinSortOverridden)
     {
         m_groupingType = RuntimeGroupingObj.GroupingTypes.Sort;
     }
     else if (grouping.IsDetail && grouping.Parent == null && !BuiltinSortOverridden)
     {
         m_groupingType = RuntimeGroupingObj.GroupingTypes.Detail;
     }
     else if (grouping.NaturalGroup)
     {
         m_groupingType = RuntimeGroupingObj.GroupingTypes.NaturalGroup;
     }
     else
     {
         m_groupingType = RuntimeGroupingObj.GroupingTypes.Hash;
     }
     m_grouping = RuntimeGroupingObj.CreateGroupingObj(m_groupingType, this, objectType);
     if (grouping.Filters == null)
     {
         m_dataAction      = dataAction;
         m_outerDataAction = dataAction;
     }
     if (grouping.RecursiveAggregates != null)
     {
         m_dataAction |= DataActions.RecursiveAggregates;
     }
     if (grouping.PostSortAggregates != null)
     {
         m_dataAction |= DataActions.PostSortAggregates;
     }
     if (grouping.Parent != null)
     {
         m_parentExpression = new RuntimeExpressionInfo(grouping.Parent, grouping.ParentExprHost, null, 0);
     }
 }
Beispiel #15
0
        private void SetupObjectModels(OnDemandMode mode, bool needDeepCopyPath, int moveNextInstanceIndex, string scopeName)
        {
            Microsoft.ReportingServices.ReportIntermediateFormat.DataRegionInstance dataRegionInstance = null;
            IMemberHierarchy memberHierarchy         = null;
            int                     num              = -1;
            ScopeInstance           scopeInstance    = m_odpContext.CurrentReportInstance;
            List <InstancePathItem> lastInstancePath = m_lastInstancePath;
            List <InstancePathItem> list             = null;
            int                     num2             = 0;

            Microsoft.ReportingServices.ReportIntermediateFormat.Report reportDefinition = m_odpContext.ReportDefinition;
            ObjectModelImpl reportObjectModel = m_odpContext.ReportObjectModel;
            bool            flag  = false;
            bool            flag2 = false;
            int             i     = 0;

            try
            {
                if (m_lastRIFObject.InstancePath != null)
                {
                    list = m_lastRIFObject.InstancePath;
                    num2 = list.Count;
                }
                if (mode != OnDemandMode.InScope)
                {
                    m_odpContext.EnsureCultureIsSetOnCurrentThread();
                }
                if (mode == OnDemandMode.InScope && 1 == reportDefinition.DataSetsNotOnlyUsedInParameters && InScopeCompare(reportDefinition.FirstDataSet.Name, scopeName))
                {
                    return;
                }
                int num3 = 0;
                if (m_odpContext.InSubreport)
                {
                    num3 = InstancePathItem.GetParentReportIndex(m_lastRIFObject.InstancePath, m_lastRIFObject.InstancePathItem.Type == InstancePathItemType.SubReport);
                }
                bool identicalPaths;
                int  sharedPathIndex = InstancePathItem.GetSharedPathIndex(num3, lastInstancePath, list, reportObjectModel.AllFieldsCleared, out identicalPaths);
                for (int j = m_specialLastGroupingValues.Count; j < num3; j++)
                {
                    m_specialLastGroupingValues.Add(null);
                }
                for (int k = num3; k < num2; k++)
                {
                    InstancePathItem instancePathItem = list[k];
                    bool             flag3            = false;
                    if (mode != OnDemandMode.InScope)
                    {
                        flag3 = (k <= sharedPathIndex);
                    }
                    if (!flag3 && mode == OnDemandMode.FullSetup)
                    {
                        if (m_specialLastGroupingValues.Count < num2)
                        {
                            m_specialLastGroupingValues.Add(null);
                        }
                        else
                        {
                            m_specialLastGroupingValues[k] = null;
                        }
                    }
                    switch (instancePathItem.Type)
                    {
                    case InstancePathItemType.SubReport:
                    {
                        if (scopeInstance.SubreportInstances == null || instancePathItem.IndexInCollection >= scopeInstance.SubreportInstances.Count)
                        {
                            break;
                        }
                        IReference <Microsoft.ReportingServices.ReportIntermediateFormat.SubReportInstance> reference = scopeInstance.SubreportInstances[instancePathItem.IndexInCollection];
                        using (reference.PinValue())
                        {
                            Microsoft.ReportingServices.ReportIntermediateFormat.SubReportInstance subReportInstance = reference.Value();
                            subReportInstance.SubReportDef.CurrentSubReportInstance = reference;
                            if (mode != OnDemandMode.InScope && !subReportInstance.Initialized)
                            {
                                if (m_odpContext.IsTablixProcessingMode || m_odpContext.IsTopLevelSubReportProcessing)
                                {
                                    return;
                                }
                                SubReportInitializer.InitializeSubReport(subReportInstance.SubReportDef);
                                reference.PinValue();
                            }
                            Global.Tracer.Assert(k == num2 - 1, "SubReport not last in instance path.");
                        }
                        break;
                    }

                    case InstancePathItemType.DataRegion:
                        if (scopeInstance is Microsoft.ReportingServices.ReportIntermediateFormat.ReportInstance && (scopeInstance.DataRegionInstances == null || scopeInstance.DataRegionInstances.Count <= instancePathItem.IndexInCollection || scopeInstance.DataRegionInstances[instancePathItem.IndexInCollection] == null || scopeInstance.DataRegionInstances[instancePathItem.IndexInCollection].Value() == null))
                        {
                            Global.Tracer.Assert(instancePathItem.IndexInCollection < reportDefinition.TopLevelDataRegions.Count, "(newItem.IndexInCollection < m_reportDefinition.TopLevelDataRegions.Count)");
                            Microsoft.ReportingServices.ReportIntermediateFormat.DataSet dataSet = reportDefinition.TopLevelDataRegions[instancePathItem.IndexInCollection].GetDataSet(reportDefinition);
                            if (mode == OnDemandMode.InScope && InScopeCompare(dataSet.Name, scopeName))
                            {
                                return;
                            }
                            PerformOnDemandTablixProcessing(dataSet);
                        }
                        scopeInstance      = scopeInstance.DataRegionInstances[instancePathItem.IndexInCollection].Value();
                        flag               = (m_inRecursiveColumnHierarchy = false);
                        flag2              = (m_inRecursiveRowHierarchy = false);
                        num                = -1;
                        dataRegionInstance = (scopeInstance as Microsoft.ReportingServices.ReportIntermediateFormat.DataRegionInstance);
                        memberHierarchy    = dataRegionInstance;
                        if (mode == OnDemandMode.InScope && InScopeCompare(dataRegionInstance.DataRegionDef.Name, scopeName))
                        {
                            return;
                        }
                        if (dataRegionInstance.DataSetIndexInCollection >= 0 && m_odpContext.CurrentDataSetIndex != dataRegionInstance.DataSetIndexInCollection && mode != OnDemandMode.InScope)
                        {
                            if (!flag3)
                            {
                                Microsoft.ReportingServices.ReportIntermediateFormat.DataSetInstance dataSetInstance = m_odpContext.CurrentReportInstance.GetDataSetInstance(dataRegionInstance.DataSetIndexInCollection, m_odpContext);
                                if (dataSetInstance != null)
                                {
                                    dataSetInstance.SetupEnvironment(m_odpContext, newDataSetDefinition: true);
                                    i = 0;
                                }
                            }
                            else
                            {
                                i = k + 1;
                            }
                        }
                        if (mode == OnDemandMode.InScope)
                        {
                            break;
                        }
                        if (!flag3)
                        {
                            dataRegionInstance.SetupEnvironment(m_odpContext);
                            i = 0;
                            if (dataRegionInstance.NoRows)
                            {
                                dataRegionInstance.DataRegionDef.NoRows = true;
                                dataRegionInstance.DataRegionDef.ResetTopLevelDynamicMemberInstanceCount();
                                return;
                            }
                            dataRegionInstance.DataRegionDef.NoRows = false;
                        }
                        else
                        {
                            i = k + 1;
                        }
                        break;

                    case InstancePathItemType.ColumnMemberInstanceIndexTopMost:
                        scopeInstance = dataRegionInstance;
                        break;

                    case InstancePathItemType.Cell:
                    {
                        if (-1 == num)
                        {
                            num = 0;
                        }
                        IList <Microsoft.ReportingServices.ReportIntermediateFormat.DataCellInstance> cellInstances = memberHierarchy.GetCellInstances(num);
                        if (cellInstances == null)
                        {
                            if (flag2 && flag)
                            {
                                reportObjectModel.ResetFieldValues();
                            }
                        }
                        else
                        {
                            if (cellInstances.Count <= instancePathItem.IndexInCollection)
                            {
                                break;
                            }
                            Microsoft.ReportingServices.ReportIntermediateFormat.DataCellInstance dataCellInstance = cellInstances[instancePathItem.IndexInCollection];
                            if (dataCellInstance != null)
                            {
                                scopeInstance = dataCellInstance;
                                if (!flag3)
                                {
                                    dataCellInstance.SetupEnvironment(m_odpContext, m_odpContext.CurrentDataSetIndex);
                                    i = 0;
                                }
                                else
                                {
                                    i = k + 1;
                                }
                            }
                        }
                        break;
                    }

                    case InstancePathItemType.None:
                        continue;
                    }
                    if (!instancePathItem.IsDynamicMember)
                    {
                        continue;
                    }
                    IList <DataRegionMemberInstance> childMemberInstances = ((IMemberHierarchy)scopeInstance).GetChildMemberInstances(instancePathItem.Type == InstancePathItemType.RowMemberInstanceIndex, instancePathItem.IndexInCollection);
                    if (childMemberInstances == null)
                    {
                        reportObjectModel.ResetFieldValues();
                        return;
                    }
                    int num4 = (k != num2 - 1 || moveNextInstanceIndex < 0 || moveNextInstanceIndex >= childMemberInstances.Count) ? ((instancePathItem.InstanceIndex >= 0) ? instancePathItem.InstanceIndex : 0) : moveNextInstanceIndex;
                    if (num4 >= childMemberInstances.Count)
                    {
                        instancePathItem.ResetContext();
                        num4 = 0;
                    }
                    DataRegionMemberInstance dataRegionMemberInstance = childMemberInstances[num4];
                    if (mode == OnDemandMode.FullSetup)
                    {
                        dataRegionMemberInstance.MemberDef.InstanceCount      = childMemberInstances.Count;
                        dataRegionMemberInstance.MemberDef.CurrentMemberIndex = num4;
                    }
                    scopeInstance        = dataRegionMemberInstance;
                    m_lastRecursiveLevel = dataRegionMemberInstance.RecursiveLevel;
                    Microsoft.ReportingServices.ReportIntermediateFormat.ReportHierarchyNode memberDef = dataRegionMemberInstance.MemberDef;
                    if (mode == OnDemandMode.InScope && InScopeCompare(memberDef.Grouping.Name, scopeName))
                    {
                        return;
                    }
                    if (instancePathItem.Type == InstancePathItemType.RowMemberInstanceIndex)
                    {
                        memberHierarchy = dataRegionMemberInstance;
                        flag2           = true;
                    }
                    else
                    {
                        num  = dataRegionMemberInstance.MemberInstanceIndexWithinScopeLevel;
                        flag = true;
                    }
                    if (mode == OnDemandMode.FullSetup && !flag3)
                    {
                        dataRegionMemberInstance.SetupEnvironment(m_odpContext, m_odpContext.CurrentDataSetIndex);
                        i = 0;
                        Microsoft.ReportingServices.ReportIntermediateFormat.Grouping grouping = memberDef.Grouping;
                        if (grouping.Parent != null)
                        {
                            if (memberDef.IsColumn)
                            {
                                m_inRecursiveColumnHierarchy = true;
                            }
                            else
                            {
                                m_inRecursiveRowHierarchy = true;
                            }
                            if (memberDef.IsTablixMember)
                            {
                                memberDef.SetMemberInstances(childMemberInstances);
                                memberDef.SetRecursiveParentIndex(dataRegionMemberInstance.RecursiveParentIndex);
                                memberDef.SetInstanceHasRecursiveChildren(dataRegionMemberInstance.HasRecursiveChildren);
                            }
                        }
                        else if (memberDef.IsColumn)
                        {
                            m_inRecursiveColumnHierarchy = false;
                        }
                        else
                        {
                            m_inRecursiveRowHierarchy = false;
                        }
                        grouping.RecursiveLevel = m_lastRecursiveLevel;
                        grouping.SetGroupInstanceExpressionValues(dataRegionMemberInstance.GroupExprValues);
                        if (mode != 0 || grouping == null || grouping.GroupExpressions == null || grouping.GroupExpressions.Count <= 0)
                        {
                            continue;
                        }
                        Microsoft.ReportingServices.ReportIntermediateFormat.ExpressionInfo expressionInfo = grouping.GroupExpressions[0];
                        if (expressionInfo.Type != Microsoft.ReportingServices.ReportIntermediateFormat.ExpressionInfo.Types.Field)
                        {
                            continue;
                        }
                        Microsoft.ReportingServices.ReportIntermediateFormat.Field field = memberDef.DataRegionDef.GetDataSet(reportDefinition).Fields[expressionInfo.IntValue];
                        if (field.DataField != null)
                        {
                            string dataField = field.DataField;
                            object second    = dataRegionMemberInstance.GroupExprValues[0];
                            PairObj <string, object> pairObj = m_specialLastGroupingValues[k];
                            if (pairObj == null)
                            {
                                pairObj = new PairObj <string, object>(dataField, second);
                                m_specialLastGroupingValues[k] = pairObj;
                            }
                            else
                            {
                                pairObj.First  = dataField;
                                pairObj.Second = second;
                            }
                        }
                    }
                    else
                    {
                        i = k + 1;
                    }
                }
                if (mode == OnDemandMode.FullSetup && !identicalPaths && scopeInstance != null && i > 0)
                {
                    for (; i < m_lastInstancePath.Count; i++)
                    {
                        if (m_lastInstancePath[i].IsScope)
                        {
                            scopeInstance.SetupFields(m_odpContext, m_odpContext.CurrentDataSetIndex);
                            break;
                        }
                    }
                }
                if (mode != 0 || m_odpContext.IsTablixProcessingMode || m_odpContext.CurrentReportInstance == null || dataRegionInstance != null || reportDefinition.DataSetsNotOnlyUsedInParameters != 1)
                {
                    return;
                }
                Microsoft.ReportingServices.ReportIntermediateFormat.DataSet         firstDataSet     = reportDefinition.FirstDataSet;
                Microsoft.ReportingServices.ReportIntermediateFormat.DataSetInstance dataSetInstance2 = m_odpContext.CurrentReportInstance.GetDataSetInstance(firstDataSet, m_odpContext);
                if (dataSetInstance2 != null)
                {
                    bool flag4 = true;
                    if (!m_odpContext.IsTablixProcessingComplete(firstDataSet.IndexInCollection))
                    {
                        PerformOnDemandTablixProcessing(firstDataSet);
                        flag4 = false;
                    }
                    if (m_odpContext.CurrentOdpDataSetInstance == dataSetInstance2)
                    {
                        flag4 = false;
                    }
                    if (flag4)
                    {
                        dataSetInstance2.SetupEnvironment(m_odpContext, newDataSetDefinition: true);
                    }
                    else if (!dataSetInstance2.NoRows)
                    {
                        dataSetInstance2.SetupFields(m_odpContext, dataSetInstance2);
                    }
                }
            }
            finally
            {
                if (needDeepCopyPath)
                {
                    InstancePathItem.DeepCopyPath(list, ref m_lastInstancePath);
                }
            }
        }
Beispiel #16
0
 public override void CreateDomainScopeMember(ReportHierarchyNode parentNode, Grouping grouping, AutomaticSubtotalContext context)
 {
     Global.Tracer.Assert(condition: false, "CreateDomainScopeMember should not be called for MapDataRegion");
 }