/// <summary> /// 删除操作 /// </summary> protected void rpt_roleList_ItemCommand(object source, RepeaterCommandEventArgs e) { HiddenField hfGetId = (HiddenField)e.Item.FindControl("hfGetId"); int id = Tools.StringHelp.GetInt(hfGetId.Value); if (e.CommandName == "del") { try { if (common.Delete("tb_sys_role", id)) { DataBind_role(); foreach (RepeaterItem rpItem in rpt_roleList.Items) { LinkButton lbbDel = (LinkButton)rpItem.FindControl("lblDelete"); lbbDel.Attributes.Add("onclick", "if(!confirm('确定删除?')) return false;"); } } } catch (Exception ex) { FinalMessage("删除失败" + ex.Message, "Manage_Role.aspx", 1); } } }
/// <summary> /// 删除 /// </summary> /// <param name="source"></param> /// <param name="e"></param> protected void rpt_Menu_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "del") { HiddenField hfGetId = (HiddenField)e.Item.FindControl("hfGetId"); int id = Tools.StringHelp.GetInt(hfGetId.Value); try { if (common.Delete("tb_sys_sysmenu", id)) { this.rpt_Menu.DataSource = GetInfoDS(); this.rpt_Menu.DataBind(); //刷新左边的菜单 Page.ClientScript.RegisterStartupScript(this.Page.GetType(), Guid.NewGuid().ToString(), "top.FreshMenu();", true); } } catch (Exception ex) { FinalMessage("删除失败" + ex.Message, "Manage_Menu.aspx", 1); } } }
/// <summary> /// 按钮操作 /// </summary> protected void rpt_Mod_ItemCommand(object source, RepeaterCommandEventArgs e) { Test_BUL.sys_Common common = new Test_BUL.sys_Common(); HiddenField hfGetId = (HiddenField)e.Item.FindControl("hfGetId"); int id = Tools.StringHelp.GetInt(hfGetId.Value); if (e.CommandName == "freeze") { try { if (common.ExecuteSql(" update tb_sys_admin set AccountState=20 where id=" + id) > 0) { DataBind_role(); foreach (RepeaterItem rpItem in rpt_Mod.Items) { LinkButton lbbDel = (LinkButton)rpItem.FindControl("lblfreeze"); lbbDel.Attributes.Add("onclick", "if(!confirm('确定禁用吗?')) return false;"); } } } catch (Exception ex) { Response.Write("<script>alert('冻结失败:" + ex.Message + "');</script>"); } } if (e.CommandName == "open") { try { if (common.ExecuteSql(" update tb_sys_admin set AccountState=10 where id=" + id) > 0) { DataBind_role(); foreach (RepeaterItem rpItem in rpt_Mod.Items) { LinkButton lbbDel = (LinkButton)rpItem.FindControl("lblopen"); lbbDel.Attributes.Add("onclick", "if(!confirm('确定启用吗?')) return false;"); } } } catch (Exception ex) { Response.Write("<script>alert('启用失败:" + ex.Message + "');</script>"); } } if (e.CommandName == "del") { try { if (common.Delete("tb_sys_admin", id)) { DataBind_role(); foreach (RepeaterItem rpItem in rpt_Mod.Items) { LinkButton lbbDel = (LinkButton)rpItem.FindControl("lblDelete"); lbbDel.Attributes.Add("onclick", "if(!confirm('确定删除吗?')) return false;"); } } } catch (Exception ex) { FinalMessage("删除失败" + ex.Message, "Manage_SysUser.aspx", 1); } } }