public GroupExpressionCollection(AspNetCore.ReportingServices.ReportProcessing.Grouping grouping)
 {
     if (grouping == null || grouping.GroupExpressions == null)
     {
         this.m_list = new List <ReportVariantProperty>();
     }
     else
     {
         int count = grouping.GroupExpressions.Count;
         this.m_list = new List <ReportVariantProperty>(count);
         for (int i = 0; i < count; i++)
         {
             this.m_list.Add(new ReportVariantProperty(grouping.GroupExpressions[i]));
         }
     }
 }
        public object GetSortOrder(ReportRuntime runtime)
        {
            object obj = null;

            if (this.m_eventSource.UserSort.SortExpressionScope == null)
            {
                obj = runtime.EvaluateUserSortExpression(this.m_eventSource);
            }
            else if (this.m_sortOrders == null)
            {
                obj = null;
            }
            else
            {
                GroupingList groupsInSortTarget = this.m_eventSource.UserSort.GroupsInSortTarget;
                if (groupsInSortTarget == null || groupsInSortTarget.Count == 0)
                {
                    obj = this.m_sortOrders.LookupTable;
                }
                else
                {
                    bool      flag      = true;
                    bool      flag2     = false;
                    int       num       = 0;
                    Hashtable hashtable = (Hashtable)this.m_sortOrders.LookupTable;
                    int       num2      = 0;
                    int       num3      = 0;
                    while (num3 < groupsInSortTarget.Count)
                    {
                        IEnumerator enumerator = hashtable.Keys.GetEnumerator();
                        enumerator.MoveNext();
                        num2 = (int)enumerator.Current;
                        for (int i = 0; i < num2; i++)
                        {
                            num += groupsInSortTarget[num3++].GroupExpressions.Count;
                        }
                        hashtable = (Hashtable)hashtable[num2];
                        if (num3 < groupsInSortTarget.Count)
                        {
                            Grouping grouping = groupsInSortTarget[num3];
                            for (int j = 0; j < grouping.GroupExpressions.Count; j++)
                            {
                                object key = runtime.EvaluateRuntimeExpression(this.m_groupExpressionsInSortTarget[num], ObjectType.Grouping, grouping.Name, "GroupExpression");
                                num++;
                                obj = hashtable[key];
                                if (obj == null)
                                {
                                    flag = false;
                                    break;
                                }
                                if (num < this.m_groupExpressionsInSortTarget.Count)
                                {
                                    hashtable = (Hashtable)obj;
                                }
                            }
                            num3++;
                            if (!flag)
                            {
                                break;
                            }
                            continue;
                        }
                        flag2 = true;
                        break;
                    }
                    if (flag && flag2)
                    {
                        obj = hashtable[1];
                        if (obj == null)
                        {
                            flag = false;
                        }
                    }
                    if (flag)
                    {
                        this.m_currentInstanceIndex = this.m_currentSortIndex + 1;
                    }
                    else
                    {
                        obj = this.m_currentInstanceIndex;
                    }
                }
            }
            if (obj == null)
            {
                obj = DBNull.Value;
            }
            return(obj);
        }
