/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void LinkButton1_Command(object sender, CommandEventArgs e) { int num = 0; switch (e.CommandName) { case "delete": int roleGroupId = Convert.ToInt32(e.CommandArgument); num = roleGroupBll.DeleteRoleGroup(roleGroupId); if (num > 0) { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('删除成功!');location.href='ShowRoleList.aspx'", true); } else { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('删除失败!');location.href='ShowRoleList.aspx'", true); } break; case "Edit": Response.Redirect("AddRoleGrop.aspx?RoleID=" + Convert.ToInt32(e.CommandArgument.ToString().Trim()) + "&name=" + e.CommandName.ToString().Trim()); break; case "IsKai": string Id = e.CommandArgument.ToString().Trim(); int Check = (roleGroupBll.GetRoleGroupById(Id)).SCheck; int SCheck = Check == 1?0:1; roleGroupBll.UPdateRoleGroupSCheck(Id, SCheck); this.dataBin(); break; default: break; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString.Count > 0) { RoleGroupBLL roleGroupBll = new RoleGroupBLL(); int roleGroupId = Convert.ToInt32(Request.QueryString["Id"]); int num = roleGroupBll.DeleteRoleGroup(roleGroupId); if (num > 0) { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('删除成功!');location.href='ShowRoleList.aspx'", true); } else { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('删除失败!');location.href='ShowRoleList.aspx'", true); } } } }