// //Of Loading of Form, loads Exam Types // private void AddExam_Load(object sender, EventArgs e) { // to allign the Legend(Group Box) to // the center of form int centerForm; int centerGroup; int groupStartPosition; centerForm = this.Width / 2; centerGroup = addExamDetailsLegend.Width / 2; groupStartPosition = centerForm - centerGroup; addExamDetailsLegend.Left = groupStartPosition; 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"); examTypeCombo.SelectedIndex = 0; }
private void AddPictureQuestionMultipleAnswer_Load(object sender, EventArgs e) { // to allign the Legend(Group Box) to // the center of form int centerForm; int centerGroup; int groupStartPosition; centerForm = this.Width / 2; centerGroup = AddPQMALegend.Width / 2; groupStartPosition = centerForm - centerGroup; AddPQMALegend.Left = groupStartPosition; //Loads Marks for (int j = 0; j <= 5; j++) { marksCombo.Items.Add(j + 1); } marksCombo.SelectedIndex = 0; //Displays Format formatText.Text = "Picture Question: Multiple Answer"; //Loads Exam Types Exam_TypeBS em = new Exam_TypeBS(); int i = em.getCount(); string[] abc = new string[i]; abc = em.loadExamType(i); for (int j = 0; j < i; j++) { examTypeCombo.Items.Add(abc[j]); } examTypeCombo.SelectedIndex = 0; //Loads Sections int k = ed.getSectionCount(); if (k > 0) { string[] bcd = new string[k]; bcd = ed.loadSection(k); for (int j = 0; j < k; j++) { sectioncomboBox.Items.Add(bcd[j]); } sectioncomboBox.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."); }
// //On Form Load: Loads the fields of the selected question // private void UpdatePictureQuestionMultipleAnswer_Load(object sender, EventArgs e) { // to allign the Legend(Group Box) to // the center of form int centerForm; int centerGroup; int groupStartPosition; centerForm = this.Width / 2; centerGroup = updateQuestionLegend.Width / 2; groupStartPosition = centerForm - centerGroup; updateQuestionLegend.Left = groupStartPosition; //Exam Type: Loads exam types if present, else shows an empty database message. Exam_TypeBS em = new Exam_TypeBS(); int m = em.getCount(); if (m > 0) { //Question ID questionIDText.Text = q.question_ID; //Exam Types string[] abc1 = new string[m]; abc1 = em.loadExamType(m); for (int j = 0; j < m; j++) { examTypeCombo.Items.Add(abc1[j]); } examTypeCombo.SelectedItem = q.exam_Type; //Question questionText.Text = q.question; //Format formatText.Text = q.format; //Options option1Text.Text = q.option1; option2Text.Text = q.option2; option3Text.Text = q.option3; option4Text.Text = q.option4; //Solution string ans = q.solution; 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; //Marks for (int j = 0; j < 8; j++) { marksCombo.Items.Add(j + 1); } marksCombo.SelectedItem = q.marks; //Loads Sections int k = cs.getSectionCount(); if (k > 0) { string[] bcd = new string[k]; bcd = cs.loadSection(k); for (int j = 0; j < k; j++) { sectioncomboBox.Items.Add(bcd[j]); } sectioncomboBox.SelectedIndex = 0; } //Section sectioncomboBox.Text = q.section; //Displays the picture byte[] image = cs.getImage(q); p.image = cs.getImage(q); string s = Convert.ToString(DateTime.Now.ToFileTime()); FileStream fs1 = new FileStream(s, FileMode.CreateNew, FileAccess.Write); fs1.Write(image, 0, image.Length); fs1.Flush(); fs1.Close(); pictureBox.Image = Image.FromFile(s); } else MessageBox.Show("No Exam Types present in the database.", "Error", MessageBoxButtons.OK); }
protected void Page_Load(object sender, EventArgs e) { //Loads Marks for (int j = 0; j <= 5; j++) { marksCombo.Items.Add(j + 1+""); } marksCombo.SelectedIndex = 0; //Displays Format formatText.Text = "Picture Question: Single Answer"; //Loads Exam Types Exam_TypeBS em = new Exam_TypeBS(); int i = em.getCount(); string[] abc = new string[i]; abc = em.loadExamType(i); for (int j = 0; j < i; j++) { examTypeCombo.Items.Add(abc[j]); } examTypeCombo.SelectedIndex = 0; //Loads Sections int k = ed.getSectionCount(); if (k > 0) { string[] bcd = new string[k]; bcd = ed.loadSection(k); for (int j = 0; j < k; j++) { sectioncomboBox.Items.Add(bcd[j]); } sectioncomboBox.SelectedIndex = 0; } }
// //On Form Load: Loads the fields of the selected question // private void UpdateMatchTheColumn_Load(object sender, EventArgs e) { // to allign the Legend(Group Box) to // the center of form int centerForm; int centerGroup; int groupStartPosition; centerForm = this.Width / 2; centerGroup = updateQuestionLegend.Width / 2; groupStartPosition = centerForm - centerGroup; updateQuestionLegend.Left = groupStartPosition; Exam_TypeBS em = new Exam_TypeBS(); int m = em.getCount(); if (m > 0) { //Loads Sections int k = cs.getSectionCount(); if (k > 0) { string[] bcd = new string[k]; bcd = cs.loadSection(k); for (int j = 0; j < k; j++) { sectioncomboBox.Items.Add(bcd[j]); } sectioncomboBox.SelectedIndex = 0; } //Question ID questionIDText.Text = q.question_ID; //Exam Type string[] abc1 = new string[m]; abc1 = em.loadExamType(m); for (int j = 0; j < m; j++) { examTypeCombo.Items.Add(abc1[j]); } examTypeCombo.SelectedItem = q.exam_Type; //Format formatText.Text = q.format; //Question Column string temp = ""; int pos; temp = q.question; temp = temp.Substring(1); pos = temp.IndexOf("."); textBoxA.Text = temp.Substring(0, pos); temp = temp.Substring(pos + 1); pos = temp.IndexOf("."); textBoxB.Text = temp.Substring(0, pos); temp = temp.Substring(pos + 1); pos = temp.IndexOf("."); textBoxC.Text = temp.Substring(0, pos); temp = temp.Substring(pos + 1); pos = temp.IndexOf("."); textBoxD.Text = temp.Substring(0, pos); //Answer Column textBox1.Text = q.option1; textBox2.Text = q.option2; textBox3.Text = q.option3; textBox4.Text = q.option4; //Solution Order solutionText.Text = q.solution; //Marks for (int j = 0; j < 8; j++) { marksCombo.Items.Add(j + 1); } marksCombo.SelectedItem = q.marks; //Section sectioncomboBox.Text = q.section; } else MessageBox.Show("No Exam Types present in the database."); }
// //On Form Load: Loads the fields of the selected question // private void UpdateSingleChoiceQuestion_Load(object sender, EventArgs e) { // to allign the Legend(Group Box) to // the center of form int centerForm; int centerGroup; int groupStartPosition; centerForm = this.Width / 2; centerGroup = updateQuestionLegend.Width / 2; groupStartPosition = centerForm - centerGroup; updateQuestionLegend.Left = groupStartPosition; Exam_TypeBS em = new Exam_TypeBS(); int m = em.getCount(); if (m > 0) { //Question ID questionIDText.Text = q.question_ID; //Exam Type string[] abc1 = new string[m]; abc1 = em.loadExamType(m); for (int j = 0; j < m; j++) { examTypeCombo.Items.Add(abc1[j]); } examTypeCombo.SelectedItem = q.exam_Type; //Question questionText.Text = q.question; //Format formatText.Text = q.format; //Options option1Text.Text = q.option1; option2Text.Text = q.option2; option3Text.Text = q.option3; option4Text.Text = q.option4; //Solution switch (q.solution) { case "1": option1Radio.Checked = true; break; case "2": option2Radio.Checked = true; break; case "3": option3Radio.Checked = true; break; case "4": option1Radio.Checked = true; break; } //Marks for (int j = 0; j < 8; j++) { marksCombo.Items.Add(j + 1); } marksCombo.SelectedItem = q.marks; //Loads Sections int k = cs.getSectionCount(); if (k > 0) { string[] bcd = new string[k]; bcd = cs.loadSection(k); for (int j = 0; j < k; j++) { sectioncomboBox.Items.Add(bcd[j]); } sectioncomboBox.SelectedIndex = 0; } //Section sectioncomboBox.Text = q.section; } else MessageBox.Show("No Exam Types present in the database.","Error",MessageBoxButtons.OK); }
// //On Form Load: Loads the fields of the selected question // private void UpdateMultipleChoiceQuestions_Load(object sender, EventArgs e) { // to allign the Legend(Group Box) to // the center of form int centerForm; int centerGroup; int groupStartPosition; centerForm = this.Width / 2; centerGroup = updateQuestionLegend.Width / 2; groupStartPosition = centerForm - centerGroup; updateQuestionLegend.Left = groupStartPosition; //Exam Type: Loads exam types if present, else shows an empty database message. Exam_TypeBS em = new Exam_TypeBS(); int m = em.getCount(); if (m > 0) { //Question ID questionIDText.Text = q.question_ID; //Exam Types string[] abc1 = new string[m]; abc1 = em.loadExamType(m); for (int j = 0; j < m; j++) { examTypeCombo.Items.Add(abc1[j]); } examTypeCombo.SelectedItem = q.exam_Type; //Question questionText.Text = q.question; //Format formatText.Text = q.format; //Options option1Text.Text = q.option1; option2Text.Text = q.option2; option3Text.Text = q.option3; option4Text.Text = q.option4; //Solution string ans = q.solution; 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; //Loads Sections int k = cs.getSectionCount(); if (k > 0) { string[] bcd = new string[k]; bcd = cs.loadSection(k); for (int j = 0; j < k; j++) { sectioncomboBox.Items.Add(bcd[j]); } sectioncomboBox.SelectedIndex = 0; } //Section sectioncomboBox.Text = q.section; //Marks for (int j = 0; j < 8; j++) { marksCombo.Items.Add(j + 1); } marksCombo.SelectedItem = q.marks; } else MessageBox.Show("No Exam Types present in the database.", "Error",MessageBoxButtons.OK); }
// //On Form Load // private void UpdateExamType_Load(object sender, EventArgs e) { // to allign the Legend(Group Box) to // the center of form int centerForm; int centerGroup; int groupStartPosition; centerForm = this.Width / 2; centerGroup = updateExamTypeLegend.Width / 2; groupStartPosition = centerForm - centerGroup; updateExamTypeLegend.Left = groupStartPosition; // Filling the Exam Type ComboBox Exam_TypeBS ed = new Exam_TypeBS(); int i = ed.getCount(); if (i > 0) { abc = new string[i]; abc = ed.loadExamType(i); for (int j = 0; j < i; j++) { examTypeCombo.Items.Add(abc[j]); } } else MessageBox.Show("No Data"); //Disabling the other controls subjectText.Text = ""; subjectText.Enabled = false; levelCombo.Enabled = false; noOfAttemptsCombo.Enabled = false; update.Enabled = false; //Loads the Level and No Of Attempts for (int j = 0; j <= 5; j++) { levelCombo.Items.Add(j); noOfAttemptsCombo.Items.Add(j); } }