Exemplo n.º 1
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 + "删除结点出错!");
                }

            }
        }
Exemplo n.º 2
0
        //�����·����������Ԫ��
        private void AddPDtypenode(Ps_pdtypenode parentn,string level, string pdreltype)
        {
            //��������·
            int count = 0;
            string sql = "where JName='" + parentn.DeviceID + "'and type='73'";
            IList<PSPDEV> list = UCDeviceBase.DataService.GetList<PSPDEV>("SelectPSPDEVByCondition", sql);
            foreach (PSPDEV ps in list)
            {

                sql = "pdreltypeid='" + pdreltype + "'and ParentID='" + parentn.ID + "'and DeviceID='" + ps.SUID + "'and devicetype='73'";
                Ps_pdtypenode ptn = UCDeviceBase.DataService.GetObject("SelectPs_pdtypenodeByCon", sql) as Ps_pdtypenode;
                if (ptn == null)
                {
                    count++;
                    ptn = new Ps_pdtypenode();

                    ptn.title = ps.Name;
                    ptn.pdreltypeid = pdreltype;
                    ptn.devicetype = "73";
                    ptn.DeviceID = ps.SUID;
                    ptn.ParentID = parentn.ID;
                    ptn.Code = level + "1" + count.ToString();
                    Services.BaseService.Create<Ps_pdtypenode>(ptn);

                }
                else
                {
                    ptn.ParentID = parentn.ID;
                    ptn.Code = level + "1" + count.ToString();
                    Services.BaseService.Update<Ps_pdtypenode>(ptn);
                }
                //���������²�Ԫ��
                AddPDtypenode(ptn, (Convert.ToInt32(level) + 1).ToString(), pdreltype);
            }
            //����·�����нڵ� ������ڵ��ҵ���·�� ������·���Ǹ���iname��Ѱ�� ����֧·��������
            sql = "where AreaID='" + parentn.DeviceID + "'and type='70'and projectid='" + ProjectSUID + "' order by Number";
            IList<PSPDEV> listnode = UCDeviceBase.DataService.GetList<PSPDEV>("SelectPSPDEVByCondition", sql);
            string xgxlsuid = "('',", xgfhsuid = "('',", xgkxsuid = "('',";
            //�ҵ��ͽڵ������ӵ���·��
            foreach (PSPDEV nd in listnode)
            {
                sql = "where IName='" + nd.SUID + "'and AreaID='" + parentn.DeviceID + "'and type='74'";
                PSPDEV ps = UCDeviceBase.DataService.GetObject("SelectPSPDEVByCondition", sql) as PSPDEV;
                if (ps!=null)
                {
                    sql = "pdreltypeid='" + pdreltype + "'and ParentID='" + parentn.ID + "'and DeviceID='" + ps.SUID + "'and devicetype='74'";
                    Ps_pdtypenode ptn = UCDeviceBase.DataService.GetObject("SelectPs_pdtypenodeByCon", sql) as Ps_pdtypenode;
                    if (ptn == null)
                    {
                        count++;
                        Ps_pdtypenode pn1 = new Ps_pdtypenode();

                        pn1.title = ps.Name;
                        pn1.pdreltypeid = pdreltype;
                        pn1.devicetype = "74";
                        pn1.DeviceID = ps.SUID;
                        pn1.ParentID = parentn.ID;
                        pn1.Code = level + "2" + count.ToString();
                        Services.BaseService.Create<Ps_pdtypenode>(pn1);
                        //��Ӷ�·��
                        sql = "where IName='" + ps.SUID + "'and type='06'";
                        int num = 0;
                        IList<PSPDEV> list1 = UCDeviceBase.DataService.GetList<PSPDEV>("SelectPSPDEVByCondition", sql);
                        foreach (PSPDEV ps1 in list1)
                        {
                            num++;
                            Ps_pdtypenode pn2 = new Ps_pdtypenode();

                            pn2.title = ps1.Name;
                            pn2.pdreltypeid = pdreltype;
                            pn2.devicetype = "06";
                            pn2.DeviceID = ps1.SUID;
                            pn2.ParentID = pn1.ID;
                            pn2.Code = (Convert.ToInt32(level) + 1).ToString() + "4" + num.ToString();
                            Services.BaseService.Create<Ps_pdtypenode>(pn2);
                        }

                        //��Ӹ��뿪��
                        sql = "where IName='" + ps.SUID + "'and type='55'";

                        list1 = UCDeviceBase.DataService.GetList<PSPDEV>("SelectPSPDEVByCondition", sql);
                        foreach (PSPDEV ps1 in list1)
                        {
                            num++;
                            Ps_pdtypenode pn2 = new Ps_pdtypenode();

                            pn2.title = ps1.Name;
                            pn2.pdreltypeid = pdreltype;
                            pn2.devicetype = "55";
                            pn2.DeviceID = ps1.SUID;
                            pn2.ParentID = pn1.ID;
                            pn2.Code = (Convert.ToInt32(level) + 1).ToString() + "6" + num.ToString();
                            Services.BaseService.Create<Ps_pdtypenode>(pn2);
                        }
                        xgxlsuid += "'" + ps.SUID + "',";
                    }
                }
                //����֧·
                  sql = "where IName='" + nd.SUID + "'and AreaID='" + parentn.DeviceID + "'and type='80'";
                  ps = UCDeviceBase.DataService.GetObject("SelectPSPDEVByCondition", sql) as PSPDEV;
                  if (ps != null)
                  {
                      sql = "pdreltypeid='" + pdreltype + "'and ParentID='" + parentn.ID + "'and DeviceID='" + ps.SUID + "'and devicetype='80'";
                      Ps_pdtypenode ptn = UCDeviceBase.DataService.GetObject("SelectPs_pdtypenodeByCon", sql) as Ps_pdtypenode;
                      if (ptn == null)
                      {
                          count++;
                          Ps_pdtypenode pn1 = new Ps_pdtypenode();

                          pn1.title = ps.Name;
                          pn1.pdreltypeid = pdreltype;
                          pn1.devicetype = "80";
                          pn1.DeviceID = ps.SUID;
                          pn1.ParentID = parentn.ID;
                          pn1.Code = level + "3" + count.ToString();
                          Services.BaseService.Create<Ps_pdtypenode>(pn1);
                      }
                      xgfhsuid += "'" + ps.SUID + "',";
                  }

                //����������
                  sql = "where IName='" + parentn.DeviceID + "'or JName='" + parentn.DeviceID + " 'and type='75' and HuganLine1='" + nd.SUID + "'or HuganLine2='"+nd.SUID+"'";
                ps = UCDeviceBase.DataService.GetObject("SelectPSPDEVByCondition", sql) as PSPDEV;
                  if (ps != null)
                  {
                      sql = "pdreltypeid='" + pdreltype + "'and ParentID='" + parentn.ID + "'and DeviceID='" + ps.SUID + "'and devicetype='75'";
                      Ps_pdtypenode ptn = UCDeviceBase.DataService.GetObject("SelectPs_pdtypenodeByCon", sql) as Ps_pdtypenode;
                      if (ptn == null)
                      {
                          count++;
                          Ps_pdtypenode pn1 = new Ps_pdtypenode();

                          pn1.title = ps.Name;
                          pn1.pdreltypeid = pdreltype;
                          pn1.devicetype = "75";
                          pn1.DeviceID = ps.SUID;
                          pn1.ParentID = parentn.ID;
                          pn1.Code = level + "5" + count.ToString();
                          Services.BaseService.Create<Ps_pdtypenode>(pn1);
                      }
                      xgxlsuid += "'" + ps.SUID + "',";
                  }
            }
            //ȥ�����һ��������
            xgxlsuid = xgxlsuid.Substring(0, xgxlsuid.LastIndexOf(','));
            xgxlsuid += ")";
            xgfhsuid = xgfhsuid.Substring(0, xgfhsuid.LastIndexOf(','));
            xgfhsuid += ")";
            xgkxsuid = xgkxsuid.Substring(0, xgkxsuid.LastIndexOf(','));
            xgkxsuid += ")";

            //����û�в�����·��

            sql = "where AreaID='" + parentn.DeviceID + "'and type='74' and suid not in "+xgxlsuid+" order by FirstNode";
            list = UCDeviceBase.DataService.GetList<PSPDEV>("SelectPSPDEVByCondition", sql);
            foreach (PSPDEV ps in list)
            {

                sql = "pdreltypeid='" + pdreltype + "'and ParentID='" + parentn.ID + "'and DeviceID='" + ps.SUID + "'and devicetype='74'";
                Ps_pdtypenode ptn = UCDeviceBase.DataService.GetObject("SelectPs_pdtypenodeByCon", sql) as Ps_pdtypenode;
                if (ptn == null)
                {
                    count++;
                    Ps_pdtypenode pn1 = new Ps_pdtypenode();

                    pn1.title ="�ڵ�������_"+ ps.Name;
                    pn1.pdreltypeid = pdreltype;
                    pn1.devicetype = "74";
                    pn1.DeviceID = ps.SUID;
                    pn1.ParentID = parentn.ID;
                    pn1.Code = level + "2" + count.ToString();
                    Services.BaseService.Create<Ps_pdtypenode>(pn1);
                    //��Ӷ�·��
                    sql = "where IName='" + ps.SUID + "'and type='06'";
                    int num = 0;
                    IList<PSPDEV> list1 = UCDeviceBase.DataService.GetList<PSPDEV>("SelectPSPDEVByCondition", sql);
                    foreach (PSPDEV ps1 in list1)
                    {
                        num++;
                        Ps_pdtypenode pn2 = new Ps_pdtypenode();

                        pn2.title = ps1.Name;
                        pn2.pdreltypeid = pdreltype;
                        pn2.devicetype = "06";
                        pn2.DeviceID = ps1.SUID;
                        pn2.ParentID = pn1.ID;
                        pn2.Code = (Convert.ToInt32(level) + 1).ToString() + "4" + num.ToString();
                        Services.BaseService.Create<Ps_pdtypenode>(pn2);
                    }

                    //��Ӹ��뿪��
                    sql = "where IName='" + ps.SUID + "'and type='55'";

                    list1 = UCDeviceBase.DataService.GetList<PSPDEV>("SelectPSPDEVByCondition", sql);
                    foreach (PSPDEV ps1 in list1)
                    {
                        num++;
                        Ps_pdtypenode pn2 = new Ps_pdtypenode();

                        pn2.title = ps1.Name;
                        pn2.pdreltypeid = pdreltype;
                        pn2.devicetype = "55";
                        pn2.DeviceID = ps1.SUID;
                        pn2.ParentID = pn1.ID;
                        pn2.Code = (Convert.ToInt32(level) + 1).ToString() + "6" + num.ToString();
                        Services.BaseService.Create<Ps_pdtypenode>(pn2);
                    }
                }
            }
            //���Ҹ���֧·
            sql = "where AreaID='" + parentn.DeviceID + "'and type='80'  and suid not in " + xgxlsuid ;
            list = UCDeviceBase.DataService.GetList<PSPDEV>("SelectPSPDEVByCondition", sql);
            foreach (PSPDEV ps in list)
            {

                sql = "pdreltypeid='" + pdreltype + "'and ParentID='" + parentn.ID + "'and DeviceID='" + ps.SUID + "'and devicetype='80'";
                Ps_pdtypenode ptn = UCDeviceBase.DataService.GetObject("SelectPs_pdtypenodeByCon", sql) as Ps_pdtypenode;
                if (ptn == null)
                {
                    count++;
                    Ps_pdtypenode pn1 = new Ps_pdtypenode();

                    pn1.title = "�ڵ�������_"+ps.Name;
                    pn1.pdreltypeid = pdreltype;
                    pn1.devicetype = "80";
                    pn1.DeviceID = ps.SUID;
                    pn1.ParentID = parentn.ID;
                    pn1.Code = level + "3" + count.ToString();
                    Services.BaseService.Create<Ps_pdtypenode>(pn1);
                }
            }
            //���������
            sql = "where IName='" + parentn.DeviceID + "'or JName='" + parentn.DeviceID + "' and suid not in "+xgxlsuid+"and type='75'";
            list = UCDeviceBase.DataService.GetList<PSPDEV>("SelectPSPDEVByCondition", sql);
            foreach (PSPDEV ps in list)
            {

                sql = "pdreltypeid='" + pdreltype + "'and ParentID='" + parentn.ID + "'and DeviceID='" + ps.SUID + "'and devicetype='75'";
                Ps_pdtypenode ptn = UCDeviceBase.DataService.GetObject("SelectPs_pdtypenodeByCon", sql) as Ps_pdtypenode;
                if (ptn == null)
                {
                    count++;
                    Ps_pdtypenode pn1 = new Ps_pdtypenode();

                    pn1.title ="�ڵ�������_"+ ps.Name;
                    pn1.pdreltypeid = pdreltype;
                    pn1.devicetype = "75";
                    pn1.DeviceID = ps.SUID;
                    pn1.ParentID = parentn.ID;
                    pn1.Code = level + "5" + count.ToString();
                    Services.BaseService.Create<Ps_pdtypenode>(pn1);
                }
            }
        }
