예제 #1
0
        /// <summary>
        /// 定额数据绑定
        /// </summary>
        private void BindDE()
        {
            DataTable table = null;

            foreach (DataRowView item in this.m_DEBH)
            {
                ComboBoxSoucer source = item["xmtz"] as ComboBoxSoucer;
                if (source != null)
                {
                    if (source.DEBH != null)
                    {
                        if (table == null)
                        {
                            table = source.DEBH.Table.Clone();
                            if (!table.Columns.Contains("ID"))
                            {
                                DataColumn col = table.Columns.Add("ID", typeof(int));
                                col.AutoIncrement     = true;
                                col.AutoIncrementSeed = 1;
                                col.AutoIncrementStep = 1;
                            }
                        }
                        DataRow row = table.NewRow();
                        row.ItemArray = source.DEBH.ItemArray;
                        table.Rows.Add(row);
                    }
                }
            }
            this.treeListEx1.CheckNodes.Clear();
            treeListEx1.DataSource = null;
            treeListEx1.DataSource = table;
            treeListEx1.ExpandAll();
        }
예제 #2
0
 private void gridView1_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
 {
     if (e.Column.Caption == "特征值")
     {
         ComboBoxSoucer soucer = e.Value as ComboBoxSoucer;
         DataRowView    drv    = this.bindingSource1.Current as DataRowView;
         if (soucer.DEBH != null)
         {
             if (soucer.DEBH["TZDEH"] != null)
             {
                 if (!string.IsNullOrEmpty(soucer.DEBH["TZDEH"].ToString()))
                 {
                     if (!DE.Contains(drv))
                     {
                         DE.Add(drv);
                     }
                 }
                 soucer.DEBH["TZMC"] = drv["TEZMC"] + ":" + soucer.TZname;
             }
         }
         drv.BeginEdit();
         drv["Remark"] = soucer.TZname;
         drv.EndEdit();
     }
     BindDE();
 }
예제 #3
0
        private void SetDefalut()
        {
            string XMTZZ = this.m_CurrQD.XMTZZ;

            if (!string.IsNullOrEmpty(XMTZZ))
            {
                string[]  Arr   = XMTZZ.Split('|');
                string[]  TZArr = Arr[0].Split(',');
                string[]  DEAyy = Arr[1].Split(',');
                DataTable dt    = this.Activitie.Property.Libraries.ListGallery.LibraryDataSet.Tables["清单特征定额表"].Copy();
                if (!dt.Columns.Contains("TZMC"))
                {
                    dt.Columns.Add("TZMC");
                }
                for (int i = 0; i < TZArr.Length; i++)
                {
                    DataRowView    v  = this.bindingSource1[i] as DataRowView;
                    ComboBoxSoucer cm = new ComboBoxSoucer();
                    cm.TZname = TZArr[i];
                    //cm.DEBH="1-1";
                    v["xmtz"] = cm;
                    if (TZArr[i] != "")
                    {
                        string   TZZ    = v["TEZZ"].ToString();
                        string[] ArrTZZ = TZZ.Split('|');
                        string   deh    = string.Empty;

                        for (int j = 0; j < ArrTZZ.Length; j++)
                        {
                            if (ArrTZZ[j].Contains(TZArr[i]))
                            {
                                deh = ArrTZZ[j].Split(',')[1];
                                break;
                            }
                        }

                        DataRow[] rows = dt.Select(string.Format("TZDEH='{0}' and TZZ='{1}'", deh, TZArr[i]));
                        if (rows.Length > 0)
                        {
                            cm.DEBH = rows[0];

                            if (cm.DEBH["TZDEH"] != null)
                            {
                                if (!string.IsNullOrEmpty(cm.DEBH["TZDEH"].ToString()))
                                {
                                    if (!DE.Contains(v))
                                    {
                                        DE.Add(v);
                                    }
                                }
                                cm.DEBH["TZMC"] = v["TEZMC"] + ":" + cm.TZname;
                            }
                        }
                    }
                }
                BindDE();
                foreach (var item in DEAyy)
                {
                    foreach (TreeListNode node in this.treeListEx1.Nodes)
                    {
                        if (node.GetValue("TZDEH").ToString() == item)
                        {
                            node.Checked = true;
                        }
                    }
                }
            }
        }