protected void BandInfo(int id) { ShowShop.BLL.Member.Role bll = new ShowShop.BLL.Member.Role(); ShowShop.Model.Member.Role model = bll.GetModelID(id); this.txtRoleName.Text = model.Name; this.txtDescription.Text = model.Description; ViewState["ID"] = model.ID; }
/// <summary> /// 保存信息 /// </summary> protected void Save() { ShowShop.BLL.Member.Role bll = new ShowShop.BLL.Member.Role(); ShowShop.Model.Member.Role model = new ShowShop.Model.Member.Role(); model.Name =this.txtRoleName.Text.Trim(); model.Description =this.txtDescription.Text.Trim(); if (ViewState["ID"] != null) { model.ID = int.Parse(ViewState["ID"].ToString()); bll.Amend(model); this.ltlMsg.Text = "操作成功,已保存该信息"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; } else { bll.Create(model); this.ltlMsg.Text = "操作成功,已保存该信息"; this.pnlMsg.Visible = true; this.pnlMsg.CssClass = "actionOk"; } }
/// <summary> /// 列表 /// </summary> /// <returns></returns> protected string GetList() { ShowShop.Common.SysParameter sp = new ShowShop.Common.SysParameter(); ChangeHope.WebPage.Table table = new ChangeHope.WebPage.Table(); ShowShop.BLL.Member.Role data = new ShowShop.BLL.Member.Role(); ChangeHope.DataBase.DataByPage dataPage = data.GetList(); //第一步先添加表头 table.AddHeadCol("10%", "序号"); table.AddHeadCol("25%", "角色名"); table.AddHeadCol("40%", "描述"); table.AddHeadCol("25%", "操作"); table.AddRow(); //添加表的内容 if (dataPage.DataReader != null) { int curpage = ChangeHope.WebPage.PageRequest.GetInt("pageindex"); if (curpage < 0) { curpage = 1; } int count = 0; while (dataPage.DataReader.Read()) { count++; string No = (15 * (curpage - 1) + count).ToString(); table.AddCol("No."+No); table.AddCol( dataPage.DataReader["name"].ToString() ); table.AddCol(dataPage.DataReader["description"].ToString()); table.AddCol(string.Format("<a href=role_edit.aspx?id={0}>编辑</a> <a href='role_setmember.aspx?id={0}'>设置成员</a> <a href='popedom_manage.aspx?id={0}'>权限管理</a> <a href='#' onclick='Del({0})'>删除</a>", dataPage.DataReader["id"].ToString())); table.AddRow(); } } string view = table.GetTable() + dataPage.PageToolBar; dataPage.Dispose(); dataPage = null; return view; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ShowShop.Common.PromptInfo.Popedom("007002006","对不起,您没有权限进行设置"); int roleid = ChangeHope.WebPage.PageRequest.GetQueryInt("id"); if (roleid > 0) { ViewState["RoleId"] = roleid; ShowShop.BLL.Member.Role bll = new ShowShop.BLL.Member.Role(); ShowShop.Model.Member.Role model = bll.GetModelID(roleid); if (model != null) { this.lbRoleName.Text = model.Name; this.lbRoleDescription.Text = model.Description; this.BindInfo(roleid.ToString()); } } } }
private void del(int id) { ShowShop.BLL.Member.Role bll = new ShowShop.BLL.Member.Role(); if (bll.Delete(id) > 0) { Response.Write("ok"); } }