Exemplo n.º 3
0
        //ɾ������Ԫ��
        //ɾ��Ԫ��
        public void DeleteNode(Ps_pdtypenode tln)
        {
            string sql = "ParentID='" + tln.ID + "'";
            IList<Ps_pdtypenode> list = UCDeviceBase.DataService.GetList<Ps_pdtypenode>("SelectPs_pdtypenodeByCon", sql);
            if (list.Count>0)
            {
                foreach (Ps_pdtypenode ps in list)
                {
                    DeleteNode(ps);
                    Services.BaseService.Delete<Ps_pdtypenode>(ps);
                }

            }
        }
Exemplo n.º 4
0
        //��������豸Ԫ����ʱ��
        private void xtraTabControl1_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e)
        {
            if (xtraTabControl1.SelectedTabPage.Name == "xtraTabPage4")
            {
                if (newflag)
                {
                    //����һ���ɿ��Է����ķ��� ��id�����ߵ�ID��ͬ��
                    //�����жϴ����������ݿ���û��
                    PSPDEV obj = Services.BaseService.GetOneByKey<PSPDEV>(dev);
                    if (obj==null)
                    {
                        MessageBox.Show("����·��û�б��浽���ݿ��У��뱣����ٲ�����");
                        return;
                    }
                    //���������ͬ��������ɾ��ԭ����
                    Ps_pdreltype pdr = new Ps_pdreltype();
                    pdr.ID = dev.SUID;
                    pdr = Services.BaseService.GetOneByKey<Ps_pdreltype>(pdr);
                    if (pdr!=null)
                    {
                        Ps_pdtypenode pn2 = new Ps_pdtypenode();
                        pn2.pdreltypeid = pdr.ID;
                        Services.BaseService.Update("DeletePs_pdtypepdreltypeid", pn2);
                        Services.BaseService.Delete<Ps_pdreltype>(pdr);
                    }
                    pdr = new Ps_pdreltype();
                    pdr.ID = dev.SUID;
                    pdr.ProjectID = this.ProjectSUID;
                    pdr.Createtime = DateTime.Now;
                    pdr.Title = textEdit1.Text;
                    pdr.S1 = dev.IName;
                    //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);

                   //���������Ԫ����
                    Ps_pdtypenode pn1 = new Ps_pdtypenode();
                    pn1.ID = dev.SUID;
                    pn1.title = textEdit1.Text;
                    pn1.pdreltypeid = pdr.ID;
                    pn1.devicetype = "73";
                    pn1.DeviceID = dev.SUID;
                    pn1.ParentID = pn.ID;
                    pn1.Code = "111";
                    Services.BaseService.Create<Ps_pdtypenode>(pn1);
                    //�����֧·��Ϣ ���ҵ��������� ������������
                    //if (!string.IsNullOrEmpty(dev.JName))
                    //{
                    //    pn = new Ps_pdtypenode();
                    //    pn.ID = dev.JName;
                    //    pn = Services.BaseService.GetOneByKey<Ps_pdtypenode>(pn);
                    //    if (pn!=null)
                    //    {
                    //        pn1 = new Ps_pdtypenode();

                    //        pn1.title = textEdit1.Text;
                    //        pn1.pdreltypeid =pn.pdreltypeid;
                    //        pn1.devicetype = "73";
                    //        pn1.DeviceID = dev.SUID;
                    //        pn1.ParentID = pn.ID;
                    //        pn1.Code = "211";
                    //        Services.BaseService.Create<Ps_pdtypenode>(pn1);
                    //    }
                    //}
                    AddPDtypenode(pn1, "2", pn1.pdreltypeid);
                }
                else
                {
                    Ps_pdreltype pdr = new Ps_pdreltype();
                    pdr.ID = dev.SUID;
                    pdr = Services.BaseService.GetOneByKey<Ps_pdreltype>(pdr);
                    if (pdr!=null)
                    {
                        pdr.Title = textEdit1.Text;
                        pdr.S1 = dev.IName;
                        Services.BaseService.Update<Ps_pdreltype>(pdr);
                        //�޸ĵ�Դ��Ϣ
                        IList<Ps_pdtypenode> list1 = Services.BaseService.GetList<Ps_pdtypenode>("SelectPs_pdtypenodeByCon", "pdreltypeid='" + pdr.ID + "' and devicetype = '01'");
                        Ps_pdtypenode pn = new Ps_pdtypenode();
                        if (list1.Count>0)
                      {
                          pn = list1[0];
                          pn.DeviceID = dev.IName;
                          Services.BaseService.Update<Ps_pdtypenode>(pn);
                      }
                        else
                      {

                          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);
                      }

                      //�޸Ĵ����߽ڵ����Ϣ

                      Ps_pdtypenode pdn = new Ps_pdtypenode();
                      pdn.ID = dev.SUID;
                      pdn = Services.BaseService.GetOneByKey<Ps_pdtypenode>(pdn);
                        if (pdn!=null)
                        {
                            pdn.title = dev.Name;
                            pdn.devicetype = "73";
                            pdn.ParentID = pn.ID;
                            Services.BaseService.Update<Ps_pdtypenode>(pdn);
                        }
                        else
                        {
                            pdn = new Ps_pdtypenode();
                            pdn.ID = dev.SUID;
                            pdn.title = textEdit1.Text;
                            pdn.pdreltypeid = pdr.ID;
                            pdn.devicetype = "73";
                            pdn.DeviceID = dev.SUID;
                            pdn.ParentID = pn.ID;
                            pdn.Code = "111";
                            Services.BaseService.Create<Ps_pdtypenode>(pdn);
                        }
                     //�ҵ�������Ϣ �޸�������Ϣ
                        DeleteNode(pdn);
                        AddPDtypenode(pdn, "2", pdn.pdreltypeid);

                    }
                    else
                    {
                        pdr = new Ps_pdreltype();
                        pdr.ID = dev.SUID;
                        pdr.ProjectID = this.ProjectSUID;
                        pdr.Createtime = DateTime.Now;
                        pdr.Title = textEdit1.Text;
                        pdr.S1 = dev.IName;
                        //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);
                        //���������Ԫ����
                        Ps_pdtypenode pn1 = new Ps_pdtypenode();
                        pn1.ID = dev.SUID;
                        pn1.title = textEdit1.Text;
                        pn1.pdreltypeid = pdr.ID;
                        pn1.devicetype = "73";
                        pn1.DeviceID = dev.SUID;
                        pn1.ParentID = pn.ID;
                        pn1.Code = "111";
                        Services.BaseService.Create<Ps_pdtypenode>(pn1);
                        //if (!string.IsNullOrEmpty(dev.JName))
                        //{
                        //    pn = new Ps_pdtypenode();
                        //    pn.ID = dev.JName;
                        //    pn = Services.BaseService.GetOneByKey<Ps_pdtypenode>(pn);
                        //    if (pn != null)
                        //    {
                        //        pn1 = new Ps_pdtypenode();

                        //        pn1.title = textEdit1.Text;
                        //        pn1.pdreltypeid = pn.pdreltypeid;
                        //        pn1.devicetype = "73";
                        //        pn1.DeviceID = dev.SUID;
                        //        pn1.ParentID = pn.ID;
                        //        pn1.Code = "211";
                        //        Services.BaseService.Create<Ps_pdtypenode>(pn1);
                        //    }
                        //}
                        AddPDtypenode(pn1, "2", pn1.pdreltypeid);
                    }

                    //pdr.PeopleSum = PDT.Peplesum;
                    //pdr.AreaName = PDT.Areaname;
                    //pdr.Year = PDT.Year;

                }
                  //�ж���֧·�Ƿ���Ԫ�� ���û�� Ȼ���ж�����û������Ԫ�� ����
                //Ps_pdtypenode pnf = new Ps_pdtypenode();
                //pnf.ID = dev.SUID;
                //pnf = Services.BaseService.GetOneByKey<Ps_pdtypenode>(pnf);
                //   string sql = "where JName='" + dev.SUID + "' and type='73' ";
                //   IList<PSPDEV> list = UCDeviceBase.DataService.GetList<PSPDEV>("SelectPSPDEVByCondition", sql);
                //if (list.Count>0)
                //{
                //    int count = 0;
                //    foreach (PSPDEV ps in list)
                //    {
                //        count++;
                //        sql = "pdreltypeid='" + dev.SUID + "'and devicetype='73'and deviceID='" + ps.SUID + "'";
                //        Ps_pdtypenode ptn = UCDeviceBase.DataService.GetObject("SelectPs_pdtypenodeByCon", sql) as Ps_pdtypenode;
                //        if (ptn!=null)
                //        {
                //            //�ж��丽���Ԫ��û�������
                //            AddPDtypenode(ps.SUID, (Convert.ToInt32(ptn.Code.Substring(0, 1)) + 1).ToString(), dev.SUID);
                //        }
                //        else
                //        {
                //            Ps_pdtypenode pn1 = new Ps_pdtypenode();

                //            pn1.title = ps.Name;
                //            pn1.pdreltypeid = dev.SUID;
                //            pn1.devicetype = "73";
                //            pn1.DeviceID = ps.SUID;
                //            pn1.ParentID = dev.SUID;
                //            pn1.Code =(Convert.ToInt32(pnf.Code.Substring(0,1))+1).ToString()+"1"+count.ToString();
                //            Services.BaseService.Create<Ps_pdtypenode>(pn1);
                //        }
                //    }
                //}
                ucdxchildnode1.DXObj = dev;

            }
        }
