public bool bInAGroup(RuntimeGroup group)
 {
     if (group.Level != this.Level)
     {
         return(false);
     }
     for (int i = 0; i < group.Count; i++)
     {
         RuntimeGroupItem item = group[i];
         if (_cells[item.CellName].Caption != item.Value)
         {
             return(false);
         }
     }
     return(true);
 }
Exemple #2
0
        protected RuntimeGroup AddARuntimeGroup(Report report)
        {
            RuntimeGroup group = new RuntimeGroup(this.Level);

            //Section header = report.Sections.GetGroupHeader(this.Level);
            foreach (string key in report.CurrentSchema[this.Level].Items)
            {
                //Cell ctmp = this.Section.Cells[key];
                Cell ctmp = this.Cells[key];
                //Cell ctmp = header.Cells[key];
                if (ctmp != null && ctmp is IMapName)
                {
                    group.AddAItem(new RuntimeGroupItem(key, (ctmp as IMapName).MapName, ctmp.Caption));
                }
            }
            return(group);
        }
        public bool bInThisRow(RuntimeGroup group)
        {
            bool bin = bInAGroup(group);

            if (!bin)
            {
                return(false);
            }

            GroupHeaderRow parent = this;

            for (int i = group.Level - 1; i > 0; i--)
            {
                parent = parent.ParentRow;
                bin    = parent.bInAGroup(group.UpperGroup(i));
                if (!bin)
                {
                    return(false);
                }
            }
            return(true);
        }
Exemple #4
0
        private void DrawCell(Cell c, int width, int height, int y, Graphics g)
        {
            if (!c.Visible)
            {
                return;
            }
            if (c is Expression)
            {
                string formula = (c as Expression).Formula.FormulaExpression.ToLower();
                if (formula == "page()")
                {
                    int pageindex = _pageindex + 1;//* _pagesinpage + _pageoffsize;
                    formula   = formula.Replace("page()", pageindex.ToString());
                    c.Caption = formula;
                }
                else if (formula == "pages()")
                {
                    int pages = _pages * _pagesinpage;
                    formula   = formula.Replace("pages()", pages.ToString());
                    c.Caption = formula;
                }
                else if (formula == "grouppage()")
                {
                    c.Caption = (_printpage == null? "" : Convert.ToString((_printpage.GroupPageIndex - 1) * _pagesinpage + _pageoffsize));
                }
                else if (formula == "grouppages()")
                {
                    c.Caption = (_printpage == null? "" : Convert.ToString(_printpage.GroupPages * _pagesinpage));
                }
                else if (c.GetStateType() == "PrintExpression")
                {
                    object o = (_printpage == null ? "": _printpage.GetValue(c));
                    if (o != null)
                    {
                        c.Caption = o.ToString();
                    }
                    else
                    {
                        c.Caption = "";
                    }
                }
            }
            else if (c is Chart)
            {
                #region chart
                Chart chart = c as Chart;
                if (chart.bNullChart)
                {
                    try
                    {
                        Infragistics.Win.UltraWinChart.UltraChart mychart = new Infragistics.Win.UltraWinChart.UltraChart();
                        chart.MyChart = mychart;
                        ChartService cs = null;
                        if (_report.Type == ReportType.IndicatorReport)
                        {
                            cs = new IndicatorChartService(_report, chart.CaptionToName);
                        }
                        else
                        {
                            cs = new ChartService(_report);
                        }
                        cs.InitializeChart(chart.Level, null, mychart);
                        if (chart.Data == null)
                        {
                            RuntimeGroup group = null;
                            if (chart.Level > 1)
                            {
                                group = AddARuntimeGroup(_report);
                                GroupHeaderRow pr = (this as GroupRow).ParentRow;
                                while (pr != null)
                                {
                                    group.AddAUpperGroup(pr.AddARuntimeGroup(_report));
                                    pr = pr.ParentRow;
                                }
                            }
                            mychart.Data.DataSource = cs.GetDataSource(chart.Level, null, group, mychart.ChartType);
                        }
                        else
                        {
                            mychart.Data.DataSource = cs.GetDataSource(chart.Level, null, chart.Data, mychart.ChartType);
                        }

                        mychart.Data.DataBind();
                    }
                    catch (Exception e)
                    {
                        chart.Caption         = e.Message;
                        chart.bExceptionChart = true;
                    }
                }
                #endregion
            }
            int x = ConvertFromInternalToControl(c.X);
            if (width != -1 && (x >= width || x + c.Width <= 0))
            {
                return;
            }

            int h;
            int ycor = y;
            if (c is SuperLabel)
            {
                if (_bautoheight)
                {
                    h = c.RuntimeHeight;
                }
                else
                {
                    h = c.Height;
                }
            }
            else
            {
                if (_bautoheight)
                {
                    h = c.ExpandHeight;
                }
                else
                {
                    h = c.MetaHeight;
                }
            }

            int celly = c.Y;
            if (c is Label && _bautoheight)
            {
                if (celly < (c as Label).AutoHeightY)
                {
                    celly = (c as Label).AutoHeightY;
                }
            }

            //if(! (c is SubReport))
            //{
            if (c.KeepPos)
            {
                ycor += celly - _ybase;
            }
            else
            {
                h = this.Height;
            }
            //}
            c.bActive      = false;
            c.bInActiveRow = false;
            if (bActiveCell != null && bActiveCell(c))
            {
                c.bActive = true;
            }
            if (bActiveRow != null && bActiveRow(this) && hasActiveCell != null && hasActiveCell())//!hasActiveCell()
            {
                c.bInActiveRow = true;
            }


            DrawIt(c, g, x, ycor, width, height, h);
        }
 public void AddAUpperGroup(RuntimeGroup group)
 {
     _uppergroups.Add(group.Level, group);
 }