Exemple #1
0
 private void dgvPapers_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         paperId = Convert.ToInt32(this.dgvPapers.SelectedRows[0].Cells[0].Value);
         manageExamPaper myP = new manageExamPaper();
         myP.getPaper(paperId);
         this.txtPaperDes.Text     = myP.description;
         this.txtPossibleMark.Text = myP.possibleMark.ToString();
         this.txtPaperTitle.Text   = myP.title;
         this.btnSavePaper.Enabled = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show("applicaton error " + ex);
     }
 }
 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);
     }
 }
Exemple #3
0
 private void btnUpdatepaper_Click(object sender, EventArgs e)
 {
     try
     {
         var paperName = this.txtPaperTitle.Text;
         var mark      = Convert.ToInt32(this.txtPossibleMark.Text);
         var des       = this.txtPaperDes.Text;
         if (paperName == "")
         {
             MessageBox.Show("exam paper should have a title", "Input error ", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else if (this.txtPossibleMark.Text == "")
         {
             MessageBox.Show("please supply a possible mark for paper", "Input error ", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             manageExamPaper myEp = new manageExamPaper();
             myEp.getPaper(paperId);
             myEp.title        = paperName;
             myEp.possibleMark = mark;
             myEp.description  = des;
             if (myEp.updatePaper(this.paperId) == true)
             {
                 this.refresh();
                 this.fillPapers(this.examId);
                 MessageBox.Show("exam paper updated sucessifully", "system notification ", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 MessageBox.Show("exam paper failed to updete", "system notification ", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("applicaton error " + ex);
     }
 }