internal void PrepareForSorting(ReportProcessing.ProcessingContext processingContext)
        {
            Global.Tracer.Assert(!m_processed, "(!m_processed)");
            if (m_eventTarget == null || m_sortFilterExpressionScopeObjects == null)
            {
                return;
            }
            processingContext.UserSortFilterContext.CurrentSortFilterEventSource = m_eventSource;
            for (int i = 0; i < m_sortFilterExpressionScopeObjects.Count; i++)
            {
                ((SortFilterExpressionScopeObj)m_sortFilterExpressionScopeObjects[i]).SortSEScopes(processingContext, m_eventSource);
            }
            GroupingList groupsInSortTarget = m_eventSource.UserSort.GroupsInSortTarget;

            if (groupsInSortTarget != null && 0 < groupsInSortTarget.Count)
            {
                m_groupExpressionsInSortTarget = new ReportProcessing.RuntimeExpressionInfoList();
                for (int j = 0; j < groupsInSortTarget.Count; j++)
                {
                    Grouping grouping = groupsInSortTarget[j];
                    for (int k = 0; k < grouping.GroupExpressions.Count; k++)
                    {
                        m_groupExpressionsInSortTarget.Add(new ReportProcessing.RuntimeExpressionInfo(grouping.GroupExpressions, grouping.ExprHost, null, k));
                    }
                }
            }
            CollectSortOrders();
        }
예제 #2
0
 internal void UpdateSubReportScopes(UserSortFilterContext context)
 {
     if (m_containingScopes != null && 0 < m_containingScopes.Count && m_containingScopes.LastEntry == null)
     {
         if (context.DetailScopeSubReports != null)
         {
             m_detailScopeSubReports = context.DetailScopeSubReports.Clone();
         }
         else
         {
             m_detailScopeSubReports = new SubReportList();
         }
         m_detailScopeSubReports.Add(this);
     }
     else
     {
         m_detailScopeSubReports = context.DetailScopeSubReports;
     }
     if (context.ContainingScopes != null)
     {
         if (m_containingScopes != null && 0 < m_containingScopes.Count)
         {
             m_containingScopes.InsertRange(0, context.ContainingScopes);
         }
         else
         {
             m_containingScopes = context.ContainingScopes;
         }
     }
 }
예제 #3
0
        internal void Add(GroupingList scopeDefs, VariantList[] scopeValues, int value)
        {
            if (scopeValues == null || scopeValues.Length == 0)
            {
                Global.Tracer.Assert(scopeDefs == null || scopeDefs.Count == 0, "(null == scopeDefs || 0 == scopeDefs.Count)");
                m_lookupTable = value;
                return;
            }
            bool lookup = true;

            if (m_lookupTable == null)
            {
                m_lookupTable = new Hashtable();
                lookup        = false;
            }
            Hashtable hashEntries = (Hashtable)m_lookupTable;
            int       num         = 0;
            int       num2        = 0;

            for (int i = 0; i < scopeValues.Length; i++)
            {
                VariantList variantList = scopeValues[i];
                if (variantList == null)
                {
                    num2++;
                    continue;
                }
                num = variantList.Count;
                if (i == scopeValues.Length - 1)
                {
                    num--;
                }
                GetNullScopeEntries(num2, ref hashEntries, ref lookup);
                for (int j = 0; j < num; j++)
                {
                    Hashtable hashtable = (!lookup) ? null : ((Hashtable)hashEntries[variantList[j]]);
                    if (hashtable == null)
                    {
                        hashtable = new Hashtable();
                        hashEntries.Add(variantList[j], hashtable);
                        lookup = false;
                    }
                    hashEntries = hashtable;
                }
                num2 = 0;
            }
            object key = 1;

            if (scopeValues[scopeValues.Length - 1] != null)
            {
                key = scopeValues[scopeValues.Length - 1][num];
            }
            else
            {
                GetNullScopeEntries(num2, ref hashEntries, ref lookup);
            }
            Global.Tracer.Assert(!hashEntries.Contains(key), "(!hashEntries.Contains(lastKey))");
            hashEntries.Add(key, value);
        }
 internal UserSortFilterContext(UserSortFilterContext parentContext, SubReport subReport)
 {
     m_runtimeSortFilterInfo  = parentContext.RuntimeSortFilterInfo;
     m_dataSetID              = parentContext.DataSetID;
     m_containingScopes       = subReport.ContainingScopes;
     m_detailScopeSubReports  = subReport.DetailScopeSubReports;
     m_inProcessUserSortPhase = parentContext.m_inProcessUserSortPhase;
 }
 internal UserSortFilterContext(UserSortFilterContext copy)
 {
     m_runtimeSortFilterInfo  = copy.RuntimeSortFilterInfo;
     m_currentContainingScope = copy.CurrentContainingScope;
     m_containingScopes       = copy.ContainingScopes;
     m_dataSetID              = copy.DataSetID;
     m_detailScopeSubReports  = copy.DetailScopeSubReports;
     m_inProcessUserSortPhase = copy.m_inProcessUserSortPhase;
 }
예제 #6
0
        internal new GroupingList Clone()
        {
            int          count        = Count;
            GroupingList groupingList = new GroupingList(count);

            for (int i = 0; i < count; i++)
            {
                groupingList.Add(this[i]);
            }
            return(groupingList);
        }
