private void defaultExamOnLoad() { string StudentName = (string)Session["student"]; ExamID = (string)Session["exam_id"]; if (Request.QueryString["id"] != null) { currentQuestionId = Request.QueryString["id"]; Session[currentQuestionId + "VQ"] = "Ahoy"; } //Time to set the timer accordingly String examDuration = AptitudeTestBLL.Instance.GetExamDurationByID(ExamID); int timeLeft = 0; if (Session["currentExamDuration"] != null) { timeLeft = (int.Parse(examDuration) * 60) - int.Parse(SessionsCommon.getTimeDifference(Session)); } else { timeLeft = int.Parse(examDuration) * 60; Session["currentExamDuration"] = DateTime.Now; } this.currentExamTime.Value = (timeLeft).ToString(); questionID = Request.QueryString["id"]; DataTable questionTable = AptitudeTestBLL.Instance.GetQuestionsForExamByID(ExamID); ArrayList al = (ArrayList)Session["questionList"]; //if (Session["questionList"] == null) //{ al = GenerateArrayList(questionTable); ShuffleList(al); Session["questionList"] = al; //} //////////List<string> lstquestion = new List<string>(); //////////if (Session["questionList"] == null) //////////{ ////////// lstquestion = GenerateArrayList(questionTable); ////////// //ShuffleList(al); ////////// Session["questionList"] = lstquestion; //////////} //////////else ////////// lstquestion = (List<string>) Session["questionList"]; GenerateHtml(al); }
protected void Page_Load(object sender, EventArgs e) { string ExamID = (string)Session["exam_id"]; String examDuration = AptitudeTestBLL.Instance.GetExamDurationByID(ExamID); int timeLeft = 0; if (Session["currentExamDuration"] != null) { timeLeft = (int.Parse(examDuration) * 60) - int.Parse(SessionsCommon.getTimeDifference(Session)); } else { timeLeft = int.Parse(examDuration) * 60; Session["currentExamDuration"] = DateTime.Now; } this.currentExamTime.Value = (timeLeft).ToString(); string StudentName = (string)Session["student"]; DataTable questionTable = AptitudeTestBLL.Instance.GetQuestionsForExamByID(ExamID); String s = "<table bgcolor=white class='tblExamSummary' border =1>"; //for (int j = 0; j < questionTable.Rows.Count; j++) foreach (DataRow questionRow in questionTable.Rows) { s += "<tr><td>"; string i = questionRow["QuestionID"].ToString(); object o = Session[i]; string question = questionRow["Question"].ToString(); s += "<a href=StartExam.aspx?id=" + questionRow["QuestionID"] + ">Edit Your Answer</a>" + question + "</a>"; String lblType = "", answerString = ""; answerString = "You did not yet mark answer for this question!"; if ("SingleSelect" == "SingleSelect") { ListItemCollection coll = (ListItemCollection)o; if (o != null) { foreach (ListItem item in coll) { if (item.Selected) { answerString = "The option you selected is <b>" + item.Text; break; } } } lblType = "Single choice question"; } else { if (o != null) { answerString = "The answer you wrote is <b>" + (string)o; } lblType = "Fill in the blank question"; } s += "<br><font color=black>" + answerString + "</b></font></td>"; //s += "<td><b>Question Type:</b> " + lblType + "</td>"; s += "</tr>"; //s += "<tr><td><font color=black>" + answerString + "</font></td></tr>"; } s += "</table>"; lblObjectiveSummary.Text = s; }
protected void Page_Load(object sender, EventArgs e) { if (Session["exam_id"] != null) { string ExamID = (string)Session["exam_id"]; //ExamTableAdapter examAdapter = new ExamTableAdapter(); //String examDuration = examAdapter.GetData().FindByExamID(Int32.Parse(ExamID)).ExamDuration.ToString(); String examDuration = AptitudeTestBLL.Instance.GetExamDurationByID(ExamID); int timeLeft = 0; if (Session["currentExamDuration"] != null) { timeLeft = (int.Parse(examDuration) * 60) - int.Parse(SessionsCommon.getTimeDifference(Session)); } else { timeLeft = int.Parse(examDuration) * 60; Session["currentExamDuration"] = DateTime.Now; } this.currentExamTime.Value = (timeLeft).ToString(); DataTable questionTable = AptitudeTestBLL.Instance.GetQuestionsForExamByID(ExamID); String s = "<table bgcolor=white border=1>"; foreach (DataRow QuestionRow in questionTable.Rows) { s += "<tr><td>"; string i = QuestionRow["QuestionID"].ToString(); object o = Session[i]; string question = QuestionRow["Question"].ToString(); s += "<a href=StartExam.aspx?id=" + QuestionRow["QuestionID"] + ">Edit Your Answer</a>" + question + "</a>"; String lblType = "", answerString = ""; answerString = "You did not yet mark answer for this question!"; if ("SingleSelect" == "SingleSelect") //== TODO { ListItemCollection coll = (ListItemCollection)o; if (o != null) { foreach (ListItem item in coll) { if (item.Selected) { answerString = "The option you selected is <b>" + item.Text; break; } } } lblType = "Single choice question"; } else { if (o != null) { answerString = "The answer you wrote is <b>" + (string)o; } lblType = "Fill in the blank question"; } s += "<br><font color=black>" + answerString + "</b></font></td>"; s += "<td><b>Question Type:</b> " + lblType + "</td>"; s += "</tr>"; //s += "<tr><td><font color=black>" + answerString + "</font></td></tr>"; } s += "</table>"; lblObjectiveSummary.Text = s; } else { Response.Redirect("../MCQTest/McqTestPage.aspx"); } }