Beispiel #3
0
 public bool PopulateRuntimeSortFilterEventInfo(ReportProcessing.ProcessingContext pc, DataSet myDataSet)
 {
     if (pc.UserSortFilterInfo != null && pc.UserSortFilterInfo.SortInfo != null && pc.OldSortFilterEventInfo != null)
     {
         if (this.m_dataSetID != -1)
         {
             return(false);
         }
         this.m_runtimeSortFilterInfo = null;
         EventInformation.SortEventInfo sortInfo = pc.UserSortFilterInfo.SortInfo;
         for (int i = 0; i < sortInfo.Count; i++)
         {
             int uniqueNameAt = sortInfo.GetUniqueNameAt(i);
             SortFilterEventInfo sortFilterEventInfo = pc.OldSortFilterEventInfo[uniqueNameAt];
             if (sortFilterEventInfo != null && sortFilterEventInfo.EventSource.UserSort != null && sortFilterEventInfo.EventSource.UserSort.DataSetID == myDataSet.ID)
             {
                 if (this.m_runtimeSortFilterInfo == null)
                 {
                     this.m_runtimeSortFilterInfo = new RuntimeSortFilterEventInfoList();
                 }
                 this.m_runtimeSortFilterInfo.Add(new RuntimeSortFilterEventInfo(sortFilterEventInfo.EventSource, uniqueNameAt, sortInfo.GetSortDirectionAt(i), sortFilterEventInfo.EventSourceScopeInfo));
             }
         }
         if (this.m_runtimeSortFilterInfo != null)
         {
             int count = this.m_runtimeSortFilterInfo.Count;
             for (int j = 0; j < count; j++)
             {
                 TextBox          eventSource         = this.m_runtimeSortFilterInfo[j].EventSource;
                 ISortFilterScope sortExpressionScope = eventSource.UserSort.SortExpressionScope;
                 if (sortExpressionScope != null)
                 {
                     sortExpressionScope.IsSortFilterExpressionScope = this.SetSortFilterInfo(sortExpressionScope.IsSortFilterExpressionScope, count, j);
                 }
                 ISortFilterScope sortTarget = eventSource.UserSort.SortTarget;
                 if (sortTarget != null)
                 {
                     sortTarget.IsSortFilterTarget = this.SetSortFilterInfo(sortTarget.IsSortFilterTarget, count, j);
                 }
                 if (eventSource.ContainingScopes != null && 0 < eventSource.ContainingScopes.Count)
                 {
                     int num = 0;
                     for (int k = 0; k < eventSource.ContainingScopes.Count; k++)
                     {
                         Grouping    grouping    = eventSource.ContainingScopes[k];
                         VariantList variantList = this.m_runtimeSortFilterInfo[j].SortSourceScopeInfo[k];
                         if (grouping != null)
                         {
                             if (grouping.SortFilterScopeInfo == null)
                             {
                                 grouping.SortFilterScopeInfo = new VariantList[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]  = variantList;
                             grouping.SortFilterScopeIndex[j] = k;
                         }
                         else
                         {
                             SubReportList detailScopeSubReports = eventSource.UserSort.DetailScopeSubReports;
                             ReportItem    parent;
                             if (detailScopeSubReports != null && num < detailScopeSubReports.Count)
                             {
                                 parent = detailScopeSubReports[num++].Parent;
                             }
                             else
                             {
                                 Global.Tracer.Assert(k == eventSource.ContainingScopes.Count - 1, "(j == eventSource.ContainingScopes.Count - 1)");
                                 parent = eventSource.Parent;
                             }
                             while (parent != null && !(parent is DataRegion))
                             {
                                 parent = parent.Parent;
                             }
                             Global.Tracer.Assert(parent is DataRegion, "(parent is DataRegion)");
                             DataRegion dataRegion = (DataRegion)parent;
                             if (dataRegion.SortFilterSourceDetailScopeInfo == null)
                             {
                                 dataRegion.SortFilterSourceDetailScopeInfo = new int[count];
                                 for (int n = 0; n < count; n++)
                                 {
                                     dataRegion.SortFilterSourceDetailScopeInfo[n] = -1;
                                 }
                             }
                             Global.Tracer.Assert(variantList != null && 1 == variantList.Count, "(null != scopeValues && 1 == scopeValues.Count)");
                             dataRegion.SortFilterSourceDetailScopeInfo[j] = (int)((ArrayList)variantList)[0];
                         }
                     }
                 }
                 GroupingList groupsInSortTarget = eventSource.UserSort.GroupsInSortTarget;
                 if (groupsInSortTarget != null)
                 {
                     for (int num3 = 0; num3 < groupsInSortTarget.Count; num3++)
                     {
                         groupsInSortTarget[num3].NeedScopeInfoForSortFilterExpression = this.SetSortFilterInfo(groupsInSortTarget[num3].NeedScopeInfoForSortFilterExpression, count, j);
                     }
                 }
                 IntList peerSortFilters = eventSource.GetPeerSortFilters(false);
                 if (peerSortFilters != null)
                 {
                     if (this.m_runtimeSortFilterInfo[j].PeerSortFilters == null)
                     {
                         this.m_runtimeSortFilterInfo[j].PeerSortFilters = new Hashtable();
                     }
                     for (int num4 = 0; num4 < peerSortFilters.Count; num4++)
                     {
                         if (eventSource.ID != peerSortFilters[num4])
                         {
                             this.m_runtimeSortFilterInfo[j].PeerSortFilters.Add(peerSortFilters[num4], null);
                         }
                     }
                 }
             }
         }
         return(true);
     }
     return(false);
 }