Exemplo n.º 5
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();
            }
        }
Exemplo n.º 6
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_pdtypenode pf = new Ps_pdtypenode();
                pf.ID = tln["ID"].ToString();
                string nodestr = tln["AreaName"].ToString();
                try
                {
                    TreeListNode node = tln.TreeList.FindNodeByKeyID(pf.ID);
                    if (node != null)
                        tln.TreeList.DeleteNode(node);
                    RemoveDataTableRow(dt, pf.ID);
                    Services.BaseService.Delete<Ps_pdtypenode>(pf);

                }
                catch (Exception e)
                {

                    MessageBox.Show(e.Message + "删除结点出错!");
                }

            }
        }
Exemplo n.º 7
0
        //添加隔离开关
        private void barButtonItem9_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListNode tln = treeList1.FocusedNode;

            if (tln != null)
            {
                DataRow row = (tln.TreeList.GetDataRecordByNode(tln) as DataRowView).Row;
                Ps_pdtypenode v = DataConverter.RowToObject<Ps_pdtypenode>(row);
                if (tln.GetValue("devicetype").ToString() == "74")
                {
                    adducdevice("55");
                    curDevice.ParentID = v.DeviceID;
                    curDevice.Add();

                    PSPDEV pd = curDevice.SelectedDevice as PSPDEV;
                    //馈线段记录
                    if (pd == null)
                        return;
                    Ps_pdtypenode pn = new Ps_pdtypenode();
                    pn.title = pd.Name;
                    pn.pdreltypeid = pdreltypeid;
                    pn.devicetype = "55";
                    pn.DeviceID = pd.SUID;
                    pn.ParentID = tln.GetValue("ID").ToString();
                    pn.Code = (tln.Level + 1).ToString() + "6" + (tln.Nodes.Count + 1).ToString();
                    Services.BaseService.Create<Ps_pdtypenode>(pn);
                    dt.Rows.Add(Itop.Common.DataConverter.ObjectToRow(pn, dt.NewRow()));
                }
                else
                {
                    MsgBox.Show("请选择馈线段,再操作!");
                    return;
                }
            }
        }
