private void toolDelete_Click(object sender, EventArgs e) { int id = int.Parse(this.dgvKeepPlace.SelectedRows[0].Cells["编号"].Value.ToString()); if (untCommon.QuestionMsg("您确定要删除选中的保存地点吗?")) { if (KeepPlaceMgr.Del(id)) { untCommon.InfoMsg("删除成功"); fresh(); } else { untCommon.InfoMsg("删除失败"); } } }
/// <summary> /// 删除选中的项 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDel_Click(object sender, EventArgs e) { if (lstInfo.SelectedIndex == -1) { untCommon.InfoMsg("请选择所要删除的项。"); return; } switch (this.lblMessge.Text) { case "增长方式": //删除增长方式 if (untCommon.QuestionMsg("确定要删除该项吗")) { if (AddTypeMgr.Del(int.Parse(lstInfo.SelectedValue.ToString()))) { btnAddType_Click(null, null); } else { untCommon.InfoMsg("删除失败"); } } break; case "资产名称": //删除资产名称 if (untCommon.QuestionMsg("确定要删除该项吗")) { if (EqNameMgr.Del(int.Parse(lstInfo.SelectedValue.ToString()))) { btnName_Click(null, null); } else { untCommon.InfoMsg("删除失败"); } } break; case "保管地点": //删除保管地点 if (untCommon.QuestionMsg("确定要删除该项吗")) { if (KeepPlaceMgr.Del(int.Parse(lstInfo.SelectedValue.ToString()))) { btnKeepPlace_Click(null, null); } else { untCommon.InfoMsg("删除失败"); } } break; case "计量单位": //删除计量单位 if (untCommon.QuestionMsg("确定要删除该项吗")) { if (UnitMgr.Del(int.Parse(lstInfo.SelectedValue.ToString()))) { btnUnit_Click(null, null); } else { untCommon.InfoMsg("删除失败"); } } break; case "清理方式": //删除清理方式 if (untCommon.QuestionMsg("确定要删除该项吗")) { if (ClearTypeMgr.Del(int.Parse(lstInfo.SelectedValue.ToString()))) { btnClearType_Click(null, null); } else { untCommon.InfoMsg("删除失败"); } } break; case "资产类别": //添加增长方式 if (untCommon.QuestionMsg("确定要删除该项吗")) { if (EqTypeMgr.Del(int.Parse(lstInfo.SelectedValue.ToString()))) { btnTyp_Click(null, null); } else { untCommon.InfoMsg("删除失败"); } } break; } }