public EmailContext ComposeEmailContextForInterviewScheduled(int interviewId) { var emailContext = new EmailContext(); var selectedInterview = _interviewRoundRepository.Get(interviewId, "JobOpening,Candidate.Person,Round,Interviewer.Person"); if (selectedInterview != null) { emailContext.PlaceHolders = new List <PlaceHolder> { new PlaceHolder("[Id]", selectedInterview.Id.ToString()), new PlaceHolder("[JobOpening]", selectedInterview.JobOpening.Title), new PlaceHolder("[Candidate]", selectedInterview.Candidate.Person.Name), new PlaceHolder("[Round]", selectedInterview.Round.Title), new PlaceHolder("[Interviewer]", selectedInterview.Interviewer.Person.Name), new PlaceHolder("[ScheduledOn]", selectedInterview.ScheduledOn.ToString()), }; emailContext.Subject = "Interview Scheduled"; emailContext.ToAddress.Add(new MailAddress(selectedInterview.Interviewer.OfficialEmail, selectedInterview.Interviewer.Person.Name)); var settings = _settingsService.GetSiteSettings(); if (settings.POCSettings != null) { var selectedPOC = _userRepository.Get(settings.POCSettings.HRDepartmentLevel1, "Person"); if (selectedPOC != null) { var pocAddress = new MailAddress(selectedPOC.OfficialEmail, selectedPOC.Person.Name); emailContext.CcAddress.Add(pocAddress); } } if (selectedInterview.ScheduledOn.HasValue) { var description = $"{selectedInterview.Round.Title} for {selectedInterview.Candidate.Person.Name} on {selectedInterview.ScheduledOn}"; var icsFileContent = IcsHelper.Generate(selectedInterview.ScheduledOn.Value, "Interview Scheduled", description); var emailAttachment = new EmailAttachment() { FileName = "Interview.ics", FileType = "text/ics", Content = Encoding.ASCII.GetBytes(icsFileContent) }; emailContext.EmailAttachments.Add(emailAttachment); } } return(emailContext); }
public JsonResult AddNote(InterviewRoundActivityViewModel vm) { var selectedInterviewRound = _interviewRoundRepository.Get(vm.InterviewRoundId); if (selectedInterviewRound != null) { // Add it as an Activity var newActivity = new InterviewRoundActivity { Title = vm.Title, Comment = vm.Comment, InterviewRoundId = selectedInterviewRound.Id, CreatedByUserId = WebUser.Id }; _interviewRoundActivityRepository.Create(newActivity); _unitOfWork.Commit(); return(Json(true)); } return(Json(false)); }
public ActionResult Get(int id) { var apiResult = TryExecute(() => _interviewRoundRepository.Get(id), "Interview Fetched sucessfully"); return(Json(apiResult, JsonRequestBehavior.AllowGet)); }