protected void btnSave_Click(object sender, EventArgs e) { string strWhere = " RoleName='" + txtRoleName.Text + "'"; string adduser = Session["uLoginName"].ToString(); int rid = 0; DataSet ds = bll_ri.GetRoleList(strWhere, rid); if (ds.Tables[0].Rows.Count > 0) { Model.Sys_RoleInfo model_ri = new Model.Sys_RoleInfo(); model_ri.RoleID = int.Parse(Request.QueryString["RoleID"].ToString()); model_ri.RoleName = txtRoleName.Text; model_ri.RoleDesc = getCheckBoxListValue(); if (bll_ri.EditRole(model_ri) > 0) { lblMsg.InnerHtml = "<script type='text/javascript'>alert('修改成功!');window.location='RoleList.aspx'</script>"; } else { lblMsg.InnerHtml = "<script type='text/javascript'>alert('修改失败!');</script>"; } } else { lblMsg.InnerHtml = "<script type='text/javascript'>alert('该角色名称不存在!');</script>"; } }
protected void btnSave_Click(object sender, EventArgs e) { string strWhere = " RoleName='" + txtRoleName.Text + "'"; string adduser = Session["uLoginName"].ToString(); int roleId = 0; DataSet ds = bll_ri.GetRoleList(strWhere, roleId); if (ds.Tables[0].Rows.Count > 0) { lblMsg.InnerHtml = "<script type='text/javascript'>alert('该角色名称已经存在!');</script>"; } else { Model.Sys_RoleInfo model_ri = new Model.Sys_RoleInfo(); model_ri.RoleName = txtRoleName.Text; model_ri.RoleDesc = getCheckBoxListValue(); model_ri.WriteRight = "1"; model_ri.AddTime = DateTime.Now; model_ri.AddUser = adduser; if (bll_ri.AddNewRole(model_ri) > 0) { lblMsg.InnerHtml = "<script type='text/javascript'>alert('添加成功!');window.location='Manage_Role.aspx'</script>"; } } }
/// <summary> /// 获取数据 /// </summary> /// <returns></returns> public DataSet GetInfoDS() { BLL.Sys_RoleInfoBLL bll_ri = new BLL.Sys_RoleInfoBLL(); int roleId = int.Parse(Session["RoleID"].ToString()); //strWhere = " RoleID="+roleId+""; DataSet ds = new DataSet(); ds = bll_ri.GetRoleList(strWhere, roleId); if (ds.Tables[0].Rows.Count > 0) { return(ds); } else { return(null); } }
/// <summary> /// 获取数据 /// </summary> /// <returns></returns> public DataSet GetRoleList() { BLL.Sys_RoleInfoBLL bll_ri = new BLL.Sys_RoleInfoBLL(); int rid = 0; //0.查询角色表; -1.查询角色菜单映射表 strWhere = ""; DataSet ds = bll_ri.GetRoleList(strWhere, rid); if (ds.Tables[0].Rows.Count > 0) { return(ds); } else { return(null); } }
/// <summary> /// 获取数据 /// </summary> /// <returns></returns> public void GetRoleList() { BLL.Sys_RoleInfoBLL bll_ri = new BLL.Sys_RoleInfoBLL(); int rid = 0; //0.查询角色表; -1.查询角色菜单映射表 strWhere = ""; DataSet ds = bll_ri.GetRoleList(strWhere, rid); if (ds.Tables[0].Rows.Count > 0) { rolename = Session["RoleID"].ToString(); this.ddl_RoleList.DataSource = ds; this.ddl_RoleList.DataTextField = "RoleName"; this.ddl_RoleList.DataValueField = "RoleID"; this.ddl_RoleList.DataBind(); ListItem item_role = ddl_RoleList.Items.FindByValue(rolename); if (item_role != null) { item_role.Selected = true; } } }