예제 #1
0
        public async Task <IActionResult> OnGet()
        {
            string user = HttpContext.Session.GetString("userID");

            // If the user is not logged in
            if (string.IsNullOrEmpty(user))
            {
                return(RedirectToPage(Routes.LOGIN));
            }

            int userRole = -1;

            if (!string.IsNullOrEmpty(HttpContext.Session.GetString("userRole")))
            {
                userRole = Convert.ToInt32(HttpContext.Session.GetString("userRole"));
            }

            // If the user is not a PCM or Admin, redirect to the main menu
            if (userRole != Roles.PCM & userRole != Roles.ADMIN)
            {
                return(RedirectToPage(Routes.INDEX));
            }

            Papers papers = new Papers();

            allPapers        = papers.getAllPapers();
            userPreselection = papers.getPreselectedPapers(user);

            return(null);
        }
예제 #2
0
        public async Task <IActionResult> OnGet()
        {
            string user = HttpContext.Session.GetString("userID");

            // If the user is not logged in
            if (string.IsNullOrEmpty(user))
            {
                return(RedirectToPage(Routes.LOGIN));
            }

            int userRole = -1;

            if (!string.IsNullOrEmpty(HttpContext.Session.GetString("userRole")))
            {
                userRole = Convert.ToInt32(HttpContext.Session.GetString("userRole"));
            }

            // If the user is not a PCM or Admin, redirect to the main menu
            if (userRole != Roles.PCC & userRole != Roles.ADMIN)
            {
                return(RedirectToPage(Routes.INDEX));
            }

            selectedUserId = Int32.Parse(Request.Query["userid"]);
            Users users = new Users();

            if (!users.isValidPcmUser(selectedUserId))
            {
                return(RedirectToPage(Routes.ASSIGN_PAPERS));
            }

            Papers papers = new Papers();

            allPapers          = papers.getAllPapers();
            userAssignedPapers = papers.getUserAssignedPapers(selectedUserId);
            userPreselection   = papers.getUserPreselection(selectedUserId);

            return(null);
        }