protected void Page_Load(object sender, EventArgs e)
        {
            rBll = new ManagerRoleService();
            string _action = MXRequest.GetQueryString("action");

            this.id = MXRequest.GetQueryInt("id");

            if (!string.IsNullOrEmpty(_action) && _action == MXEnums.ActionEnum.Edit.ToString())
            {
                this.action = MXEnums.ActionEnum.Edit.ToString();//修改类型
                if (this.id == 0)
                {
                    JscriptMsg("传输参数不正确!", "back", "Error");
                    return;
                }
                var adminEntity = GetAdminInfo();
                if (!rBll.Exists(this.id, adminEntity.Id))
                {
                    JscriptMsg("角色不存在或已被删除!", "back", "Error");
                    return;
                }
            }
            if (!Page.IsPostBack)
            {
                ChkAdminLevel("manager_role", MXEnums.ActionEnum.View.ToString()); //检查权限
                // RoleTypeBind(); //绑定角色类型
                NavBind();                                                         //绑定导航
                if (action == MXEnums.ActionEnum.Edit.ToString())                  //修改
                {
                    ShowInfo(this.id);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 检查管理员权限
        /// </summary>
        /// <param name="nav_name">菜单名称</param>
        /// <param name="action_type">操作类型</param>
        public void ChkAdminLevel(string nav_name, string action_type)
        {
            var  model   = GetAdminInfo();
            var  service = new ManagerRoleService(new ManagerRoleRepository(siteConfig.sysdatabaseprefix));
            bool result  = service.Exists(model.role_id, nav_name, action_type);

            if (!result)
            {
                string msgbox = "parent.jsdialog(\"错误提示\", \"您没有管理该页面的权限,请勿非法进入!\", \"back\", \"Error\")";
                Response.Write("<script type=\"text/javascript\">" + msgbox + "</script>");
                Response.End();
            }
        }