Esempio n. 1
0
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
            {
                return;
            }
            TreeListNode tn = treeList1.FocusedNode;

            DataRow[]        dr  = dataTable.Select("ID='" + tn["ID"].ToString() + "'");
            PDreltypefrmedit PDT = new PDreltypefrmedit();

            if (dr[0] != null)
            {
                PDT.Pdtype = Itop.Common.DataConverter.RowToObject <Ps_pdreltype>(dr[0]);
            }
            if (PDT.ShowDialog() == DialogResult.OK)
            {
                Services.BaseService.Update <Ps_pdreltype>(PDT.Pdtype);
                treeList1.FocusedNode.SetValue("Title", PDT.Title);
                IList <Ps_pdtypenode> list1 = Services.BaseService.GetList <Ps_pdtypenode>("SelectPs_pdtypenodeByCon", "pdreltypeid='" + PDT.Pdtype.ID + "'and devicetype='01'");
                if (list1.Count > 0)
                {
                    Ps_pdtypenode pn    = list1[0];
                    PSPDEV        devzx = new PSPDEV();
                    devzx.SUID = PDT.Pdtype.S1;
                    devzx      = Services.BaseService.GetOneByKey <PSPDEV>(devzx);
                    if (devzx != null)
                    {
                        pn.title    = devzx.Name;
                        pn.DeviceID = devzx.SUID;
                    }
                    else
                    {
                        pn.title = PDT.Pdtype.Title;
                    }
                    Services.BaseService.Create <Ps_pdtypenode>(pn);
                }
            }
        }
Esempio n. 2
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();
            }
        }
Esempio n. 3
0
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (treeList1.FocusedNode == null)
                return;
              TreeListNode tn=treeList1.FocusedNode;
            DataRow[] dr=dataTable.Select("ID='"+tn["ID"].ToString()+"'");
            PDreltypefrmedit PDT = new PDreltypefrmedit();
            if (dr[0]!=null)
            {
                PDT.Pdtype = Itop.Common.DataConverter.RowToObject<Ps_pdreltype>(dr[0]);
            }
            if (PDT.ShowDialog() == DialogResult.OK) {

                Services.BaseService.Update<Ps_pdreltype>(PDT.Pdtype);
                treeList1.FocusedNode.SetValue("Title", PDT.Title);
                  IList<Ps_pdtypenode>  list1 = Services.BaseService.GetList<Ps_pdtypenode>("SelectPs_pdtypenodeByCon", "pdreltypeid='" + PDT.Pdtype.ID+ "'and devicetype='01'");
               if (list1.Count>0)
               {
                   Ps_pdtypenode pn = list1[0];
                   PSPDEV devzx = new PSPDEV();
                   devzx.SUID = PDT.Pdtype.S1;
                   devzx = Services.BaseService.GetOneByKey<PSPDEV>(devzx);
                   if (devzx != null)
                   {
                       pn.title = devzx.Name;
                       pn.DeviceID = devzx.SUID;
                   }
                   else
                   {
                       pn.title = PDT.Pdtype.Title;

                   }
                   Services.BaseService.Create<Ps_pdtypenode>(pn);
               }

            }
        }
Esempio n. 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();
            }
        }