Пример #1
0
        // GET: /ListRoles
        //sortable List of Users Roles
        public ActionResult ListRoles(string id, int?page, string sortField, int?sortOrder)
        {
            sortField = "AdministratorRoleHierarchyLevelTypeName";

            //Get SystemUser
            SystemUser systemUser = new SystemUser();

            systemUser = systemUserRepository.GetUserBySystemUserGuid(id);

            //Check Exists
            if (systemUser == null)
            {
                return(View("Error"));
            }

            //Check AccessRights
            ViewData["Access"] = "";
            RolesRepository rolesRepository = new RolesRepository();

            if (rolesRepository.HasWriteAccessToSystemUserRoles(systemUser.SystemUserGuid))
            {
                ViewData["Access"] = "WriteAccess";
            }

            //Set Export Access Rights
            ViewData["ExportAccess"] = "";
            if (hierarchyRepository.AdminHasDomainWriteAccess(exportGroupName))
            {
                ViewData["ExportAccess"] = "WriteAccess";
            }

            if (sortField == null || sortField == "Name")
            {
                sortField = "Name";
            }

            ViewData["DeletedFlag"] = false;


            if (sortOrder == 1)
            {
                ViewData["NewSortOrder"]     = 0;
                ViewData["CurrentSortOrder"] = 1;
            }
            else
            {
                ViewData["NewSortOrder"]     = 1;
                ViewData["CurrentSortOrder"] = 0;
            }

            ViewData["SystemUserName"] = (systemUser.LastName + ", " + systemUser.LastName + " " + systemUser.MiddleName).Replace("  ", " ");
            ViewData["SystemUserGuid"] = systemUser.SystemUserGuid;

            const int pageSize      = 15;
            var       items         = systemUserRepository.GetSystemUserRoles(id, sortField, sortOrder ?? 0);
            var       paginatedView = new PaginatedList <fnDesktopDataAdmin_SelectSystemUserRoles_v1Result>(items, page ?? 0, pageSize);

            return(View(paginatedView));
        }