Exemplo n.º 8
0
        private void barButtonItem10_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            TreeListNode tln = treeList1.FocusedNode;
            frmDeviceSelect dlg = new frmDeviceSelect();
            if (tln != null)
            {
                DataRow row = (tln.TreeList.GetDataRecordByNode(tln) as DataRowView).Row;
                Ps_pdtypenode v = DataConverter.RowToObject<Ps_pdtypenode>(row);
                if (tln.GetValue("devicetype").ToString() == "01")
                {
                    //adducdevice("73");
                    //curDevice.Add();
                    //PSPDEV pd = curDevice.SelectedDevice as PSPDEV;
                    //馈线段记录
                    dlg.InitDeviceType("01", "73");
                }
                else if (tln.GetValue("devicetype").ToString() == "73")
                {
                    dlg.InitDeviceType("73", "74", "80", "75");

                }
                else if (tln.GetValue("devicetype").ToString() == "74")
                {
                    dlg.InitDeviceType("06", "55");

                }
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    Dictionary<string, object> dic = dlg.GetSelectedDevice();
                    PSPDEV devzx = dic["device"] as PSPDEV;
                    //S1 = devzx.SUID;
                    Ps_pdtypenode pn = new Ps_pdtypenode();
                    pn.title = devzx.Name;
                    pn.pdreltypeid = pdreltypeid;
                    pn.devicetype = devzx.Type;
                    pn.DeviceID = devzx.SUID;
                    if (devzx.Type != "01")
                    {
                        pn.ParentID = tln.GetValue("ID").ToString();
                    }
                    switch (devzx.Type)
                    {
                        case "73":
                            pn.Code = (tln.Level + 1).ToString() + "1" + (tln.Nodes.Count + 1).ToString();
                            break;
                        case "74":
                            pn.Code = (tln.Level + 1).ToString() + "2" + (tln.Nodes.Count + 1).ToString();
                            break;
                        case "80":
                            pn.Code = (tln.Level + 1).ToString() + "3" + (tln.Nodes.Count + 1).ToString();
                            break;
                        case "75":
                            pn.Code = (tln.Level + 1).ToString() + "5" + (tln.Nodes.Count + 1).ToString();
                            break;
                        case "06":
                            pn.Code = (tln.Level + 1).ToString() + "4" + (tln.Nodes.Count + 1).ToString();
                            break;
                        case "55":
                            pn.Code = (tln.Level + 1).ToString() + "6" + (tln.Nodes.Count + 1).ToString();
                            break;
                        case "01":
                            pn.Code = treeList1.Nodes.Count.ToString();
                            break;
                    }

                    Services.BaseService.Create<Ps_pdtypenode>(pn);
                    dt.Rows.Add(Itop.Common.DataConverter.ObjectToRow(pn, dt.NewRow()));
                }
            }
        }