예제 #1
0
        protected override void OnInitialized(EventArgs e)
        {
            base.OnInitialized(e);


            CommonClient oDMCommon = new CommonClient();
            DataTable    dt        = oDMCommon.GetDataTable("SELECT * FROM AdmnLayoutLists WHERE ID=" + FeatureID, CompanyDBIndex.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;
            DataGridTextColumn dgCol;

            dgCol            = new 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 DataGridTextColumn();
                dgCol.Header  = oCol.Label;
                dgCol.Width   = oCol.Width;
                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;
        }
예제 #2
0
 public static Field FromXml(string Xml)
 {
     return((Field)(PACTSerializer.FromXml(Xml, typeof(Field))));
 }