public ActionResult Edit(int?id) { if (_rolesManager.SetCurrentEmployee(GetCurrentUserEmail())) { if (_rolesManager.IsStaffing()) { var applicant = _applicantsDataAccess.GetApplicantById(id); if (applicant == null) { return(HttpNotFound()); } ViewBag.HiringManagers = new SelectList(GetAllHiringManagers()); ViewBag.ProfilePic = _rolesManager.LoggedInEmployee.ProfilePic; ViewBag.Staffing = _rolesManager.IsStaffing(); return(View("ApplicantForm", applicant)); } ViewBag.ErrorMsg = "You are not authorized to view this page"; return(View("Error")); } ViewBag.ErrorMsg = "You are not registered on our system. Plz contact the system administrator if u think this is wrong."; return(View("Error")); }
// GET: PhoneInterview public ActionResult Index(int?applicantId) { if (applicantId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (_rolesManager.SetCurrentEmployee(GetCurrentUserEmail())) { if (_rolesManager.IsStaffing()) { ViewBag.ApplicantName = _applicantsDataAccess.GetApplicantById(applicantId).Name; var formQuestions = from d in _formQuestionsDataAccess.GetAllQuestions(FormType.PhoneInterview) orderby d.OrderInForm select d; var phoneInterview = new PhoneInterview { ApplicantId = (int)applicantId }; var viewModel = new PhoneInterviewViewModel { FormQuestions = formQuestions.ToList(), PhoneInterview = phoneInterview }; ViewBag.ProfilePic = _rolesManager.LoggedInEmployee.ProfilePic; ViewBag.Staffing = _rolesManager.IsStaffing(); return(View(viewModel)); } ViewBag.ErrorMsg = "You are not authorized to view this page"; return(View("Error")); } ViewBag.ErrorMsg = "You are not registered on our system. Plz contact the system administrator if u think this is wrong."; return(View("Error")); }
public ActionResult SaveFeedback(FeedbackFormViewModel feedbackFormViewModel) { if (!ModelState.IsValid) { return(View("Error")); } var interview = feedbackFormViewModel.Feedback.Interview; feedbackFormViewModel.Feedback.Interview = null; feedbackFormViewModel.Feedback.SubmissionDate = DateTime.Now; _feedbacksDataAccess.CreateFeedback(feedbackFormViewModel.Feedback); var applicant = _applicantsDataAccess.GetApplicantById(interview.ApplicantId); if (interview.InterviewType == InterviewType.HR) { if (feedbackFormViewModel.Feedback.Hired) { _applicantsDataAccess.EditApplicantStatus(applicant, ApplicantStatus.HRPassed); } else { _applicantsDataAccess.EditApplicantStatus(applicant, ApplicantStatus.HRRejected); } } else if (interview.InterviewType == InterviewType.Technical) { if (feedbackFormViewModel.Feedback.Hired) { _applicantsDataAccess.EditApplicantStatus(applicant, ApplicantStatus.TechPassed); } else { _applicantsDataAccess.EditApplicantStatus(applicant, ApplicantStatus.TechRejected); } } else if (interview.InterviewType == InterviewType.HiringManager) { if (feedbackFormViewModel.Feedback.Hired) { _applicantsDataAccess.EditApplicantStatus(applicant, ApplicantStatus.HiringManagerAccepted); } else { _applicantsDataAccess.EditApplicantStatus(applicant, ApplicantStatus.HiringManagerRejected); } } return(RedirectToAction("Details", new { applicantId = interview.ApplicantId, interviewType = interview.InterviewType })); }
public bool GetApplicantDetails(ApplicantsDataAccess applicantsDataAccess, ref Applicant applicant, int?id) { if (IsStaffing()) { applicant = applicantsDataAccess.GetApplicantById(id); return(true); } else if (IsManager()) { var app = applicantsDataAccess.GetApplicantById(id); if (app != null) { var appsInTeam = applicantsDataAccess.GetApplicantsByHiringManager(LoggedInEmployee.Name); if (appsInTeam.Exists(a => a.Id == app.Id)) { applicant = app; } return(applicant.Id != 0); } } return(false); }
// GET: ApplicantsQuestions public ActionResult Index(int?applicantId) { if (applicantId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (_rolesManager.SetCurrentEmployee(GetCurrentUserEmail())) { if (_rolesManager.IsStaffing()) { ViewBag.ApplicantName = _applicantsDataAccess.GetApplicantById(applicantId).Name; ViewBag.ProfilePic = _rolesManager.LoggedInEmployee.ProfilePic; ViewBag.Staffing = _rolesManager.IsStaffing(); return(View(_applicantsQuestionsDataAccess.GetAllQuestions((int)applicantId))); } ViewBag.ErrorMsg = "You are not authorized to view this page"; return(View("Error")); } ViewBag.ErrorMsg = "You are not registered on our system. Plz contact the system administrator if u think this is wrong."; return(View("Error")); }
public ActionResult Save(ApplicationFormViewModel applicationFormViewModel, HttpPostedFileBase uploadFile) { ////I commented it coz it will always give an error as resume field is required //if (!ModelState.IsValid) //{ // ViewBag.ErrorMsg = "Something went wrong with your submission. Please try again later"; // return View("Error"); //} applicationFormViewModel.FormResponse.SubmissionDate = DateTime.Now; applicationFormViewModel.FormResponse.Status = ApplicationFormResponseStatus.NotViewed; applicationFormViewModel.FormResponse.ApplicantResume = "#"; // HACK: coz resume is required and not yet created _formResponsesDataAccess.CreateResponse(applicationFormViewModel.FormResponse); var applicant = _applicantsDataAccess.GetApplicantById(applicationFormViewModel.FormResponse.ApplicantId); if (applicant != null) { applicant.Status = ApplicantStatus.ApplicationSubmitted; if (uploadFile != null) { var serverPath = Server.MapPath("~/Uploads/"); if (!Directory.Exists(serverPath)) { Directory.CreateDirectory(serverPath); } var extension = Path.GetExtension(uploadFile.FileName)?.ToLower(); if (extension != ".pdf") { ViewBag.ErrorMsg = "Invalid file type - Need to be PDF"; return(View("Error")); } var filePath = Path.Combine(serverPath + Path.GetFileName(uploadFile.FileName)); uploadFile.SaveAs(filePath); var applicantName = string.Join("", applicant.Name.Split(' ')); var fileName = applicant.Id.ToString() + '.' + applicantName + ".pdf"; applicant.FormResponse.ApplicantResume = _blobServices.BlobUrl + "resumes/" + fileName; _applicantsDataAccess.SaveChangesToDb(); _blobServices.BlobMediaUpload(fileName, filePath, "resumes"); // Delete file from server after finishing GC.Collect(); GC.WaitForPendingFinalizers(); System.IO.File.Delete(filePath); } _applicantsDataAccess.SaveChangesToDb(); } else { ViewBag.ErrorMsg = "Can't find applicant data in our system to submit it. " + "Please contact system administrator if you think this is a mistake"; return(View("Error")); } return(View("Success")); }