Ejemplo n.º 1
0
        public override void Add()
        {
            frmBYQ3dlg dlg = new frmBYQ3dlg();
            dlg.Name = "";
            dlg.ProjectSUID = this.ProjectID;
            PSPDEV p = new PSPDEV();
            p.ProjectID = this.ProjectID;
            p.SvgUID = ParentID;
            if (ParentObj is PSP_Substation_Info)
            {
                p.Name = (ParentObj as PSP_Substation_Info).Title + "-��ѹ��";
                p.OperationYear = (ParentObj as PSP_Substation_Info).S2;
                p.Date1 = (ParentObj as PSP_Substation_Info).S2;
                p.Date2 = (ParentObj as PSP_Substation_Info).L29;
            }
            else if (ParentObj is PSP_PowerSubstation_Info)
            {
                p.Name = (ParentObj as PSP_PowerSubstation_Info).Title + "-��ѹ��";
                p.OperationYear = (ParentObj as PSP_PowerSubstation_Info).S3;
                p.Date1 = (ParentObj as PSP_PowerSubstation_Info).S3;
                p.Date2 = (ParentObj as PSP_PowerSubstation_Info).S30;
            }

            dlg.DeviceMx = p;
            if (dlg.ShowDialog() == DialogResult.OK) {
                //���Ӽ�¼
                PSPDEV dev = dlg.DeviceMx;
                dev.ProjectID = this.ProjectID;
                UCDeviceBase.DataService.Create("InsertPSPDEV", dev);
                DataRow row=datatable1.NewRow();
                if (dev.NodeType == "0")
                {
                    dev.NodeType = "ƽ��ڵ�";
                }
                else if (dev.NodeType == "1")
                {
                    dev.NodeType = "PQ�ڵ�";
                }
                else if (dev.NodeType == "2")
                {
                    dev.NodeType = "PV�ڵ�";
                }
                else
                {
                    dev.NodeType = null;
                }
                if (dev.KSwitchStatus == "1")
                {
                    dev.KSwitchStatus = "�˳�����";
                }
                else
                {
                    dev.KSwitchStatus = "Ͷ������";
                }
                if (dev.UnitFlag == "0")
                {
                    dev.UnitFlag = "p.u.";
                }
                else
                {
                    if (dev.Type == "01" || dev.Type == "04" || dev.Type == "12")
                    {
                        dev.UnitFlag = "kV/MW/MVar";
                    }
                    else
                    {
                        dev.UnitFlag = "Ohm/10-6Siem";
                    }
                }
                Itop.Common.DataConverter.ObjectToRow(dev, row);
                datatable1.Rows.Add(row);
            }
        }