예제 #7
0
        internal int Lookup(GroupingList scopeDefs, VariantList[] scopeValues)
        {
            object obj = null;

            if (scopeValues == null || scopeValues.Length == 0)
            {
                Global.Tracer.Assert(scopeDefs == null || scopeDefs.Count == 0, "(null == scopeDefs || 0 == scopeDefs.Count)");
                obj = m_lookupTable;
            }
            else
            {
                Hashtable hashtable = (Hashtable)m_lookupTable;
                int       num       = 0;
                for (int i = 0; i < scopeValues.Length; i++)
                {
                    VariantList variantList = scopeValues[i];
                    if (variantList == null)
                    {
                        num++;
                        continue;
                    }
                    hashtable = (Hashtable)hashtable[num];
                    for (int j = 0; j < variantList.Count; j++)
                    {
                        obj = hashtable[variantList[j]];
                        if (i < scopeValues.Length - 1 || j < variantList.Count - 1)
                        {
                            hashtable = (Hashtable)obj;
                            Global.Tracer.Assert(hashtable != null, "(null != hashEntries)");
                        }
                    }
                    num = 0;
                }
                if (scopeValues[scopeValues.Length - 1] == null)
                {
                    hashtable = (Hashtable)hashtable[num];
                    obj       = hashtable[1];
                }
            }
            Global.Tracer.Assert(obj is int);
            return((int)obj);
        }
예제 #8
0
        private GroupingList GenerateUserSortGroupingList(bool rowIsInnerGrouping)
        {
            GroupingList groupingList = new GroupingList();

            for (MatrixHeading matrixHeading = rowIsInnerGrouping ? m_rows : m_columns; matrixHeading != null; matrixHeading = matrixHeading.SubHeading)
            {
                if (matrixHeading.Grouping != null)
                {
                    groupingList.Add(matrixHeading.Grouping);
                }
            }
            for (MatrixHeading matrixHeading = rowIsInnerGrouping ? m_columns : m_rows; matrixHeading != null; matrixHeading = matrixHeading.SubHeading)
            {
                if (matrixHeading.Grouping != null)
                {
                    groupingList.Add(matrixHeading.Grouping);
                }
            }
            return(groupingList);
        }
        internal object GetSortOrder(ReportRuntime runtime)
        {
            object obj = null;

            if (m_eventSource.UserSort.SortExpressionScope == null)
            {
                obj = runtime.EvaluateUserSortExpression(m_eventSource);
            }
            else if (m_sortOrders == null)
            {
                obj = null;
            }
            else
            {
                GroupingList groupsInSortTarget = m_eventSource.UserSort.GroupsInSortTarget;
                if (groupsInSortTarget == null || groupsInSortTarget.Count == 0)
                {
                    obj = m_sortOrders.LookupTable;
                }
                else
                {
                    bool      flag      = true;
                    bool      flag2     = false;
                    int       num       = 0;
                    Hashtable hashtable = (Hashtable)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(m_groupExpressionsInSortTarget[num], ObjectType.Grouping, grouping.Name, "GroupExpression");
                                num++;
                                obj = hashtable[key];
                                if (obj == null)
                                {
                                    flag = false;
                                    break;
                                }
                                if (num < 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)
                    {
                        m_currentInstanceIndex = m_currentSortIndex + 1;
                    }
                    else
                    {
                        obj = m_currentInstanceIndex;
                    }
                }
            }
            if (obj == null)
            {
                obj = DBNull.Value;
            }
            return(obj);
        }
 internal bool PopulateRuntimeSortFilterEventInfo(ReportProcessing.ProcessingContext pc, DataSet myDataSet)
 {
     if (pc.UserSortFilterInfo == null || pc.UserSortFilterInfo.SortInfo == null || pc.OldSortFilterEventInfo == null)
     {
         return(false);
     }
     if (m_dataSetID != -1)
     {
         return(false);
     }
     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 (m_runtimeSortFilterInfo == null)
             {
                 m_runtimeSortFilterInfo = new RuntimeSortFilterEventInfoList();
             }
             m_runtimeSortFilterInfo.Add(new RuntimeSortFilterEventInfo(sortFilterEventInfo.EventSource, uniqueNameAt, sortInfo.GetSortDirectionAt(i), sortFilterEventInfo.EventSourceScopeInfo));
         }
     }
     if (m_runtimeSortFilterInfo != null)
     {
         int count = m_runtimeSortFilterInfo.Count;
         for (int j = 0; j < count; j++)
         {
             TextBox          eventSource         = m_runtimeSortFilterInfo[j].EventSource;
             ISortFilterScope sortExpressionScope = eventSource.UserSort.SortExpressionScope;
             if (sortExpressionScope != null)
             {
                 sortExpressionScope.IsSortFilterExpressionScope = SetSortFilterInfo(sortExpressionScope.IsSortFilterExpressionScope, count, j);
             }
             ISortFilterScope sortTarget = eventSource.UserSort.SortTarget;
             if (sortTarget != null)
             {
                 sortTarget.IsSortFilterTarget = 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 = 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;
                         continue;
                     }
                     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)variantList[0];
                 }
             }
             GroupingList groupsInSortTarget = eventSource.UserSort.GroupsInSortTarget;
             if (groupsInSortTarget != null)
             {
                 for (int num2 = 0; num2 < groupsInSortTarget.Count; num2++)
                 {
                     groupsInSortTarget[num2].NeedScopeInfoForSortFilterExpression = SetSortFilterInfo(groupsInSortTarget[num2].NeedScopeInfoForSortFilterExpression, count, j);
                 }
             }
             IntList peerSortFilters = eventSource.GetPeerSortFilters(create: false);
             if (peerSortFilters == null)
             {
                 continue;
             }
             if (m_runtimeSortFilterInfo[j].PeerSortFilters == null)
             {
                 m_runtimeSortFilterInfo[j].PeerSortFilters = new Hashtable();
             }
             for (int num3 = 0; num3 < peerSortFilters.Count; num3++)
             {
                 if (eventSource.ID != peerSortFilters[num3])
                 {
                     m_runtimeSortFilterInfo[j].PeerSortFilters.Add(peerSortFilters[num3], null);
                 }
             }
         }
     }
     return(true);
 }