//
        //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.");
        }
Beispiel #2
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();
     }
 }
        //
        //Deletes the selected Exam & pops up a Success or Error message
        //
        private void delete_Click(object sender, EventArgs e)
        {
            if(empIDexamIDcombo.SelectedIndex != -1)
            {
                DialogResult result = MessageBox.Show("Are you sure you want delete " + empIDexamIDcombo.SelectedItem.ToString()+ "?", "Delete Applciant", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    //Results Object
                    Results r = new Results();
                    string temp = empIDexamIDcombo.SelectedItem.ToString();
                    int pos = temp.IndexOf(":");
                    r.employee_ID = temp.Substring(0, pos);
                    r.exam_ID = temp.Substring(pos+1);

                    //Gets Exam type
                    Exam_Details ed = new Exam_Details();
                    ed.exam_ID = r.exam_ID;
                    Exam_DetailsBS edb = new Exam_DetailsBS();
                    ed = edb.getExamDetails(ed);

                    //ResultStatus object
                    ResultStatus rs = new ResultStatus();
                    rs.employee_ID = r.employee_ID;
                    rs.exam_Type = ed.exam_Type;

                    //Gets Attempt No
                    ResultStatusBS rsb = new ResultStatusBS();
                    rs= rsb.getResultStatus(rs);

                    if (rs.attempt_No == 1)
                    {
                        //First Timer
                        string feedback = em.deleteResults(r);
                        if(feedback !="Error")
                        {
                            rsb.deleteResultStatus(rs);
                            MessageBox.Show("Succesfully deleted.", "Delete Applicant", MessageBoxButtons.OK);
                        }
                        else
                            MessageBox.Show("Unsuccessful attempt. Sorry for the inconvenience.", "Error", MessageBoxButtons.OK);
                    }
                    else
                    {
                        //Repeater
                        rs.attempt_No--;
                        string feedback = em.deleteResults(r);
                        if (feedback != "Error")
                        {
                            rsb.updateResultStatus(rs);
                            MessageBox.Show("Succesfully deleted.", "Delete Applicant",MessageBoxButtons.OK);
                        }
                        else
                            MessageBox.Show("Unsuccessful attempt. Sorry for the inconvenience.","Error",MessageBoxButtons.OK);
                    }
                }
            }
            else
                MessageBox.Show("Please select a valid entry.", "Error");
            this.DeleteApplicant_Load(sender, e);
        }
        //
        //Deletes the selected Exam & pops up a Success or Error message
        //
        protected void delete_Click(object sender, EventArgs e)
        {
            if (empIDexamIDcombo.SelectedIndex != -1)
            {
                //DialogResult result = MessageBox.Show("Are you sure you want delete " + empIDexamIDcombo.SelectedItem.ToString() + "?", "Delete Applciant", MessageBoxButtons.YesNo);

                    //Results Object
                    Results r = new Results();
                    string temp = empIDexamIDcombo.SelectedItem.ToString();
                    int pos = temp.IndexOf(":");
                    r.employee_ID = temp.Substring(0, pos);
                    r.exam_ID = temp.Substring(pos + 1);

                    //Gets Exam type
                    Exam_Details ed = new Exam_Details();
                    ed.exam_ID = r.exam_ID;
                    Exam_DetailsBS edb = new Exam_DetailsBS();
                    ed = edb.getExamDetails(ed);

                    //ResultStatus object
                    ResultStatus rs = new ResultStatus();
                    rs.employee_ID = r.employee_ID;
                    rs.exam_Type = ed.exam_Type;

                    //Gets Attempt No
                    ResultStatusBS rsb = new ResultStatusBS();
                    rs = rsb.getResultStatus(rs);

                    if (rs.attempt_No == 1)
                    {
                        //First Timer
                        string feedback = em.deleteResults(r);
                        if (feedback != "Error")
                        {
                            rsb.deleteResultStatus(rs);
                            System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('Succesfully deleted.')</SCRIPT>");
                            //essageBox.Show("Succesfully deleted.", "Delete Applicant", MessageBoxButtons.OK);
                        }
                        else
                            System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('Unsuccessful attempt. Sorry for the inconvenience')</SCRIPT>");
                            //MessageBox.Show("Unsuccessful attempt. Sorry for the inconvenience.", "Error", MessageBoxButtons.OK);
                    }
                    else
                    {
                        //Repeater
                        rs.attempt_No--;
                        string feedback = em.deleteResults(r);
                        if (feedback != "Error")
                        {
                            rsb.updateResultStatus(rs);
                            System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('Succesfully deleted.')</SCRIPT>");
                            //MessageBox.Show("Succesfully deleted.", "Delete Applicant", MessageBoxButtons.OK);
                        }
                        else
                            System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE='JavaScript'>alert('Unsuccessful attempt. Sorry for the inconvenience')</SCRIPT>");
                            //MessageBox.Show("Unsuccessful attempt. Sorry for the inconvenience.", "Error", MessageBoxButtons.OK);
                    }
            }
            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);
        }