protected void btnDeleteSelect_Click(object sender, EventArgs e) { if (Session["ZT_ADMIN"] == null) { Response.Redirect("Login.aspx"); } else { if (!Communal.CheckQx("RenCaiDelete.aspx")) { Response.Redirect("RightsWarn.aspx"); } else { string DeleteTitle = ""; foreach (GridViewRow gr in this.GridView1.Rows) { CheckBox cb = (CheckBox)gr.Cells[1].FindControl("Select"); if (cb.Checked) { //删除数据库信息 Label ll = (Label)gr.Cells[1].FindControl("lblRenCaiID"); int RenCaiID = Convert.ToInt32(ll.Text); WebProject.BLL.BaseData.ZT_COM_RenCai bll_RenCai = new WebProject.BLL.BaseData.ZT_COM_RenCai(); DeleteTitle += bll_RenCai.GetModel(RenCaiID).Name + ","; bll_RenCai.Delete(RenCaiID); } } LogManage.WriteLog(Request.UserHostAddress, "人才管理", "删除人才", "成功", "人才名称:" + DeleteTitle.TrimEnd(',') + ", 操作人:" + SessionUtil.GetAdminSession().AdminNo); ShowData(); } } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { if (Session["ZT_ADMIN"] == null) { Response.Redirect("Login.aspx"); } else { if (!Communal.CheckQx("RenCaiDelete.aspx")) { Response.Redirect("RightsWarn.aspx"); } else { //删除数据库的信息 Label ll = (Label)this.GridView1.Rows[e.RowIndex].Cells[1].FindControl("lblRenCaiID"); int RenCaiID = Convert.ToInt32(ll.Text); WebProject.BLL.BaseData.ZT_COM_RenCai bll_RenCai = new WebProject.BLL.BaseData.ZT_COM_RenCai(); LogManage.WriteLog(Request.UserHostAddress, "人才管理", "删除人才", "成功", "人才名称:" + bll_RenCai.GetModel(RenCaiID).Name + ", 操作人:" + SessionUtil.GetAdminSession().AdminNo); bll_RenCai.Delete(RenCaiID); //重新加载信息 ShowData(); } } }