예제 #1
0
 private void btnSaveExam_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();
             if (myE.checkEndTermExamSet(subject, grade, sessions.currTerm) == false)
             {
                 if (myE.setExam(subject, typ, sessions.currTerm, Convert.ToInt32(grade), sessions.userId, des, title) == true)
                 {
                     MessageBox.Show("exam added sucessifully", "system notificaton", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     this.fillExams();
                 }
             }
             else
             {
                 MessageBox.Show(subject + " end of term exam already created ", "system notificaton", MessageBoxButtons.OK, MessageBoxIcon.Hand);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Application error  " + ex);
     }
 }
예제 #2
0
 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);
     }
 }
예제 #3
0
 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);
     }
 }
예제 #4
0
 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);
     }
 }