Пример #1
0
 internal Rows(Report rpt, TableGroups tg, Grouping g, Sorting s)
 {
     _Rpt    = rpt;
     _SortBy = new List <RowsSortExpression>();
     // Pull all the sort expression together
     if (tg != null)
     {
         foreach (TableGroup t in tg.Items)
         {
             foreach (GroupExpression ge in t.Grouping.GroupExpressions.Items)
             {
                 _SortBy.Add(new RowsSortExpression(ge.Expression));
             }
             // TODO what to do with the sort expressions!!!!
         }
     }
     if (g != null)
     {
         if (g.ParentGroup != null)
         {
             _SortBy.Add(new RowsSortExpression(g.ParentGroup));
         }
         else if (g.GroupExpressions != null)
         {
             foreach (GroupExpression ge in g.GroupExpressions.Items)
             {
                 _SortBy.Add(new RowsSortExpression(ge.Expression));
             }
         }
     }
     if (s != null)
     {
         foreach (SortBy sb in s.Items)
         {
             _SortBy.Add(new RowsSortExpression(sb.SortExpression, sb.Direction == SortDirectionEnum.Ascending));
         }
     }
     if (_SortBy.Count > 0)
     {
         _SortBy.TrimExcess();
     }
     else
     {
         _SortBy = null;
     }
 }
Пример #2
0
        internal Table(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p, xNode)
        {
            _TableColumns             = null;
            _Header                   = null;
            _TableGroups              = null;
            _Details                  = null;
            _Footer                   = null;
            _FillPage                 = true;
            _DetailDataElementName    = "Details";
            _DetailDataCollectionName = "Details_Collection";
            _DetailDataElementOutput  = DataElementOutputEnum.Output;
            _IsGrid                   = xNode.Name != "Table"; // a grid is a restricted table to no data behind it

            // Loop thru all the child nodes
            foreach (XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (xNodeLoop.Name)
                {
                case "TableColumns":
                    _TableColumns = new TableColumns(r, this, xNodeLoop);
                    break;

                case "Header":
                    _Header = new Header(r, this, xNodeLoop);
                    break;

                case "TableGroups":
                    _TableGroups = new TableGroups(r, this, xNodeLoop);
                    break;

                case "Details":
                    _Details = new Details(r, this, xNodeLoop);
                    break;

                case "Footer":
                    _Footer = new Footer(r, this, xNodeLoop);
                    break;

                case "FillPage":
                    _FillPage = Conversion.ToBoolean(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                case "DetailDataElementName":
                    _DetailDataElementName = xNodeLoop.InnerText;
                    break;

                case "DetailDataCollectionName":
                    _DetailDataCollectionName = xNodeLoop.InnerText;
                    break;

                case "DetailDataElementOutput":
                    _DetailDataElementOutput = Reporting.Rdl.DataElementOutput.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                default:
                    if (DataRegionElement(xNodeLoop))                                   // try at DataRegion level
                    {
                        break;
                    }
                    // don't know this element - log it
                    OwnerReport.rl.LogError(4, "Unknown " + xNode.Name + " element '" + xNodeLoop.Name + "' ignored.");
                    break;
                }
            }
            DataRegionFinish();                                 // Tidy up the DataRegion
            if (_TableColumns == null)
            {
                OwnerReport.rl.LogError(8, "TableColumns element must be specified for a " + xNode.Name + ".");
                return;
            }

            // Verify Grid restrictions
            if (_IsGrid)
            {
                if (_TableGroups != null)
                {
                    OwnerReport.rl.LogError(8, "TableGroups not allowed in Grid element '" + xNode.Name + "'.");
                }
            }

            if (OwnerReport.rl.MaxSeverity < 8)
            {
                VerifyCC();                                     // Verify column count
            }
        }