private void ShowDetails() { if (gridView1.FocusedRowHandle < 0) { return; } PowerEachList report = Itop.Common.DataConverter.RowToObject <PowerEachList>(gridView1.GetDataRow(gridView1.FocusedRowHandle)); Form7 frm = new Form7(report); //frm.CanEdit = base.EditRight; //frm.CanPrint = base.PrintRight; //frm.IsSelect = IsSelect; frm.Text = report.ListName + "年大用户数据统计分析"; frm.ADDRight = base.AddRight; frm.EDItRight = base.EditRight; frm.DELeteRight = base.DeleteRight; frm.PRIntRight = base.PrintRight; DialogResult dr = frm.ShowDialog(); // if (IsSelect && dr == DialogResult.OK) if (dr == DialogResult.OK) { //Title = report.Title; // Unit = "单位:万千瓦时"; Gcontrol = frm.Gcontrol; DialogResult = DialogResult.OK; } }
private void FormPlanTable_BigUser_Load(object sender, EventArgs e) { //this.Text="淮北供电公司2008--2010年110千伏及以上电网规划项目前期计划工作表"; HideToolBarButton(); PowerEachList report = new PowerEachList(); report.Types = typeFlag; IList listReports = Common.Services.BaseService.GetList("SelectPowerEachListList", report); dataTable = Itop.Common.DataConverter.ToDataTable(listReports, typeof(PowerEachList)); gridView1.BeginUpdate(); gridControl1.DataSource = dataTable; gridView1.Columns["UID"].Visible = false; gridView1.Columns["UID"].OptionsColumn.ShowInCustomizationForm = false; gridView1.Columns["ParentID"].Visible = false; gridView1.Columns["ParentID"].OptionsColumn.ShowInCustomizationForm = false; gridView1.Columns["Types"].Visible = false; gridView1.Columns["Types"].OptionsColumn.ShowInCustomizationForm = false; gridView1.Columns["ListName"].Caption = "项目计划表名称"; gridView1.Columns["ListName"].Width = 300; gridView1.Columns["CreateDate"].Caption = "创建日期"; gridView1.Columns["CreateDate"].Width = 80; gridView1.Columns["CreateDate"].VisibleIndex = 20; gridView1.Columns["Remark"].Caption = "备注"; gridView1.Columns["Remark"].VisibleIndex = 21; // gridView1.Columns["Remark"].Width = 150; gridView1.EndUpdate(); }
/// <summary> /// 修改焦点对象 /// </summary> public void UpdateObject() { //获取焦点对象 PowerEachList obj = FocusedObject; if (obj == null) { return; } //创建对象的一个副本 PowerEachList objCopy = new PowerEachList(); DataConverter.CopyTo <PowerEachList>(obj, objCopy); //执行修改操作 using (FrmPowerEachListDialog2 dlg = new FrmPowerEachListDialog2()) { dlg.Object = objCopy; //绑定副本 dlg.IsJSXM = isjsxm; dlg.IsBTN = isbtn; if (dlg.ShowDialog() != DialogResult.OK) { return; } } //用副本更新焦点对象 DataConverter.CopyTo <PowerEachList>(objCopy, obj); //刷新表格 gridControl.RefreshDataSource(); }
public void AddObjecta(string type) { //检查对象链表是否已经加载 if (ObjectList == null) { return; } //新建对象 PowerEachList obj = new PowerEachList(); obj.Types = type; //执行添加操作 using (FrmPowerEachListDialog2 dlg = new FrmPowerEachListDialog2()) { dlg.IsCreate = true; //设置新建标志 dlg.Object = obj; dlg.IsPower = true; dlg.IsJSXM = isjsxm; dlg.IsBTN = isbtn; if (dlg.ShowDialog() != DialogResult.OK) { return; } } //将新对象加入到链表中 ObjectList.Add(obj); //刷新表格,并将焦点行定位到新对象上。 gridControl.RefreshDataSource(); GridHelper.FocuseRow(this.gridView, obj); }
private void ShowDetails() { if (gridView1.FocusedRowHandle < 0) { return; } PowerEachList report = Itop.Common.DataConverter.RowToObject <PowerEachList>(gridView1.GetDataRow(gridView1.FocusedRowHandle)); FrmPlanTableInfo_HuanBei frm = new FrmPlanTableInfo_HuanBei(report); //frm.CanEdit = base.EditRight; //frm.CanPrint = base.PrintRight; //frm.IsSelect = IsSelect; frm.add = base.AddRight; frm.edit = base.EditRight; frm.delete = base.DeleteRight; frm.print = base.PrintRight; DialogResult dr = frm.ShowDialog(); // if (IsSelect && dr == DialogResult.OK) if (dr == DialogResult.OK) { //Title = report.Title; // Unit = "单位:万千瓦时"; Gcontrol = frm.Gcontrol; DialogResult = DialogResult.OK; } }
private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (gridView1.FocusedRowHandle < 0) { return; } if (!base.DeleteRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } if (MsgBox.ShowYesNo("是否删除 " + gridView1.GetDataRow(gridView1.FocusedRowHandle)["ListName"]) == DialogResult.No) { return; } PowerEachList report = Itop.Common.DataConverter.RowToObject <PowerEachList>(gridView1.GetDataRow(gridView1.FocusedRowHandle)); try { Common.Services.BaseService.Update("DeletePowerEachList_HuaiBei", report); gridView1.DeleteRow(gridView1.FocusedRowHandle); } catch (Exception ex) { MsgBox.Show("删除出错:" + ex.Message); } }
public FrmPlanTableInfo_HuanBei(PowerEachList ptable) { InitializeComponent(); plantable = ptable; typeflag = ptable.UID; dt = ptable.CreateDate; this.Text = ptable.ListName; }
private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (gridView1.FocusedRowHandle < 0) { return; } if (!base.DeleteRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } if (MsgBox.ShowYesNo("是否删除 " + gridView1.GetDataRow(gridView1.FocusedRowHandle)["ListName"]) == DialogResult.No) { return; } PowerEachList report = Itop.Common.DataConverter.RowToObject <PowerEachList>(gridView1.GetDataRow(gridView1.FocusedRowHandle)); try { PSP_VolumeBalance ob = new PSP_VolumeBalance(); ob.Flag = report.UID; if (typeFlag.Contains("110")) { ob.TypeID = "110"; } else if (typeFlag.Contains("220")) { ob.TypeID = "220"; } IList <PSP_VolumeBalance> list = Services.BaseService.GetList <PSP_VolumeBalance>("SelectPSP_VolumeBalanceByTypeID", ob); foreach (PSP_VolumeBalance listtemp in list) { Services.BaseService.Update("DeletePSP_VolumeBalance2", listtemp); } Common.Services.BaseService.Update("DeletePowerEachList_VolumeBalance", report); gridView1.DeleteRow(gridView1.FocusedRowHandle); } catch (Exception ex) { MsgBox.Show("删除出错:" + ex.Message); } }
public void DeleteObject() { //获取焦点对象 PowerEachList obj = FocusedObject; if (obj == null) { bl = false; return; } int coun = 0; //执行删除操作 try { Services.BaseService.Delete <PowerEachList>(obj); Services.BaseService.Update("DeletePowerPicSelect1", obj.UID); } catch { //Debug.Fail(exc.Message); //HandleException.TryCatch(exc); return; } this.gridView.BeginUpdate(); //记住当前焦点行索引 int iOldHandle = this.gridView.FocusedRowHandle; //从链表中删除 ObjectList.Remove(obj); //刷新表格 gridControl.RefreshDataSource(); //设置新的焦点行索引 GridHelper.FocuseRowAfterDelete(this.gridView, iOldHandle); this.gridView.EndUpdate(); }
/// <summary> /// 刷新表格中的数据 /// </summary> /// <returns>ture:成功 false:失败</returns> public bool RefreshData(string type) { try { //IList<PowerEachList> list = Services.BaseService.GetStrongList<PowerEachList>(); PowerEachList pe = new PowerEachList(); pe.Types = type; //IList<PowerEachList> list = Services.BaseService.GetStrongList<PowerEachList>(pe); IList <PowerEachList> list = Services.BaseService.GetList <PowerEachList>("SelectPowerEachListList", pe); this.gridControl.DataSource = list; } catch (Exception exc) { Debug.Fail(exc.Message); HandleException.TryCatch(exc); return(false); } return(true); }
private void EditReport() { if (gridView1.FocusedRowHandle < 0) { return; } if (!base.EditRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } PowerEachList report = Itop.Common.DataConverter.RowToObject <PowerEachList>(gridView1.GetDataRow(gridView1.FocusedRowHandle)); FormForecastReport_BigUser frm = new FormForecastReport_BigUser(); frm.IsEdit = true; frm.Psp_ForecastReport = report; frm.Text = "修改项目计划表"; if (frm.ShowDialog() == DialogResult.OK) { Itop.Common.DataConverter.ObjectToRow(frm.Psp_ForecastReport, gridView1.GetDataRow(gridView1.FocusedRowHandle)); } }
private void simpleButton1_Click(object sender, EventArgs e) { //if(textEdit1.Text == string.Empty) //{ // MsgBox.Show("请输入计划表名称!"); // return; //} if (_isEdit)//修改 { } else//新建 { psp_ForecastReport = new PowerEachList(); psp_ForecastReport.Types = _typeFlag; } psp_ForecastReport.ListName = spinEdit1.Text; DateTime dt = DateTime.Now; if (dateEdit1.Text == null || dateEdit1.Text == "") { dateEdit1.Text = dt.ToString(); } if (Convert.ToDateTime(dateEdit1.Text) > dt) { psp_ForecastReport.CreateDate = dt; } else { psp_ForecastReport.CreateDate = Convert.ToDateTime(dateEdit1.Text); } psp_ForecastReport.Remark = memoEdit1.Text; if (_isEdit) { try { Common.Services.BaseService.Update <PowerEachList>(psp_ForecastReport); } catch { MsgBox.Show("修改计划表出错!"); return; } } else { try { PowerEachList obj = (PowerEachList)Common.Services.BaseService.GetObject("SelectPowerEachListListByTypesAndListName", psp_ForecastReport); if (obj != null) { MsgBox.Show("已经存在此项目表名称!"); return; } Common.Services.BaseService.Create <PowerEachList>(psp_ForecastReport); PowerEachList oo = (PowerEachList)Common.Services.BaseService.GetObject("SelectPowerEachListListByTypesAndListName", psp_ForecastReport); } catch { MsgBox.Show("新建计划表出错!"); return; } } DialogResult = DialogResult.OK; }
private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (gridView1.FocusedRowHandle < 0) { return; } if (!base.DeleteRight) { MsgBox.Show("您没有权限进行此项操作!"); return; } if (MsgBox.ShowYesNo("是否删除 " + gridView1.GetDataRow(gridView1.FocusedRowHandle)["ListName"]) == DialogResult.No) { return; } PowerEachList report = Itop.Common.DataConverter.RowToObject <PowerEachList>(gridView1.GetDataRow(gridView1.FocusedRowHandle)); try { Common.Services.BaseService.Update("DeletePowerEachList_BigUser", report); PSP_BigUser_Types psp_Type = new PSP_BigUser_Types(); psp_Type.S2 = "S2 LIKE '%" + (Convert.ToInt32(report.ListName)) + "%' and ItemID=" + ItemID; IList listTypes = Common.Services.BaseService.GetList("SelectPSP_BigUser_TypesByItemID", psp_Type); foreach (PSP_BigUser_Types psp_Typetemp in listTypes) { psp_Type = psp_Typetemp; string[] yearitem = psp_Typetemp.S2.Split(','); if (yearitem.Length == 1) { //DeletePSP_ValuesByType里面删除数据和分类 Common.Services.BaseService.Delete <PSP_BigUser_Types>(psp_Typetemp); } else { psp_Type.S2 = ""; foreach (string strtemp in yearitem) { if (strtemp != report.ListName) { if (psp_Type.S2 == "") { psp_Type.S2 = strtemp; } else { psp_Type.S2 += "," + strtemp; } } } Common.Services.BaseService.Update <PSP_BigUser_Types>(psp_Type); } } gridView1.DeleteRow(gridView1.FocusedRowHandle); } catch (Exception ex) { MsgBox.Show("删除出错:" + ex.Message); } }
private void ShowDetails() { if (gridView1.FocusedRowHandle < 0) { return; } PowerEachList report = Itop.Common.DataConverter.RowToObject <PowerEachList>(gridView1.GetDataRow(gridView1.FocusedRowHandle)); FormPSP_VolumeBalance frm = new FormPSP_VolumeBalance(report); if (typeFlag.Contains("110")) { if (report.ListName.Contains("110千伏变电容量平衡表")) { frm.Text = report.ListName; } else { frm.Text = report.ListName + "110千伏变电容量平衡表"; } } else if (typeFlag.Contains("220")) { if (report.ListName.Contains("220千伏变电容量平衡表")) { frm.Text = report.ListName; } else { frm.Text = report.ListName + "220千伏变电容量平衡表"; } } else if (typeFlag.Contains("35")) { if (report.ListName.Contains("35千伏变电容量平衡表")) { frm.Text = report.ListName; } else { frm.Text = report.ListName + "35千伏变电容量平衡表"; } } frm.ADdRight = this.AddRight; frm.EDitRight = this.EditRight; frm.DEleteRight = this.DeleteRight; frm.PRintRight = this.PrintRight; //frm.Hide(); //DialogResult dr = frm.ShowDialog(); frm.Show(); // if (IsSelect && dr == DialogResult.OK) //if (dr == DialogResult.OK) //{ // //Title = report.Title; // // Unit = "单位:万千瓦时"; // //Gcontrol = frm.Gcontrol; // DialogResult = DialogResult.OK; //} }
private void simpleButton1_Click(object sender, EventArgs e) { if (textEdit1.Text == string.Empty) { MsgBox.Show("请输入计划表名称!"); return; } if (_isEdit)//修改 { } else//新建 { psp_ForecastReport = new PowerEachList(); psp_ForecastReport.Types = _typeFlag; } psp_ForecastReport.ListName = textEdit1.Text; DateTime dt = DateTime.Now; if (dateEdit1.Text == null || dateEdit1.Text == "") { dateEdit1.Text = dt.ToString(); } if (Convert.ToDateTime(dateEdit1.Text) > dt) { psp_ForecastReport.CreateDate = dt; } else { psp_ForecastReport.CreateDate = Convert.ToDateTime(dateEdit1.Text); } psp_ForecastReport.Remark = memoEdit1.Text; if (_isEdit) { try { Common.Services.BaseService.Update <PowerEachList>(psp_ForecastReport); } catch { MsgBox.Show("修改计划表出错!"); return; } } else { try { PSP_PlanTable_HuaiBei plan = new PSP_PlanTable_HuaiBei(); PowerEachList obj = (PowerEachList)Common.Services.BaseService.GetObject("SelectPowerEachListListByTypesAndListName", psp_ForecastReport); if (obj != null) { MsgBox.Show("已经存在此项目表名称!"); return; } Common.Services.BaseService.Create <PowerEachList>(psp_ForecastReport); PowerEachList oo = (PowerEachList)Common.Services.BaseService.GetObject("SelectPowerEachListListByTypesAndListName", psp_ForecastReport); DateTime dtt = new DateTime(); dtt = DateTime.Now; plan.UID = Guid.NewGuid().ToString(); plan.Title = "时间间隔"; plan.Flag2 = oo.UID; plan.ParentID = "0"; plan.KeyFlag = "time1"; plan.ItemSB = "0"; plan.ItemPF = "0"; plan.KYWC = "0"; plan.KYPS = "0"; plan.PSYJ = "0"; // plan.CSSC = "0"; // plan.JSGFSSB = "0"; // plan.ZBSB = "0"; // plan.ZBSHDateTime = "0"; ////plan.CSSC = DateTime.Now; ////plan.JSGFSSB = DateTime.Now; ////plan.ZBSB = DateTime.Now; ////plan.ZBSHDateTime = DateTime.Now; plan.XZYJS = "0"; plan.HPPF = "0"; plan.TDYS = "0"; plan.SBHZSQ = "0"; plan.XMHZ = "0"; plan.JHKSDateTime = "0"; plan.JHTCDateTime = "0"; //plan.JHTCDateTime_GuiHua = DateTime.Now; plan.CreateDate = dtt.AddSeconds(1); Common.Services.BaseService.Create <PSP_PlanTable_HuaiBei>(plan); plan.UID = Guid.NewGuid().ToString(); plan.Title = "220千伏输变电工程"; plan.Flag2 = oo.UID; plan.ParentID = "0"; plan.KeyFlag = "220"; plan.ItemSB = ""; plan.ItemPF = ""; plan.KYWC = ""; plan.KYPS = ""; plan.PSYJ = ""; //plan.CSSC = DateTime.Now; //plan.JSGFSSB = DateTime.Now; //plan.ZBSB = DateTime.Now; //plan.ZBSHDateTime = DateTime.Now; plan.XZYJS = ""; plan.HPPF = ""; plan.TDYS = ""; plan.SBHZSQ = ""; plan.XMHZ = ""; plan.JHKSDateTime = ""; plan.JHTCDateTime = ""; plan.JHTCDateTime_GuiHua = DateTime.Now; plan.CreateDate = dtt.AddSeconds(2); Common.Services.BaseService.Create <PSP_PlanTable_HuaiBei>(plan); plan.UID = Guid.NewGuid().ToString(); plan.Title = "时间间隔"; plan.Flag2 = oo.UID; plan.ParentID = "0"; plan.KeyFlag = "time2"; plan.ItemSB = "0"; plan.ItemPF = "0"; plan.KYWC = "0"; plan.KYPS = "0"; plan.PSYJ = "0"; //plan.CSSC = DateTime.Now; //plan.JSGFSSB = DateTime.Now; //plan.ZBSB = DateTime.Now; //plan.ZBSHDateTime = DateTime.Now; plan.XZYJS = "0"; plan.HPPF = "0"; plan.TDYS = "0"; plan.SBHZSQ = "0"; plan.XMHZ = "0"; plan.JHKSDateTime = "0"; plan.JHTCDateTime = "0"; plan.JHTCDateTime_GuiHua = null; plan.CreateDate = dtt.AddSeconds(3); Common.Services.BaseService.Create <PSP_PlanTable_HuaiBei>(plan); plan.UID = Guid.NewGuid().ToString(); plan.Title = "110千伏输变电工程"; plan.Flag2 = oo.UID; plan.ParentID = "0"; plan.KeyFlag = "110"; plan.ItemSB = ""; plan.ItemPF = ""; plan.KYWC = ""; plan.KYPS = ""; plan.PSYJ = ""; //plan.CSSC = DateTime.Now; //plan.JSGFSSB = DateTime.Now; //plan.ZBSB = DateTime.Now; //plan.ZBSHDateTime = DateTime.Now; plan.XZYJS = ""; plan.HPPF = ""; plan.TDYS = ""; plan.SBHZSQ = ""; plan.XMHZ = ""; plan.JHKSDateTime = ""; plan.JHTCDateTime = ""; plan.JHTCDateTime_GuiHua = DateTime.Now; plan.CreateDate = dtt.AddSeconds(4); Common.Services.BaseService.Create <PSP_PlanTable_HuaiBei>(plan); plan.UID = Guid.NewGuid().ToString(); plan.Title = "时间间隔"; plan.Flag2 = oo.UID; plan.ParentID = "0"; plan.KeyFlag = "time3"; plan.ItemSB = "0"; plan.ItemPF = "0"; plan.KYWC = "0"; plan.KYPS = "0"; plan.PSYJ = "0"; //plan.CSSC = DateTime.Now; //plan.JSGFSSB = DateTime.Now; //plan.ZBSB = DateTime.Now; //plan.ZBSHDateTime = DateTime.Now; plan.XZYJS = "0"; plan.HPPF = "0"; plan.TDYS = "0"; plan.SBHZSQ = "0"; plan.XMHZ = "0"; plan.JHKSDateTime = "0"; plan.JHTCDateTime = "0"; plan.JHTCDateTime_GuiHua = null; plan.CreateDate = dtt.AddSeconds(5); Common.Services.BaseService.Create <PSP_PlanTable_HuaiBei>(plan); plan.UID = Guid.NewGuid().ToString(); plan.Title = "扩建工程"; plan.Flag2 = oo.UID; plan.ParentID = "0"; plan.KeyFlag = "kuojian"; plan.ItemSB = ""; plan.ItemPF = ""; plan.KYWC = ""; plan.KYPS = ""; plan.PSYJ = ""; //plan.CSSC = DateTime.Now; //plan.JSGFSSB = DateTime.Now; //plan.ZBSB = DateTime.Now; //plan.ZBSHDateTime = DateTime.Now; plan.XZYJS = ""; plan.HPPF = ""; plan.TDYS = ""; plan.SBHZSQ = ""; plan.XMHZ = ""; plan.JHKSDateTime = ""; plan.JHTCDateTime = ""; plan.JHTCDateTime_GuiHua = DateTime.Now; plan.CreateDate = dtt.AddSeconds(6); Common.Services.BaseService.Create <PSP_PlanTable_HuaiBei>(plan); plan.UID = Guid.NewGuid().ToString(); plan.Title = "220千伏部分"; plan.Flag2 = oo.UID; plan.ParentID = "0"; plan.KeyFlag = "220千伏"; plan.ItemSB = ""; plan.ItemPF = ""; plan.KYWC = ""; plan.KYPS = ""; plan.PSYJ = ""; //plan.CSSC = DateTime.Now; //plan.JSGFSSB = DateTime.Now; //plan.ZBSB = DateTime.Now; //plan.ZBSHDateTime = DateTime.Now; plan.XZYJS = ""; plan.HPPF = ""; plan.TDYS = ""; plan.SBHZSQ = ""; plan.XMHZ = ""; plan.JHKSDateTime = ""; plan.JHTCDateTime = ""; plan.JHTCDateTime_GuiHua = null; plan.CreateDate = dtt.AddSeconds(7); Common.Services.BaseService.Create <PSP_PlanTable_HuaiBei>(plan); plan.UID = Guid.NewGuid().ToString(); plan.Title = "110千伏部分"; plan.Flag2 = oo.UID; plan.ParentID = "0"; plan.KeyFlag = "110千伏"; plan.ItemSB = ""; plan.ItemPF = ""; plan.KYWC = ""; plan.KYPS = ""; plan.PSYJ = ""; //plan.CSSC = DateTime.Now; //plan.JSGFSSB = DateTime.Now; //plan.ZBSB = DateTime.Now; //plan.ZBSHDateTime = DateTime.Now; plan.XZYJS = ""; plan.HPPF = ""; plan.TDYS = ""; plan.SBHZSQ = ""; plan.XMHZ = ""; plan.JHKSDateTime = ""; plan.JHTCDateTime = ""; plan.JHTCDateTime_GuiHua = null; plan.CreateDate = dtt.AddSeconds(8); Common.Services.BaseService.Create <PSP_PlanTable_HuaiBei>(plan); } catch { MsgBox.Show("新建计划表出错!"); return; } } DialogResult = DialogResult.OK; }
/// <summary> /// 删除焦点对象 /// </summary> public void DeleteObject(string lb) { //获取焦点对象 PowerEachList obj = FocusedObject; if (obj == null) { bl = false; return; } int coun = 0; switch (lb) { case "xuqiu": PowerTypes pt = new PowerTypes(); pt.Flag2 = obj.UID; IList <PowerTypes> li = Services.BaseService.GetList <PowerTypes>("SelectPowerTypesByFlag2", pt); coun = li.Count; break; case "xihua": PowerProjectTypes pt1 = new PowerProjectTypes(); pt1.Flag2 = obj.UID; IList <PowerProjectTypes> li1 = Services.BaseService.GetList <PowerProjectTypes>("SelectPowerProjectTypesByFlag2", pt1); coun = li1.Count; break; case "shebei": PowerStuffTypes pt2 = new PowerStuffTypes(); pt2.Flag2 = obj.UID; IList <PowerStuffTypes> li2 = Services.BaseService.GetList <PowerStuffTypes>("SelectPowerStuffTypesByFlag2", pt2); coun = li2.Count; break; case "fanwei": PowersTypes pt3 = new PowersTypes(); pt3.Flag2 = obj.UID; IList <PowersTypes> li3 = Services.BaseService.GetList <PowersTypes>("SelectPowersTypesByFlag2", pt3); coun = li3.Count; break; case "sb": PowerProTypes pt4 = new PowerProTypes(); pt4.Flag2 = obj.UID; IList <PowerProTypes> li4 = Services.BaseService.GetList <PowerProTypes>("SelectPowerProTypesByFlag2INParent", pt4); coun = li4.Count; break; case "gusuan": PSP_PowerProValues_LangFang pt5 = new PSP_PowerProValues_LangFang(); pt5.Flag2 = obj.UID; IList <PSP_PowerProValues_LangFang> li5 = Services.BaseService.GetList <PSP_PowerProValues_LangFang>("SelectPSP_PowerProValues_LangFangByFlag2INParent", pt5); coun = li5.Count; break; } if (coun > 0) { MsgBox.Show("该分类下面有记录,无法删除"); bl = false; return; } //请求确认 if (MsgBox.ShowYesNo(Strings.SubmitDelete) != DialogResult.Yes) { bl = false; return; } //执行删除操作 try { Services.BaseService.Delete <PowerEachList>(obj); if (lb == "sb") { Services.BaseService.Update("DeletePowerPicSelect1", obj.UID); Services.BaseService.Update("DeletePowerProTypesInFlag2", obj.UID); } if (lb == "gusuan") { Services.BaseService.Update("DeletePowerPicSelect1", obj.UID); Services.BaseService.Update("DeletePowerProTypesInFlag2", obj.UID); } } catch { //Debug.Fail(exc.Message); //HandleException.TryCatch(exc); return; } this.gridView.BeginUpdate(); //记住当前焦点行索引 int iOldHandle = this.gridView.FocusedRowHandle; //从链表中删除 ObjectList.Remove(obj); //刷新表格 gridControl.RefreshDataSource(); //设置新的焦点行索引 GridHelper.FocuseRowAfterDelete(this.gridView, iOldHandle); this.gridView.EndUpdate(); }