protected void btnCompleteExam_Click(object sender, EventArgs e) { Label lblLoggedInUser = this.Master.FindControl("lblLoggedInUser") as Label; ClassExam recordAnswers = new ClassExam(); recordAnswers.RecordExamAnswers(this, lblLoggedInUser); }
protected void Page_Load(object sender, EventArgs e) { string selectedModule = Session["selectedModule"].ToString(); ClassExam loadData = new ClassExam(); loadData.LoadExamQuestions(this, selectedModule); }
protected void GridViewStudentObtainedGrades_SelectedIndexChanged(object sender, EventArgs e) { string studentId = Session["loggedInUser"].ToString(); string moduleId = GridViewStudentObtainedGrades.SelectedRow.Cells[1].Text; string attempt = GridViewStudentObtainedGrades.SelectedRow.Cells[3].Text; ClassExam examPaper = new ClassExam(); examPaper.ViewExamPaper(studentId, moduleId, attempt, panelDataView); }
protected void GridViewStudentModules_SelectedIndexChanged(object sender, EventArgs e) { string studentId = GridViewStudents.SelectedRow.Cells[1].Text; string moduleId = GridViewStudentModules.SelectedRow.Cells[1].Text; string attempt = GridViewStudentModules.SelectedRow.Cells[3].Text; ClassExam viewExamPaper = new ClassExam(); viewExamPaper.ViewExamPaper(studentId, moduleId, attempt, panelDataView); }
protected void btnBeginExam_Click(object sender, EventArgs e) { if (GridViewAvailbleModules.SelectedIndex >= 0) { Session["selectedModule"] = GridViewAvailbleModules.SelectedRow.Cells[1].Text; Label lblloggedInStudent = this.Master.FindControl("lblLoggedInUser") as Label; Session["btn01Color"] = "btn btn-default btn-circle"; Session["btn02Color"] = "btn btn-default btn-circle"; Session["btn03Color"] = "btn btn-default btn-circle"; Session["btn04Color"] = "btn btn-default btn-circle"; Session["btn05Color"] = "btn btn-default btn-circle"; Session["btn06Color"] = "btn btn-default btn-circle"; Session["btn07Color"] = "btn btn-default btn-circle"; Session["btn08Color"] = "btn btn-default btn-circle"; Session["btn09Color"] = "btn btn-default btn-circle"; Session["btn10Color"] = "btn btn-default btn-circle"; Session["btn11Color"] = "btn btn-default btn-circle"; Session["btn12Color"] = "btn btn-default btn-circle"; Session["btn13Color"] = "btn btn-default btn-circle"; Session["btn14Color"] = "btn btn-default btn-circle"; Session["btn15Color"] = "btn btn-default btn-circle"; Session["rbListQuestion01"] = -1; Session["rbListQuestion02"] = -1; Session["rbListQuestion03"] = -1; Session["rbListQuestion04"] = -1; Session["rbListQuestion05"] = -1; Session["rbListQuestion06"] = -1; Session["rbListQuestion07"] = -1; Session["rbListQuestion08"] = -1; Session["rbListQuestion09"] = -1; Session["rbListQuestion10"] = -1; Session["rbListQuestion11"] = -1; Session["rbListQuestion12"] = -1; Session["rbListQuestion13"] = -1; Session["rbListQuestion14"] = -1; Session["rbListQuestion15"] = -1; Session["questionAttempt"] = Convert.ToInt32(lblAttemptsTaken.Text) + 1; ClassExam selectAndRecord = new ClassExam(); selectAndRecord.SelectRandomExamQuestions(Session["selectedModule"].ToString(), lblloggedInStudent); selectAndRecord.RecordAttempt(lblloggedInStudent.Text, Session["selectedModule"].ToString(), (int)Session["questionAttempt"]); Response.Redirect("QuestionPage01.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Label lblloggedInStudent = this.Master.FindControl("lblLoggedInUser") as Label; lblloggedInStudent.Text = Session["loggedInUser"].ToString(); Session["btn13Color"] = "btn btn-primary btn-circle"; int pageIndex = 12; ClassExam loadData = new ClassExam(); loadData.LoadExamQuestions(lblQuestion13, rbListQuestion13, pageIndex, hf13, hfCorrectAns13); rbListQuestion13.SelectedIndex = Convert.ToInt32(Session["rbListQuestion13"]); string studentId = Session["loggedInUser"].ToString(); int questionAttempt = Convert.ToInt32(Session["questionAttempt"]); int providedAnswer = rbListQuestion13.SelectedIndex + 1; string selectedModuleId = Session["selectedModule"].ToString(); int correctAnswer = Convert.ToInt32(hfCorrectAns13.Value); loadData.ReduceExamMarks(studentId, questionAttempt, providedAnswer, selectedModuleId, correctAnswer); } }
protected void btnSaveAndNext_Click(object sender, EventArgs e) { if (rbListQuestion13.SelectedIndex == -1) { Session["btn13Color"] = "btn btn-danger btn-circle"; } else { Session["btn13Color"] = "btn btn-success btn-circle"; string studentId = Session["loggedInUser"].ToString(); string questionId = hf13.Value; int questionAttempt = Convert.ToInt32(Session["questionAttempt"]); int providedAnswer = rbListQuestion13.SelectedIndex + 1; int correctAnswer = Convert.ToInt32(hfCorrectAns13.Value); string selectedModuleId = Session["selectedModule"].ToString(); ClassExam record = new ClassExam(); record.RecordExamAnswers(studentId, questionId, questionAttempt, providedAnswer, selectedModuleId, correctAnswer); } Response.Redirect("QuestionPage14.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (Session["loggedInUser"] == null) { Response.Redirect("login.aspx"); } else { lblLoggedinUser.Text = Session["loggedInUser"].ToString(); int userLevel = Convert.ToInt32(Session["userLevel"]); if (userLevel == 2) { students.Visible = false; lecturers.Visible = false; courses.Visible = false; modules.Visible = false; } } ClassExam resetDataSet = new ClassExam(); resetDataSet.ResetDataSet(); }
/// <summary> /// Method to add class exam - SS /// </summary> /// <param name="addClassExam">class exam</param> /// <param name="loggedInUser">logged in user</param> /// <returns>response</returns> public async Task <ClassExamResponse> AddClassExamAsync(AddClassExamAc addClassExam, ApplicationUser loggedInUser) { var instituteId = await _instituteUserMappingHelperService.GetUserCurrentSelectedInstituteIdAsync(loggedInUser.Id, true); if (!await _iMSDbContext.InstituteClasses.AnyAsync(x => x.Id == addClassExam.ClassId && x.InstituteId == instituteId)) { return new ClassExamResponse() { HasError = true, Message = "Class not found", ErrorType = ClassExamResponseType.ClassId } } ; else if (!await _iMSDbContext.Sections.AnyAsync(x => x.Id == addClassExam.SectionId && x.InstituteId == instituteId)) { return new ClassExamResponse() { HasError = true, Message = "Section not found", ErrorType = ClassExamResponseType.SectionId } } ; else if (!await _iMSDbContext.ExamDefinitions.AnyAsync(x => x.Id == addClassExam.ExamId && x.InstituteId == instituteId)) { return new ClassExamResponse() { HasError = true, Message = "Exam not found", ErrorType = ClassExamResponseType.ExamId } } ; else { var subjectIds = addClassExam.ClassExamSubjectMappings.Select(x => x.SubjectId).Distinct().ToList(); var subjectCount = await _iMSDbContext.InstituteSubjects.CountAsync(x => subjectIds.Contains(x.Id)); if (subjectIds.Count != subjectCount) { return new ClassExamResponse() { HasError = true, Message = "Subject not found", ErrorType = ClassExamResponseType.SubjectId } } ; else { var classExam = new ClassExam() { ClassId = addClassExam.ClassId, CreatedOn = DateTime.UtcNow, ExamId = addClassExam.ExamId, SectionId = addClassExam.SectionId, TotalAttendanceDays = addClassExam.TotalAttendanceDays, UpdatedById = loggedInUser.Id, UpdatedOn = DateTime.UtcNow }; _iMSDbContext.ClassExams.Add(classExam); await _iMSDbContext.SaveChangesAsync(); List <ClassExamSubjectMapping> classExamSubjects = new List <ClassExamSubjectMapping>(); foreach (var subject in addClassExam.ClassExamSubjectMappings) { classExamSubjects.Add(new ClassExamSubjectMapping() { ClassExamId = classExam.Id, Content = subject.Content, CreatedOn = DateTime.UtcNow, EndTime = subject.EndTime, MaxScore = subject.MaxScore, MinScore = subject.MinScore, Remark = subject.Remark, StartDate = subject.StartDate, StartTime = subject.StartTime, SubjectId = subject.SubjectId }); } _iMSDbContext.ClassExamSubjectMappings.AddRange(classExamSubjects); await _iMSDbContext.SaveChangesAsync(); return(new ClassExamResponse() { HasError = false, Message = "Class exam detail added successfully" }); } } }