private void Remove_btn_Click(object sender, EventArgs e)
 {
     try
     {
         Scores       score  = new Scores();
         int          sid    = Convert.ToInt32(DataGridView_Score.CurrentRow.Cells[0].Value);
         int          cid    = Convert.ToInt32(DataGridView_Score.CurrentRow.Cells[3].Value);
         DialogResult delete = XtraMessageBox.Show("Are you sure remove score with Student ID: " + sid + " and Course ID " + cid + "?", "Remove Record", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (delete == DialogResult.Yes)
         {
             if (score.Delete_Score(sid, cid))
             {
                 XtraMessageBox.Show("Remove succussful!", "Remove Score", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 this.LoadScore();
             }
             else
             {
                 XtraMessageBox.Show("Remove failed!", "Remove Score", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
     catch
     {
         XtraMessageBox.Show("ERROR!");
     }
 }
Esempio n. 2
0
 public void RemoveScore()
 {
     try
     {
         DialogResult data = MessageBox.Show("Are you sure detele this record?", "Delete Score", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (data == DialogResult.Yes)
         {
             int id  = Convert.ToInt32(IDStudent.Text);
             int cid = Convert.ToInt32(table.Rows[ComboBox_Course.SelectedIndex][0].ToString());
             if (score.Delete_Score(id, cid))
             {
                 XtraMessageBox.Show("Delete successful!", "Delete Score", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
             else
             {
                 XtraMessageBox.Show("Delete failed!", "Delete Score", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         else
         {
             XtraMessageBox.Show("Error!, please check the textbox control again", "Delete Score", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch
     {
         MessageBox.Show("Error!!! Tip: Check textbox or combobox", "Delete Score", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }