Beispiel #1
0
        public void init()
        {
            try {
                if (dataTable != null)
                {
                    dataTable.Columns.Clear();
                    treeList1.Columns.Clear();
                }
                AddFixColumn();
                Ps_pdreltype pr = new Ps_pdreltype();
                pr.ProjectID = Itop.Client.MIS.ProgUID;
                IList <Ps_pdreltype> listTypes = Services.BaseService.GetList <Ps_pdreltype>("SelectPs_pdreltypeByProjectID", pr);



                dataTable = Itop.Common.DataConverter.ToDataTable((IList)listTypes, typeof(Ps_pdreltype));
                treeList1.BeginInit();
                if (dataTable != null)
                {
                    treeList1.DataSource = dataTable;
                }


                //treeList1.Columns["Sort"].SortOrder = SortOrder.Ascending;
                treeList1.EndInit();
                Application.DoEvents();
                treeList1.ExpandAll();
            } catch (System.Exception ex) {
            }
        }
Beispiel #2
0
 //删除结点
 public void DeleteNode(TreeListNode tln)
 {
     if (tln.HasChildren)
     {
         for (int i = 0; i < tln.Nodes.Count; i++)
         {
             DeleteNode(tln.Nodes[i]);
         }
         DeleteNode(tln);
     }
     else
     {
         Ps_pdreltype pf = new Ps_pdreltype();
         pf.ID = tln["ID"].ToString();
         string nodestr = tln["Title"].ToString();
         try {
             TreeListNode node = tln.TreeList.FindNodeByKeyID(pf.ID);
             if (node != null)
             {
                 tln.TreeList.DeleteNode(node);
             }
             RemoveDataTableRow(dataTable, pf.ID);
             Ps_pdtypenode pn = new Ps_pdtypenode();
             pn.pdreltypeid = pf.ID;
             Itop.Client.Common.Services.BaseService.Update("DeletePs_pdtypepdreltypeid", pn);
             Itop.Client.Common.Services.BaseService.Delete <Ps_pdreltype>(pf);
         } catch (Exception e) {
             MessageBox.Show(e.Message + "删除结点出错!");
         }
     }
 }
Beispiel #3
0
        //private void UcPdtype_Load(object sender, EventArgs e) {
        //    init();
        //}

        private void treeList1_MouseClick(object sender, MouseEventArgs e)
        {
            if (FocusedNodeChanged != null)
            {
                if (treeList1.FocusedNode != null)
                {
                    TreeListNode tn  = treeList1.FocusedNode;
                    Ps_pdreltype pdr = new Ps_pdreltype();
                    pdr.ID = tn["ID"].ToString();
                    pdr    = Services.BaseService.GetOneByKey <Ps_pdreltype>(pdr);
                    FocusedNodeChanged(treeList1, pdr);
                }
            }
        }
Beispiel #4
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            PDreltypefrmedit PDT = new PDreltypefrmedit();

            if (PDT.ShowDialog() == DialogResult.OK)
            {
                Ps_pdreltype pdr = new Ps_pdreltype();
                pdr.ProjectID  = Itop.Client.MIS.ProgUID;
                pdr.Createtime = DateTime.Now;
                pdr.Title      = PDT.Title;
                pdr.S1         = PDT.S1;
                //pdr.PeopleSum = PDT.Peplesum;
                //pdr.AreaName = PDT.Areaname;
                //pdr.Year = PDT.Year;
                Services.BaseService.Create <Ps_pdreltype>(pdr);
                //创建电源
                Ps_pdtypenode pn = new Ps_pdtypenode();
                pn.pdreltypeid = pdr.ID;
                pn.devicetype  = "01";
                PSPDEV devzx = new PSPDEV();
                devzx.SUID = pdr.S1;
                devzx      = Services.BaseService.GetOneByKey <PSPDEV>(devzx);
                if (devzx != null)
                {
                    pn.title    = devzx.Name;
                    pn.DeviceID = devzx.SUID;
                }
                else
                {
                    pn.title = pdr.Title;
                }
                pn.Code = "0";
                Services.BaseService.Create <Ps_pdtypenode>(pn);
                dataTable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(pdr, dataTable.NewRow()));

                //init();
            }
        }
Beispiel #5
0
 void ucPdtype1_FocusedNodeChanged(object sender, Ps_pdreltype e)
 {
     ucPdtypenode1.ParentObj = e;
 }