use of amu.zhcet.common.realtime.RealTimeStatus in project zhcet-web by zhcet-amu.
the class StudentRegistrationController method uploadStudents.
@PostMapping("/confirm")
public String uploadStudents(RedirectAttributes attributes, @SessionAttribute(KEY_STUDENT_REGISTRATION) Confirmation<Student> confirmation, WebRequest webRequest) {
if (confirmation == null || !confirmation.getErrors().isEmpty()) {
attributes.addFlashAttribute("errors", Collections.singletonList("Unknown Error"));
} else {
try {
RealTimeStatus status = realTimeStatusService.install();
studentUploadService.registerStudents(confirmation, status);
attributes.addFlashAttribute("task_id_student", status.getId());
attributes.addFlashAttribute("students_registered", true);
} catch (Exception e) {
log.error("Error registering students", e);
attributes.addFlashAttribute("student_unknown_error", true);
}
webRequest.removeAttribute(KEY_STUDENT_REGISTRATION, RequestAttributes.SCOPE_SESSION);
}
return "redirect:/admin/dean";
}
use of amu.zhcet.common.realtime.RealTimeStatus in project zhcet-web by zhcet-amu.
the class FacultyRegistrationController method uploadFaculty.
@PostMapping("/confirm")
public String uploadFaculty(RedirectAttributes attributes, @SessionAttribute(KEY_FACULTY_REGISTRATION) Confirmation<FacultyMember> confirmation, WebRequest webRequest) {
if (confirmation == null || !confirmation.getErrors().isEmpty()) {
attributes.addFlashAttribute("errors", Collections.singletonList("Unknown Error"));
} else {
try {
String passwordFileLocation = facultyUploadService.savePasswordFile(confirmation);
RealTimeStatus status = realTimeStatusService.install();
facultyUploadService.registerFaculty(confirmation, status);
attributes.addFlashAttribute("task_id_faculty", status.getId());
attributes.addFlashAttribute("file_saved", passwordFileLocation);
attributes.addFlashAttribute("faculty_registered", true);
} catch (IOException e) {
log.error("Error registering faculty", e);
attributes.addFlashAttribute("file_error", true);
} catch (Exception e) {
log.error("Error registering faculty", e);
attributes.addFlashAttribute("faculty_unknown_error", true);
}
webRequest.removeAttribute("confirmFacultyRegistration", RequestAttributes.SCOPE_SESSION);
}
return "redirect:/admin/dean";
}
Aggregations