Beispiel #1
0
 /// <summary>
 /// Creates a new <see cref="PACTRequest" />
 /// object from an XML string.
 /// </summary>
 /// <param name="Xml">
 /// XML string to create the object from.</param>
 /// <returns>
 /// A <see cref="PACTRequest" /> object.
 /// </returns>
 public static TreeColumn FromXml(string Xml)
 {
     return((TreeColumn)(PACTSerializer.FromXml(Xml, typeof(TreeColumn))));
 }
Beispiel #2
0
        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);

            if (GetFeatureID(this) == 0)
            {
                return;
            }

            CommonClient oDMCommon = new CommonClient();
            DataTable    dt        = oDMCommon.GetDataTable("SELECT * FROM AdmnLayoutLists WHERE ID=" + GetFeatureID(this).ToString(), GetCompanyDBIndex(this).ToString());

            oDMCommon.Close();
            strTable      = dt.Rows[0]["TableName"].ToString();
            strPrimaryKey = dt.Rows[0]["PrimaryKey"].ToString();
            _Where        = dt.Rows[0]["WhereClause"].ToString();

            XmlDocument xDoc = new XmlDocument();

            xDoc.LoadXml(dt.Rows[0]["LayoutXML"].ToString());

            XmlNodeList xList = xDoc.SelectNodes("XML/Columns/TreeColumn");
            TreeColumn  oCol;

            oColumns = new List <TreeColumn>();

            _Query = "SELECT " + strPrimaryKey;

            this.IsEditable = true;
            Microsoft.Windows.Controls.DataGridTextColumn dgCol;

            dgCol            = new Microsoft.Windows.Controls.DataGridTextColumn();
            dgCol.Header     = strPrimaryKey;
            dgCol.Binding    = new Binding(strPrimaryKey);
            dgCol.Visibility = System.Windows.Visibility.Hidden;
            this.Columns.Add(dgCol);


            for (int i = 0; i < xList.Count; i++)
            {
                oCol    = (TreeColumn)PACTSerializer.FromXml(xList[i].OuterXml, typeof(TreeColumn));
                _Query += "," + oCol.Name;

                dgCol        = new Microsoft.Windows.Controls.DataGridTextColumn();
                dgCol.Header = oCol.Label;

                if (xList.Count == 1)
                {
                    if (this.Width > 0)
                    {
                        dgCol.Width = this.Width;
                    }
                    else
                    {
                        dgCol.Width = oCol.Width;
                    }
                }
                else
                {
                    dgCol.Width = oCol.Width;
                }

                dgCol.CanUserResize = false;
                dgCol.CanUserSort   = false;
                dgCol.Binding       = new Binding(oCol.Name);
                iWidth += oCol.Width;
                this.Columns.Add(dgCol);
                oColumns.Add(oCol);
            }

            _Query += " FROM " + strTable;

            if (this.SelectedValue != null)
            {
                valueSelected = true;
            }

            //this.SelectedValue = new Binding(strPrimaryKey);
            this.SelectedValuePath = strPrimaryKey;
        }