protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.hidDepartId.Value = ""; this.hidRoleId.Value = ""; this.hidRowsCount.Value = ""; if (Session["loginUser"] == null) { Response.Redirect("/admin/login.aspx"); return; } if (roleId > 0) { SysRole role = SysRoleService.GetSysRoleById(roleId); if (role != null) { this.lblRoleName.Text = role.RoleName; this.lblRoleDesc.Text = role.RoleDesc; Department depart = DepartmentService.GetDepartmentByID(role.DepartmentId); this.lblDepartment.Text = depart.Name; this.hidDepartId.Value = role.DepartmentId.ToString(); this.hidRoleId.Value = role.Id.ToString(); //加载权限树 LoadLevelTree(role.Id, role.DepartmentId); } } } }
/// <summary> /// 角色名称 /// </summary> /// <param name="roleId"></param> /// <returns></returns> protected string GetRoleName(object roleId) { int id = Convert.ToInt32(roleId); SysRole item = SysRoleService.GetSysRoleById(id); if (item != null) { return(item.RoleName); } else { return(""); } }