Example #1
0
 public RowData(RowData rd) : this()
 {
     foreach (string key in rd.Keys)
     {
         _data.Add(key, rd[key]);
     }
 }
 protected void CreateNameToColumnMap()
 {
     _cellnametocolumnname = new SimpleHashtable();
     foreach (Section section in _currentreport.Sections)
     {
         if (section is GroupHeader)
         {
             foreach (Cell cell in section.Cells)
             {
                 if (cell is IGroup)
                 {
                     _cellnametocolumnname.Add(cell.Name, (cell as IMapName).MapName);
                 }
             }
         }
         else if (section is Detail)
         {
             foreach (Cell cell in section.Cells)
             {
                 if (cell is GroupDimension || cell is CalculateGroupDimension)
                 {
                     _cellnametocolumnname.Add(cell.Name, (cell as IMapName).MapName);
                 }
             }
         }
     }
 }
        public void OpenChartWizard(Chart chart)
        {
            ChartService _chartservice = null;
            string       id            = null;

            if (chart.Report.Type == ReportType.IndicatorReport)
            {
                id = "IndicatorChart";
                Hashtable       ctn = new Hashtable();
                SimpleHashtable sht = new SimpleHashtable();
                if (!string.IsNullOrEmpty(chart.DataSource))
                {
                    Section          indicatordetail = chart.Report.Sections[SectionType.IndicatorDetail];
                    IIndicatorMetrix metrix          = indicatordetail.Cells[chart.DataSource] as IIndicatorMetrix;
                    if (metrix == null)
                    {
                        throw new Exception("非法图表数据源矩阵");
                    }

                    sht.Add("__bcross__", metrix.CrossPart != null);
                    if (metrix.IndicatorParts != null)
                    {
                        foreach (IPart indi in metrix.IndicatorParts)
                        {
                            sht.Add((indi as Cell).Caption, (indi as Cell).Name);
                        }
                    }
                }
                else
                {
                    sht.Add("__bcross__", false);
                }
                ctn.Add(chart.Level, sht);
                _chartservice = new IndicatorChartService(chart.Report, ctn);
            }
            else
            {
                _chartservice = new ChartService(chart.Report);
            }

            ChartWizardAdapter _wizardadapter = new ChartWizardAdapter(_chartservice);

            if (_wizardadapter.ChartWizard.ShowDialog(_chartservice.GetSchemasAllLevel(chart.Level), chart.Level, id) == DialogResult.OK)
            {
                RemoteDataHelper rdh = DefaultConfigs.GetRemoteHelper();
                rdh.SaveChartStrings(ClientReportContext.Login.UfMetaCnnString, chart.Report.ViewID, chart.Report.ChartStrings);
            }
            else
            {
                chart.Report.ChartStrings = null;
            }
            chart.ChartWizard = null;
        }
Example #4
0
 public void AddData(string key, object value)
 {
     if (_getdatas == null)
     {
         _getdatas = new SimpleHashtable();
     }
     _getdatas.Add(key, value);
 }
 private void AddATableColumn(string columnname, object source, Type type, string designcaption, string designname)
 {
     if (!_captiontoname.Contains(columnname))
     {
         _currenttable.Columns.Add(new DataColumn(columnname, type));
         _captiontoname.Add(columnname, source);
     }
     if (designcaption != null && !_designcaptiontodesignname.Contains(designcaption))
     {
         _designcaptiontodesignname.Add(designcaption, designname);
     }
 }
        private void CreateDataTable(Section pagetitle)//from pagetitle,designcaption=null, to be x; ____ to be none; a___b to be two new columns; others to be a new column
        {
            _captiontoname             = new SimpleHashtable();
            _designcaptiontodesignname = new SimpleHashtable();
            _designcaptiontodesignname.Add("__bcross__", _currentreport.Type == ReportType.CrossReport);
            _currenttable = new DataTable((_currentmetrix as Cell).Name);
            AddATableColumn("X", new SimpleArrayList(), typeof(string), null, null);
            _data.Tables.Add(_currenttable);

            foreach (Cell cell in pagetitle.Cells)
            {
                if (cell is Label)
                {
                    Label l = cell as Label;
                    if (l.DesignCaption != "____")
                    {
                        if (l is SuperLabel)
                        {
                            foreach (Label sl in (l as SuperLabel).Labels)
                            {
                                if (!string.IsNullOrEmpty(sl.DesignCaption) && sl.DesignCaption != "____")
                                {
                                    AddATableColumn(l.Caption + "____" + sl.Caption, sl.Name, typeof(decimal), sl.Caption, sl.DesignName);
                                }
                                //AddATableColumn(l.DesignCaption + "____" + sl.DesignCaption, sl.Name, typeof(decimal), sl.DesignCaption, sl.DesignName);
                            }
                        }
                        else if (string.IsNullOrEmpty(l.DesignCaption))//x
                        {
                            SimpleArrayList sal = _captiontoname["X"] as SimpleArrayList;
                            sal.Add(l.Name);
                        }
                        else
                        {
                            AddATableColumn(l.Caption, l.Name, typeof(decimal), l.Caption, l.DesignName);
                            //AddATableColumn(l.DesignCaption, l.Name, typeof(decimal), l.DesignCaption, l.DesignName);
                        }
                    }
                }
            }
        }
Example #7
0
 private void AppendFrom(Section section, SemiRow semirow, ShowStyle showstyle, string baseid, System.Drawing.Graphics g)
 {
     if (section == null || (_nogroupheader && section.Type == "GroupHeader"))
     {
         return;
     }
     foreach (SectionLine sl in section.SectionLines)
     {
         if (sl.Cells.Count > 0)
         {
             if (section is GroupHeader)
             {
                 GroupHeaderRow row = new GroupHeaderRow(sl, semirow, g);
                 SetRowState(showstyle, row);
                 _parentrows.Add(row.Level.ToString(), row);
                 if (row.Level > 1)
                 {
                     row.ParentRow = _parentrows[Convert.ToString(row.Level - 1)] as GroupHeaderRow;
                 }
                 Add(row);
             }
             else if (section is GroupSummary)
             {
                 GroupRow row = new GroupRow(sl, semirow, g);
                 SetRowState(showstyle, row);
                 row.ParentRow = _parentrows[Convert.ToString(row.Level)] as GroupHeaderRow;
                 Add(row);
             }
             else
             {
                 Row row = new Row(sl, semirow, baseid, g);
                 SetRowState(showstyle, row);
                 row.ParentRow = _parentrows[Convert.ToString(row.Level - 1)] as GroupHeaderRow;
                 Add(row);
             }
         }
     }
 }
        public void FillFrom(Report report)
        {
            if (_report != null)
            {
                _report.BaseTable = report.BaseTable;
            }
            _grouplevels = report.GroupLevels;
            if (!string.IsNullOrEmpty(report.BaseTable))
            {
                _tablenamecollection.Add(report.BaseTable);
                if (!_levelcollection.Contains(report.BaseTable) || _grouplevels > (int)_levelcollection[report.BaseTable])
                {
                    _levelcollection.Add(report.BaseTable, _grouplevels);
                }
            }
            if (!string.IsNullOrEmpty(report.RawTable))
            {
                _tablenamecollection.Add(report.RawTable);
            }
            if (!string.IsNullOrEmpty(report.CrossTable))
            {
                _tablenamecollection.Add(report.CrossTable);
            }

            if (report.bFromCache)
            {
                if (report.bPageByGroup)
                {
                    _pages = report.RowsCount == 0 ? 1 : report.RowsCount;
                }
                else
                {
                    _pages = report.PageRecords == 0 ? 1 : (report.RowsCount / report.PageRecords + (report.RowsCount % report.PageRecords == 0 ? 0 : 1));
                }
                _report.RowsCount   = report.RowsCount;
                _report.GroupsCount = report.GroupsCount;
                return;
            }

            if (_report != null)
            {
                _report.Dispose();
                _report = null;
            }
            _report = report;
            _type   = _report.Type;

            if (string.IsNullOrEmpty(_viewid))
            {
                _viewid = _report.ViewID;
            }
            if (!string.IsNullOrEmpty(_colorid))
            {
                _report.ColorStyleID = _colorid;
            }
            if (_showstyle == ShowStyle.None)
            {
                if (!_report.bNoneCross && _report.CurrentCrossSchema != null)
                {
                    if (_report.CurrentCrossSchema.CrossRowGroup != null)
                    {
                        _showstyle = _report.CurrentCrossSchema.CrossRowGroup.ShowStyle;
                    }
                    else
                    {
                        _showstyle = _report.CurrentCrossSchema.ShowStyle; //为了升级兼容
                    }
                }
                else
                {
                    _showstyle = _report.CurrentSchema.ShowStyle;
                }
            }

            //自由报表合并单元格--2
            //if (_type == ReportType.FreeReport)
            //    _report.CurrentSchema.ShowStyle = (_report.FreeViewStyle == FreeViewStyle.MergeCell ? ShowStyle.NoGroupHeader : ShowStyle.Normal);

            _bshowdetail = report.bShowDetail;

            _pageindex = 0;
            if (_report.bPageByGroup)
            {
                _pages = _report.RowsCount == 0 ? 1 : _report.RowsCount;
            }
            else
            {
                _pages = _report.PageRecords == 0?1:(_report.RowsCount / _report.PageRecords + (_report.RowsCount % _report.PageRecords == 0 ? 0 : 1));
            }

            if (_report.bIndicator)
            {
                return;
            }

            using (Graphics g = Row.CreateGraphics())
            {
                _report.TransformFromInchOfHandredToPixel(g);
            }

            foreach (Section section in report.Sections)
            {
                section.Cells.SetSuper();
            }

            #region RedrawReportHeader
            Section header = _report.Sections[SectionType.ReportHeader];
            if (header != null)
            {
                foreach (Cell cell in header.Cells)
                {
                    if (cell is Expression && cell.Visible)
                    {
                        if ((cell as Expression).Formula.FormulaExpression == "Page()" ||
                            (cell as Expression).Formula.FormulaExpression == "Pages()")
                        {
                            _dynamiccontentonheader = true;
                            if (_report.ReportHeaderOption != ReportHeaderPrintOption.NotPint)
                            {
                                _report.ReportHeaderOption = ReportHeaderPrintOption.EveryPage;
                            }
                        }
                    }
                }
            }
            #endregion
        }
 public void Add(string columnname, object value)
 {
     _data.Add(columnname, value);
 }