protected void markForReview_Click(object sender, EventArgs e) { quiz = (ArithmeticHelper.QuizPaper)Cache[userID]; try { ArithmeticHelper.Question q = quiz.questionaire[quiz.presentQuestion]; q.markedForReview = true; quiz.questionaire[quiz.presentQuestion] = q; dataBindQuestionList(); Cache[userID] = quiz; } catch (SystemException) { Response.Redirect("Error.aspx"); } }
protected void next_Click(object sender, EventArgs e) { quiz = (ArithmeticHelper.QuizPaper)Cache[userID]; setTime(); previous.Enabled = true; previous0.Enabled = true; if (++quiz.presentQuestion == (quiz.questionaire.Count - 1)) { next.Enabled = false; next0.Enabled = false; } ArithmeticHelper.Question q = quiz.questionaire[quiz.presentQuestion]; q.markedForReview = false; quiz.questionaire[quiz.presentQuestion] = q; setLabels(); setVisibility(); Cache[userID] = quiz; }
protected void questionSelected(object sender, GridViewCommandEventArgs e) { if (e.CommandName != "selected") { return; } quiz = (ArithmeticHelper.QuizPaper)Cache[userID]; setTime(); quiz.presentQuestion = Convert.ToInt16(e.CommandArgument) + questionView.PageIndex * questionView.PageSize; ArithmeticHelper.Question q = quiz.questionaire[quiz.presentQuestion]; q.markedForReview = false; quiz.questionaire[quiz.presentQuestion] = q; if (quiz.presentQuestion == quiz.questionaire.Count - 1) { next.Enabled = false; next0.Enabled = false; } else { next0.Enabled = true; next.Enabled = true; } if (quiz.presentQuestion == 0) { previous0.Enabled = false; previous.Enabled = false; } else { previous.Enabled = true; previous0.Enabled = true; } setLabels(); setVisibility(); Cache[userID] = quiz; }
protected void options_SelectedIndexChanged(object sender, EventArgs e) { quiz = (ArithmeticHelper.QuizPaper)Cache[userID]; setTime(); quiz.questionsAnswered++; ArithmeticHelper.Question q = quiz.questionaire[quiz.presentQuestion]; q.setSelectedOption(options.SelectedIndex); if (q.selectedOption == q.options.IndexOf(q.answer)) { q.correct = 1; } else { q.correct = 0; } quiz.questionaire[quiz.presentQuestion] = q; result.ImageUrl = ImageURLS[quiz.questionaire.ElementAt(quiz.presentQuestion).correct]; time.Text = " Time : " + quiz.questionaire.ElementAt(quiz.presentQuestion).time + " (sec) "; setAnswerColor(); setVisibility(); Cache[userID] = quiz; }