protected void btnDeleteSelect_Click(object sender, EventArgs e) { if (Session["ZT_ADMIN"] == null) { Response.Redirect("Login.aspx"); } else { if (!Communal.CheckQx("ZhaoPinDelete.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("lblZhaoPinID"); int ZhaoPinID = Convert.ToInt32(ll.Text); WebProject.BLL.BaseData.ZT_COM_ZhaoPin bll_ZhaoPin = new WebProject.BLL.BaseData.ZT_COM_ZhaoPin(); DeleteTitle += bll_ZhaoPin.GetModel(ZhaoPinID).Position + ","; bll_ZhaoPin.Delete(ZhaoPinID); } } 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("ZhaoPinDelete.aspx")) { Response.Redirect("RightsWarn.aspx"); } else { //删除数据库的信息 Label ll = (Label)this.GridView1.Rows[e.RowIndex].Cells[1].FindControl("lblZhaoPinID"); int ZhaoPinID = Convert.ToInt32(ll.Text); WebProject.BLL.BaseData.ZT_COM_ZhaoPin bll_ZhaoPin = new WebProject.BLL.BaseData.ZT_COM_ZhaoPin(); LogManage.WriteLog(Request.UserHostAddress, "招聘管理", "删除招聘信息", "成功", "招聘职位:" + bll_ZhaoPin.GetModel(ZhaoPinID).Position + ", 删除人:" + SessionUtil.GetAdminSession().AdminNo); bll_ZhaoPin.Delete(ZhaoPinID); //重新加载信息 ShowData(); } } }