public async Task <IActionResult> OnPostApproveAsync(int id) { var weeklyLog = await _context.WeeklyLog.Where(w => w.DateDeleted == null).Include(w => w.Project).FirstOrDefaultAsync(w => w.WeeklyLogId == id); if (weeklyLog == null) { ErrorMessage = "Weekly log not found"; return(RedirectToPage("/Supervisor/Supervision/Index")); } if (weeklyLog.WeeklyLogStatus != "New" && weeklyLog.WeeklyLogStatus != "Modified") { ErrorMessage = "Weekly log approved or require modification. Action denied"; return(RedirectToPage("/Supervisor/Supervision/SupervisedStudent", weeklyLog.ProjectId)); } var project = await _context.Project.Where(p => p.DateDeleted == null).FirstOrDefaultAsync(p => p.ProjectId == weeklyLog.ProjectId); // update weekly log weeklyLog.Comment = Af.Comment; weeklyLog.WeeklyLogStatus = "Approved"; weeklyLog.DateModified = DateTime.Now; await _context.SaveChangesAsync(); var username = HttpContext.Session.GetString("_username"); // get supervisor information var supervisor = await _context.Supervisor.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.AssignedId == weeklyLog.SupervisorId); var student = await _context.Student.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.AssignedId == weeklyLog.StudentId); var mailsubject = $"FYP System - Weekly Log {weeklyLog.WeeklyLogNumber} (Approved)"; var mailbody = $@"Dear {student.StudentName}, The Weekly Log {weeklyLog.WeeklyLogNumber} for the project below had been approved: Project ID: {weeklyLog.Project.AssignedId} Project Title: {weeklyLog.Project.ProjectTitle} Meeting Date: {weeklyLog.WeeklyLogDate.ToShortDateString()} Comments: {Af.Comment} Please navigate to the system menu under Weekly Log --> Weekly Log List to check for more information. Please contact the Coordinator if you found any problem or difficulty using the system. Thank You. Yours Sincerely, {supervisor.SupervisorName} (FYP Supervisor)"; await _emailSender.SendEmailAsync(supervisor.SupervisorEmail, student.StudentEmail, mailsubject, mailbody); SuccessMessage = $"Weekly log approved."; return(RedirectToPage("/Supervisor/Supervision/Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } Batch.DateModified = DateTime.Now; _context.Attach(Batch).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BatchExists(Batch.BatchId)) { return(NotFound()); } else { throw; } } return(RedirectToPage("/Coordinator/Management/Batch/Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } Announcement.AnnouncementStatus = "Edited"; Announcement.DateModified = DateTime.Now; _context.Attach(Announcement).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AnnouncementExists(Announcement.AnnouncementId)) { return(NotFound()); } else { throw; } } SuccessMessage = "Announcement modified successfully."; return(RedirectToPage("/Coordinator/Announcement/Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } SubmissionType.EndDate = SubmissionType.EndDate.AddDays(1).AddSeconds(-1); SubmissionType.GraceDate = SubmissionType.GraceDate.AddDays(1).AddSeconds(-1); SubmissionType.Status = "Modified"; SubmissionType.DateModified = DateTime.Now; _context.Attach(SubmissionType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SubmissionTypeExists(SubmissionType.SubmissionTypeId)) { return(NotFound()); } else { throw; } } SuccessMessage = "Submission modified successfully."; return(RedirectToPage("/Coordinator/Management/SubmissionType/Index")); }
public async Task <IActionResult> OnPostAsync(IFormFile file) { if (!ModelState.IsValid) { return(Page()); } if (file != null) { var rootPath = _appEnvironment.ContentRootPath; var folderPath = $"\\Files\\Announcement\\"; var filePathWithoutName = rootPath + folderPath; Directory.CreateDirectory(filePathWithoutName); var fileName = file.FileName; var filePath = filePathWithoutName + fileName; using (var fstream = new FileStream(filePath, FileMode.Create)) { await file.CopyToAsync(fstream); } Announcement.AttachmentFolder = folderPath; Announcement.AttachmentFile = fileName; } Announcement.AnnouncementStatus = "New"; Announcement.DateCreated = DateTime.Now; _context.Announcement.Add(Announcement); await _context.SaveChangesAsync(); SuccessMessage = $"File: {file.FileName} Announcement created successfully."; return(RedirectToPage("/Coordinator/Announcement/Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } Supervisor.DateModified = DateTime.Now; _context.Attach(Supervisor).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SupervisorExists(Supervisor.SupervisorId)) { return(NotFound()); } else { throw; } } SuccessMessage = "Profile modified successfully."; return(RedirectToPage("/Supervisor/Profile/Index")); }
public async Task <IActionResult> OnPostAsync(int id) { if (Epf.Type == null) { ErrorMessage = "Change type cannot be empty."; return(RedirectToPage("/Coordinator/Project/EditProject", id)); } if (Epf.Type == "Edit Supervisor") { if (Epf.Supervisor == null) { ErrorMessage = "The new supervisor is not selected."; return(RedirectToPage("/Coordinator/Project/EditProject", id)); } var project = await _context.Project.Where(p => p.DateDeleted == null).FirstOrDefaultAsync(p => p.ProjectId == id); if (project == null) { ErrorMessage = "Project not found."; return(RedirectToPage("/Supervisor/Project/ViewProject", id)); } var oldSupervisor = await _context.Supervisor.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.AssignedId == project.SupervisorId); project.SupervisorId = Epf.Supervisor; await _context.SaveChangesAsync(); // propagate changes to all weekly logs var weeklyLogs = await _context.WeeklyLog.Where(w => w.ProjectId == id).ToListAsync(); foreach (var item in weeklyLogs) { item.SupervisorId = Epf.Supervisor; } await _context.SaveChangesAsync(); await SendEmailAsync(oldSupervisor.AssignedId, project); await SendEmailStudentAsync(project); SuccessMessage = $"New supervisor assigned for Project {project.AssignedId}. "; } return(RedirectToPage("/Coordinator/Project/Index")); }
public async Task <IActionResult> OnPostAsync(int id) { if (!ModelState.IsValid) { return(Page()); } var username = HttpContext.Session.GetString("_username"); var project = await _context.Project.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(p => p.ProjectId == id); var supervisor = await _context.Supervisor.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.AssignedId == project.SupervisorId); var Requisition = new Requisition { ProjectId = id, Sender = username, Receiver = supervisor.AssignedId, RequisitionStatus = "New", DateCreated = DateTime.Now }; _context.Requisition.Add(Requisition); await _context.SaveChangesAsync(); var student = await _context.Student.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.AssignedId == username); var mailsubject = "FYP System - Project Requisition"; // TODO: Modify the coordinator email and name var mailbody = $@"Dear {supervisor.SupervisorName}, I would like to requisition for this project: Project ID: {project.AssignedId} Project Title: {project.ProjectTitle} -------------------------------------------------------------------------- Please navigate to Project --> Received Requisition for more information. Please contact coordinator if there is any questions. Thank you. -------------------------------------------------------------------------- Yours Sincerely, {student.StudentName} {student.AssignedId} (FYP Student)"; await _emailSender.SendEmailAsync(student.StudentEmail, supervisor.SupervisorEmail, mailsubject, mailbody); // Log Message SuccessMessage = $"Requisition for {project.ProjectTitle} sent successfully."; return(RedirectToPage("/Student/Project/ProjectList")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } Specialization.DateCreated = DateTime.Now; _context.Specialization.Add(Specialization); await _context.SaveChangesAsync(); return(RedirectToPage("/Coordinator/Management/Specialization/Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } SubmissionType.EndDate = SubmissionType.EndDate.AddDays(1).AddSeconds(-1); SubmissionType.GraceDate = SubmissionType.GraceDate.AddDays(1).AddSeconds(-1); SubmissionType.DateCreated = DateTime.Now; SubmissionType.Status = "New"; _context.SubmissionType.Add(SubmissionType); await _context.SaveChangesAsync(); SuccessMessage = "Submission type created successfully."; return(RedirectToPage("/Coordinator/Management/SubmissionType/Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Category = await _context.Category.FindAsync(id); if (Category != null) { Category.DateDeleted = DateTime.Now; //_context.Category.Remove(Category); await _context.SaveChangesAsync(); } return(RedirectToPage("/Coordinator/Management/Category/Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Focus = await _context.Focus.FindAsync(id); if (Focus != null) { Focus.DateDeleted = DateTime.Now; //_context.Focus.Remove(Focus); await _context.SaveChangesAsync(); } return(RedirectToPage("/Coordinator/Management/Focus/Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Session = await _context.Session.FindAsync(id); if (Session != null) { Session.DateDeleted = DateTime.Now; //_context.Session.Remove(Session); await _context.SaveChangesAsync(); } return(RedirectToPage("/Coordinator/Management/Session/Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Batch = await _context.Batch.FindAsync(id); if (Batch != null) { Batch.DateDeleted = DateTime.Now; //_context.Batch.Remove(Batch); await _context.SaveChangesAsync(); } return(RedirectToPage("/Coordinator/Management/Batch/Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } var username = HttpContext.Session.GetString("_username"); User = await _context.User.Where(s => s.UserName == username) .FirstOrDefaultAsync(); if (User != null) { if (Hash.Validate(changeData.Password, Salt.Generate(username), User.UserPassword)) { if (changeData.NewPassword.Equals(changeData.ConfirmPassword)) { var newHashedPassword = Hash.Generate(changeData.NewPassword, Salt.Generate(username)); User.UserPassword = newHashedPassword; User.DateModified = DateTime.Now; SuccessMessage = $"Password changed for " + username; await _context.SaveChangesAsync(); } else { ErrorMessage = $"The two passwords do not match. "; } } else { ErrorMessage = $"The existing password is incorrect. "; } } else { ErrorMessage = $"User {username} does not exist."; } return(RedirectToPage("/Coordinator/Management/Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } SubmissionType = await _context.SubmissionType.FindAsync(id); if (SubmissionType != null) { SubmissionType.Status = "Deleted"; SubmissionType.DateDeleted = DateTime.Now; //_context.SubmissionType.Remove(SubmissionType); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostOffAsync(int id) { var student = await _context.Student .FirstOrDefaultAsync(s => s.StudentId == id); if (student == null) { ErrorMessage = "Student not found"; return(RedirectToPage("/Coordinator/Student/Index")); } student.StudentStatus = "Off"; student.DateModified = DateTime.Now; await _context.SaveChangesAsync(); await SendEmailAsync(student, "Off"); SuccessMessage = $"Student {student.StudentName} status changed to Off successfully"; return(RedirectToPage("/Coordinator/Student/Index")); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } // Create new student var temp = Student.StudentName; Student.StudentName = temp.ToUpper(); Student.StudentStatus = "New"; Student.DateCreated = DateTime.Now; _context.Student.Add(Student); await _context.SaveChangesAsync(); var coordinator = await _context.Coordinator.Where(c => c.DateDeleted == null).FirstOrDefaultAsync(); var mailsubject = "FYP System - Student Approval"; var mailbody = $@"Dear {coordinator.CoordinatorName}, There is a new student approval request. Student ID: {Student.AssignedId} Student Name: {Student.StudentName} Please navigate to Student --> Student Approval for more information. "; await _emailSender.SendEmailAsync(Student.StudentEmail, coordinator.CoordinatorEmail, mailsubject, mailbody); // Log Message SuccessMessage = $"Student {Student.StudentName} registered successfully!"; return(RedirectToPage("/Account/Login")); }
public async Task <IActionResult> OnPostInactiveAsync(int id) { var supervisor = await _context.Supervisor .FirstOrDefaultAsync(s => s.SupervisorId == id); if (supervisor == null) { ErrorMessage = "Supervisor not found"; return(RedirectToPage("/Coordinator/Supervisor/Index")); } supervisor.SupervisorStatus = "Inactive"; supervisor.DateModified = DateTime.Now; await _context.SaveChangesAsync(); // Set all Available project as Not Available var projects = await _context.Project .Where(p => p.DateDeleted == null) .Where(p => p.ProposedBy == "Lecturer") .Where(p => p.ProjectStatus == "Available") .Where(p => p.SupervisorId == supervisor.AssignedId) .ToListAsync(); foreach (var item in projects) { item.ProjectStatus = "Not Available"; item.DateModified = DateTime.Now; } await _context.SaveChangesAsync(); await SendEmailAsync(supervisor, projects, "Inactive", "Not Available"); SuccessMessage = $"Supervisor {supervisor.SupervisorName} status changed to Inactive successfully"; return(RedirectToPage("/Coordinator/Supervisor/Index")); }
public async Task <IActionResult> OnPostAsync(int id) { var requisition = await _context.Requisition.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(r => r.RequisitionId == id); if (requisition == null) { ErrorMessage = "Requisition not found"; return(RedirectToPage("/Supervisor/Project/ReceivedRequisition")); } if (requisition.RequisitionStatus != "Accepted") { ErrorMessage = "Requisition was not accepted or rejected. Action denied"; return(RedirectToPage("/Supervisor/Project/ReceivedRequisition")); } var student = await _context.Student.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.AssignedId == requisition.Sender); // check if student had other project. if the student had other then he cannout be confirmed and the requisition status will be set as faiiled if (student.ProjectId != null) { // update requisition as failed requisition.RequisitionStatus = "Failed"; requisition.DateModified = DateTime.Now; await _context.SaveChangesAsync(); var project2 = await _context.Project.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(p => p.ProjectId == requisition.ProjectId); project2.ProjectStatus = "Available"; project2.DateModified = DateTime.Now; await _context.SaveChangesAsync(); ErrorMessage = "This student had confirmed with other project. You cannot accept the student."; return(RedirectToPage("/Supervisor/Project/ReceivedRequisition")); } // update requisition as completed requisition.RequisitionStatus = "Completed"; requisition.DateModified = DateTime.Now; await _context.SaveChangesAsync(); // update proposal as completed var proposal = await _context.Proposal.Where(p => p.DateDeleted == null).FirstOrDefaultAsync(p => p.ProjectId == requisition.ProjectId); proposal.ProposalStatus = "Completed"; proposal.DateModified = DateTime.Now; await _context.SaveChangesAsync(); // update project as taken var project = await _context.Project.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(p => p.ProjectId == requisition.ProjectId); project.ProjectStatus = "Taken"; project.ProjectStage = "FYP1"; project.DateModified = DateTime.Now; await _context.SaveChangesAsync(); // confirm student student.ProjectId = project.ProjectId; student.StudentStatus = "Confirmed"; student.DateModified = DateTime.Now; await _context.SaveChangesAsync(); // send email var username = HttpContext.Session.GetString("_username"); var supervisor = await _context.Supervisor.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.AssignedId == username); // Email notification var mailsubject = "FYP System - Project Accepted"; var mailbody = $@"Dear {student.StudentName}, Your requisition for the following project is accepted and you are confirmed with this project. Project ID: {project.AssignedId} Project Title: {project.ProjectTitle} Please navigate to the system menu under Project --> My Requisition or My Project to check for more information. Please contact the Coordinator if you found any problem or difficulty using the system. Thank You. Yours Sincerely, {supervisor.SupervisorName} (FYP Supervisor)"; await _emailSender.SendEmailAsync(supervisor.SupervisorEmail, student.StudentEmail, mailsubject, mailbody); SuccessMessage = "Project confirmed with student."; return(RedirectToPage("/Supervisor/Project/ReceivedRequisition")); }
public async Task <IActionResult> OnPostAsync(int id) { if (Epf.Description == null || Epf.Objective == null || Epf.Scope == null || Epf.Title == null) { ErrorMessage = "The field cannot be empty."; return(RedirectToPage("/Supervisor/Project/EditProposal", id)); } var proposal = await _context.Proposal.Where(p => p.DateDeleted == null).FirstOrDefaultAsync(p => p.ProposalId == id); if (proposal == null) { ErrorMessage = "Proposal not found."; return(RedirectToPage("/Supervisor/Project/MyProposal")); } if (proposal.ProposalStatus != "Require Modification") { ErrorMessage = "Modification not required. Action denied"; return(RedirectToPage("/Supervisor/Project/MyProposal")); } proposal.ProposalStatus = "Modified"; proposal.DateModified = DateTime.Now; await _context.SaveChangesAsync(); var project = await _context.Project.Where(p => p.DateDeleted == null).FirstOrDefaultAsync(p => p.ProjectId == proposal.ProjectId); project.ProjectTitle = Epf.Title; project.ProjectCategory = Epf.Category; project.ProjectFocus = Epf.Focus; project.DateModified = DateTime.Now; await _context.SaveChangesAsync(); var projectSpecializations = await _context.ProjectSpecialization.Include(p => p.Specialization).Where(ps => ps.ProjectId == project.ProjectId).ToListAsync(); projectSpecializations[0].ProjectDescription = Epf.Description; projectSpecializations[0].ProjectObjective = Epf.Objective; projectSpecializations[0].ProjectScope = Epf.Scope; await _context.SaveChangesAsync(); var review = await _context.Review.Where(r => r.DateDeleted == null).FirstOrDefaultAsync(r => r.ProjectId == project.ProjectId); review.ReviewStatus = "Modified"; review.DateModified = DateTime.Now; await _context.SaveChangesAsync(); var supervisor = await _context.Supervisor.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.AssignedId == project.SupervisorId); var reviewer = await _context.Supervisor.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.AssignedId == review.Reviewer); var mailsubject = "FYP System - Proposal (Modified)"; var mailbody = $@"Dear {reviewer.SupervisorName}, My proposal for the following project had been modified. Project ID: {project.AssignedId} Project Title: {project.ProjectTitle} Please conduct review on the proposal again. Thank you. Please navigate to the system menu under Review --> Review List to check for more information. Please contact the Coordinator if you found any problem or difficulty using the system. Thank You. Yours Sincerely, {supervisor.SupervisorName} (FYP Supervisor)"; await _emailSender.SendEmailAsync(supervisor.SupervisorEmail, reviewer.SupervisorEmail, mailsubject, mailbody); var student = await _context.Student.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.AssignedId == proposal.Sender); if (student != null) { var mailsubject2 = "FYP System - Proposal (Modified)"; var mailbody2 = $@"Dear {student.StudentName}, The proposal for the following project had been modified. Project ID: {project.AssignedId} Project Title: {project.ProjectTitle} Please navigate to the system menu under Project --> My Proposal to check for more information. Please contact the Coordinator if you found any problem or difficulty using the system. Thank You. Yours Sincerely, {supervisor.SupervisorName} (FYP Supervisor)"; await _emailSender.SendEmailAsync(supervisor.SupervisorEmail, student.StudentEmail, mailsubject2, mailbody2); return(RedirectToPage("/Supervisor/Project/ReceivedProposal")); } SuccessMessage = $"Proposal Modified and Sent"; return(RedirectToPage("/Supervisor/Project/MyProposal")); }
public async Task <IActionResult> OnPostAsync(int id) { //if (Epf.Type == "Cancel Project") //{ // if (Epf.Reason == null) // { // ErrorMessage = "The reason cannot be empty."; // return RedirectToPage("/Supervisor/Project/EditProject", id); // } // var project = await _context.Project.Where(p => p.DateDeleted == null).FirstOrDefaultAsync(p => p.ProjectId == id); // if (project == null) // { // ErrorMessage = "Project not found."; // return RedirectToPage("/Supervisor/Project/ViewProject", id); // } // if (project.ProjectStatus != "Available" && project.ProjectStatus != "Taken") // { // ErrorMessage = "Action denied"; // return RedirectToPage("/Supervisor/Project/ViewProject", id); // } // var changeRequest = new ChangeRequest // { // ChangeRequestType = Epf.Type, // ReasonToChange = Epf.Reason, // ChangeRequestStatus = "New", // DateCreated = DateTime.Now // }; //} if (Epf.Type == null) { ErrorMessage = "Change type cannot be empty."; return(RedirectToPage("/Supervisor/Project/EditProject", id)); } if (Epf.Type == "Edit Project") { if (Epf.Reason == null) { ErrorMessage = "The reason cannot be empty."; return(RedirectToPage("/Supervisor/Project/EditProject", id)); } if (Epf.Title == null || Epf.Description == null || Epf.Objective == null || Epf.Scope == null) { ErrorMessage = "The field cannot be empty."; return(RedirectToPage("/Supervisor/Project/EditProject", id)); } var project = await _context.Project.Where(p => p.DateDeleted == null).FirstOrDefaultAsync(p => p.ProjectId == id); if (project == null) { ErrorMessage = "Project not found."; return(RedirectToPage("/Supervisor/Project/ViewProject", id)); } if (project.ProjectStatus != "Available" && project.ProjectStatus != "Taken") { ErrorMessage = "Action denied"; return(RedirectToPage("/Supervisor/Project/ViewProject", id)); } var changeRequest = new ChangeRequest { ChangeRequestType = Epf.Type, Title = Epf.Title, Description = Epf.Description, Objective = Epf.Objective, Scope = Epf.Scope, ReasonToChange = Epf.Reason, ChangeRequestStatus = "New", ProjectId = id, DateCreated = DateTime.Now }; _context.ChangeRequest.Add(changeRequest); await _context.SaveChangesAsync(); var username = HttpContext.Session.GetString("_username"); var supervisor = await _context.Supervisor.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.AssignedId == username); var coordinator = await _context.Coordinator.Where(c => c.DateDeleted == null).FirstOrDefaultAsync(); var mailsubject = "FYP System - Project (Request for Modification)"; var mailbody = $@"Dear {coordinator.CoordinatorName}, The following project is requesting for change approval. Project ID: {project.AssignedId} Project Title: {project.ProjectTitle} New Project Title: {Epf.Title} New Project Description: {Epf.Description} New Project Objective: {Epf.Objective} New Project Scope: {Epf.Scope} Please navigate to the system menu under Project --> Manage Project Change to check for more information. Please contact the Coordinator if you found any problem or difficulty using the system. Thank You. Yours Sincerely, {supervisor.SupervisorName} (FYP Supervisor)"; await _emailSender.SendEmailAsync(supervisor.SupervisorEmail, coordinator.CoordinatorEmail, mailsubject, mailbody); //var projectSpecializations = await _context.ProjectSpecialization.Include(p => p.Specialization).Where(ps => ps.ProjectId == project.ProjectId).ToListAsync(); //projectSpecializations[0].ProjectDescription = Epf.Description; //projectSpecializations[0].ProjectObjective = Epf.Objective; //projectSpecializations[0].ProjectScope = Epf.Scope; //await _context.SaveChangesAsync(); // var supervisor = await _context.Supervisor.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.AssignedId == project.SupervisorId); // var student = await _context.Student.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.ProjectId == project.ProjectId); // if (student != null) // { // var mailsubject = "FYP System - Project (Modified)"; // var mailbody = $@"Dear {student.StudentName}, //Your following project had been modified. //Project ID: {project.AssignedId} //Project Title: {project.ProjectTitle} //New Project Description: //{Epf.Description} //New Project Objective: //{Epf.Objective} //New Project Scope: //{Epf.Scope} //Please navigate to the system menu under Project --> My Project to check for more information. //Please contact the Coordinator if you found any problem or difficulty using the system. Thank You. //Yours Sincerely, //{supervisor.SupervisorName} //(FYP Supervisor)"; // await _emailSender.SendEmailAsync(supervisor.SupervisorEmail, student.StudentEmail, mailsubject, mailbody); // } SuccessMessage = "Change request sent."; } return(RedirectToPage("/Supervisor/Project/ViewProject", id)); }
public async Task <IActionResult> OnPostAcceptAsync(int id) { // update proposal status as accepted var proposal = await _context.Proposal.Where(p => p.DateDeleted == null).FirstOrDefaultAsync(p => p.ProposalId == id); if (proposal == null) { ErrorMessage = "Proposal not found"; return(RedirectToPage("/Supervisor/Project/ReceivedProposal")); } if (proposal.ProposalStatus != "New" && proposal.ProposalStatus != "Modified") { ErrorMessage = "Proposal had been accepted or rejected. Action denied."; return(RedirectToPage("/Supervisor/Project/ReceivedProposal")); } proposal.ProposalStatus = "Accepted"; proposal.ProposalComment = Vpf.Comment; proposal.DateModified = DateTime.Now; await _context.SaveChangesAsync(); var username = HttpContext.Session.GetString("_username"); var student = await _context.Student.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.AssignedId == proposal.Sender); var supervisor = await _context.Supervisor.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.AssignedId == username); var project = await _context.Project.Where(p => p.DateDeleted == null).FirstOrDefaultAsync(p => p.ProjectId == proposal.ProjectId); if (Vpf.ModeratorOne != null && Vpf.ModeratorTwo == null && Vpf.ModeratorThree == null) { project.ModeratorOne = Vpf.ModeratorOne; await _context.SaveChangesAsync(); } if (Vpf.ModeratorOne == null && Vpf.ModeratorTwo != null && Vpf.ModeratorThree == null) { project.ModeratorOne = Vpf.ModeratorTwo; await _context.SaveChangesAsync(); } if (Vpf.ModeratorOne == null && Vpf.ModeratorTwo == null && Vpf.ModeratorThree != null) { project.ModeratorOne = Vpf.ModeratorThree; await _context.SaveChangesAsync(); } if (Vpf.ModeratorOne != null && Vpf.ModeratorTwo != null && Vpf.ModeratorThree == null) { project.ModeratorOne = Vpf.ModeratorOne; project.ModeratorTwo = Vpf.ModeratorTwo; await _context.SaveChangesAsync(); } if (Vpf.ModeratorOne == null && Vpf.ModeratorTwo != null && Vpf.ModeratorThree != null) { project.ModeratorOne = Vpf.ModeratorTwo; project.ModeratorTwo = Vpf.ModeratorThree; await _context.SaveChangesAsync(); } if (Vpf.ModeratorOne != null && Vpf.ModeratorTwo == null && Vpf.ModeratorThree != null) { project.ModeratorOne = Vpf.ModeratorOne; project.ModeratorTwo = Vpf.ModeratorThree; await _context.SaveChangesAsync(); } if (Vpf.ModeratorOne != null && Vpf.ModeratorTwo != null && Vpf.ModeratorThree != null) { project.ModeratorOne = Vpf.ModeratorOne; project.ModeratorTwo = Vpf.ModeratorTwo; project.ModeratorThree = Vpf.ModeratorThree; await _context.SaveChangesAsync(); } if (Vpf.CoSupervisor != null) { project.CoSupervisorId = Vpf.CoSupervisor; await _context.SaveChangesAsync(); var cosupervisor = await _context.Supervisor.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.AssignedId == Vpf.CoSupervisor); var mailsubject2 = "FYP System - Assigned as Co-Supervisor"; var mailbody2 = $@"Dear {cosupervisor.SupervisorName}, You had been assigned as Co-Supervisor for the following project. Project ID: {project.AssignedId} Project Title: {project.ProjectTitle} Please navigate to the system menu under Project --> My Project to check for more information. Please contact the Coordinator if you found any problem or difficulty using the system. Thank You. Yours Sincerely, {supervisor.SupervisorName} (FYP Supervisor)"; await _emailSender.SendEmailAsync(supervisor.SupervisorEmail, cosupervisor.SupervisorEmail, mailsubject2, mailbody2); } // send email var mailsubject = "FYP System - Proposal Accepted"; var mailbody = $@"Dear {student.StudentName}, Your proposal for the following project is accepted. Project ID: {project.AssignedId} Project Title: {project.ProjectTitle} Comments: {Vpf.Comment} The project will be sent for review before you are confirmed with the project. Please navigate to the system menu under Project --> My Proposal to check for more information. Please contact the Coordinator if you found any problem or difficulty using the system. Thank You. Yours Sincerely, {supervisor.SupervisorName} (FYP Supervisor)"; await _emailSender.SendEmailAsync(supervisor.SupervisorEmail, student.StudentEmail, mailsubject, mailbody); SuccessMessage = "Proposal approved."; // Automatic request for review // update proposal status as In Review proposal.ProposalStatus = "In Review"; proposal.DateModified = DateTime.Now; await _context.SaveChangesAsync(); // create new review var review = new Models.Review { ProjectId = proposal.ProjectId, ReviewStatus = "New", DateCreated = DateTime.Now }; _context.Review.Add(review); await _context.SaveChangesAsync(); // update project status as In Review project.ProjectStatus = "In Review"; await _context.SaveChangesAsync(); var coordinator = await _context.Coordinator.Where(c => c.DateDeleted == null).FirstOrDefaultAsync(); // send email var mailsubject3 = "FYP System - Request for Review"; var mailbody3 = $@"Dear Coordinator, I would like to request for review on my proposal: Project ID: {project.AssignedId} Project Name: {project.ProjectTitle} Yours Sincerely, {supervisor.SupervisorName} (FYP Supervisor)"; await _emailSender.SendEmailAsync(supervisor.SupervisorEmail, coordinator.CoordinatorEmail, mailsubject3, mailbody3); SuccessMessage += " Review requested!"; return(RedirectToPage("/Supervisor/Project/ReceivedProposal")); }
public async Task <IActionResult> OnPostAsync(int id) { if (Ef.WorkDone == null || Ef.WorkToBeDone == null || Ef.Problem == null || Ef.Date == null) { ErrorMessage = "The field cannot be empty."; return(RedirectToPage("/Student/Progress/EditWeeklyLog", id)); } var weeklyLog = await _context.WeeklyLog.Where(w => w.DateDeleted == null).Include(w => w.Project).FirstOrDefaultAsync(w => w.WeeklyLogId == id); if (weeklyLog == null) { ErrorMessage = "Weekly log not found"; return(RedirectToPage("/Student/Progress/Index")); } if (weeklyLog.WeeklyLogStatus != "Require Modification") { ErrorMessage = "Modification not required. Action denied"; return(RedirectToPage("/Student/Progress/Index")); } // update weekly log weeklyLog.WeeklyLogDate = Ef.Date; weeklyLog.WorkDone = Ef.WorkDone; weeklyLog.WorkToBeDone = Ef.WorkToBeDone; weeklyLog.Problem = Ef.Problem; weeklyLog.WeeklyLogStatus = "Modified"; weeklyLog.DateModified = DateTime.Now; await _context.SaveChangesAsync(); var username = HttpContext.Session.GetString("_username"); // get supervisor information var supervisor = await _context.Supervisor.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.AssignedId == weeklyLog.SupervisorId); var cosupervisor = await _context.Supervisor.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.AssignedId == weeklyLog.CoSupervisorId); var student = await _context.Student.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.AssignedId == weeklyLog.StudentId); var mailsubject = $"FYP System - Weekly Log {weeklyLog.WeeklyLogNumber} (Modified)"; var mailbody = $@"Dear {supervisor.SupervisorName}, The Weekly Log {weeklyLog.WeeklyLogNumber} for the project below had been modified: Project ID: {weeklyLog.Project.AssignedId} Project Title: {weeklyLog.Project.ProjectTitle} Meeting Date: {Ef.Date.ToShortDateString()} Comments from Supervisor: {weeklyLog.Comment} Work Done: {Ef.WorkDone} Work to Be Done: {Ef.WorkToBeDone} Problems Faced: {Ef.Problem} Please navigate to the system menu under My Supervision --> Supervision List to check for more information. Please contact the Coordinator if you found any problem or difficulty using the system. Thank You. Yours Sincerely, {student.StudentName} {student.AssignedId} (FYP Student)"; await _emailSender.SendEmailAsync(student.StudentEmail, supervisor.SupervisorEmail, mailsubject, mailbody); if (cosupervisor != null) { var mailsubject2 = $"FYP System - Weekly Log {weeklyLog.WeeklyLogNumber} (Modified)"; var mailbody2 = $@"Dear {cosupervisor.SupervisorName}, The Weekly Log {weeklyLog.WeeklyLogNumber} for the project below had been modified: Project ID: {weeklyLog.Project.AssignedId} Project Title: {weeklyLog.Project.ProjectTitle} Meeting Date: {Ef.Date.ToShortDateString()} Comments from Supervisor: {weeklyLog.Comment} Work Done: {Ef.WorkDone} Work to Be Done: {Ef.WorkToBeDone} Problems Faced: {Ef.Problem} Please navigate to the system menu under My Supervision --> Supervision List to check for more information. Please contact the Coordinator if you found any problem or difficulty using the system. Thank You. Yours Sincerely, {student.StudentName} {student.AssignedId} (FYP Student)"; await _emailSender.SendEmailAsync(student.StudentEmail, cosupervisor.SupervisorEmail, mailsubject2, mailbody2); } SuccessMessage = $"Weekly log modified and sent successfully."; return(RedirectToPage("/Student/Progress/Index")); }
public async Task <IActionResult> OnPostReviewAsync(int id) { var proposal = await _context.Proposal.Where(p => p.DateDeleted == null).FirstOrDefaultAsync(p => p.ProposalId == id); if (proposal == null) { ErrorMessage = "Proposal not found."; return(RedirectToPage("/Supervisor/Project/ReceivedProposal")); } if (proposal.ProposalStatus != "Accepted") { ErrorMessage = "Proposal is not accepted yet"; return(RedirectToPage("/Supervisor/Project/ReceivedProposal")); } // update proposal status as In Review proposal.ProposalStatus = "In Review"; proposal.DateModified = DateTime.Now; await _context.SaveChangesAsync(); // create new review var review = new Models.Review { ProjectId = proposal.ProjectId, ReviewStatus = "New", DateCreated = DateTime.Now }; _context.Review.Add(review); await _context.SaveChangesAsync(); // update project status as In Review var project = await _context.Project.Where(p => p.DateDeleted == null).FirstOrDefaultAsync(p => p.ProjectId == proposal.ProjectId); project.ProjectStatus = "In Review"; await _context.SaveChangesAsync(); var username = HttpContext.Session.GetString("_username"); var supervisor = await _context.Supervisor.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(m => m.AssignedId == username); var coordinator = await _context.Coordinator.Where(c => c.DateDeleted == null).FirstOrDefaultAsync(); // send email var mailsubject = "FYP System - Request for Review"; var mailbody = $@"Dear Coordinator, I would like to request for review on my proposal: Project ID: {project.AssignedId} Project Name: {project.ProjectTitle} Yours Sincerely, {supervisor.SupervisorName} (FYP Supervisor)"; await _emailSender.SendEmailAsync(supervisor.SupervisorEmail, coordinator.CoordinatorEmail, mailsubject, mailbody); SuccessMessage = "Review requested!"; return(RedirectToPage("/Supervisor/Project/ReceivedProposal")); }
public async Task <IActionResult> OnPostAsync(int id) { if (!ModelState.IsValid) { return(Page()); } // update proposal status Proposal proposal = await _context.Proposal.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(m => m.ProposalId == id); proposal.ProposalStatus = "In Review"; proposal.DateModified = DateTime.Now; _context.Attach(proposal).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProposalExists(proposal.ProposalId)) { return(NotFound()); } else { throw; } } // Create new review var review = new Models.Review { ProjectId = proposal.ProjectId, ReviewStatus = "New", DateCreated = DateTime.Now }; _context.Review.Add(review); await _context.SaveChangesAsync(); // Update current project var project = await _context.Project.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(p => p.ProjectId == proposal.ProjectId); project.ProjectStatus = "In Review"; await _context.SaveChangesAsync(); var username = HttpContext.Session.GetString("_username").ToString(); var supervisor = await _context.Supervisor.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(m => m.AssignedId == username); var coordinator = await _context.Coordinator.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(); //Email Handler var mailsubject = "FYP System - Request for Review"; var mailbody = $@"Dear Coordinator, I would like to request for review on my proposal: Project ID: {proposal.Project.AssignedId} Project Name: {proposal.Project.ProjectTitle} Yours Sincerely, {supervisor.SupervisorName} (FYP Supervisor)"; await _emailSender.SendEmailAsync(supervisor.SupervisorEmail, coordinator.CoordinatorEmail, mailsubject, mailbody); // Log Message SuccessMessage = $"Review for {proposal.Project.ProjectTitle} requested!"; return(RedirectToPage("/Supervisor/Project/MyProposal")); }
public async Task <IActionResult> OnPostAsync(int id) { if (!ModelState.IsValid) { return(Page()); } // Update student status Models.Student student = await _context.Student .Include(s => s.Batch) .Include(s => s.User).FirstOrDefaultAsync(m => m.StudentId == id); student.StudentStatus = "On"; student.DateModified = DateTime.Now; _context.Attach(student).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentExists(student.StudentId)) { return(NotFound()); } else { throw; } } var newPassword = RandomPassword(); var hashedPassword = HashPassword(newPassword, student.AssignedId); // Create new user var newUser = new Models.User(student.AssignedId, hashedPassword, "Student") { DateCreated = DateTime.Now }; _context.User.Add(newUser); await _context.SaveChangesAsync(); var user = await _context.User.Where(u => u.DateDeleted == null).FirstOrDefaultAsync(u => u.UserName == student.AssignedId); student.UserId = user.UserId; await _context.SaveChangesAsync(); var username = HttpContext.Session.GetString("_username"); var coordinator = await _context.Coordinator.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(c => c.AssignedId == username); // Email Handler var mailsubject = "FYP System - Login Credentials"; var mailbody = $@"Dear {student.StudentName}, Your login credentials: User Name: {student.AssignedId} Password: {newPassword} Please change your password at Settings. Note : Account without any activity within 3 days after sending this email, may be deactivated. Please contact the Coordinator if you found any problem or difficulty using the system. Thank You. Yours Sincerely, {coordinator.CoordinatorName} (FYP Coordinator)"; await _emailSender.SendEmailAsync(coordinator.CoordinatorEmail, student.StudentEmail, mailsubject, mailbody); // Log Message SuccessMessage = $"Student {student.StudentName} approved!"; return(RedirectToPage("/Coordinator/Student/Index")); }
public async Task <IActionResult> OnPostAsync(int id) { if (Mf.Moderator == null) { ErrorMessage = $"Moderator field cannot be empty"; return(RedirectToPage("/Coordinator/Moderation/AssignModerator", id)); } var project = await _context.Project .Where(p => p.DateDeleted == null) .FirstOrDefaultAsync(p => p.ProjectId == id); // update project moderator project.ModeratorId = Mf.Moderator; await _context.SaveChangesAsync(); var moderator = await _context.Supervisor.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.AssignedId == Mf.Moderator); var username = HttpContext.Session.GetString("_username"); var coordinator = await _context.Coordinator.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(c => c.AssignedId == username); // send email to moderator var mailsubject = "FYP System - Assigned Project to Moderate"; var mailbody = $@"Dear {moderator.SupervisorName}, You have been assigned to moderate the project as detailed below: Project Title: {project.ProjectTitle} Please navigate to the system menu under My Moderation --> Moderation List Please contact the Coordinator if you found any problem or difficulty using the system. Thank You. Yours Sincerely, {coordinator.CoordinatorName} (FYP Coordinator)"; await _emailSender.SendEmailAsync(coordinator.CoordinatorEmail, moderator.SupervisorEmail, mailsubject, mailbody); SuccessMessage = $"Moderator assigned for {project.ProjectTitle} successfully."; // send email to student var student = await _context.Student.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(s => s.ProjectId == project.ProjectId); var mailsubject2 = "FYP System - Assigned Moderator"; var mailbody2 = $@"Dear {student.StudentName}, Your project {project.ProjectTitle} had been assigned with the moderator as follows: {moderator.SupervisorName} Please navigate to the system menu under Project --> My Project to check for more information. Please contact the Coordinator if you found any problem or difficulty using the system. Thank You. Yours Sincerely, {coordinator.CoordinatorName} (FYP Coordinator)"; await _emailSender.SendEmailAsync(coordinator.CoordinatorEmail, student.StudentEmail, mailsubject2, mailbody2); return(RedirectToPage("/Coordinator/Moderation/Index")); }
public async Task<IActionResult> OnPostApproveAsync(int id) { var changeRequest = await _context.ChangeRequest .Include(c => c.Project) .FirstOrDefaultAsync(c => c.ChangeRequestId == id); if (changeRequest == null) { ErrorMessage = "Change request not found."; return RedirectToPage("/Coordinator/Project/ChangeRequest/Index"); } var project = await _context.Project .FirstOrDefaultAsync(p => p.ProjectId == changeRequest.ProjectId); var projectSpecialization = await _context.ProjectSpecialization .FirstOrDefaultAsync(ps => ps.ProjectId == project.ProjectId); changeRequest.ChangeRequestStatus = "Approved"; await _context.SaveChangesAsync(); project.ProjectTitle = changeRequest.Title; await _context.SaveChangesAsync(); projectSpecialization.ProjectDescription = changeRequest.Description; projectSpecialization.ProjectObjective = changeRequest.Objective; projectSpecialization.ProjectScope = changeRequest.Scope; await _context.SaveChangesAsync(); // send email var username = HttpContext.Session.GetString("_username"); var coordinator = await _context.Coordinator.FirstOrDefaultAsync(c => c.AssignedId == username); var supervisor = await _context.Supervisor.FirstOrDefaultAsync(s => s.AssignedId == changeRequest.Project.SupervisorId); var mailsubject = "FYP System - Project Change Request (Approved)"; var mailbody = $@"Dear {supervisor.SupervisorName}, The change request for the following project had been approved. Project ID: {changeRequest.Project.AssignedId} Project Title: {changeRequest.Project.ProjectTitle} New Project Title: {changeRequest.Title} New Project Description: {changeRequest.Description} New Project Objective: {changeRequest.Objective} New Project Scope: {changeRequest.Scope} Please navigate to the system menu under Project --> My Project to check for more information. Please contact the Coordinator if you found any problem or difficulty using the system. Thank You. Yours Sincerely, {coordinator.CoordinatorName} (FYP Coordinator)"; await _emailSender.SendEmailAsync(coordinator.CoordinatorEmail, supervisor.SupervisorEmail, mailsubject, mailbody); // send email to student if exists var student = await _context.Student.FirstOrDefaultAsync(s => s.ProjectId == project.ProjectId); if (student != null) { var mailsubject2 = "FYP System - Project Change (Approved)"; var mailbody2 = $@"Dear {student.StudentName}, There are some changes to the following project: Project ID: {changeRequest.Project.AssignedId} Project Title: {changeRequest.Project.ProjectTitle} New Project Title: {changeRequest.Title} New Project Description: {changeRequest.Description} New Project Objective: {changeRequest.Objective} New Project Scope: {changeRequest.Scope} Please navigate to the system menu under Project --> My Project to check for more information. Please contact the Coordinator if you found any problem or difficulty using the system. Thank You. Yours Sincerely, {coordinator.CoordinatorName} (FYP Coordinator)"; await _emailSender.SendEmailAsync(coordinator.CoordinatorEmail, supervisor.SupervisorEmail, mailsubject2, mailbody2); } SuccessMessage = "Change request approved"; return RedirectToPage("/Coordinator/Project/ChangeRequest/Index"); }
public async Task <IActionResult> OnPostSubmitAsync() { if (!ModelState.IsValid) { return(Page()); } User = await _context.User.FirstOrDefaultAsync(s => s.UserName == forgetPasswordData.UserName); bool TryAgain = false; if (User != null) { if (User.UserType == "Student") { var student = await _context.Student.Where(s => s.DateDeleted == null && s.StudentStatus == "On").FirstOrDefaultAsync(s => s.AssignedId == User.UserName); if (student != null) { var newPassword = RandomPassword(); var hashedPassword = HashPassword(newPassword, student.AssignedId); User.UserPassword = hashedPassword; User.DateModified = DateTime.Now; await _context.SaveChangesAsync(); var coordinator = await _context.Coordinator.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(); // Email Handler var mailsubject = "FYP System - Reset Login Credentials"; var mailbody = $@"Dear {student.StudentName}, Your reset login credentials: User Name: {student.AssignedId} Password: {newPassword} Please change your password at Settings. Please contact the Coordinator if you found any problem or difficulty using the system. Thank You. Yours Sincerely, {coordinator.CoordinatorName} (FYP Coordinator)"; await _emailSender.SendEmailAsync(coordinator.CoordinatorEmail, student.StudentEmail, mailsubject, mailbody); SuccessMessage = $"Password reset sent to student {User.UserName} email"; } else { ErrorMessage = $"Student {User.UserName} not found"; TryAgain = true; } } if (User.UserType == "Supervisor") { var supervisor = await _context.Supervisor.Where(s => s.DateDeleted == null && s.SupervisorStatus == "Active").FirstOrDefaultAsync(s => s.AssignedId == User.UserName); if (supervisor != null) { var newPassword = RandomPassword(); var hashedPassword = HashPassword(newPassword, supervisor.AssignedId); User.UserPassword = hashedPassword; User.DateModified = DateTime.Now; await _context.SaveChangesAsync(); var coordinator = await _context.Coordinator.Where(s => s.DateDeleted == null).FirstOrDefaultAsync(); // Email Handler var mailsubject = "FYP System - Login Credentials"; var mailbody = $@"Dear {supervisor.SupervisorName}, Your reset login credentials: User Name: {supervisor.AssignedId} Password: {newPassword} Please change your password at Settings. Please contact the Coordinator if you found any problem or difficulty using the system. Thank You. Yours Sincerely, {coordinator.CoordinatorName} (FYP Coordinator)"; await _emailSender.SendEmailAsync(coordinator.CoordinatorEmail, supervisor.SupervisorEmail, mailsubject, mailbody); SuccessMessage = $"Password reset sent to supervisor {User.UserName} email"; } else { ErrorMessage = $"Supervisor {User.UserName} not found"; TryAgain = true; } } if (User.UserType == "Coordinator") { // handler for coordinator ErrorMessage = "Feature not available for coordinator"; } } else { ErrorMessage = $"{forgetPasswordData.UserName} does not exist."; TryAgain = true; } if (!TryAgain) { return(RedirectToPage("/Account/Login")); } else { return(RedirectToPage("/Account/ForgetPassword")); } }