public ActionResult ReviewTest(int UserApplicationId) { if (!ModelState.IsValid) { return(RedirectToAction("LogOff", "CandidateAccount")); } var user = _userService.GetUserByUserApplicationId(UserApplicationId); if (user == null) { ViewBag.Status = 1; ViewBag.Msg = "User not found for online test, Kindly contact admin."; return(View("Welcome")); } UserTestSuite userTestSuite = _testSuiteService.GetUserTestSuiteByUserApplicationId(UserApplicationId); if (userTestSuite == null) { ViewBag.Status = 1; ViewBag.Msg = "Test suite is not assigned for you, Kindly contact admin."; return(View("Welcome")); } TestSuiteCandidateModel testSuiteCandidateModel = _mappingService.Map <UserTestSuite, TestSuiteCandidateModel>(userTestSuite); var candidateInfoBusinessModel = _userService.GetCandidateInfo(user); testSuiteCandidateModel.ProfilePhotoFilePath = user.ProfilePhotoFilePath; testSuiteCandidateModel.CandidateInfo = _mappingService.Map <CandidateInfoBusinessModel, CandidateInfoViewModel>(candidateInfoBusinessModel); testSuiteCandidateModel.NavigationDetails = GetNavigationDetails(testSuiteCandidateModel.UserTestSuiteId); testSuiteCandidateModel.TotalQuestionCount = testSuiteCandidateModel.PracticalCount + testSuiteCandidateModel.ObjectiveCount; testSuiteCandidateModel.DurationInMin = testSuiteCandidateModel.Duration; testSuiteCandidateModel.TestSummary = GetTestSummary(testSuiteCandidateModel.UserTestSuiteId); testSuiteCandidateModel.UserId = user.UserId; CandidateStatus status; if (Enum.TryParse(user.CandidateStatus, out status)) { if (user.CandidateStatus == CandidateStatus.TestSubmitted.ToString()) { var userRole = MvcApplication.getCurrentUserRoles(); if (userRole.Contains(RoleName.Panel.ToString())) { user.CandidateStatus = CandidateStatus.UnderEvaluation.ToString(); _userService.Update(user); } } testSuiteCandidateModel.CandidateStatus = status; } return(View(testSuiteCandidateModel)); return(View()); }
public ActionResult LoadTestSummaryView(int userId, int UserTestSuiteId) { var user = _userService.GetUserById(userId); UserTestSuite userTestSuite = _testSuiteService.GetUserTestSuiteByUserApplicationId(user.UserApplicationId); TestSuiteCandidateModel testSuiteCandidateModel = _mappingService.Map <UserTestSuite, TestSuiteCandidateModel>(userTestSuite); var candidateInfoBusinessModel = _userService.GetCandidateInfo(user); testSuiteCandidateModel.CandidateInfo = _mappingService.Map <CandidateInfoBusinessModel, CandidateInfoViewModel>(candidateInfoBusinessModel); testSuiteCandidateModel.NavigationDetails = GetNavigationDetails(testSuiteCandidateModel.UserTestSuiteId); testSuiteCandidateModel.TotalQuestionCount = testSuiteCandidateModel.PracticalCount + testSuiteCandidateModel.ObjectiveCount; testSuiteCandidateModel.DurationInMin = testSuiteCandidateModel.Duration; testSuiteCandidateModel.TestSummary = GetTestSummary(testSuiteCandidateModel.UserTestSuiteId); testSuiteCandidateModel.UserId = user.UserId; return(PartialView("_reviewerTestSummaryAndCandidateDetails", testSuiteCandidateModel)); }
public ActionResult OnlineTest() { if (!ModelState.IsValid) { return(RedirectToAction("LogOff", "CandidateAccount")); } var userEmail = User.Identity.Name.Trim(); var user = _userService.GetUserByEmail(userEmail); if (user == null) { ViewBag.Status = 1; ViewBag.Msg = "User not found for online test, kindly contact admin."; return(View("Welcome", new TestSuiteCandidateModel())); } UserTestSuite userTestSuite = _testSuiteService.GetUserTestSuiteByUserApplicationId(user.UserApplicationId); if (userTestSuite == null) { ViewBag.Status = 1; ViewBag.Msg = "No test is assigned for you, kindly contact admin."; return(View("Welcome", new TestSuiteCandidateModel())); } else if (user.CandidateStatus != CandidateStatus.TestAssigned.ToString()) { ViewBag.Status = 1; ViewBag.Msg = "You have already submitted your test."; return(View("Welcome", new TestSuiteCandidateModel())); } TestSuiteCandidateModel testSuiteCandidateModel = _mappingService.Map <UserTestSuite, TestSuiteCandidateModel>(userTestSuite); var candidateInfoBusinessModel = _userService.GetCandidateInfo(user); testSuiteCandidateModel.CandidateInfo = _mappingService.Map <CandidateInfoBusinessModel, CandidateInfoViewModel>(candidateInfoBusinessModel); testSuiteCandidateModel.ProfilePhotoFilePath = user.ProfilePhotoFilePath; testSuiteCandidateModel.NavigationDetails = GetNavigationDetails(testSuiteCandidateModel.UserTestSuiteId); testSuiteCandidateModel.TotalQuestionCount = testSuiteCandidateModel.PracticalCount + testSuiteCandidateModel.ObjectiveCount; testSuiteCandidateModel.DurationInMin = testSuiteCandidateModel.RemainingTime > 0 ? testSuiteCandidateModel.RemainingTime : testSuiteCandidateModel.Duration; testSuiteCandidateModel.UserId = user.UserApplicationId; return(View(testSuiteCandidateModel)); }
public ActionResult TestSuiteAndCandidateDetails() { var userEmail = User.Identity.Name.Trim(); var user = _userService.GetUserByEmail(userEmail); if (user == null) { return(RedirectToAction("LogOff", "CandidateAccount")); } UserTestSuite userTestSuite = _testSuiteService.GetUserTestSuiteByUserApplicationId(user.UserApplicationId); if (userTestSuite != null) { if (userTestSuite.RemainingTime > 0) { userTestSuite.Duration = userTestSuite.RemainingTime; } else { var testSuiteDetails = _testSuiteService.GetTestSuiteDetails().SingleOrDefault(model => model.TestSuiteId == userTestSuite.TestSuiteId && !model.IsDeleted); _testSuiteService.AssignSuite(userTestSuite, testSuiteDetails); } } TestSuiteCandidateModel testSuiteCandidateModel = _mappingService.Map <UserTestSuite, TestSuiteCandidateModel>(userTestSuite); testSuiteCandidateModel = testSuiteCandidateModel ?? new TestSuiteCandidateModel(); var candidateInfoBusinessModel = _userService.GetCandidateInfo(user); testSuiteCandidateModel.CandidateInfo = _mappingService.Map <CandidateInfoBusinessModel, CandidateInfoViewModel>(candidateInfoBusinessModel); testSuiteCandidateModel.NavigationDetails = GetNavigationDetails(testSuiteCandidateModel.UserTestSuiteId); testSuiteCandidateModel.DurationInMin = testSuiteCandidateModel.RemainingTime > 0 ? testSuiteCandidateModel.RemainingTime : testSuiteCandidateModel.Duration; return(PartialView("_testSuiteAndCandidateDetails", testSuiteCandidateModel)); }
public ActionResult PreViewQuestion(int testSuiteId) { var viewerEmailId = User.Identity.Name; var viewer = _containerUserService.FindUserByEmail(viewerEmailId); int count = 0; var testSuiteViewQuesModel = new TestSuiteViewQuesModel(); var testSuiteQuestionList = new List <TestSuiteQuestion>(); try { TestSuite testSuitDetails = _testSuiteService.GetTestSuitById(testSuiteId); var previewTest = new PreviewTestBusinessModel { TestSuite = testSuitDetails, ViewerId = viewer.ID }; if (testSuitDetails != null && testSuitDetails.Status == Convert.ToInt32(TestSuiteStatus.Ready)) { var questionList = _testSuiteService.GetPreview(previewTest); foreach (var pQuestion in questionList) { count++; testSuiteQuestionList.Add(new TestSuiteQuestion() { QuestionType = pQuestion.QuestionType, QuestionNumber = count, QuestionDescription = pQuestion.QuestionDescription, OptionCount = pQuestion.OptionCount, Answer = pQuestion.Answer, CorrectAnswer = pQuestion.CorrectAnswer, Id = pQuestion.Id, Marks = pQuestion.Marks, Option1 = pQuestion.Option1, Option2 = pQuestion.Option2, Option3 = pQuestion.Option3, Option4 = pQuestion.Option4, Option5 = pQuestion.Option5, Option6 = pQuestion.Option6, Option7 = pQuestion.Option7, Option8 = pQuestion.Option8, }); } testSuiteViewQuesModel.TestSuiteQuestion = testSuiteQuestionList; testSuiteViewQuesModel.TestSuiteName = testSuitDetails.TestSuiteName; testSuiteViewQuesModel.Duration = testSuitDetails.Duration; testSuiteViewQuesModel.ObjectiveCount = questionList.Count(x => x.QuestionType == 1); testSuiteViewQuesModel.PracticalCount = questionList.Count(x => x.QuestionType == 2); TestSuiteCandidateModel testSuiteCandidateModel = new TestSuiteCandidateModel { TestSuiteId = testSuiteId, PracticalCount = testSuiteViewQuesModel.PracticalCount, ObjectiveCount = testSuiteViewQuesModel.ObjectiveCount, Duration = testSuiteViewQuesModel.Duration }; testSuiteCandidateModel.NavigationDetails = GetQuestionNavigationDetails(questionList); testSuiteCandidateModel.TotalQuestionCount = testSuiteCandidateModel.PracticalCount + testSuiteCandidateModel.ObjectiveCount; testSuiteCandidateModel.DurationInMin = testSuiteCandidateModel.Duration; return(View("PreviewQuestions", testSuiteCandidateModel)); } else { testSuiteViewQuesModel.ErrorMessage = "Test suite is not ready."; } } catch { testSuiteViewQuesModel.ErrorMessage = "Something went wrong! Please try later."; } return(View(testSuiteViewQuesModel)); }