private void cmbSelectPaper_TextChanged(object sender, EventArgs e) { try { this.paperId = Convert.ToInt32(cmbSelectPaper.SelectedValue); manageExamPaper myP = new manageExamPaper(); myP.getPaper(this.paperId); this.txtPaperTitle.Text = myP.title; this.txtPossible.Text = myP.possibleMark.ToString(); manageExams myE = new manageExams(); myE.getExam(this.examId); this.txtExamDescription.Text = myE.description; this.txtExamCater.Text = myE.examTyp; } catch (Exception ex) { MessageBox.Show("failed in mbSelectPaper_ValueMemberChanged() " + ex.Message); } }
private void dgvExams_DoubleClick(object sender, EventArgs e) { try { examId = Convert.ToInt32(dgvExams.SelectedRows[0].Cells[0].Value); manageExams myE = new manageExams(); myE.getExam(examId); this.cmbExamType.Text = myE.examTyp; this.cmbSubject.Text = myE.subjectId; this.cmbGrade.Text = myE.classGrade.ToString(); this.txtExamTitle.Text = myE.title; this.txtExamDes.Text = myE.description; this.btnSaveExam.Enabled = false; this.fillPapers(examId); } catch (Exception ex) { MessageBox.Show("Application error " + ex); } }
private void btnUpdateExam_Click(object sender, EventArgs e) { try { var subject = this.cmbSubject.Text; var grade = this.cmbGrade.Text; var typ = this.cmbExamType.Text; var title = this.txtExamTitle.Text; var des = this.txtExamDes.Text; if (subject == "" || grade == "" || typ == " " || title == "" || des == "") { MessageBox.Show("make sure u fill in all fields", "input error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { manageExams myE = new manageExams(); myE.getExam(this.examId); myE.classGrade = Convert.ToInt16(grade); myE.examTyp = typ; myE.title = title; myE.description = des; if (myE.updateExam(this.examId) == true) { MessageBox.Show("Exam updated success", "System notifcation ", MessageBoxButtons.OK, MessageBoxIcon.Information); this.refresh(); this.fillExams(); } else { MessageBox.Show("Exam updated failed", "System notifcation ", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { MessageBox.Show("Application error " + ex); } }