private void UpdateReview(decimal?mark, string comment, int?userTestDetailId) { UserTestDetails userTestDetails = _testSuiteService.GetUserTestDetailsId(userTestDetailId); userTestDetails.Mark = mark; Silicus.UtilityContainer.Models.DataObjects.User user = _containerUserService.FindUserByEmail(HttpContext.User.Identity.Name); if (user != null) { userTestDetails.MarkGivenBy = user.ID; userTestDetails.MarkGivenByName = user.DisplayName; } userTestDetails.MarkGivenDate = DateTime.Now; userTestDetails.ReviwerComment = comment; _testSuiteService.UpdateUserTestDetails(userTestDetails); }
/// <summary> /// Showing all candidate list in grid /// </summary> /// <param name="request"></param> /// <returns></returns> public ActionResult GetCandidateDetails([DataSourceRequest] DataSourceRequest request, string RoleName) { _testSuiteService.TestSuiteActivation(); var userlist = _userService.GetUserDetails().Where(p => p.Role.ToLower() == RoleName.ToLower()).ToArray().Reverse().OrderByDescending(x => x.CandidateStatus.StartsWith("New")).ToArray(); var currentUserRoles = MvcApplication.getCurrentUserRoles(); if (currentUserRoles.Count == 1 && currentUserRoles.Contains(Silicus.Ensure.Models.Constants.RoleName.Panel.ToString())) { var currentUserMail = HttpContext.User.Identity.Name; var user = _containerUserService.FindUserByEmail(currentUserMail); if (user != null) { userlist = userlist.Where(x => x.PanelId != null && x.PanelId.Contains(Convert.ToString(user.ID))).ToArray(); } } var viewModels = _mappingService.Map <UserBusinessModel[], UserViewModel[]>(userlist); bool userInRole = User.IsInRole(Silicus.Ensure.Models.Constants.RoleName.Admin.ToString()); for (int index = 0; index < viewModels.Count(); index++) { var testSuitId = _testSuiteService.GetUserTestSuiteByUserApplicationId(viewModels[index].UserApplicationId); viewModels[index].IsAdmin = userInRole; viewModels[index].TestSuiteId = testSuitId != null ? testSuitId.TestSuiteId : 0; } // viewModels = viewModels.OrderByDescending(x => x.CandidateStatus).ToList(); DataSourceResult result = viewModels.ToDataSourceResult(request); return(Json(result)); }
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)); }