public override void Add() { frmBDZdlg dlg = new frmBDZdlg(); dlg.ProjectID = Itop.Client.MIS.ProgUID; dlg.Name = ""; dlg.CsbuttonVisble(true); dlg.IsRead = false; if (dlg.ShowDialog() == DialogResult.OK) { //���Ӽ�¼ PSP_Substation_Info dev = dlg.DeviceMx; dev.AreaID = Itop.Client.MIS.ProgUID; if (dlg.bcflag) //�ڵ���豸������ʱ�� �Ѿ������˱��� { DataService.Update<PSP_Substation_Info>(dev); } else DataService.Create<PSP_Substation_Info>(dev); DataRow row = datatable1.NewRow(); Itop.Common.DataConverter.ObjectToRow(dev, row); datatable1.Rows.Add(row); } else { if (dlg.bcflag) { PSP_Substation_Info dev = dlg.DeviceMx; dev.AreaID = Itop.Client.MIS.ProgUID; DataService.Update<PSP_Substation_Info>(dev); DataRow row = datatable1.NewRow(); Itop.Common.DataConverter.ObjectToRow(dev, row); datatable1.Rows.Add(row); } } }
public override void Edit() { frmBDZdlg dlg = new frmBDZdlg(); dlg.CsbuttonVisble(true); DataRow row = gridView1.GetDataRow(gridView1.FocusedRowHandle); if (row != null) { PSP_Substation_Info dev = Itop.Common.DataConverter.RowToObject <PSP_Substation_Info>(row); dlg.DeviceMx = dev; dlg.IsRead = false; if (dlg.ShowDialog() == DialogResult.OK) { //更新记录 dev = dlg.DeviceMx; dev.AreaID = Itop.Client.MIS.ProgUID; DataService.Update <PSP_Substation_Info>(dev); Itop.Common.DataConverter.ObjectToRow(dev, row); } } }
public override void Add() { frmBDZdlg dlg = new frmBDZdlg(); dlg.ProjectID = Itop.Client.MIS.ProgUID; dlg.Name = ""; dlg.CsbuttonVisble(true); dlg.IsRead = false; if (dlg.ShowDialog() == DialogResult.OK) { //增加记录 PSP_Substation_Info dev = dlg.DeviceMx; dev.AreaID = Itop.Client.MIS.ProgUID; if (dlg.bcflag) //在点击设备参数的时候 已经进行了保存 { DataService.Update <PSP_Substation_Info>(dev); } else { DataService.Create <PSP_Substation_Info>(dev); } DataRow row = datatable1.NewRow(); Itop.Common.DataConverter.ObjectToRow(dev, row); datatable1.Rows.Add(row); } else { if (dlg.bcflag) { PSP_Substation_Info dev = dlg.DeviceMx; dev.AreaID = Itop.Client.MIS.ProgUID; DataService.Update <PSP_Substation_Info>(dev); DataRow row = datatable1.NewRow(); Itop.Common.DataConverter.ObjectToRow(dev, row); datatable1.Rows.Add(row); } } }
public override void Edit() { frmBDZdlg dlg = new frmBDZdlg(); dlg.CsbuttonVisble(true); DataRow row = gridView1.GetDataRow(gridView1.FocusedRowHandle); if (row != null) { PSP_Substation_Info dev = Itop.Common.DataConverter.RowToObject<PSP_Substation_Info>(row); dlg.DeviceMx = dev; dlg.IsRead = false; if (dlg.ShowDialog() == DialogResult.OK) { //���¼�¼ dev = dlg.DeviceMx; dev.AreaID = Itop.Client.MIS.ProgUID; DataService.Update<PSP_Substation_Info>(dev); Itop.Common.DataConverter.ObjectToRow(dev, row); } } }