public override void Add() { //frmDLQdlg dlg = new frmDLQdlg(); //dlg.Name = ""; //if (dlg.ShowDialog() == DialogResult.OK) { // //���Ӽ�¼ // PSPDEV dev = dlg.DeviceMx; // dev.ProjectID = this.ProjectID; // UCDeviceBase.DataService.Create("InsertPSPDEV", dev); // DataRow row=datatable1.NewRow(); // Itop.Common.DataConverter.ObjectToRow(dev, row); // datatable1.Rows.Add(row); //} AddDlqiform dlg = new AddDlqiform(); PSPDEV pd = new PSPDEV(); pd.Type = "06"; pd.IName = ParentID; pd.ProjectID = this.ProjectID; dlg.DeviceMx = pd; 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); } }
public override void Edit() { AddDlqiform dlg = new AddDlqiform(); 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); } } }
public override void Edit() { AddDlqiform dlg = new AddDlqiform(); 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); } } }
public override void Add() { //frmDLQdlg dlg = new frmDLQdlg(); //dlg.Name = ""; //if (dlg.ShowDialog() == DialogResult.OK) { // //增加记录 // PSPDEV dev = dlg.DeviceMx; // dev.ProjectID = this.ProjectID; // UCDeviceBase.DataService.Create("InsertPSPDEV", dev); // DataRow row=datatable1.NewRow(); // Itop.Common.DataConverter.ObjectToRow(dev, row); // datatable1.Rows.Add(row); //} AddDlqiform dlg = new AddDlqiform(); PSPDEV pd = new PSPDEV(); pd.Type = "06"; pd.IName = ParentID; pd.ProjectID = this.ProjectID; dlg.DeviceMx = pd; 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); } }