Exemplo n.º 1
0
        public async Task <IActionResult> OnGetAsync(int id)
        {
            var username = HttpContext.Session.GetString("_username");
            var usertype = HttpContext.Session.GetString("_usertype");
            var access   = new Access(username, "Coordinator");

            if (access.IsLogin())
            {
                if (access.IsAuthorize(usertype))
                {
                    Project = await _context.Project
                              .Where(p => p.DateDeleted == null)
                              .FirstOrDefaultAsync(p => p.ProjectId == id);

                    ModeratorSelectList = new SelectList(_context.Supervisor.Where(s => s.DateDeleted == null).Where(s => s.AssignedId != Project.SupervisorId || s.AssignedId != Project.CoSupervisorId).OrderBy(s => s.SupervisorName), "AssignedId", "SupervisorName");

                    SupervisorPairs           = new Dictionary <string, string>();
                    SupervisorModerationPairs = new Dictionary <string, int>();

                    var supervisors = await _context.Supervisor
                                      .Where(s => s.DateDeleted == null)
                                      .ToListAsync();

                    foreach (var item in supervisors)
                    {
                        SupervisorPairs.Add(item.AssignedId, item.SupervisorName);

                        var projects = await _context.Project.Where(p => p.DateDeleted == null).Where(p => p.ModeratorId == item.AssignedId).ToListAsync();

                        SupervisorModerationPairs.Add(item.AssignedId, projects.Count());
                    }

                    ProjectSpecialization = await _context.ProjectSpecialization
                                            .Include(ps => ps.Specialization)
                                            .FirstOrDefaultAsync(ps => ps.ProjectId == id);

                    Mf = new ModeratorForm();

                    return(Page());
                }
                else
                {
                    ErrorMessage = "Access Denied";
                    return(RedirectToPage($"/{usertype}/Index"));
                }
            }
            else
            {
                ErrorMessage = "Login Required";
                return(RedirectToPage("/Account/Login"));
            }
        }
Exemplo n.º 2
0
Arquivo: Form1.cs Projeto: MAXer2/sait
        private void bunifuFlatButton1_Click(object sender, EventArgs e)
        {
            ModeratorForm r = new ModeratorForm();

            r.Show();
        }