Пример #1
0
        private static CustomReportItemHeadingList HeadingListClone(CustomReportItemHeadingList headings, DataCellsList dataRowCells, ref int currentIndex, int headingSpan, InitializationContext context)
        {
            if (headings == null)
            {
                return(null);
            }
            int count = headings.Count;

            Global.Tracer.Assert(1 <= count);
            CustomReportItemHeadingList customReportItemHeadingList = new CustomReportItemHeadingList(count);

            for (int i = 0; i < count; i++)
            {
                CustomReportItemHeading customReportItemHeading = headings[i];
                if (customReportItemHeading.m_grouping != null)
                {
                    context.AggregateRewriteScopes.Add(customReportItemHeading.m_grouping.Name, null);
                }
                CustomReportItemHeading customReportItemHeading2 = HeadingClone(customReportItemHeading, dataRowCells, ref currentIndex, headingSpan, context);
                if (customReportItemHeading.m_innerHeadings != null)
                {
                    customReportItemHeading2.m_innerHeadings = HeadingListClone(customReportItemHeading.m_innerHeadings, dataRowCells, ref currentIndex, headingSpan, context);
                }
                if (customReportItemHeading.m_grouping != null)
                {
                    context.AggregateRewriteScopes.Remove(customReportItemHeading.m_grouping.Name);
                }
                customReportItemHeadingList.Add(customReportItemHeading2);
            }
            return(customReportItemHeadingList);
        }
Пример #2
0
        internal static bool ValidateProcessingRestrictions(CustomReportItemHeadingList headings, bool isColumn, bool hasStatic, InitializationContext context)
        {
            bool   flag         = true;
            bool   flag2        = false;
            bool   flag3        = false;
            bool   flag4        = false;
            string propertyName = isColumn ? "column" : "row";

            if (headings != null)
            {
                for (int i = 0; i < headings.Count; i++)
                {
                    CustomReportItemHeading customReportItemHeading = headings[i];
                    if (!customReportItemHeading.Static && customReportItemHeading.Grouping == null)
                    {
                        context.ErrorContext.Register(ProcessingErrorCode.rsInvalidGrouping, Severity.Error, context.ObjectType, context.ObjectName, propertyName);
                        flag = false;
                    }
                    if (customReportItemHeading.Subtotal)
                    {
                        context.ErrorContext.Register(ProcessingErrorCode.rsCRISubtotalNotSupported, Severity.Error, context.ObjectType, context.ObjectName, propertyName);
                        flag = false;
                    }
                    if (customReportItemHeading.Static && hasStatic)
                    {
                        flag3 = true;
                    }
                    if (customReportItemHeading.Static && customReportItemHeading.InnerHeadings != null)
                    {
                        flag4 = true;
                    }
                    if (!customReportItemHeading.Static && headings.Count > 1)
                    {
                        flag2 = true;
                    }
                    if (flag && !flag2 && !flag3 && !flag4 && customReportItemHeading.InnerHeadings != null && !ValidateProcessingRestrictions(customReportItemHeading.InnerHeadings, isColumn, customReportItemHeading.Static, context))
                    {
                        flag = false;
                    }
                }
            }
            if (flag3)
            {
                context.ErrorContext.Register(ProcessingErrorCode.rsCRIMultiStaticColumnsOrRows, Severity.Error, context.ObjectType, context.ObjectName, propertyName);
                flag = false;
            }
            if (flag4)
            {
                context.ErrorContext.Register(ProcessingErrorCode.rsCRIStaticWithSubgroups, Severity.Error, context.ObjectType, context.ObjectName, propertyName);
                flag = false;
            }
            if (flag2)
            {
                context.ErrorContext.Register(ProcessingErrorCode.rsCRIMultiNonStaticGroups, Severity.Error, context.ObjectType, context.ObjectName, propertyName);
                flag = false;
            }
            return(flag);
        }
Пример #3
0
 internal bool Initialize(int level, CustomReportItemHeadingList peerHeadings, int headingIndex, DataCellsList dataRowCells, ref int currentIndex, ref int maxLevel, InitializationContext context)
 {
     m_level = level;
     if (level > maxLevel)
     {
         maxLevel = level;
     }
     context.ExprHostBuilder.DataGroupingStart(m_isColumn);
     if (m_static)
     {
         Global.Tracer.Assert(!m_subtotal);
         if (m_grouping != null)
         {
             context.ErrorContext.Register(ProcessingErrorCode.rsInvalidStaticDataGrouping, Severity.Error, context.ObjectType, context.ObjectName, "DataGrouping");
             m_grouping = null;
         }
         else
         {
             m_sorting = null;
             CommonInitialize(level, dataRowCells, ref currentIndex, ref maxLevel, context);
         }
     }
     else
     {
         if ((context.Location & LocationFlags.InDetail) != 0)
         {
             context.ErrorContext.Register(ProcessingErrorCode.rsInvalidDetailDataGrouping, Severity.Error, context.ObjectType, context.ObjectName, "DataGrouping");
             return(false);
         }
         if (m_grouping != null && m_grouping.CustomProperties != null)
         {
             if (m_customProperties == null)
             {
                 m_customProperties = new DataValueList(m_grouping.CustomProperties.Count);
             }
             m_customProperties.AddRange(m_grouping.CustomProperties);
             m_grouping.CustomProperties = null;
         }
         if (m_subtotal)
         {
             if (m_grouping != null)
             {
                 context.AggregateRewriteScopes = new Hashtable();
                 context.AggregateRewriteScopes.Add(m_grouping.Name, null);
             }
             Global.Tracer.Assert(peerHeadings[headingIndex] != null);
             int currentIndex2 = currentIndex;
             CustomReportItemHeading customReportItemHeading = HeadingClone(this, dataRowCells, ref currentIndex2, m_headingSpan, context);
             customReportItemHeading.m_innerHeadings = HeadingListClone(m_innerHeadings, dataRowCells, ref currentIndex2, m_headingSpan, context);
             Global.Tracer.Assert(currentIndex + m_headingSpan == currentIndex2);
             Global.Tracer.Assert(!customReportItemHeading.m_subtotal && m_subtotal);
             Global.Tracer.Assert(headingIndex < peerHeadings.Count);
             peerHeadings.Insert(headingIndex + 1, customReportItemHeading);
             context.AggregateRewriteScopes = null;
             context.AggregateRewriteMap    = null;
         }
         if (m_grouping != null)
         {
             context.Location |= LocationFlags.InGrouping;
             context.RegisterGroupingScope(m_grouping.Name, m_grouping.SimpleGroupExpressions, m_grouping.Aggregates, m_grouping.PostSortAggregates, m_grouping.RecursiveAggregates, m_grouping);
             ObjectType objectType = context.ObjectType;
             string     objectName = context.ObjectName;
             context.ObjectType = ObjectType.Grouping;
             context.ObjectName = m_grouping.Name;
             CommonInitialize(level, dataRowCells, ref currentIndex, ref maxLevel, context);
             context.ObjectType = objectType;
             context.ObjectName = objectName;
             context.UnRegisterGroupingScope(m_grouping.Name);
         }
         else
         {
             context.Location |= LocationFlags.InDetail;
             CommonInitialize(level, dataRowCells, ref currentIndex, ref maxLevel, context);
         }
     }
     m_exprHostID   = context.ExprHostBuilder.DataGroupingEnd(m_isColumn);
     m_hasExprHost |= (m_exprHostID >= 0);
     return(m_subtotal);
 }