Ejemplo n.º 1
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     = 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 = Conversion.ToBoolean(xNodeLoop.InnerText, OwnerReport.rl);
                    break;

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

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

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

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

                case "MultiValue":
                    _MultiValue = Conversion.ToBoolean(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));
            }
        }
Ejemplo n.º 2
0
        List <Textbox> _HideDuplicates; // holds any textboxes that use this as a hideduplicate scope

        internal DataSetDefn(ReportDefn r, ReportLink p, XmlNode xNode)
            : base(r, p)
        {
            _Name                = null;
            _Fields              = null;
            _Query               = null;
            _CaseSensitivity     = TrueFalseAutoEnum.True;
            _Collation           = null;
            _AccentSensitivity   = TrueFalseAutoEnum.False;
            _KanatypeSensitivity = TrueFalseAutoEnum.False;
            _WidthSensitivity    = TrueFalseAutoEnum.False;
            _Filters             = null;
            _HideDuplicates      = null;
            // 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 "Fields":
                    _Fields = new Fields(r, this, xNodeLoop);
                    break;

                case "Query":
                    _Query = new Query(r, this, xNodeLoop);
                    break;

                case "Rows":            // Extension !!!!!!!!!!!!!!!!!!!!!!!
                case "fyi:Rows":
                    _XmlRowData = "<?xml version='1.0' encoding='UTF-8'?><Rows>" + xNodeLoop.InnerXml + "</Rows>";
                    foreach (XmlAttribute xA in xNodeLoop.Attributes)
                    {
                        if (xA.Name == "File")
                        {
                            _XmlRowFile = xA.Value;
                        }
                    }
                    break;

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

                case "Collation":
                    _Collation = xNodeLoop.InnerText;
                    break;

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

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

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

                case "Filters":
                    _Filters = new Filters(r, this, xNodeLoop);
                    break;

                default:
                    OwnerReport.rl.LogError(4, "Unknown DataSet element '" + xNodeLoop.Name + "' ignored.");
                    break;
                }
            }
            if (this.Name != null)
            {
                OwnerReport.LUAggrScope.Add(this.Name.Nm, this);                // add to referenceable TextBoxes
            }
            else
            {
                OwnerReport.rl.LogError(4, "Name attribute must be specified in a DataSet.");
            }

            if (_Query == null)
            {
                OwnerReport.rl.LogError(8, "Query element must be specified in a DataSet.");
            }
        }