示例#1
0
        DataRegion _ParentDataRegion; // when DataRegions are nested; the nested regions have the parent set

        #endregion Fields

        #region Constructors

        internal DataRegion(ReportDefn r, ReportLink p, XmlNode xNode)
            : base(r,p,xNode)
        {
            _KeepTogether=false;
            _NoRows=null;
            _DataSetName=null;
            _DataSetDefn=null;
            _PageBreakAtStart=false;
            _PageBreakAtEnd=false;
            _Filters=null;
        }
        IDictionary _Items; // list of report items

        #endregion Fields

        #region Constructors

        internal DataSetsDefn(ReportDefn r, ReportLink p, XmlNode xNode)
            : base(r, p)
        {
            if (xNode.ChildNodes.Count < 10)
                _Items = new ListDictionary();	// Hashtable is overkill for small lists
            else
                _Items = new Hashtable(xNode.ChildNodes.Count);

            // Loop thru all the child nodes
            foreach(XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                    continue;
                if (xNodeLoop.Name == "DataSet")
                {
                    DataSetDefn ds = new DataSetDefn(r, this, xNodeLoop);
                    if (ds != null && ds.Name != null)
                        _Items.Add(ds.Name.Nm, ds);
                }
            }
        }
示例#3
0
        Report _rpt; //    the runtime report

        #endregion Fields

        #region Constructors

        internal DataSet(Report rpt, DataSetDefn dsd)
        {
            _rpt = rpt;
            _dsd = dsd;
        }
示例#4
0
        // Handle parsing of function in final pass
        internal override void FinalPass()
        {
            base.FinalPass();

            if (this is Table)
            {   // Grids don't have any data responsibilities
                Table t = this as Table;
                if (t.IsGrid)
                    return;
            }

            // DataRegions aren't allowed in PageHeader or PageFooter;
            if (this.InPageHeaderOrFooter())
                OwnerReport.rl.LogError(8, String.Format("The DataRegion '{0}' is not allowed in a PageHeader or PageFooter", this.Name == null? "unknown": Name.Nm) );

            ResolveNestedDataRegions();

            if (_ParentDataRegion != null)		// when nested we use the dataset of the parent
            {
                _DataSetDefn = _ParentDataRegion.DataSetDefn;
            }
            else if (_DataSetName != null)
            {
                if (OwnerReport.DataSetsDefn != null)
                    _DataSetDefn = (DataSetDefn) OwnerReport.DataSetsDefn.Items[_DataSetName];
                if (_DataSetDefn == null)
                {
                    OwnerReport.rl.LogError(8, String.Format("DataSetName '{0}' not specified in DataSets list.", _DataSetName));
                }
            }
            else
            {		// No name but maybe we can default to a single Dataset
                if (_DataSetDefn == null && OwnerReport.DataSetsDefn != null &&
                    OwnerReport.DataSetsDefn.Items.Count == 1)
                {
                    foreach (DataSetDefn d in OwnerReport.DataSetsDefn.Items.Values)
                    {
                        _DataSetDefn = d;
                        break;	// since there is only 1 this will obtain it
                    }
                }
                if (_DataSetDefn == null)
                    OwnerReport.rl.LogError(8, string.Format("{0} must specify a DataSetName.",this.Name == null? "DataRegions": this.Name.Nm));
            }

            if (_NoRows != null)
                _NoRows.FinalPass();
            if (_Filters != null)
                _Filters.FinalPass();

            return;
        }
        internal override void FinalPass()
        {
            _ds = OwnerReport.DataSetsDefn[this._DataSetName];
            if (_ds == null)
                OwnerReport.rl.LogError(8, "DataSetReference refers to unknown data set '" + _DataSetName + "'");
            else
            {
                _vField = _ds.Fields[_ValueField];
                if (_vField == null)
                    OwnerReport.rl.LogError(8, "ValueField refers to unknown field '" + _ValueField + "'");
                else
                {
                    if (_LabelField == null)
                        _lField = _vField;
                    else
                    {
                        _lField = _ds.Fields[_LabelField];
                        if (_lField == null)
                            OwnerReport.rl.LogError(8, "LabelField refers to unknown field '" + _LabelField + "'");
                    }
                }
            }

            return;
        }