예제 #1
0
        internal QueryParametersCtl(DesignXmlDraw dxDraw, DataSetValues dsv)
        {
            _Draw = dxDraw;
            _dsv  = dsv;
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            // Initialize form using the style node values
            InitValues();
        }
		internal QueryParametersCtl(DesignXmlDraw dxDraw, DataSetValues dsv)
		{
			_Draw = dxDraw;
			_dsv = dsv;
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			// Initialize form using the style node values
			InitValues();			
		}
예제 #3
0
        internal DataSetRowsCtl(DesignXmlDraw dxDraw, XmlNode dsNode, DataSetValues dsv)
        {
            _Draw   = dxDraw;
            _dsv    = dsv;
            _dsNode = dsNode;
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            // Initialize form using the style node values
            InitValues();
        }
		internal DataSetRowsCtl(DesignXmlDraw dxDraw, XmlNode dsNode, DataSetValues dsv)
		{
			_Draw = dxDraw;
			_dsv = dsv;
			_dsNode = dsNode;
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			// Initialize form using the style node values
			InitValues();			
		}
예제 #5
0
        private void InitValues()
        {
            // Initialize the DataGrid columns
            DataGridTextBoxColumn dgtbName      = new DataGridTextBoxColumn();
            DataGridTextBoxColumn dgtbQueryName = new DataGridTextBoxColumn();
            DataGridTextBoxColumn dgtbValue     = new DataGridTextBoxColumn();
            DataGridTextBoxColumn dgtbTypeName  = new DataGridTextBoxColumn();

            this.dataGridTableStyle1.GridColumnStyles.AddRange(new DataGridColumnStyle[] {
                dgtbName,
                dgtbQueryName,
                dgtbValue,
                dgtbTypeName
            });
            // dgtbName
            dgtbName.Format      = "";
            dgtbName.FormatInfo  = null;
            dgtbName.HeaderText  = "Name";
            dgtbName.MappingName = "Name";
            dgtbName.Width       = 75;

            // dgtbQueryName
            dgtbQueryName.Format      = "";
            dgtbQueryName.FormatInfo  = null;
            dgtbQueryName.HeaderText  = "Query Column Name";
            dgtbQueryName.MappingName = "QueryName";
            dgtbQueryName.Width       = 80;

            // dgtbValue
            //
            dgtbValue.Format      = "";
            dgtbValue.FormatInfo  = null;
            dgtbValue.HeaderText  = "Value";
            dgtbValue.MappingName = "Value";
            dgtbValue.Width       = 175;

            // dgtbTypeName
            dgtbTypeName.Format      = "";
            dgtbTypeName.FormatInfo  = null;
            dgtbTypeName.HeaderText  = "TypeName";
            dgtbTypeName.MappingName = "TypeName";
            dgtbTypeName.Width       = 150;

            // cbDataSource
            cbDataSource.Items.AddRange(_Draw.DataSourceNames);

            //
            // Obtain the existing DataSet info
            //
            XmlNode      dNode = this._dsNode;
            XmlAttribute nAttr = dNode.Attributes["Name"];

            _dsv      = new DataSetValues(nAttr == null? "": nAttr.Value);
            _dsv.Node = dNode;

            XmlNode ctNode = DesignXmlDraw.FindNextInHierarchy(dNode, "Query", "CommandText");

            _dsv.CommandText = ctNode == null? "": ctNode.InnerText;

            XmlNode datasource = DesignXmlDraw.FindNextInHierarchy(dNode, "Query", "DataSourceName");

            _dsv.DataSourceName = datasource == null? "": datasource.InnerText;

            XmlNode timeout = DesignXmlDraw.FindNextInHierarchy(dNode, "Query", "Timeout");

            try
            {
                _dsv.Timeout = timeout == null? 0: Convert.ToInt32(timeout.InnerText);
            }
            catch                       // we don't stop just because timeout isn't convertable
            {
                _dsv.Timeout = 0;
            }

            // Get QueryParameters; they are loaded here but used by the QueryParametersCtl
            _dsv.QueryParameters = new DataTable();
            _dsv.QueryParameters.Columns.Add(new DataColumn("Name", typeof(string)));
            _dsv.QueryParameters.Columns.Add(new DataColumn("Value", typeof(string)));
            XmlNode qpNode = DesignXmlDraw.FindNextInHierarchy(dNode, "Query", "QueryParameters");

            if (qpNode != null)
            {
                string[] rowValues = new string[2];
                foreach (XmlNode qNode in qpNode.ChildNodes)
                {
                    if (qNode.Name != "QueryParameter")
                    {
                        continue;
                    }
                    XmlAttribute xAttr = qNode.Attributes["Name"];
                    if (xAttr == null)
                    {
                        continue;
                    }
                    rowValues[0] = xAttr.Value;
                    rowValues[1] = _Draw.GetElementValue(qNode, "Value", "");
                    _dsv.QueryParameters.Rows.Add(rowValues);
                }
            }

            // Get Fields
            _dsv.Fields = new DataTable();
            _dsv.Fields.Columns.Add(new DataColumn("Name", typeof(string)));
            _dsv.Fields.Columns.Add(new DataColumn("QueryName", typeof(string)));
            _dsv.Fields.Columns.Add(new DataColumn("Value", typeof(string)));
            _dsv.Fields.Columns.Add(new DataColumn("TypeName", typeof(string)));

            XmlNode fsNode = _Draw.GetNamedChildNode(dNode, "Fields");

            if (fsNode != null)
            {
                string[] rowValues = new string[4];
                foreach (XmlNode fNode in fsNode.ChildNodes)
                {
                    if (fNode.Name != "Field")
                    {
                        continue;
                    }
                    XmlAttribute xAttr = fNode.Attributes["Name"];
                    if (xAttr == null)
                    {
                        continue;
                    }
                    rowValues[0] = xAttr.Value;
                    rowValues[1] = _Draw.GetElementValue(fNode, "DataField", "");
                    rowValues[2] = _Draw.GetElementValue(fNode, "Value", "");
                    string typename = null;
                    typename = _Draw.GetElementValue(fNode, "TypeName", null);
                    if (typename == null)
                    {
                        typename = _Draw.GetElementValue(fNode, "rd:TypeName", null);
                        if (typename != null)
                        {
                            _UseTypenameQualified = true;                               // we got it qualified so we'll generate qualified
                        }
                    }
                    rowValues[3] = typename == null?"":typename;

                    _dsv.Fields.Rows.Add(rowValues);
                }
            }
            this.tbDSName.Text     = _dsv.Name;
            this.tbSQL.Text        = _dsv.CommandText;
            this.cbDataSource.Text = _dsv.DataSourceName;
            dgFields.DataSource    = _dsv.Fields;
        }
		private void InitValues()
		{
			// Initialize the DataGrid columns
			DataGridTextBoxColumn dgtbName = new DataGridTextBoxColumn();
			DataGridTextBoxColumn dgtbQueryName = new DataGridTextBoxColumn();
			DataGridTextBoxColumn dgtbValue = new DataGridTextBoxColumn();
			DataGridTextBoxColumn dgtbTypeName = new DataGridTextBoxColumn();

			this.dataGridTableStyle1.GridColumnStyles.AddRange(new DataGridColumnStyle[] {
																					  dgtbName,
																					  dgtbQueryName,
																					  dgtbValue,
																					  dgtbTypeName});
			// dgtbName
			dgtbName.Format = "";
			dgtbName.FormatInfo = null;
			dgtbName.HeaderText = "Name";
			dgtbName.MappingName = "Name";
			dgtbName.Width = 75;

			// dgtbQueryName
			dgtbQueryName.Format = "";
			dgtbQueryName.FormatInfo = null;
			dgtbQueryName.HeaderText = "Query Column Name";
			dgtbQueryName.MappingName = "QueryName";
			dgtbQueryName.Width = 80;

			// dgtbValue
			// 
			dgtbValue.Format = "";
			dgtbValue.FormatInfo = null;
			dgtbValue.HeaderText = "Value";
			dgtbValue.MappingName = "Value";
			dgtbValue.Width = 175;

			// dgtbTypeName
			dgtbTypeName.Format = "";
			dgtbTypeName.FormatInfo = null;
			dgtbTypeName.HeaderText = "TypeName";
			dgtbTypeName.MappingName = "TypeName";
			dgtbTypeName.Width = 150;

			// cbDataSource
			cbDataSource.Items.AddRange(_Draw.DataSourceNames);

			//
			// Obtain the existing DataSet info
			//
			XmlNode dNode = this._dsNode;
			XmlAttribute nAttr = dNode.Attributes["Name"];

			_dsv = new DataSetValues(nAttr == null? "": nAttr.Value);
			_dsv.Node = dNode;
				
			XmlNode ctNode = DesignXmlDraw.FindNextInHierarchy(dNode, "Query", "CommandText");
			_dsv.CommandText = ctNode == null? "": ctNode.InnerText;
				
			XmlNode datasource = DesignXmlDraw.FindNextInHierarchy(dNode, "Query", "DataSourceName");
			_dsv.DataSourceName = datasource == null? "": datasource.InnerText;

			XmlNode timeout = DesignXmlDraw.FindNextInHierarchy(dNode, "Query", "Timeout");
			try
			{
				_dsv.Timeout = timeout == null? 0: Convert.ToInt32(timeout.InnerText);
			}
			catch		// we don't stop just because timeout isn't convertable
			{
				_dsv.Timeout = 0;
			}

			// Get QueryParameters; they are loaded here but used by the QueryParametersCtl
			_dsv.QueryParameters = new DataTable();
			_dsv.QueryParameters.Columns.Add(new DataColumn("Name", typeof(string)));
			_dsv.QueryParameters.Columns.Add(new DataColumn("Value", typeof(string)));
			XmlNode qpNode = DesignXmlDraw.FindNextInHierarchy(dNode, "Query", "QueryParameters");
			if (qpNode != null)
			{
				string[] rowValues = new string[2];
				foreach (XmlNode qNode in qpNode.ChildNodes)
				{
					if (qNode.Name != "QueryParameter")
						continue;
					XmlAttribute xAttr = qNode.Attributes["Name"];
					if (xAttr == null)
						continue;
					rowValues[0] = xAttr.Value;
					rowValues[1] = _Draw.GetElementValue(qNode, "Value", "");
					_dsv.QueryParameters.Rows.Add(rowValues);
				}
			}

			// Get Fields
			_dsv.Fields = new DataTable();
			_dsv.Fields.Columns.Add(new DataColumn("Name", typeof(string)));
			_dsv.Fields.Columns.Add(new DataColumn("QueryName", typeof(string)));
			_dsv.Fields.Columns.Add(new DataColumn("Value", typeof(string)));
			_dsv.Fields.Columns.Add(new DataColumn("TypeName", typeof(string)));

			XmlNode fsNode = _Draw.GetNamedChildNode(dNode, "Fields");
			if (fsNode != null)
			{
				string[] rowValues = new string[4];
				foreach (XmlNode fNode in fsNode.ChildNodes)
				{
					if (fNode.Name != "Field")
						continue;
					XmlAttribute xAttr = fNode.Attributes["Name"];
					if (xAttr == null)
						continue;
					rowValues[0] = xAttr.Value;
					rowValues[1] = _Draw.GetElementValue(fNode, "DataField", "");
					rowValues[2] = _Draw.GetElementValue(fNode, "Value", "");
					string typename=null;
					typename = _Draw.GetElementValue(fNode, "TypeName", null);
					if (typename == null)
					{
						typename = _Draw.GetElementValue(fNode, "rd:TypeName", null);
						if (typename != null)
							_UseTypenameQualified = true;	// we got it qualified so we'll generate qualified
					}
					rowValues[3] = typename==null?"":typename;

					_dsv.Fields.Rows.Add(rowValues);
				}
			}
			this.tbDSName.Text = _dsv.Name;
			this.tbSQL.Text = _dsv.CommandText;
			this.cbDataSource.Text = _dsv.DataSourceName;
			dgFields.DataSource = _dsv.Fields;
		}