public IActionResult PrepareCandiateDetails(string enrollmentId) { CandidateDetailsViewModel viewModel = new CandidateDetailsViewModel(); if (enrollmentId != null && enrollmentId.Length > 0) { viewModel = this._candidateService.GetCandateDetails(Convert.ToInt32(enrollmentId)); if (!string.IsNullOrEmpty(viewModel.AccountManager)) { var acManager = this._userManager.Users.Where(r => r.Id == Convert.ToInt32(viewModel.AccountManager)).FirstOrDefault(); if (acManager != null) { viewModel.AccountManagerName = acManager.FirstName + " " + acManager.LastName; } } } return(this.Json( new { Success = true, Message = string.Empty, Html = this.RenderPartialViewToString("_CandidateDetails", viewModel) })); }
public CandidateExamWrapperModel GetCandidateExamList() { CandidateExamWrapperModel model = new CandidateExamWrapperModel(); model = _candidateExamRepository.GetAllSubmittedTests(); foreach (var rec in model.CandidateExamList) { CandidateDetailsViewModel candidate = _candidateRepository.GetCandidateDetails(rec.CandidateId); rec.CandidateName = candidate.Name; TestDetailsViewModel test = _testRepository.GetTestDetails(rec.TestId); rec.TestName = test.Name; List <CandidateExamQuestionLogModel> list = _candidateExamQuestionLogRepository.FindByCandidateExamId(rec.Id); int CorrectAnswers = 0; int TotalQuestions = test.QuestionList.Count(); foreach (var obj in list) { if (obj.IsAnswerCorrect == true) { CorrectAnswers = CorrectAnswers + 1; } } rec.Score = CorrectAnswers + "/" + TotalQuestions; } return(model); }
public CandidateDetailsViewModel GetCandidateDetails(int id) { string connectionString = "server=localhost;uid=root;password=Reset1234;database=OnlineTestManagement;"; CandidateDetailsViewModel model = new CandidateDetailsViewModel(); string queryString = "select OnlineTestManagement.Candidate.Id, OnlineTestManagement.Candidate.Name,OnlineTestManagement.Candidate.EmailId,OnlineTestManagement.Candidate.MobileNumber,OnlineTestManagement.Candidate.Password,OnlineTestManagement.Candidate.AppliedFor, OnlineTestManagement.Test.Name as Test from (OnlineTestManagement.Candidate INNER JOIN Test ON OnlineTestManagement.Candidate.TestId = OnlineTestManagement.Test.Id) where OnlineTestManagement.Candidate.Id=" + id + " "; using (MySqlConnection connection = new MySqlConnection(connectionString)) { MySqlCommand command = new MySqlCommand(queryString, connection); connection.Open(); MySqlDataReader reader = command.ExecuteReader(); // Call Read before accessing data. while (reader.Read()) { model.Id = (int)reader[0]; model.Name = reader[1].ToString(); model.EmailId = reader[2].ToString(); model.MobileNumber = reader[3].ToString(); model.Password = reader[4].ToString(); model.AppliedFor = reader[5].ToString(); model.Test = reader[6].ToString(); } connection.Close(); } return(model); }
public CandidateExamModel GetCandidateExamDetails(int id) { CandidateExamModel model = new CandidateExamModel(); model = _candidateExamRepository.GetExamDetails(id); CandidateDetailsViewModel candidate = _candidateRepository.GetCandidateDetails(model.CandidateId); model.CandidateName = candidate.Name; TestDetailsViewModel test = _testRepository.GetTestDetails(model.TestId); model.TestName = test.Name; model.list = new List <CandidateExamQuestionLogModel>(); model.list = _candidateExamQuestionLogRepository.FindByCandidateExamId(id); int CorrectAnswers = 0; int TotalQuestions = test.QuestionList.Count(); foreach (var obj in model.list) { if (obj.IsAnswerCorrect == true) { CorrectAnswers = CorrectAnswers + 1; } } model.Score = CorrectAnswers + "/" + TotalQuestions; model.TotalNumberOfQuestions = TotalQuestions; model.AttemptedQuestions = model.list.Count(); model.CorrectAnswers = CorrectAnswers; model.WrongAnswers = model.list.Count() - CorrectAnswers; foreach (var que in test.QuestionList) { bool IsPresent = false; foreach (var item in model.list) { if (que.Id == item.QuestionId) { IsPresent = true; } } if (IsPresent == false) { CandidateExamQuestionLogModel rec = new CandidateExamQuestionLogModel(); rec.Question = que.Question; rec.SelectedAnswer = "NA"; rec.IsAnswerCorrect = false; model.list.Add(rec); } } return(model); }
public IActionResult PrepareCandiateDetails(string enrollmentId) { CandidateDetailsViewModel viewModel = new CandidateDetailsViewModel(); if (enrollmentId != null && enrollmentId.Length > 0) { viewModel = this._candidateService.GetCandateDetails(Convert.ToInt32(enrollmentId)); } return(this.Json( new { Success = true, Message = string.Empty, Html = this.RenderPartialViewToString("_CandidateDetails", viewModel) })); }
public ActionResult Details(int id) { var candidate = _candidateRepository.Get(id, "Person"); if (candidate == null) { return(HttpNotFound()); } ViewBag.InterviewerId = new MultiSelectList(_userRepository.GetAllBy(u => u.EmployeeStatus != EmployeeStatus.Ex && u.Id != 1, "Person"), "Id", "Person.Name"); ViewBag.JobOpeningId = new SelectList(_jobOpeningRepository.GetAll(), "Id", "Title"); ViewBag.RoundId = new SelectList(_roundRepository.GetAll(), "Id", "Title"); var candidateDocs = _candidateDocumentRepository.GetAllBy(m => m.CandidateId == candidate.Id); var rounds = _interviewRoundRepository.GetAllBy(m => m.CandidateId == candidate.Id, "Interviewer.Person,Round"); var vm = new CandidateDetailsViewModel(candidate) { CandidateDocuments = candidateDocs.ToList(), InterviewRounds = rounds.ToList() }; return(View(vm)); }
public IActionResult Details(int id) { CandidateDetailsViewModel model = _candidateService.GetCandidateDetails(id); return(View(model)); }
public CandidateDetailsViewModel GetCandidateDetails(int id) { CandidateDetailsViewModel model = _candidateRepository.GetCandidateDetails(id); return(model); }