//
 //On click of Go button, passes selected Exam to Update Paper Form
 //
 private void go_Click(object sender, EventArgs e)
 {
     if (examIDCombo.SelectedIndex != -1)
     {
         Exam_Details ed = new Exam_Details();
         ed.exam_ID = examIDCombo.SelectedItem.ToString();
         ed= d.getExamDetails(ed);
         UpdatePaper f28 = new UpdatePaper(ed);
         f28.MdiParent = this.MdiParent;
         f28.Dock = DockStyle.Fill;
         this.Close();
         f28.Show();
     }
     else
         MessageBox.Show("Please select a valid Exam ID.", "Error");
 }
        //
        //On click Of Start Button
        //
        protected void startTest_Click(object sender, EventArgs e)
        {
            //DialogResult r = MessageBox.Show("Are you sure you want to start the test?", "Start the Test", MessageBoxButtons.OKCancel);
            string confirmValue = Request.Form["confirm_value"];
            if (confirmValue == "Yes")
            {
                //Gets the Set Paper Details for the Exam
                Paper s = new Paper();
                s.exam_ID = ed.exam_ID;
                PaperBS p = new PaperBS();
                int scount = p.getRowCountForExam(s);
                Paper[] arr = new Paper[scount];
                arr = p.viewPaperDetails(s, scount);

                //Timer duration
                int timeLeft = ed.duration * 60;

                //Gets the questions according to the set paper details after random selection and shuffling
                int qcount = p.getAddedQuestionCount(s);
                q = new Questions[qcount];
                QuestionsBS b = new QuestionsBS();
                q = b.getQuestionPaper(arr, q, ed);

                //Initializes the Answers array and Bookmark array
                AnswerBS ab = new AnswerBS();
                a = new Answers[qcount];
                a = ab.initializeAnswersArray(a, q, ed, emp);
                b1 = new Bookmark[qcount];
                b1 = ab.initializeBookmarksArray(b1);

                //Swap Options
                Questions[] qnew = b.swapOptions(q);
                Int32 n = 0;
                Session["noOfQues"] = q.Count();
                Session["questions"] = qnew;
                Session["answers"] = a;
                Session["bookmark"] = b1;
                Session["ind"] = n;
                Session["time"] = timeLeft;
                Session["employee"] = emp;
                Session["exam"] = ed;
                Session["timeout"] = DateTime.Now.AddMinutes(ed.duration).ToString();

                //Chooses the first from according to the format of first question
                string first = qnew[0].format;
                switch (first)
                {
                    case "Match The Column":
                        Response.Redirect("~/MatchTheColumnTest.aspx");
                        break;

                    case "MCQ (Single Answer)":
                        Response.Redirect("~/SingleAnswerTest.aspx");
                        break;

                    case "MCQ (Multiple Answers)":
                        Response.Redirect("~/MultipleAnswerTest.aspx");
                        break;

                    case "Picture Question: Single Answer":
                        Response.Redirect("~/PictureQuestionSingleAns.aspx");
                        break;

                    case "Picture Question: Multiple Answer":
                        Response.Redirect("~/PictureQuestionMultipleAnswer.aspx");
                        break;
                }
            }
        }