Esempio n. 1
0
 public virtual object this[string name]
 {
     get
     {
         if (name.ToLower() == "emptycolumn")
         {
             return("");
         }
         if (_data.Contains(name))
         {
             return(_data[name]);
         }
         else if (_reader != null)
         {
             return(_reader[name]);
         }
         else
         {
             return("");
         }
     }
     set
     {
         _data.Add(name, value);
     }
 }
Esempio n. 2
0
 private object GetAValue(SimpleHashtable hash, string key)
 {
     if (hash != null && hash.Contains(key))
     {
         return(hash[key]);
     }
     return(null);
 }
Esempio n. 3
0
 public void RefreshDrillTag(Row row)
 {
     foreach (Cell cell in row.Cells)
     {
         if (_cellnametocolumnname.Contains(cell.Name))
         {
             _drilltag.Add(_cellnametocolumnname[cell.Name].ToString(), cell.Caption);
         }
     }
 }
 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);
     }
 }
        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
        }