/// -----------------------------------------------------------------------------------------------
        /// <summary>
        ///     Constructor
        /// </summary>
        /// <param name="db">AccessEntities</param>
        /// -----------------------------------------------------------------------------------------------
        public AccessUtils(AccessEntities db)
        {
            _db                     = db;
            _appId                  = AppCommon.AppAttributeValue;
            _isSysAdmin             = HttpContext.Current.User.Identity.GetSysAdmin();
            _accessRoutesFilter     = "/Access/";
            _systemAdminRouteFilter = "/SystemAdmin/";

            var appid  = AppCommon.AppAttributeValue;
            var userid = AppCommon.UserProfile.Id.ToString();

            _areaGuids = _db.spUserAreas(appid, userid).Select(l => l.Id).ToList();
            _roleGuids = _db.spUserRoles(appid, userid).Select(l => l.RoleId).ToList();
        }
Example #2
0
        public JsonResult GetAreas()
        {
            var areas = _db.spUserAreas(AppCommon.AppAttributeValue, AppCommon.UserProfile.Id.ToString()).ToList();

            var records = areas.Where(l => l.ParentId == null)
                          .OrderBy(l => l.Area)
                          .Select(l => new Area
            {
                id       = l.Id,
                text     = l.Area,
                children = GetChildren(areas, l.Id)
            })
                          .ToList();

            return(Json(records, JsonRequestBehavior.AllowGet));
        }