public ActionResult ChangeStatus(InterviewRound vm) { if (ModelState.IsValid) { var selectedInterviewRound = _interviewRoundRepository.Get(vm.Id); if (selectedInterviewRound != null) { selectedInterviewRound.Status = vm.Status; var newActivity = new InterviewRoundActivity { InterviewRoundId = selectedInterviewRound.Id, Title = "Status Changed", Comment = vm.Comments, CreatedByUserId = WebUser.Id }; _interviewRoundActivityRepository.Create(newActivity); _unitOfWork.Commit(); } _interviewRoundRepository.Update(selectedInterviewRound); _unitOfWork.Commit(); return(RedirectToAction("Details", "InterviewRounds", new { id = vm.Id })); } return(View(vm)); }
public ActionResult Update(InterviewRound referal) { ApiResult <InterviewRound> apiResult; if (ModelState.IsValid) { if (referal.Id > 0) { apiResult = TryExecute(() => { _interviewRoundRepository.Update(referal); _unitOfWork.Commit(); return(referal); }, "Interview updated sucessfully"); } else { apiResult = TryExecute(() => { _interviewRoundRepository.Create(referal); _unitOfWork.Commit(); return(referal); }, "Interview created sucessfully"); } } else { apiResult = ApiResultFromModelErrors <InterviewRound>(); } return(Json(apiResult, JsonRequestBehavior.AllowGet)); }
public async Task <bool> Update(InterviewRound obj) { bool result = false; var filterId = Builders <InterviewRound> .Filter.Eq(i => i.Id, obj.Id); var data = await DbSet.FindAsync(filterId); try { var interviewRound = data.FirstOrDefault(); if (!string.IsNullOrEmpty(obj.FeedbackId)) { interviewRound.FeedbackId = obj.FeedbackId; } if (!string.IsNullOrEmpty(obj.Interviewer)) { interviewRound.Interviewer = obj.Interviewer; } interviewRound.Date = obj.Date; result = Convert.ToBoolean(await DbSet.FindOneAndReplaceAsync(filterId, interviewRound)); } catch (Exception ex) { } return(result); }
public async Task <InterviewRoundDetailModel> Handle(GetInterviewRoundDetailQuery request, CancellationToken cancellationToken) { var interviewround = new InterviewRound(); interviewround = await _context.GetById(request.Id); return(InterviewRoundDetailModel.Create(interviewround)); }
public async Task <Unit> Handle(UpdateInterviewRoundCommand request, CancellationToken cancellationToken) { var interviewRound = new InterviewRound(); interviewRound.Id = request.Id; interviewRound.FeedbackId = request.FeedbackId; interviewRound.Date = System.DateTime.Now; _context.Update(interviewRound); return(Unit.Value); }
// Todo Interviewers ?? public static InterviewRound MapToInterviewRound(InterviewRoundCreateCommand command) { var interviewRound = new InterviewRound { SequenceNumber = command.SequenceNumber }; if (command.Questionnaire?.Any() == true) { interviewRound.Questionnaire = command.Questionnaire.Select(x => InterchangeTemplateCreateCommand.MapToInterchangeTemplate(x)); } return(interviewRound); }
private void addInterviews() { var data = System.IO.File.ReadAllText(@"C:\Users\Ashish\Desktop\Interviews(Ambition).json"); var interviews = JsonConvert.DeserializeObject <IEnumerable <interview> >(data); var groups = interviews.GroupBy(g => g.Company); foreach (var group in groups) { var companyId = databaseContext.Companies.SingleOrDefault(c => c.Name == group.Key || c.Identifier.ToUpper() == group.Key.ToUpper())?.Id; if (!companyId.HasValue) { continue; } foreach (var interview in group) { var intvw = new Interview { CompanyId = companyId.Value, Title = interview.JobTitle, Description = interview.Description ?? interview.OverAllExp, PostedOn = string.IsNullOrWhiteSpace(interview.PostedOn) ? DateTime.MinValue : DateTime.ParseExact(interview.PostedOn, "dd MMM yyyy", null), Rounds = new List <InterviewRound>() }; foreach (var round in interview.Rounds) { var r = new InterviewRound { Detail = round.Description, RoundName = round.Name, Questions = new List <Question>() }; foreach (var q in round.Questions) { var ques = new Question { Detail = q.Desc }; r.Questions.Add(ques); } intvw.Rounds.Add(r); } databaseContext.Interviews.Add(intvw); } } databaseContext.SaveChanges(); }
public async void Add(InterviewRound obj) { try { //var filter = Builders<User>.Filter.Eq(i=>i.Id, id); //var data = userDbset.Find(filterId).FirstOrDefaultAsync().GetAwaiter().GetResult(); //var count = userDbset.CountDocuments(filter); await DbSet.InsertOneAsync(obj); } catch (Exception ex) { } }
public async Task <Unit> Handle(CreateInterviewRoundCommand request, CancellationToken cancellationToken) { var entity = new InterviewRound { InterviewRoundTypeId = request.InterviewRoundTypeId, InterviewProcessId = request.InterviewProcessId, Interviewer = request.Interviewer, FeedbackId = request.FeedbackId, Date = System.DateTime.Now }; _context.Add(entity); return(Unit.Value); }
public InterviewRoundDetailsViewModel(InterviewRound interviewRound) { Id = interviewRound.Id; Code = interviewRound.Code; JobOpeningId = interviewRound.JobOpeningId; JobOpening = interviewRound.JobOpening; CandidateId = interviewRound.CandidateId; Candidate = interviewRound.Candidate; RoundId = interviewRound.RoundId; Round = interviewRound.Round; InterviewerId = interviewRound.InterviewerId; Interviewer = interviewRound.Interviewer; ScheduledOn = interviewRound.ScheduledOn; Status = interviewRound.Status; Comments = interviewRound.Comments; }
public ActionResult Edit(InterviewRound interviewRound) { if (ModelState.IsValid) { _interviewRoundRepository.Update(interviewRound); _unitOfWork.Commit(); return(RedirectToAction("Index")); } ViewBag.CandidateId = new SelectList(_candidateRepository.GetAll(o => o.OrderByDescending(c => c.Id), "Person").Select(c => new { c.Id, Name = c.Person.Name + "- [" + c.Code + "]" }), "Id", "Name", interviewRound.CandidateId); ViewBag.InterviewerId = new SelectList(_userRepository.GetAllBy(u => u.EmployeeStatus != EmployeeStatus.Ex && u.Id != 1, "Person"), "Id", "Person.Name", interviewRound.InterviewerId); ViewBag.JobOpeningId = new SelectList(_jobOpeningRepository.GetAll(), "Id", "Title", interviewRound.JobOpeningId); ViewBag.RoundId = new SelectList(_roundRepository.GetAll(), "Id", "Title", interviewRound.RoundId); return(View(interviewRound)); }
public ActionResult Create(CreateInterviewRoundViewModel vm) { if (ModelState.IsValid) { var interviews = new List <int>(); foreach (var interviewer in vm.InterviewerIds.ToList()) { var newInterviewRound = new InterviewRound() { JobOpeningId = vm.JobOpeningId, CandidateId = vm.CandidateId, RoundId = vm.RoundId, InterviewerId = interviewer, ScheduledOn = vm.ScheduledOn, Status = InterviewStatus.Scheduled, Comments = vm.Comments }; _interviewRoundRepository.Create(newInterviewRound); _unitOfWork.Commit(); interviews.Add(newInterviewRound.Id); } foreach (var interviewId in interviews) { #if !DEBUG _emailComposerService.InterviewScheduled(interviewId); #endif } return(RedirectToAction("Index")); } ViewBag.CandidateId = new SelectList(_candidateRepository.GetAll(o => o.OrderByDescending(c => c.Id), "Person").Select(c => new { c.Id, Name = c.Person.Name + "- [" + c.Code + "]" }), "Id", "Name"); ViewBag.InterviewerId = new MultiSelectList(_userRepository.GetAllBy(u => u.EmployeeStatus != EmployeeStatus.Ex && u.Id != 1, "Person"), "Id", "Person.Name", vm.InterviewerIds); ViewBag.JobOpeningId = new SelectList(_jobOpeningRepository.GetAll(), "Id", "Title"); ViewBag.RoundId = new SelectList(_roundRepository.GetAll(), "Id", "Title"); return(View(vm)); }
public JsonResult AddInterviewRound(CreateInterviewRoundViewModel vm) { try { var interviews = new List <int>(); foreach (var interviewer in vm.InterviewerIds.ToList()) { var newInterviewRound = new InterviewRound { JobOpeningId = vm.JobOpeningId, CandidateId = vm.CandidateId, RoundId = vm.RoundId, InterviewerId = interviewer, ScheduledOn = vm.ScheduledOn, Status = InterviewStatus.Scheduled, Comments = vm.Comments }; _interviewRoundRepository.Create(newInterviewRound); _unitOfWork.Commit(); interviews.Add(newInterviewRound.Id); } foreach (var interviewId in interviews) { #if !DEBUG _emailComposerService.InterviewScheduled(interviewId); #endif } return(Json(true)); } catch (Exception) { return(Json(false)); } }
public IActionResult OnPost() { if (!ModelState.IsValid) { return(Page()); } var userId = UserId; var company = databaseContext.Companies .Where(c => c.Name.ToUpper().Contains(Input.Company) || c.Identifier.ToUpper().Contains(Input.Company)); int companyId = 0; if (company.Any()) { companyId = company.Single().Id; } else { companyId = CreateCompany(Input.Company).Id; } var interview = new Interview { CandidateId = userId, CompanyId = companyId, Experience = Input.Experience, Location = Input.Location, PostedOn = DateTime.Now, Source = Input.Source, Title = Input.Title, Rounds = new List <InterviewRound>(), Identifier = GetIdentifier(Input.Title) }; if (Input.Rounds != null && Input.Rounds.Any()) { foreach (var round in Input.Rounds) { var iRound = new InterviewRound { Detail = round.Desc, RoundType = round.Type, Questions = new List <Question>() }; if (round.Questions != null && round.Questions.Any()) { foreach (var ques in round.Questions) { var iQues = new Question { Detail = ques.Question }; if (!string.IsNullOrWhiteSpace(ques.Skill)) { var skillInDb = databaseContext.Skills.Where(s => s.Name == ques.Skill); Skill skill; if (!skillInDb.Any()) { skill = new Skill { Name = ques.Skill } } ; else { skill = skillInDb.Single(); } iQues.Skill = skill; } iRound.Questions.Add(iQues); } } interview.Rounds.Add(iRound); } } databaseContext.Interviews.Add(interview); databaseContext.SaveChanges(); return(new RedirectToPageResult("Interview")); }
public static InterviewRoundDetailModel Create(InterviewRound interviewRound) { return(Projection.Compile().Invoke(interviewRound)); }