ValidValues _ValidValues; // Possible values for the parameter (for an

        #endregion Fields

        #region Constructors

        //    Indicates whether or not the parameter is
        //    used in a query in the report. This is
        //    needed to determine if the queries need
        //    to be re-executed if the parameter
        //    changes. Auto indicates the
        //    UsedInQuery setting should be
        //    autodetected as follows: True if the
        //    parameter is referenced in any query
        //    value expression.
        internal ReportParameter(ReportDefn r, ReportLink p, XmlNode xNode)
            : base(r, p)
        {
            _Name=null;
            _dt = TypeCode.Object;
            _Nullable = false;
            _DefaultValue=null;
            _AllowBlank=false;
            _Prompt=null;
            _ValidValues=null;
            _UsedInQuery = TrueFalseAutoEnum.Auto;
            // Run thru the attributes
            foreach(XmlAttribute xAttr in xNode.Attributes)
            {
                switch (xAttr.Name)
                {
                    case "Name":
                        _Name = new Name(xAttr.Value);
                        break;
                }
            }
            // Loop thru all the child nodes
            foreach(XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                    continue;
                switch (xNodeLoop.Name)
                {
                    case "DataType":
                        _dt = DataType.GetStyle(xNodeLoop.InnerText, this.OwnerReport);
                        _NumericType = DataType.IsNumeric(_dt);
                        break;
                    case "Nullable":
                        _Nullable = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                        break;
                    case "DefaultValue":
                        _DefaultValue = new DefaultValue(r, this, xNodeLoop);
                        break;
                    case "AllowBlank":
                        _AllowBlank = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                        break;
                    case "Prompt":
                        _Prompt = xNodeLoop.InnerText;
                        break;
                    case "Hidden":
                        _Hidden = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                        OwnerReport.rl.LogError(4, "ReportParameter element Hidden is currently ignored.");	// TODO
                        break;
                    case "MultiValue":
                        _MultiValue = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                        break;
                    case "ValidValues":
                        _ValidValues = new ValidValues(r, this, xNodeLoop);
                        break;
                    case "UsedInQuery":
                        _UsedInQuery = TrueFalseAuto.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                        break;
                    default:
                        // don't know this element - log it
                        OwnerReport.rl.LogError(4, "Unknown ReportParameter element '" + xNodeLoop.Name + "' ignored.");
                        break;
                }
            }
            if (_Name == null)
                OwnerReport.rl.LogError(8, "ReportParameter name is required but not specified.");

            if (_dt == TypeCode.Object)
                OwnerReport.rl.LogError(8, string.Format("ReportParameter DataType is required but not specified or invalid for {0}.", _Name==null? "<unknown name>": _Name.Nm));
        }
Example #2
0
        TrueFalseAutoEnum _UsedInQuery;   // Enum True | False | Auto (default)
        //	Indicates whether or not the parameter is
        //	used in a query in the report. This is
        //	needed to determine if the queries need
        //	to be re-executed if the parameter
        //	changes. Auto indicates the
        //	UsedInQuery setting should be
        //	autodetected as follows: True if the
        //	parameter is referenced in any query
        //	value expression.

        internal ReportParameter(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p)
        {
            _Name         = null;
            _dt           = TypeCode.Object;
            _Nullable     = true;
            _DefaultValue = null;
            _AllowBlank   = true;
            _Prompt       = null;
            _ValidValues  = null;
            _UsedInQuery  = TrueFalseAutoEnum.Auto;
            // Run thru the attributes
            foreach (XmlAttribute xAttr in xNode.Attributes)
            {
                switch (xAttr.Name)
                {
                case "Name":
                    _Name = new Name(xAttr.Value);
                    break;
                }
            }
            // Loop thru all the child nodes
            foreach (XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                {
                    continue;
                }
                switch (xNodeLoop.Name)
                {
                case "DataType":
                    _dt          = DataType.GetStyle(xNodeLoop.InnerText, this.OwnerReport);
                    _NumericType = DataType.IsNumeric(_dt);
                    break;

                case "Nullable":
                    _Nullable = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                case "DefaultValue":
                    _DefaultValue = new DefaultValue(r, this, xNodeLoop);
                    break;

                case "AllowBlank":
                    _AllowBlank = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                case "Prompt":
                    _Prompt = xNodeLoop.InnerText;
                    break;

                case "Hidden":
                    _Hidden = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                    OwnerReport.rl.LogError(4, "ReportParameter element Hidden is currently ignored.");                                 // TODO
                    break;

                case "MultiValue":
                    _MultiValue = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                case "ValidValues":
                    _ValidValues = new ValidValues(r, this, xNodeLoop);
                    break;

                case "UsedInQuery":
                    _UsedInQuery = TrueFalseAuto.GetStyle(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

                default:
                    // don't know this element - log it
                    OwnerReport.rl.LogError(4, "Unknown ReportParameter element '" + xNodeLoop.Name + "' ignored.");
                    break;
                }
            }
            if (_Name == null)
            {
                OwnerReport.rl.LogError(8, "ReportParameter name is required but not specified.");
            }

            if (_dt == TypeCode.Object)
            {
                OwnerReport.rl.LogError(8, string.Format("ReportParameter DataType is required but not specified or invalid for {0}.", _Name == null? "<unknown name>": _Name.Nm));
            }
        }