public PartialViewResult Edit(int id)
 {
     var customRoleProvider = new CustomAuthentication.CustomRoleProvider();
     var userManager = new DataAccess.UserManager();
     var user = userManager.GetUserDetail(id);
     var roles = IsAdmin ? customRoleProvider.GetAllRoles() : customRoleProvider.GetAllRoles().Where(model => model.RoleId != 1 && model.RoleId != 2).ToList();
     ViewData["UserRoles"] = roles;
     var officeMananer = new DataAccess.OfficeMananer();
     ViewData["Offices"] = officeMananer.GetOffices(IsAdmin ? 0 : UserDetail.UserId);
     return PartialView(user);
 }
 public PartialViewResult Edit(int id)
 {
     var userDetailManager = new DataAccess.UserManager();
     var officeMananer = new DataAccess.OfficeMananer();
     var user = userDetailManager.GetUserDetail(UserDetail.UserId);
     var offices = officeMananer.GetOffices(IsAdmin ? 0 : UserDetail.UserId);
     ViewData["Offices"] = offices;
     var conventionManager = new DataAccess.ConventionManager();
     var conventions = conventionManager.GetConventions();
     ViewData["Conventions"] = conventions;
     var eventManager = new DataAccess.EventManager();
     var eventDetail = eventManager.GetEventDetail(id);
     return PartialView(eventDetail);
 }
 public ActionResult Add()
 {
     var userDetailManager = new DataAccess.UserManager();
     var officeMananer = new DataAccess.OfficeMananer();
     var user = userDetailManager.GetUserDetail(UserDetail.UserId);
     var offices = officeMananer.GetOffices(IsAdmin ? 0 : UserDetail.UserId);
     ViewData["Offices"] = offices;
     var conventionManager = new DataAccess.ConventionManager();
     var conventions = conventionManager.GetConventions();
     ViewData["Conventions"] = conventions;
     if (IsAdmin)
     {
         var customRoleProvider = new CustomAuthentication.CustomRoleProvider();
         var customMembershipProvider = new CustomAuthentication.CustomMembershipProvider();
         ViewData["Employee"] = customMembershipProvider.GetUsers(4);
     }
     return PartialView();
 }
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            #region User Specific Settings
            var sessionUser = (CustomAuthentication.User)(Session["User"]);
            var userManager = new DataAccess.UserManager();
            user = userManager.GetUserDetail(sessionUser.UserId);
            isAdmin = sessionUser.Roles.Any(model => model.RoleName.Equals(ADMIN_ROLE, StringComparison.InvariantCultureIgnoreCase));
            #endregion

            ControllerName = filterContext.RouteData.Values["controller"].ToString() + filterContext.RouteData.Values["action"].ToString();
            ViewData["Controller_Name"] = ControllerName;
            ViewData["UserDetail"] = UserDetail;

            BundleConfig.AddScript("~/Scripts/Users", "users.js", ControllerName);

            Script = string.Empty;
            StartupScript = string.Empty;

            Script = string.Format("var pageName = \"{0}\";", filterContext.RouteData.Values["controller"].ToString());

            base.OnActionExecuting(filterContext);
        }