예제 #1
0
 public override void Add()
 {
     frmDXdlg dlg = new frmDXdlg();
     dlg.ProjectSUID = this.ProjectID;
     dlg.newflag = true;
     dlg.Name = "";
     PSPDEV p = new PSPDEV();
     p.ProjectID = this.ProjectID;
     p.JName = ParentID;
     dlg.DeviceMx = p;
     if (dlg.ShowDialog() == DialogResult.OK) {
         //���Ӽ�¼
         PSPDEV dev = dlg.DeviceMx;
         dev.ProjectID = this.ProjectID;
         UCDeviceBase.DataService.Create("InsertPSPDEV", 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";
             }
         }
         DataRow row=datatable1.NewRow();
         Itop.Common.DataConverter.ObjectToRow(dev, row);
         datatable1.Rows.Add(row);
     }
 }
예제 #2
0
        public override void Edit()
        {
            frmDXdlg dlg = new frmDXdlg();
            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);
                }
            }
        }