Ejemplo n.º 2
0
        private void elementProperty()
        {
            XmlElement element = tlVectorControl1.SVGDocument.CurrentElement;
               if (element is Use)
               {
               if (element.GetAttribute("xlink:href").Contains("motherlinenode"))
               {
                   string suid = element.GetAttribute("Deviceid");
                  // DeviceHelper.ShowDeviceDlg(DeviceType.MX, suid, false);
                   frmMXdlg dlg = new frmMXdlg();
                   if (suid != null)
                   {
                       PSPDEV dev =(PSPDEV) DeviceHelper.GetDevice<PSPDEV>(suid);
                       dlg.DeviceMx = dev;
                       if (dlg.ShowDialog() == DialogResult.OK)
                       {
                           if (dlg.Name==null)
                           {
                               MessageBox.Show("名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           string strCon = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + tlVectorControl1.SVGDocument.SvgdataUid + "' AND Name = '" +dlg.Name+ "' AND Type = '01'";
                           IList listName = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                           if (listName.Count >= 2 || (listName.Count == 1 && (listName[0] as PSPDEV).SUID != dev.SUID))
                           {
                               MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           dev = dlg.DeviceMx;
                           dev.ProjectID = this.ProjectUID;
                           XmlNode text = tlVectorControl1.SVGDocument.SelectSingleNode("svg/*[@ParentID='" + element.GetAttribute("id") + "']");
                         if (text != null)
                         {
                           (text as Text).InnerText = dev.Name;
                         }
                           Services.BaseService.Update<PSPDEV>(dev);

                       }
                   }

               }
               if (element.GetAttribute("xlink:href").Contains("transformertwozu"))
               {
                   string suid = element.GetAttribute("Deviceid");
                   // DeviceHelper.ShowDeviceDlg(DeviceType.MX, suid, false);
                   frmBYQ2dlg dlg = new frmBYQ2dlg();
                   if (suid != null)
                   {
                       PSPDEV dev = (PSPDEV)DeviceHelper.GetDevice<PSPDEV>(suid);
                       dlg.DeviceMx = dev;
                       if (dlg.ShowDialog() == DialogResult.OK)
                       {
                           if (dlg.Name == null)
                           {
                               MessageBox.Show("名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           string strCon = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + tlVectorControl1.SVGDocument.SvgdataUid + "' AND Name = '" + dlg.Name + "' AND Type = '02'";
                           IList listName = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                           if (listName.Count >= 2 || (listName.Count == 1 && (listName[0] as PSPDEV).SUID != dev.SUID))
                           {
                               MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           dev = dlg.DeviceMx;
                           dev.ProjectID = this.ProjectUID;
                           XmlNode text = tlVectorControl1.SVGDocument.SelectSingleNode("svg/*[@ParentID='" + element.GetAttribute("id") + "']");
                           if (text != null)
                           {
                               (text as Text).InnerText = dev.Name;
                           }
                           Services.BaseService.Update<PSPDEV>(dev);

                       }
                   }

               }
               if (element.GetAttribute("xlink:href").Contains("transformerthirdzu"))
               {
                   string suid = element.GetAttribute("Deviceid");
                   // DeviceHelper.ShowDeviceDlg(DeviceType.MX, suid, false);
                   frmBYQ3dlg dlg = new frmBYQ3dlg();
                   if (suid != null)
                   {
                       PSPDEV dev = (PSPDEV)DeviceHelper.GetDevice<PSPDEV>(suid);
                       dlg.DeviceMx = dev;
                       if (dlg.ShowDialog() == DialogResult.OK)
                       {
                           if (dlg.Name == null)
                           {
                               MessageBox.Show("名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           string strCon = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + tlVectorControl1.SVGDocument.SvgdataUid + "' AND Name = '" + dlg.Name + "' AND Type = '03'";
                           IList listName = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                           if (listName.Count >= 2 || (listName.Count == 1 && (listName[0] as PSPDEV).SUID != dev.SUID))
                           {
                               MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           dev = dlg.DeviceMx;
                           dev.ProjectID = this.ProjectUID;
                           XmlNode text = tlVectorControl1.SVGDocument.SelectSingleNode("svg/*[@ParentID='" + element.GetAttribute("id") + "']");
                           if (text != null)
                           {
                               (text as Text).InnerText = dev.Name;
                           }
                           Services.BaseService.Update<PSPDEV>(dev);

                       }
                   }

               }
               if (element.GetAttribute("xlink:href").Contains("dynamotorline"))
               {
                   string suid = element.GetAttribute("Deviceid");
                   // DeviceHelper.ShowDeviceDlg(DeviceType.MX, suid, false);
                   frmFDJdlg dlg = new frmFDJdlg();
                   if (suid != null)
                   {
                       PSPDEV dev = (PSPDEV)DeviceHelper.GetDevice<PSPDEV>(suid);
                       dlg.DeviceMx = dev;
                       if (dlg.ShowDialog() == DialogResult.OK)
                       {
                           if (dlg.Name == null)
                           {
                               MessageBox.Show("名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           string strCon = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + tlVectorControl1.SVGDocument.SvgdataUid + "' AND Name = '" + dlg.Name + "' AND Type = '04'";
                           IList listName = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                           if (listName.Count >= 2 || (listName.Count == 1 && (listName[0] as PSPDEV).SUID != dev.SUID))
                           {
                               MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           dev = dlg.DeviceMx;
                           dev.ProjectID = this.ProjectUID;
                           XmlNode text = tlVectorControl1.SVGDocument.SelectSingleNode("svg/*[@ParentID='" + element.GetAttribute("id") + "']");
                           if (text != null)
                           {
                               (text as Text).InnerText = dev.Name;
                           }
                           Services.BaseService.Update<PSPDEV>(dev);

                       }
                   }

               }
               if (element.GetAttribute("xlink:href").Contains("loadline"))
               {
                   string suid = element.GetAttribute("Deviceid");
                   // DeviceHelper.ShowDeviceDlg(DeviceType.MX, suid, false);
                   frmFHdlg dlg = new frmFHdlg();
                   if (suid != null)
                   {
                       PSPDEV dev = (PSPDEV)DeviceHelper.GetDevice<PSPDEV>(suid);
                       dlg.DeviceMx = dev;
                       if (dlg.ShowDialog() == DialogResult.OK)
                       {
                           if (dlg.Name == null)
                           {
                               MessageBox.Show("名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           string strCon = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + tlVectorControl1.SVGDocument.SvgdataUid + "' AND Name = '" + dlg.Name + "' AND Type = '12'";
                           IList listName = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                           if (listName.Count >= 2 || (listName.Count == 1 && (listName[0] as PSPDEV).SUID != dev.SUID))
                           {
                               MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           dev = dlg.DeviceMx;
                           dev.ProjectID = this.ProjectUID;
                           XmlNode text = tlVectorControl1.SVGDocument.SelectSingleNode("svg/*[@ParentID='" + element.GetAttribute("id") + "']");
                           if (text != null)
                           {
                               (text as Text).InnerText = dev.Name;
                           }
                           Services.BaseService.Update<PSPDEV>(dev);

                       }
                   }

               }
               if (element.GetAttribute("xlink:href").Contains("串联电抗器"))
               {
                   string suid = element.GetAttribute("Deviceid");
                   // DeviceHelper.ShowDeviceDlg(DeviceType.MX, suid, false);
                   frmCLDKdlg dlg = new frmCLDKdlg();
                   if (suid != null)
                   {
                       PSPDEV dev = (PSPDEV)DeviceHelper.GetDevice<PSPDEV>(suid);
                       dlg.DeviceMx = dev;
                       if (dlg.ShowDialog() == DialogResult.OK)
                       {
                           if (dlg.Name == null)
                           {
                               MessageBox.Show("名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           string strCon = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + tlVectorControl1.SVGDocument.SvgdataUid + "' AND Name = '" + dlg.Name + "' AND Type = '10'";
                           IList listName = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                           if (listName.Count >= 2 || (listName.Count == 1 && (listName[0] as PSPDEV).SUID != dev.SUID))
                           {
                               MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           dev = dlg.DeviceMx;
                           dev.ProjectID = this.ProjectUID;
                           XmlNode text = tlVectorControl1.SVGDocument.SelectSingleNode("svg/*[@ParentID='" + element.GetAttribute("id") + "']");
                           if (text != null)
                           {
                               (text as Text).InnerText = dev.Name;
                           }
                           Services.BaseService.Update<PSPDEV>(dev);

                       }
                   }

               }
               if (element.GetAttribute("xlink:href").Contains("串联电容器"))
               {
                   string suid = element.GetAttribute("Deviceid");
                   // DeviceHelper.ShowDeviceDlg(DeviceType.MX, suid, false);
                   frmCLDRdlg dlg = new frmCLDRdlg();
                   if (suid != null)
                   {
                       PSPDEV dev = (PSPDEV)DeviceHelper.GetDevice<PSPDEV>(suid);
                       dlg.DeviceMx = dev;
                       if (dlg.ShowDialog() == DialogResult.OK)
                       {
                           if (dlg.Name == null)
                           {
                               MessageBox.Show("名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           string strCon = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + tlVectorControl1.SVGDocument.SvgdataUid + "' AND Name = '" + dlg.Name + "' AND Type = '08'";
                           IList listName = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                           if (listName.Count >= 2 || (listName.Count == 1 && (listName[0] as PSPDEV).SUID != dev.SUID))
                           {
                               MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           dev = dlg.DeviceMx;
                           dev.ProjectID = this.ProjectUID;
                           XmlNode text = tlVectorControl1.SVGDocument.SelectSingleNode("svg/*[@ParentID='" + element.GetAttribute("id") + "']");
                           if (text != null)
                           {
                               (text as Text).InnerText = dev.Name;
                           }
                           Services.BaseService.Update<PSPDEV>(dev);

                       }
                   }

               }
               if (element.GetAttribute("xlink:href").Contains("并联电容器"))
               {
                   string suid = element.GetAttribute("Deviceid");
                   // DeviceHelper.ShowDeviceDlg(DeviceType.MX, suid, false);
                   frmBLDRdlg dlg = new frmBLDRdlg();
                   if (suid != null)
                   {
                       PSPDEV dev = (PSPDEV)DeviceHelper.GetDevice<PSPDEV>(suid);
                       dlg.DeviceMx = dev;
                       if (dlg.ShowDialog() == DialogResult.OK)
                       {
                           if (dlg.Name == null)
                           {
                               MessageBox.Show("名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           string strCon = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + tlVectorControl1.SVGDocument.SvgdataUid + "' AND Name = '" + dlg.Name + "' AND Type = '09'";
                           IList listName = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                           if (listName.Count >= 2 || (listName.Count == 1 && (listName[0] as PSPDEV).SUID != dev.SUID))
                           {
                               MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           dev = dlg.DeviceMx;
                           dev.ProjectID = this.ProjectUID;
                           XmlNode text = tlVectorControl1.SVGDocument.SelectSingleNode("svg/*[@ParentID='" + element.GetAttribute("id") + "']");
                           if (text != null)
                           {
                               (text as Text).InnerText = dev.Name;
                           }
                           Services.BaseService.Update<PSPDEV>(dev);

                       }
                   }

               }
               if (element.GetAttribute("xlink:href").Contains("并联电抗器"))
               {
                   string suid = element.GetAttribute("Deviceid");
                   // DeviceHelper.ShowDeviceDlg(DeviceType.MX, suid, false);
                   frmBLDKdlg dlg = new frmBLDKdlg();
                   if (suid != null)
                   {
                       PSPDEV dev = (PSPDEV)DeviceHelper.GetDevice<PSPDEV>(suid);
                       dlg.DeviceMx = dev;
                       if (dlg.ShowDialog() == DialogResult.OK)
                       {
                           if (dlg.Name == null)
                           {
                               MessageBox.Show("名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           string strCon = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + tlVectorControl1.SVGDocument.SvgdataUid + "' AND Name = '" + dlg.Name + "' AND Type = '11'";
                           IList listName = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                           if (listName.Count >= 2 || (listName.Count == 1 && (listName[0] as PSPDEV).SUID != dev.SUID))
                           {
                               MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           dev = dlg.DeviceMx;
                           dev.ProjectID = this.ProjectUID;
                           XmlNode text = tlVectorControl1.SVGDocument.SelectSingleNode("svg/*[@ParentID='" + element.GetAttribute("id") + "']");
                           if (text != null)
                           {
                               (text as Text).InnerText = dev.Name;
                           }
                           Services.BaseService.Update<PSPDEV>(dev);

                       }
                   }

               }
               if (element.GetAttribute("xlink:href").Contains("1/2母联开关"))
               {
                   string suid = element.GetAttribute("Deviceid");
                   // DeviceHelper.ShowDeviceDlg(DeviceType.MX, suid, false);
                   frmMLdlg dlg = new frmMLdlg();
                   if (suid != null)
                   {
                       PSPDEV dev = (PSPDEV)DeviceHelper.GetDevice<PSPDEV>(suid);
                       dlg.DeviceMx = dev;
                       if (dlg.ShowDialog() == DialogResult.OK)
                       {
                           if (dlg.Name == null)
                           {
                               MessageBox.Show("名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           string strCon = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + tlVectorControl1.SVGDocument.SvgdataUid + "' AND Name = '" + dlg.Name + "' AND Type = '13'";
                           IList listName = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                           if (listName.Count >= 2 || (listName.Count == 1 && (listName[0] as PSPDEV).SUID != dev.SUID))
                           {
                               MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           dev = dlg.DeviceMx;
                           dev.ProjectID = this.ProjectUID;
                           XmlNode text = tlVectorControl1.SVGDocument.SelectSingleNode("svg/*[@ParentID='" + element.GetAttribute("id") + "']");
                           if (text != null)
                           {
                               (text as Text).InnerText = dev.Name;
                           }
                           Services.BaseService.Update<PSPDEV>(dev);

                       }
                   }

               }
               if (element.GetAttribute("xlink:href").Contains("2/3母联开关"))
               {
                   string suid = element.GetAttribute("Deviceid");
                   // DeviceHelper.ShowDeviceDlg(DeviceType.MX, suid, false);
                   frmML2dlg dlg = new frmML2dlg();
                   if (suid != null)
                   {
                       PSPDEV dev = (PSPDEV)DeviceHelper.GetDevice<PSPDEV>(suid);
                       dlg.DeviceMx = dev;
                       if (dlg.ShowDialog() == DialogResult.OK)
                       {
                           if (dlg.Name == null)
                           {
                               MessageBox.Show("名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           string strCon = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + tlVectorControl1.SVGDocument.SvgdataUid + "' AND Name = '" + dlg.Name + "' AND Type = '14'";
                           IList listName = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                           if (listName.Count >= 2 || (listName.Count == 1 && (listName[0] as PSPDEV).SUID != dev.SUID))
                           {
                               MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           dev = dlg.DeviceMx;
                           dev.ProjectID = this.ProjectUID;
                           XmlNode text = tlVectorControl1.SVGDocument.SelectSingleNode("svg/*[@ParentID='" + element.GetAttribute("id") + "']");
                           if (text != null)
                           {
                               (text as Text).InnerText = dev.Name;
                           }
                           Services.BaseService.Update<PSPDEV>(dev);

                       }
                   }

               }
               if (element.GetAttribute("xlink:href").Contains("线路互感"))
               {
                   string suid = element.GetAttribute("Deviceid");
                   // DeviceHelper.ShowDeviceDlg(DeviceType.MX, suid, false);
                   frmML2dlg dlg = new frmML2dlg();
                   if (suid != null)
                   {
                       PSPDEV dev = (PSPDEV)DeviceHelper.GetDevice<PSPDEV>(suid);
                       dlg.DeviceMx = dev;
                       if (dlg.ShowDialog() == DialogResult.OK)
                       {
                           if (dlg.Name == null)
                           {
                               MessageBox.Show("名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           string strCon = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + tlVectorControl1.SVGDocument.SvgdataUid + "' AND Name = '" + dlg.Name + "' AND Type = '15'";
                           IList listName = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                           if (listName.Count >= 2 || (listName.Count == 1 && (listName[0] as PSPDEV).SUID != dev.SUID))
                           {
                               MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           dev = dlg.DeviceMx;
                           dev.ProjectID = this.ProjectUID;
                           XmlNode text = tlVectorControl1.SVGDocument.SelectSingleNode("svg/*[@ParentID='" + element.GetAttribute("id") + "']");
                           if (text != null)
                           {
                               (text as Text).InnerText = dev.Name;
                           }
                           Services.BaseService.Update<PSPDEV>(dev);

                       }
                   }

               }
               }
               else if (element is Polyline)
               {

                   string suid = element.GetAttribute("Deviceid");
                   // DeviceHelper.ShowDeviceDlg(DeviceType.MX, suid, false);
                   frmXLdlg dlg = new frmXLdlg();
                   if (!string.IsNullOrEmpty(suid))
                   {
                       PSPDEV dev = (PSPDEV)DeviceHelper.GetDevice<PSPDEV>(suid);
                       dlg.DeviceMx = dev;
                       if (dlg.ShowDialog() == DialogResult.OK)
                       {
                           if (dlg.Name == null)
                           {
                               MessageBox.Show("名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           string strCon = ",PSP_ELCDEVICE WHERE PSPDEV.SUID = PSP_ELCDEVICE.DeviceSUID AND PSP_ELCDEVICE.ProjectSUID = '" + tlVectorControl1.SVGDocument.SvgdataUid + "' AND Name = '" + dlg.Name + "' AND Type = '05'";
                           IList listName = Services.BaseService.GetList("SelectPSPDEVByCondition", strCon);
                           if (listName.Count >= 2 || (listName.Count == 1 && (listName[0] as PSPDEV).SUID != dev.SUID))
                           {
                               MessageBox.Show("名称已存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                               return;
                           }
                           dev = dlg.DeviceMx;
                           dev.ProjectID = this.ProjectUID;
                           XmlNode text = tlVectorControl1.SVGDocument.SelectSingleNode("svg/*[@ParentID='" + element.GetAttribute("id") + "']");
                           if (text != null)
                           {
                               (text as Text).InnerText = dev.Name;
                           }
                           Services.BaseService.Update<PSPDEV>(dev);

                       }
                   }
                   //else if (suid=="")
                   //{
                   //    //dlgSubstation.InitData();
                   //    object subID = DeviceHelper.SelectProjectDevice("05", tlVectorControl1.SVGDocument.SvgdataUid, this.ProjectUID, linecol);
                   //    XmlElement n1 = tlVectorControl1.SVGDocument.CreateElement("text") as Text;
                   //    if (subID != null)
                   //    {

                   //        element.SetAttribute("Deviceid", ((PSPDEV)subID).SUID);
                   //        element.SetAttribute("Type", "05");
                   //        element.SetAttribute("layer", SvgDocument.currentLayer);

                   //        tlVectorControl1.SVGDocument.RootElement.AppendChild(element);
                   //        tlVectorControl1.SVGDocument.CurrentElement = element as SvgElement;
                   //        //RectangleF t = ((IGraph)temp).GetBounds();
                   //        //n1.SetAttribute("x", (t.X - 10).ToString());
                   //        //n1.SetAttribute("y", (t.Y - 10).ToString());
                   //        //n1.InnerText = ((PSPDEV)subID).Name;
                   //        //n1.SetAttribute("layer", SvgDocument.currentLayer);
                   //        //n1.SetAttribute("ParentID", temp.GetAttribute("id"));
                   //        //tlVectorControl1.SVGDocument.RootElement.AppendChild(n1);
                   //        tlVectorControl1.Operation = ToolOperation.Select;
                   //    }
                   //    else
                   //    {
                   //        tlVectorControl1.SVGDocument.CurrentElement = element as SvgElement;
                   //        tlVectorControl1.Delete();
                   //        return;
                   //        //tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                   //        //tlVectorControl1.Delete();
                   //    }

                   //    foreach (eleclass ele in linecol)
                   //    {
                   //        if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == true)
                   //        {
                   //            MessageBox.Show("已经有此线路!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                   //            tlVectorControl1.SVGDocument.CurrentElement = element as SvgElement;
                   //            tlVectorControl1.Delete();
                   //            //tlVectorControl1.SVGDocument.CurrentElement = n1 as SvgElement;
                   //            //tlVectorControl1.Delete();
                   //        }
                   //        else if (ele.suid == ((PSPDEV)subID).SUID && ele.selectflag == false)
                   //        {
                   //            linecol.Remove(ele);
                   //            eleclass ele1 = new eleclass(((PSPDEV)subID).Name, ((PSPDEV)subID).SUID, ((PSPDEV)subID).Type, true);
                   //            linecol.Add(ele1);
                   //        }

                   //    }
                   //}

               }
        }
Ejemplo n.º 3
0
        public override void Edit()
        {
            frmBYQ3dlg dlg = new frmBYQ3dlg();
            DataRow row = gridView1.GetDataRow(gridView1.FocusedRowHandle);
            if (row != null)
            {
                PSPDEV dev = Itop.Common.DataConverter.RowToObject<PSPDEV>(row);
                if (dev.NodeType == "ƽ��ڵ�")
                {
                    dev.NodeType = "0";
                }
                else if (dev.NodeType == "PQ�ڵ�")
                {
                    dev.NodeType = "1";
                }
                else if (dev.NodeType == "PV�ڵ�")
                {
                    dev.NodeType = "2";
                }
                if (dev.KSwitchStatus == "�˳�����")
                {
                    dev.KSwitchStatus = "1";
                }
                else
                {
                    dev.KSwitchStatus = "0";
                }
                if (dev.UnitFlag == "p.u.")
                {
                    dev.UnitFlag = "0";
                }
                else
                {
                    dev.UnitFlag = "1";

                }
                dlg.DeviceMx = dev;
                dlg.ProjectSUID = dev.ProjectID;
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    //���¼�¼
                    dev = dlg.DeviceMx;
                    dev.ProjectID = this.ProjectID;
                    UCDeviceBase.DataService.Update<PSPDEV>(dev);
                    if (dev.NodeType == "0")
                    {
                        dev.NodeType = "ƽ��ڵ�";
                    }
                    else if (dev.NodeType == "1")
                    {
                        dev.NodeType = "PQ�ڵ�";
                    }
                    else if (dev.NodeType == "2")
                    {
                        dev.NodeType = "PV�ڵ�";
                    }
                    else
                    {
                        dev.NodeType = null;
                    }
                    if (dev.KSwitchStatus == "1")
                    {
                        dev.KSwitchStatus = "�˳�����";
                    }
                    else
                    {
                        dev.KSwitchStatus = "Ͷ������";
                    }
                    if (dev.UnitFlag == "0")
                    {
                        dev.UnitFlag = "p.u.";
                    }
                    else
                    {
                        if (dev.Type == "01" || dev.Type == "04" || dev.Type == "12")
                        {
                            dev.UnitFlag = "kV/MW/MVar";
                        }
                        else
                        {
                            dev.UnitFlag = "Ohm/10-6Siem";
                        }
                    }
                    Itop.Common.DataConverter.ObjectToRow(dev, row);
                    string sql = "S1='" + dev.Name + "'and S4='�������ѹ��'";
                    IList<Psp_Attachtable> ilist = UCDeviceBase.DataService.GetList<Psp_Attachtable>("SelectPsp_AttachtableByCont", sql);
                    if (ilist.Count > 0)
                    {
                        Psp_Attachtable pdr = ilist[0];
                        pdr.ZHI =dev.SiN;
                        pdr.S3 = dev.OperationYear;
                        pdr.startYear = dev.Date1;
                        pdr.endYear = dev.Date2;
                        UCDeviceBase.DataService.Update<Psp_Attachtable>(pdr);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public static bool ShowDeviceDlg(string stype, string uid, bool isread)
        {
            object dev = null;

            if (stype == "20")
            {
                dev = GetDevice <PSP_Substation_Info>(uid);
            }
            else if (stype == "30")
            {
                dev = GetDevice <PSP_PowerSubstation_Info>(uid);
            }
            else
            {
                dev = GetDevice <PSPDEV>(uid);
            }
            if (dev == null)
            {
                return(false);
            }
            switch (stype)
            {
            case "20":    //变电站

                frmBDZdlg dlg = new frmBDZdlg();
                dlg.StartYear = StartYear;
                dlg.DeviceMx  = dev as PSP_Substation_Info;

                dlg.IsRead     = isread;
                dlg.IsonlyRead = true;
                if (dlg.ShowDialog() == DialogResult.OK && !isread)
                {
                    UCDeviceBase.DataService.Update <PSP_Substation_Info>(dlg.DeviceMx);
                    dev = dlg.DeviceMx;
                }
                else
                {
                    dev = null;
                }
                break;

            case "30":    //电源
                frmDYdlg dlg21 = new frmDYdlg();
                dlg21.DeviceMx   = dev as PSP_PowerSubstation_Info;
                dlg21.IsRead     = isread;
                dlg21.IsonlyRead = true;
                dlg21.StartYear  = StartYear;
                if (dlg21.ShowDialog() == DialogResult.OK && !isread)
                {
                    UCDeviceBase.DataService.Update <PSP_PowerSubstation_Info>(dlg21.DeviceMx);
                    dev = dlg21.DeviceMx;
                }
                else
                {
                    dev = null;
                }
                break;

            case "01":
                frmMXdlg dlg1 = new frmMXdlg();
                dlg1.DeviceMx = dev as PSPDEV;

                // dlg1.ShowDialog();
                if (dlg1.ShowDialog() == DialogResult.OK && !isread)
                {
                    UCDeviceBase.DataService.Update <PSPDEV>(dlg1.DeviceMx);
                }
                break;

            case "02":
                frmBYQ2dlg dlg2 = new frmBYQ2dlg();
                dlg2.DeviceMx = dev as PSPDEV;
                dlg2.ShowDialog();
                break;

            case "03":
                frmBYQ3dlg dlg3 = new frmBYQ3dlg();
                dlg3.DeviceMx = dev as PSPDEV;
                dlg3.ShowDialog();
                break;

            case "04":
                frmFDJdlg dlg4 = new frmFDJdlg();
                dlg4.DeviceMx = dev as PSPDEV;
                dlg4.ShowDialog();
                break;

            case "05":
                frmXLdlg dlg5 = new frmXLdlg();
                dlg5.DeviceMx = dev as PSPDEV;
                dlg5.glist    = glist;
                dlg5.isread   = true;
                DialogResult rst = dlg5.ShowDialog();
                if (rst == DialogResult.OK && !isread)
                {
                    UCDeviceBase.DataService.Update <PSPDEV>(dlg5.DeviceMx);
                }
                break;

            case "06":
                frmDLQdlg dlg6 = new frmDLQdlg();
                dlg6.DeviceMx = dev as PSPDEV;
                dlg6.ShowDialog();
                break;

            case "07":
                frmKGdlg dlg7 = new frmKGdlg();
                dlg7.DeviceMx = dev as PSPDEV;
                dlg7.ShowDialog();
                break;

            case "08":
                frmCLDRdlg dlg8 = new frmCLDRdlg();
                dlg8.DeviceMx = dev as PSPDEV;
                dlg8.ShowDialog();
                break;

            case "09":
                frmBLDRdlg dlg9 = new frmBLDRdlg();
                dlg9.DeviceMx = dev as PSPDEV;
                dlg9.ShowDialog();
                break;

            case "10":
                frmCLDKdlg dlg10 = new frmCLDKdlg();
                dlg10.DeviceMx = dev as PSPDEV;
                dlg10.ShowDialog();
                break;

            case "11":
                frmBLDKdlg dlg11 = new frmBLDKdlg();
                dlg11.DeviceMx = dev as PSPDEV;
                dlg11.ShowDialog();
                break;

            case "12":
                frmFHdlg dlg12 = new frmFHdlg();
                dlg12.DeviceMx = dev as PSPDEV;
                dlg12.ShowDialog();
                break;

            case "13":
                frmMLdlg dlg13 = new frmMLdlg();
                dlg13.DeviceMx = dev as PSPDEV;
                dlg13.ShowDialog();
                break;

            case "14":
                frmML2dlg dlg14 = new frmML2dlg();
                dlg14.DeviceMx = dev as PSPDEV;
                dlg14.ShowDialog();
                break;

            case "15":
                frmHGdlg dlg15 = new frmHGdlg();
                dlg15.DeviceMx = dev as PSPDEV;
                dlg15.ShowDialog();
                break;

            case "50":
            case "51":
            case "52":
                frmPWdlg dlg18 = new frmPWdlg();
                dlg18.DeviceMx = dev as PSPDEV;
                dlg18.ShowDialog();
                break;

            case "54":
            case "56":
            case "57":
            case "58":
            case "59":
                frmPWKGdlg dlg17 = new frmPWKGdlg();
                dlg17.DeviceMx = dev as PSPDEV;
                dlg17.ShowDialog();
                break;

            case "61":
            case "62":
            case "63":
            case "64":
            case "65":
                frmPWKGdlg dlg88 = new frmPWKGdlg();
                dlg88.DeviceMx = dev as PSPDEV;
                dlg88.ShowDialog();
                break;

            case "70":
                frmZXdlg dlg19 = new frmZXdlg();
                dlg19.DeviceMx = dev as PSPDEV;
                if (dlg19.ShowDialog() == DialogResult.OK && !isread)
                {
                    UCDeviceBase.DataService.Update <PSPDEV>(dlg19.DeviceMx);
                }
                break;

            case "72":
                frmBYQTWOdlg dlg20 = new frmBYQTWOdlg();
                dlg20.DeviceMx = dev as PSPDEV;
                dlg20.ShowDialog();
                break;

            case "73":
                frmDXdlg DX = new frmDXdlg();
                DX.DeviceMx = dev as PSPDEV;
                DX.isread   = true;
                DX.ShowDialog();
                break;

            case "75":
                frmLUXdlg LUX = new frmLUXdlg();
                LUX.DeviceMx = dev as PSPDEV;
                LUX.isread   = true;
                LUX.ShowDialog();
                break;

            case "71":
                frmRDQdlg dlg22 = new frmRDQdlg();
                dlg22.DeviceMx = dev as PSPDEV;
                dlg22.ShowDialog();
                break;

            case "76":

                break;
            }
            return(dev != null);
        }
Ejemplo n.º 5
0
        public override void Edit()
        {
            frmBYQ3dlg dlg = new frmBYQ3dlg();
            DataRow    row = gridView1.GetDataRow(gridView1.FocusedRowHandle);

            if (row != null)
            {
                PSPDEV dev = Itop.Common.DataConverter.RowToObject <PSPDEV>(row);
                if (dev.NodeType == "平衡节点")
                {
                    dev.NodeType = "0";
                }
                else if (dev.NodeType == "PQ节点")
                {
                    dev.NodeType = "1";
                }
                else if (dev.NodeType == "PV节点")
                {
                    dev.NodeType = "2";
                }
                if (dev.KSwitchStatus == "退出运行")
                {
                    dev.KSwitchStatus = "1";
                }
                else
                {
                    dev.KSwitchStatus = "0";
                }
                if (dev.UnitFlag == "p.u.")
                {
                    dev.UnitFlag = "0";
                }
                else
                {
                    dev.UnitFlag = "1";
                }
                dlg.DeviceMx    = dev;
                dlg.ProjectSUID = dev.ProjectID;
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    //更新记录
                    dev           = dlg.DeviceMx;
                    dev.ProjectID = this.ProjectID;
                    UCDeviceBase.DataService.Update <PSPDEV>(dev);
                    if (dev.NodeType == "0")
                    {
                        dev.NodeType = "平衡节点";
                    }
                    else if (dev.NodeType == "1")
                    {
                        dev.NodeType = "PQ节点";
                    }
                    else if (dev.NodeType == "2")
                    {
                        dev.NodeType = "PV节点";
                    }
                    else
                    {
                        dev.NodeType = null;
                    }
                    if (dev.KSwitchStatus == "1")
                    {
                        dev.KSwitchStatus = "退出运行";
                    }
                    else
                    {
                        dev.KSwitchStatus = "投入运行";
                    }
                    if (dev.UnitFlag == "0")
                    {
                        dev.UnitFlag = "p.u.";
                    }
                    else
                    {
                        if (dev.Type == "01" || dev.Type == "04" || dev.Type == "12")
                        {
                            dev.UnitFlag = "kV/MW/MVar";
                        }
                        else
                        {
                            dev.UnitFlag = "Ohm/10-6Siem";
                        }
                    }
                    Itop.Common.DataConverter.ObjectToRow(dev, row);
                    string sql = "S1='" + dev.Name + "'and S4='三绕组变压器'";
                    IList <Psp_Attachtable> ilist = UCDeviceBase.DataService.GetList <Psp_Attachtable>("SelectPsp_AttachtableByCont", sql);
                    if (ilist.Count > 0)
                    {
                        Psp_Attachtable pdr = ilist[0];
                        pdr.ZHI       = dev.SiN;
                        pdr.S3        = dev.OperationYear;
                        pdr.startYear = dev.Date1;
                        pdr.endYear   = dev.Date2;
                        UCDeviceBase.DataService.Update <Psp_Attachtable>(pdr);
                    }
                }
            }
        }
Ejemplo n.º 6
0
        public override void Add()
        {
            frmBYQ3dlg dlg = new frmBYQ3dlg();

            dlg.Name        = "";
            dlg.ProjectSUID = this.ProjectID;
            PSPDEV p = new PSPDEV();

            p.ProjectID = this.ProjectID;
            p.SvgUID    = ParentID;
            if (ParentObj is PSP_Substation_Info)
            {
                p.Name          = (ParentObj as PSP_Substation_Info).Title + "-变压器";
                p.OperationYear = (ParentObj as PSP_Substation_Info).S2;
                p.Date1         = (ParentObj as PSP_Substation_Info).S2;
                p.Date2         = (ParentObj as PSP_Substation_Info).L29;
            }
            else if (ParentObj is PSP_PowerSubstation_Info)
            {
                p.Name          = (ParentObj as PSP_PowerSubstation_Info).Title + "-变压器";
                p.OperationYear = (ParentObj as PSP_PowerSubstation_Info).S3;
                p.Date1         = (ParentObj as PSP_PowerSubstation_Info).S3;
                p.Date2         = (ParentObj as PSP_PowerSubstation_Info).S30;
            }

            dlg.DeviceMx = p;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                //增加记录
                PSPDEV dev = dlg.DeviceMx;
                dev.ProjectID = this.ProjectID;
                UCDeviceBase.DataService.Create("InsertPSPDEV", dev);
                DataRow row = datatable1.NewRow();
                if (dev.NodeType == "0")
                {
                    dev.NodeType = "平衡节点";
                }
                else if (dev.NodeType == "1")
                {
                    dev.NodeType = "PQ节点";
                }
                else if (dev.NodeType == "2")
                {
                    dev.NodeType = "PV节点";
                }
                else
                {
                    dev.NodeType = null;
                }
                if (dev.KSwitchStatus == "1")
                {
                    dev.KSwitchStatus = "退出运行";
                }
                else
                {
                    dev.KSwitchStatus = "投入运行";
                }
                if (dev.UnitFlag == "0")
                {
                    dev.UnitFlag = "p.u.";
                }
                else
                {
                    if (dev.Type == "01" || dev.Type == "04" || dev.Type == "12")
                    {
                        dev.UnitFlag = "kV/MW/MVar";
                    }
                    else
                    {
                        dev.UnitFlag = "Ohm/10-6Siem";
                    }
                }
                Itop.Common.DataConverter.ObjectToRow(dev, row);
                datatable1.Rows.Add(row);
            }
        }
Ejemplo n.º 7
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DataRow row = gridView1.GetDataRow(gridView1.FocusedRowHandle);

            if (row != null)
            {
                Psp_Attachtable     PD  = Itop.Common.DataConverter.RowToObject <Psp_Attachtable>(row);
                Psp_AttachtableEdit PDT = new Psp_AttachtableEdit();
                PDT.SateType = "修改";
                PDT.type     = Type;
                PDT.RowData  = PD;
                if (PDT.ShowDialog() == DialogResult.OK)
                {
                    Psp_Attachtable pdr = PDT.RowData;
                    Itop.Client.Common.Services.BaseService.Update <Psp_Attachtable>(pdr);
                    datatable.Rows.Remove(row);
                    ((DataTable)gridControl1.DataSource).Rows.Add(Itop.Common.DataConverter.ObjectToRow(pdr, datatable.NewRow()));
                    //datatable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(pdr, datatable.NewRow()));
                    string         con  = " where Type in ('02','03') AND  ProjectID ='" + Itop.Client.MIS.ProgUID + "'and Name='" + pdr.S1 + "'";
                    IList <PSPDEV> list = Services.BaseService.GetList <PSPDEV>("SelectPSPDEVByCondition", con);
                    if (list.Count > 0)
                    {
                        PSPDEV dv = list[0];
                        dv.Name          = pdr.S1;
                        dv.OperationYear = pdr.S3;
                        dv.Date1         = pdr.startYear;
                        dv.Date2         = pdr.endYear;
                        if (!string.IsNullOrEmpty(pdr.S4))
                        {
                            if (pdr.S4.Contains("三绕组"))
                            {
                                dv.SiN  = pdr.ZHI;
                                dv.X1   = pdr.D1;
                                dv.X2   = pdr.D2;
                                dv.Type = "03";
                            }
                            else
                            {
                                dv.Burthen  = (decimal)pdr.ZHI;
                                dv.HuganTQ1 = pdr.D1;
                                dv.HuganTQ2 = pdr.D2;
                                dv.Type     = "02";
                            }
                        }
                        else
                        {
                            dv.Burthen  = (decimal)pdr.ZHI;
                            dv.HuganTQ1 = pdr.D1;
                            dv.HuganTQ2 = pdr.D2;
                            dv.Type     = "02";
                        }

                        dv.ProjectID = Itop.Client.MIS.ProgUID;
                        if (MessageBox.Show("是否需要修改更详细的信息?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                        {
                            if (dv.Type == "02")
                            {
                                frmBYQ2dlg dlg = new frmBYQ2dlg();
                                dlg.DeviceMx = dv;
                                if (dlg.ShowDialog() == DialogResult.OK)
                                {
                                    dv = dlg.DeviceMx;
                                    Services.BaseService.Update <PSPDEV>(dv);
                                }
                            }
                            else
                            {
                                frmBYQ3dlg dlg = new frmBYQ3dlg();
                                dlg.DeviceMx = dv;
                                if (dlg.ShowDialog() == DialogResult.OK)
                                {
                                    dv = dlg.DeviceMx;
                                    Services.BaseService.Update <PSPDEV>(dv);
                                }
                            }
                        }
                    }
                    else
                    {
                        PSPDEV dv = new PSPDEV();
                        dv.Name          = pdr.S1;
                        dv.OperationYear = pdr.S3;
                        dv.Date1         = pdr.startYear;
                        dv.Date2         = pdr.endYear;
                        if (!string.IsNullOrEmpty(pdr.S4))
                        {
                            if (pdr.S4.Contains("三绕组"))
                            {
                                dv.SiN  = pdr.ZHI;
                                dv.X1   = pdr.D1;
                                dv.X2   = pdr.D2;
                                dv.Type = "03";
                            }
                            else
                            {
                                dv.Burthen  = (decimal)pdr.ZHI;
                                dv.HuganTQ1 = pdr.D1;
                                dv.HuganTQ2 = pdr.D2;
                                dv.Type     = "02";
                            }
                        }
                        else
                        {
                            dv.Burthen  = (decimal)pdr.ZHI;
                            dv.HuganTQ1 = pdr.D1;
                            dv.HuganTQ2 = pdr.D2;
                            dv.Type     = "02";
                        }

                        dv.ProjectID = Itop.Client.MIS.ProgUID;
                        dv.AreaID    = parentID;
                        if (MessageBox.Show("是否需要添加更详细的信息?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                        {
                            if (dv.Type == "02")
                            {
                                frmBYQ2dlg dlg = new frmBYQ2dlg();
                                dlg.DeviceMx = dv;
                                if (dlg.ShowDialog() == DialogResult.OK)
                                {
                                    dv = dlg.DeviceMx;
                                    Services.BaseService.Create <PSPDEV>(dv);
                                }
                            }
                            else
                            {
                                frmBYQ3dlg dlg = new frmBYQ3dlg();
                                dlg.DeviceMx = dv;
                                if (dlg.ShowDialog() == DialogResult.OK)
                                {
                                    dv = dlg.DeviceMx;
                                    Services.BaseService.Create <PSPDEV>(dv);
                                }
                            }
                        }
                    }

                    //gridControl1.DataSource = datatable;
                }
            }
        }
Ejemplo n.º 8
0
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Psp_AttachtableEdit PDT = new Psp_AttachtableEdit();

            if (string.IsNullOrEmpty(parentID))
            {
                Itop.Common.MsgBox.ShowYesNo("变电站或电源为空!");
                return;
            }
            // PDT.parentobj = ParentObj;
            Psp_Attachtable pdr = new Psp_Attachtable();

            pdr.Relatetable   = relatetable;
            pdr.RelatetableID = parentID;
            pdr.startYear     = startyear;
            pdr.endYear       = endyear;
            pdr.D1            = 1;
            pdr.D2            = 1;
            pdr.S2            = "新建";
            PDT.SateType      = "新建";
            pdr.S3            = DateTime.Now.Year.ToString();
            PDT.type          = Type;
            PDT.RowData       = pdr;
            if (PDT.ShowDialog() == DialogResult.OK)
            {
                pdr = PDT.RowData;

                Itop.Client.Common.Services.BaseService.Create <Psp_Attachtable>(pdr);
                //添加绕组变压器
                string         con  = " where Type in ('02','03') AND  ProjectID ='" + Itop.Client.MIS.ProgUID + "'and Name='" + pdr.S1 + "'";
                IList <PSPDEV> list = Services.BaseService.GetList <PSPDEV>("SelectPSPDEVByCondition", con);
                if (list.Count > 0)
                {
                    PSPDEV dv = list[0];
                    dv.OperationYear = pdr.S3;
                    dv.AreaID        = parentID;
                    dv.Date1         = pdr.startYear;
                    dv.Date2         = pdr.endYear;
                    if (dv.Type == "02")
                    {
                        dv.HuganTQ1 = pdr.D1;
                        dv.HuganTQ2 = pdr.D2;
                        dv.Burthen  = (decimal)pdr.ZHI;
                    }
                    else
                    {
                        dv.X1       = pdr.D1;
                        dv.X2       = pdr.D2;
                        dv.HuganTQ2 = pdr.D2;
                        dv.SiN      = pdr.ZHI;
                    }
                    Services.BaseService.Update <PSPDEV>(dv);
                }
                else
                {
                    PSPDEV dv = new PSPDEV();
                    dv.Name          = pdr.S1;
                    dv.OperationYear = pdr.S3;
                    dv.Date1         = pdr.startYear;
                    dv.Date2         = pdr.endYear;
                    if (!string.IsNullOrEmpty(pdr.S4))
                    {
                        if (pdr.S4.Contains("三绕组"))
                        {
                            dv.SiN  = pdr.ZHI;
                            dv.X1   = pdr.D1;
                            dv.X2   = pdr.D2;
                            dv.Type = "03";
                        }
                        else
                        {
                            dv.Burthen  = (decimal)pdr.ZHI;
                            dv.HuganTQ1 = pdr.D1;
                            dv.HuganTQ2 = pdr.D2;
                            dv.Type     = "02";
                        }
                    }
                    else
                    {
                        dv.Burthen  = (decimal)pdr.ZHI;
                        dv.HuganTQ1 = pdr.D1;
                        dv.HuganTQ2 = pdr.D2;
                        dv.Type     = "02";
                    }

                    dv.ProjectID = Itop.Client.MIS.ProgUID;
                    dv.AreaID    = parentID;
                    if (MessageBox.Show("是否需要添加更详细的信息?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                    {
                        if (dv.Type == "02")
                        {
                            frmBYQ2dlg dlg = new frmBYQ2dlg();
                            dlg.DeviceMx = dv;
                            if (dlg.ShowDialog() == DialogResult.OK)
                            {
                                dv = dlg.DeviceMx;
                                Services.BaseService.Create <PSPDEV>(dv);
                            }
                        }
                        else
                        {
                            frmBYQ3dlg dlg = new frmBYQ3dlg();
                            dlg.DeviceMx = dv;
                            if (dlg.ShowDialog() == DialogResult.OK)
                            {
                                dv = dlg.DeviceMx;
                                Services.BaseService.Create <PSPDEV>(dv);
                            }
                        }
                    }
                }

                //datatable.Rows.Add(Itop.Common.DataConverter.ObjectToRow(pdr, datatable.NewRow()));
                ((DataTable)gridControl1.DataSource).Rows.Add(Itop.Common.DataConverter.ObjectToRow(pdr, datatable.NewRow()));
                //gridControl1.DataSource = datatable;
            }
        }