Пример #1
0
        //
        //On Form Load: Displays Welcome Message, displays today's schedule, if any
        //
        private void EmpHome_Load(object sender, EventArgs e)
        {
            emp = b.getEmployee(emp);
            welcomeLabel.Text = "Welcome " + emp.first_Name + " " + emp.last_Name;

            ResultsBS r = new ResultsBS();
            int count = r.getExamCountForEmployee(emp);
            Exam_Details[] er = new Exam_Details[count];
            er = r.getExamIDsForEmployee(emp, count);
            er = eb.getSchedule(er);
            int[] index = eb.checkTodaysSchedule(er);
            Results[] res = new Results[index.Length];
            for (int i = 0; i < index.Length; i++)
            {
                res[i] = new Results();
                res[i].employee_ID = emp.employee_Id;
                res[i].exam_ID = er[index[i]].exam_ID;
            }

            //bool[] feed = new bool[index.Length];
            res = r.checkIfAppeared(res);

            int total = 0;
            for (int i = res.Length - 1; i >= 0; i--)
            {
                if (res[i].score == -1)
                {
                    total++;
                    ed.exam_ID = res[i].exam_ID;
                }
            }

            if (total == 0)
            {
                examIDLabel.Text = "Sorry.";
                examTypeLabel.Text = "You dont have any test scheduled today.";
                dateLabel.Text = "";
                durationLabel.Text = "";
                noteLabel.Text = "";
                skipTutorial.Enabled = false;
                takeTutorial.Enabled = false;
            }
            else
            {
                ed = eb.getExamDetails(ed);
                Exam_Types et1 = new Exam_Types();
                et1.exam_Type = ed.exam_Type;
                et1 = et.getExamType(et1);

                examIDLabel.Text += ed.exam_ID;
                examTypeLabel.Text +=" " +et1.exam_Type + " (" + et1.subject + " Level " + et1.level_Number+")";
                dateLabel.Text += ed.datetime.Date.ToShortDateString(); ;
                durationLabel.Text += +ed.duration;
                total--;
                if (total >= 1)
                    noteLabel.Text += "You have " + total + " more exams scheduled today.";
                else
                    noteLabel.Text = "";
            }
        }
 //
 //Validates fields before adding Exam
 //
 public String addExamDetail(Exam_Details e, string configure)
 {
     string config = configure;
     string feedback="";
     bool feed = false;
     int i = 0;
     if(e.exam_Type.Length == 0)
     {
         feedback += (++i) + ". ExamType  ";
         feed = true;
     }
     if (e.datetime < DateTime.Today)
     {
         feedback += (++i) + ". Date  ";
         feed = true;
     }
     if (e.duration <= 0)
     {
         feedback += (++i) + ". Duration  ";
         feed = true;
     }
     if (feed)
     {
         //Not valid: Returns erroneous fields
         return ("Please enter valid entries for: " + feedback);
     }
     else
     {
         //Valid: Adds Exam Detail and returns assigned Exam ID or Error Message
         string eid = ed.addExamDetails(e,config);
         return eid;
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     emp = (Employee)Session["employee"];
     ed = (Exam_Details)Session["exam"];
     nameLabel.Text = emp.first_Name + " " + emp.last_Name;
     examIDLabel.Text = "Exam ID:" + ed.exam_ID;
 }
        //
        //Returns array of indices of exam scheduled today from a array of Exam_Details
        //
        public int[] checkTodaysSchedule(Exam_Details[] er)
        {
            DateTime dt;
            int k = 0;
            for (int i = 0; i < er.Length; i++)
            {
                dt = er[i].datetime.Date;
                if (dt.Equals(DateTime.Today.Date))
                {
                    k = k + 1;
                }
            }

            int[] index = new int[k];
            int j = 0;
            for (int i = 0; i < er.Length; i++)
            {
                dt = er[i].datetime.Date;
                if (dt.Equals(DateTime.Today.Date))
                {
                    index[j] = i;
                    j++;
                }
            }
            return index;
        }
Пример #5
0
 public CheckSolution(Questions[] q1, Answers[] a1, Employee e1, Exam_Details ed1)
 {
     InitializeComponent();
     q = q1;
     a = a1;
     emp = e1;
     ed = ed1;
 }
Пример #6
0
 public Result(Employee e1, Exam_Details e2,Questions[] q1, Answers[] a1)
 {
     InitializeComponent();
     emp = e1;
     ed = e2;
     a = a1;
     q = q1;
 }
Пример #7
0
 //
 //Accepts and assigns Question, Answers, Bookmark array, index, time left, Employee and Exam Details
 //
 public PictureQuestionSingleAns(Questions[] que, Answers[] ans, Bookmark[] b1, int ind, int timeleft1, Employee e, Exam_Details exd)
 {
     InitializeComponent();
     q = que;
     a = ans;
     b = b1;
     index = ind;
     timeLeft = timeleft1;
     emp = e;
     ed = exd;
 }
Пример #8
0
 //
 //Accepts and assigns Question, Answers, Bookmark array, index, time left, Employee and Exam Details
 //
 public MatchTheColumnTest(Questions[] que, Answers[] ans, Bookmark[] b1, int ind, int timeleft1, Employee e, Exam_Details exd)
 {
     InitializeComponent();
     q = que;
     a = ans;
     index = ind;
     b = b1;
     timeLeft = timeleft1;
     emp = e;
     ed = exd;
 }
 //
 //Initializes the fields of Answers array including answers
 //
 public Answers[] initializeAnswersArray(Answers[] a, Questions[] q, Exam_Details ed, Employee emp)
 {
     for (int i = 0; i < q.Length; i++)
     {
         a[i] = new Answers();
         a[i].exam_ID = ed.exam_ID;
         a[i].employee_Id = emp.employee_Id;
         a[i].question_ID = q[i].question_ID;
         a = this.storeAnswer(a, i, "");
     }
     return a;
 }
        //
        //Calculates marks for each question and the total, stores them in Answers array, DAL call to store the answers in the Answers table, and final results in the Result table
        //
        public bool submit(Answers[] a, Questions[] q, Employee emp, Exam_Details ed)
        {
            //Calculates marks for each question (stores them in Answers array), total and percentage
            int score = 0;
            int outOf = 0;
            float per = 0;
            for (int i = 0; i < q.Length; i++)
            {
                if (a[i].answer.Equals(q[i].solution))
                    a[i].marks = q[i].marks;
                else
                    a[i].marks = 0;
                score += a[i].marks;
                outOf += q[i].marks;
            }
            per = (score *100) / outOf;

            //DAL call to store the answers in the Answers table
            bool feed = d.submitAnswers(a);

            //DAL call to store final result in the Result table
            if (feed)
            {
                Results re = new Results();
                re.employee_ID = emp.employee_Id;
                re.exam_ID = ed.exam_ID;
                re.score = score;
                re.percentage = per;
                ResultsDAL rb = new ResultsDAL();
                bool feed1 = rb.addScore(re);
                if (feed1)
                {
                    ResultStatusDAL rsd = new ResultStatusDAL();
                    ResultStatus rs = new ResultStatus();
                    rs.employee_ID = emp.employee_Id;
                    rs.exam_Type = ed.exam_Type;
                    if (re.percentage >= 50.0)
                        rs.status = "Passed";
                    else
                        rs.status = "Failed";
                    bool feed2 = rsd.updateStatus(rs);
                    if (feed2)
                        return true;
                    else
                        return false;
                }
                else
                    return false;
            }
            else
                return false;
        }
 //
 //On click on Check button: Validates selection & Naviagtes to Check Employee Result Form
 //
 protected void check_Click(object sender, EventArgs e)
 {
     if (examIDCombo.SelectedIndex != -1)
     {
         Exam_Details d = new Exam_Details();
         d.exam_ID = examIDCombo.SelectedItem.ToString();
         //d = ed.getExamDetails(d);
         //ro.employee_ID = temp.Substring(0, 4);
         Session["exam_ID"] = d.exam_ID;
         Response.Redirect("~/SetPaper.aspx");
     }
     else
         System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('Please select a valid Exam ID.')</SCRIPT>");
 }
 //
 //On click of Go button, passes selected Exam to Set Paper Form
 //
 private void go_Click(object sender, EventArgs e)
 {
     if (examIDCombo.SelectedIndex != -1)
     {
         Exam_Details d = new Exam_Details();
         d.exam_ID = examIDCombo.SelectedItem.ToString();
         d = ed.getExamDetails(d);
         SetPaper f28 = new SetPaper(d);
         f28.MdiParent = this.MdiParent;
         f28.Dock = DockStyle.Fill;
         this.Close();
         f28.Show();
     }
     else
         MessageBox.Show("Please select a valid Exam ID.", "Error");
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            emp = (Employee)Session["employee"];
            ed = (Exam_Details)Session["exam"];

            employeeNameLabel.Text = emp.first_Name + " " + emp.last_Name;
            examIDLabel.Text = "Exam ID:" + ed.exam_ID;

            for (int i = 0; i <= 5; i++)
            {
                comboBox1.Items.Add(i+"");
                comboBox2.Items.Add(i+"");
                comboBox3.Items.Add(i+"");
                comboBox4.Items.Add(i+"");
                comboBox5.Items.Add(i+"");
                comboBox1.SelectedIndex = comboBox2.SelectedIndex = comboBox3.SelectedIndex = comboBox4.SelectedIndex = comboBox5.SelectedIndex = 0;
            }
        }
        //
        //On changing the Exam ID
        //
        private void examIDcombo_SelectedIndexChanged(object sender, EventArgs e)
        {
            //Resets the other controls on change of ExamID, also disables then in case of an invalid selection
            examTypeCombo.ResetText();
            examTypeCombo.Items.Clear();
            examTypeCombo.Enabled = false;
            datePicker.Enabled = false;
            update.Enabled = false;

            if (examIDCombo.SelectedIndex != -1)
            {
                //Gets the details of the selected Exam ID
                Exam_Details et = new Exam_Details();
                Exam_DetailsBS cs = new Exam_DetailsBS();
                et.exam_ID = examIDCombo.SelectedItem.ToString();
                et = cs.getExamDetails(et);

                //Enables the other controls
                examTypeCombo.Enabled = true;
                datePicker.Enabled = true;
                update.Enabled = true;

                //Loads the Exam Types
                Exam_TypeBS em = new Exam_TypeBS();
                int i = em.getCount();
                if (i > 0)
                {
                    string[] abc = new string[i];
                    abc = em.loadExamType(i);
                    for (int j = 0; j < i; j++)
                    {
                        examTypeCombo.Items.Add(abc[j]);
                    }
                }
                else
                    MessageBox.Show("No Data");

                //Loads the Exam Details
                examTypeCombo.SelectedItem = et.exam_Type;
                datePicker.Value = et.datetime;
            }
            else
                MessageBox.Show("Please select a valid Exam ID.");
        }
 //
 //Updates fields of Exam, returns Success or Error Message
 //
 public bool addResult(Exam_Details e)
 {
     try
     {
         conn.Open();
         cmd = new SqlCommand("Update Exam_Details SET Highest=" + e.highest + ", Lowest=" + e.lowest + ", Average=" + e.average + " Where Exam_ID='" + e.exam_ID + "'", conn);
         int i = cmd.ExecuteNonQuery();
         conn.Close();
         if (i == 1)
             return true;
         else
             return false;
     }
     catch (Exception ex)
     {
         conn.Close();
         return false;
     }
 }
 //
 //Deletes an Exam with given Exam ID, and returns a success or error message
 //
 public string deleteExamDetails(Exam_Details et)
 {
     try
     {
         conn.Open();
         cmd = new SqlCommand("Delete Exam_Details where Exam_ID='" + et.exam_ID + "'",conn);
         int i = cmd.ExecuteNonQuery();
         conn.Close();
         if(i==1)
             return "Exam " + et.exam_ID + " is successfully deleted";
         else
             return "Attempt unsuccessful. Sorry for the inconvenience.";
     }
     catch (Exception ex)
     {
         conn.Close();
         return "Attempt unsuccessful. Sorry for the inconvenience.";
     }
 }
        //
        //Deletes the selected Exam & pops up a Success or Error message
        //
        protected void delete_Click(object sender, EventArgs e)
        {
            if (examIDCombo.SelectedIndex != -1)
            {
                //DialogResult result = MessageBox.Show("Are you sure you want delete exam " + examIDCombo.SelectedItem.ToString() + "?", "Delete Exam", MessageBoxButtons.YesNo);
                //if (result == DialogResult.Yes)

                    Exam_Details r = new Exam_Details();
                    r.exam_ID = examIDCombo.SelectedItem.ToString();
                    string feedback = ed.deleteExamDetails(r);
                    System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('Succesfully deleted.')</SCRIPT>");
                    //MessageBox.Show(feedback);

            }
            else
                System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('Please select a valid entry.')</SCRIPT>");
            //MessageBox.Show("Please select a valid entry.", "Error");

            this.Page_Load(sender, e);
        }
 //
 //Adds Exam Detail and returns assigned Exam ID (or Error Message)
 //
 public string addExamDetails(Exam_Details e,string configure)
 {
     try
     {
         string config = configure;
         e.exam_ID = this.getNext();
         conn.Open();
         cmd = new SqlCommand("Insert into Exam_Details(Exam_ID,Exam_Type,Datetime,Highest,Lowest,Average,Answer_Config,Duration) values('" + e.exam_ID + "','" + e.exam_Type + "','" + e.datetime + "'," + e.highest + " ," + e.lowest +"," + e.average + ",'"+config+"',"+e.duration+")", conn);
         int i =cmd.ExecuteNonQuery();
         conn.Close();
         if(i==1)
             return "Exam was successfully added & assigned ID " + e.exam_ID + ".";
         else
             return "Some error occured. Sorry for the inconvenience.";
     }
     catch (Exception ex)
     {
         conn.Close();
         return "Some error occured. Sorry for the inconvenience.";
     }
 }
        //Calculate Highest, Lowest, Average
        public Exam_Details calculateResultFull(Results re)
        {
            Results[] r = cs.viewResult(re);
            Exam_Details ed = new Exam_Details();
            Exam_Details ed1 = new Exam_Details();
            ed.exam_ID = re.exam_ID;
            int highest = 0, lowest = 999, sum = 0;
            ed1 = cs.CheckResult(re);
            if (ed1.exam_ID != "ED000")
            {
                if (ed1.datetime.Date == DateTime.Today.Date)
                {
                    ed.exam_ID = "ED00";
                }
                else
                {
                    for (int i = 0; i < r.Length; i++)
                    {
                        if (highest < r[i].score)
                            highest = r[i].score;
                        if (lowest > r[i].score)
                            lowest = r[i].score;
                        sum += r[i].score;
                    }
                    ed.highest = highest;
                    ed.lowest = lowest;
                    ed.average = sum / r.Length;
                    bool feed = cs.addResult(ed);
                }
            }
            else if (cs.CheckResult(re).exam_ID == "ED000")
            {
                ed.exam_ID = "ED000";
            }
            else
                ed = cs.getExamDetails(ed);

            return ed;
        }
Пример #20
0
 //
 //On click of Proceed: Navigates to Feedback form
 //
 private void proceed_Click(object sender, EventArgs e)
 {
     //Gets the exam configuration
     Exam_DetailsBS edb = new Exam_DetailsBS();
     ed = edb.getExamDetails(ed);
     if (ed.answer_Config == "Yes")
     {
         //Navigates to Check Solution Form
         CheckSolution f = new CheckSolution(q, a, emp, ed);
         f.MdiParent = this.MdiParent;
         f.Dock = DockStyle.Fill;
         this.Close();
         f.Show();
     }
     else if (ed.answer_Config == "No")
     {
         //Navigates to Feedback Form
         FeedbackForm fm8 = new FeedbackForm(emp, ed);
         fm8.MdiParent = this.MdiParent;
         fm8.Dock = DockStyle.Fill;
         this.Close();
         fm8.Show();
     }
 }
        //
        //On click of Update button
        //
        private void update_Click(object sender, EventArgs e)
        {
            if (examIDCombo.SelectedIndex == -1 || examTypeCombo.SelectedIndex == -1)
                MessageBox.Show("Please select a valid entry", "Error");
            else
            {
                string config = "";
                if (yesConfigRadio.Checked)
                    config = "Yes";
                else if (noConfigRadio.Checked)
                    config = "No";

                Exam_DetailsBS js = new Exam_DetailsBS();
                Exam_Details em = new Exam_Details();
                em.exam_ID = examIDCombo.SelectedItem.ToString();
                em.exam_Type = (string)examTypeCombo.SelectedItem;
                em.datetime = datePicker.Value;

                if (durationTextBox.TextLength == 0)
                    em.duration = 0;
                else
                    em.duration = Convert.ToInt32(durationTextBox.Text);

                //Business logic call, forwarded to DAL
                string feedback = js.updateExamDetail(em,config);
                MessageBox.Show(feedback, "Update Exam");

                examIDCombo.SelectedIndex = 0;
                examTypeCombo.SelectedIndex = 0;
                datePicker.Value = DateTime.Today;
                yesConfigRadio.Checked = false;
                noConfigRadio.Checked = false;
            }
        }
Пример #22
0
 public LogoutForm(Employee e, Exam_Details exd)
 {
     InitializeComponent();
     emp = e;
     ed = exd;
 }
        //
        //On click of Add button, validates, adds Exam & displays assigned Exam ID
        //
        private void add_Click(object sender, EventArgs e)
        {
            bool a = false;
            bool b = false;
            if (yesConfigRadio.Checked == false && noConfigRadio.Checked == false)
            {
                MessageBox.Show("Kindly select an option to allow employee to see the answers after exam or not to");
            }

            else a = true;

            if (examTypeCombo.SelectedIndex != -1)
            {
                b = true;
            }
            else
                MessageBox.Show("Please select a valid Exam ID.", "Error");
            string config = "";
            if (yesConfigRadio.Checked)
                config = "Yes";
            else if (noConfigRadio.Checked)
                config = "No";

            if (a == true && b == true)
            {
                Exam_Details em = new Exam_Details();
                Exam_DetailsBS js = new Exam_DetailsBS();
                em.exam_Type = examTypeCombo.SelectedItem.ToString();
                em.datetime = datePicker.Value;
                if (durationTextBox.TextLength == 0)
                    em.duration = 0;
                else
                    em.duration = Convert.ToInt32(durationTextBox.Text);

                //Call to BLL to validate and add Exam
                string feed = js.addExamDetail(em,config);
                MessageBox.Show(feed, "Add Exam");

                examTypeCombo.SelectedIndex = 0;
                datePicker.Value = DateTime.Today;
                durationTextBox.Text = "";
                yesConfigRadio.Checked = false;
                noConfigRadio.Checked = false;
            }
            else
                MessageBox.Show("Please select a valid Exam Type.");
        }
 //
 //DAL call to get other fields of a Exam given the Exam ID
 //
 public Exam_Details getExamDetails(Exam_Details et)
 {
     et = ed.getExamDetails(et);
     return et;
 }
 //
 //DAL call to get exam Type and schedule of Exam with given Exam IDs
 //
 public Exam_Details[] getSchedule(Exam_Details[] er)
 {
     er = ed.getSchedule(er);
     return er;
 }
 //
 //Validates fields before updating
 //
 public String updateExamDetail(Exam_Details e,string configure)
 {
     string feedback = "";
     bool feed = false;
     int i = 0;
     if (e.exam_Type.Length == 0)
     {
         feedback += (++i) + ". ExamType  ";
         feed = true;
     }
     if (e.datetime < DateTime.Today)
     {
         feedback += (++i) + ". Date  ";
         feed = true;
     }
     if (e.duration <= 0)
     {
         feedback += (++i) + ". Duration  ";
         feed = true;
     }
     if (feed)
     {
         //Not valid: Returns erroneous fields
         return ("Please enter valid entries for: " + feedback);
     }
     else
     {
         //Valid: Updates Exam Details, returns Success or Unsuccess message
         string feed2 = ed.updateExamDetails(e,configure);
         return feed2;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            q = (Questions[])Session["questions"];
            a = (Answers[])Session["answers"];
            b = (Bookmark[])Session["bookmark"];
            index = (int)Session["ind"];
            timeLeft = (int)Session["time"];
            emp = (Employee)Session["employee"];
            ed = (Exam_Details)Session["exam"];

            //Session["answers"] = null;
            //Session.Remove("answers");
            //if (!SM1.IsInAsyncPostBack)
              //  Session["timeout"] = DateTime.Now.AddMinutes(ed.duration).ToString();

            //Displays timer, employee name, exam ID, question, question no, options

            //Timer.Start();
            employeeNameLabel.Text = emp.first_Name + " " + emp.last_Name;
            examIDLabel.Text = "Exam ID:" + ed.exam_ID;
            questionLabel.Text = q[index].question;
            questionNoLabel.Text = (index + 1) + ".";
            option1RadioButton.Text = q[index].option1;
            option2RadioButton.Text = q[index].option2;
            option3RadioButton.Text = q[index].option3;
            option4RadioButon.Text = q[index].option4;

            //Displays previous answer, if any
            if (Page.IsPostBack)
            {
                if (a[index].answer != "")
                {
                    string ans = a[index].answer;
                    if (ans.Equals("1"))
                        option1RadioButton.Checked = true;
                    else if (ans.Equals("2"))
                        option2RadioButton.Checked = true;
                    else if (ans.Equals("3"))
                        option3RadioButton.Checked = true;
                    else if (ans.Equals("4"))
                        option4RadioButon.Checked = true;
                    else
                    {
                        option1RadioButton.Checked = false;
                        option2RadioButton.Checked = false;
                        option3RadioButton.Checked = false;
                        option4RadioButon.Checked = false;
                    }
                    //answ.Text = a[index].answer;
                }
            }
            else
            {
                option1RadioButton.Checked = false;
                option2RadioButton.Checked = false;
                option3RadioButton.Checked = false;
                option4RadioButon.Checked = false;
                //answ.Text = a[index].answer;
            }

            //Displays correctly enabled/disabled Next, Previous, Bookmark and Remove Bookmark buttons
            if (index == q.Length - 1)
                next.Enabled = false;
            else
                next.Enabled = true;

            if (index == 0)
                previous.Enabled = false;
            else
                previous.Enabled = true;

            if (b[index].status == true)
            {
                bookmark.Enabled = false;
                removeBookmark.Enabled = true;
            }
            else
            {
                bookmark.Enabled = true;
                removeBookmark.Enabled = false;
            }

            //Displays bookmark Grid and current question cell
            DataTable dt = new DataTable();
            dt.Columns.Add("Question", Type.GetType("System.Int32"));

            if (q.Length > 0)
            {
                for (int i = 0; i < q.Length; i++)
                {
                    dt.Rows.Add();
                    dt.Rows[dt.Rows.Count - 1]["Question"] = (i + 1);
                }
                bookmarkGridView.DataSource = dt;
                //bookmarkGridView.Enabled = false;
                bookmarkGridView.DataBind();
            }
        }
Пример #28
0
 public FeedbackForm(Employee e, Exam_Details exd)
 {
     InitializeComponent();
     emp = e;
     ed = exd;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            q = (Questions[])Session["questions"];
            a = (Answers[])Session["answers"];
            b = (Bookmark[])Session["bookmark"];
            index = (int)Session["ind"];
            timeLeft = (int)Session["time"];
            emp = (Employee)Session["employee"];
            ed = (Exam_Details)Session["exam"];

            if (!SM1.IsInAsyncPostBack)
                Session["timeout"] = DateTime.Now.AddMinutes(ed.duration).ToString();

            //Displays timer, employee name, exam ID, question, question no, options
            //Timer.Start();
            employeeNameLabel.Text = emp.first_Name + " " + emp.last_Name;
            examIDLabel.Text = "Exam ID:" + ed.exam_ID;
            questionLabel.Text = q[index].question;
            questionNoLabel.Text = (index + 1) + ".";
            option1CheckBox.Text = q[index].option1;
            option2CheckBox.Text = q[index].option2;
            option3CheckBox.Text = q[index].option3;
            option4CheckBox.Text = q[index].option4;

            //Displays previous answer, if any
            string ans = a[index].answer;
            if (ans.Contains("1"))
                option1CheckBox.Checked = true;
            if (ans.Contains("2"))
                option2CheckBox.Checked = true;
            if (ans.Contains("3"))
                option3CheckBox.Checked = true;
            if (ans.Contains("4"))
                option4CheckBox.Checked = true;

            //Displays correctly enabled/disabled Next, Previous, Bookmark and Remove Bookmark buttons
            if (index == q.Length - 1)
                next.Enabled = false;
            else
                next.Enabled = true;
            if (index == 0)
                previous.Enabled = false;
            else
                previous.Enabled = true;
            if (b[index].status == true)
            {
                bookmark.Enabled = false;
                removeBookmark.Enabled = true;
            }
            else
            {
                bookmark.Enabled = true;
                removeBookmark.Enabled = false;
            }

            //Displays bookmark Grid and current question cell
            DataTable dt = new DataTable();
            dt.Columns.Add("Question", Type.GetType("System.Int32"));

            if (q.Length > 0)
            {
                for (int i = 0; i < q.Length; i++)
                {
                    dt.Rows.Add();
                    dt.Rows[dt.Rows.Count - 1]["Question"] = (i + 1);
                }
                bookmarkGridView.DataSource = dt;
                //bookmarkGridView.Enabled = false;
                bookmarkGridView.DataBind();
            }

            //Displays the picture
            byte[] image = qb.getImage(q[index]);

            string base64String = Convert.ToBase64String(image, 0, image.Length);
            pictureBox.ImageUrl = "data:image/png;base64," + base64String;
            pictureBox.Visible = true;

            //pictureBox.Image = Image.FromFile(s);
        }
 //
 //DAl call to delete an Exam with the given Exam ID
 //
 public string deleteExamDetails(Exam_Details e)
 {
     string abc = ed.deleteExamDetails(e);
     return abc;
 }