Esempio n. 1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (GeneralTools.ConfirmationBox("this action will close the application, confirm?"))
     {
         Application.Exit();
     }
 }
        private void btn_Delete_Click(object sender, EventArgs e)
        {
            if (GeneralTools.ConfirmationBox("Are you sure you want to delete this student?") == true)
            {
                var studentRepository = new StudentRepository();

                var studentNumber = Convert.ToInt32(txtBox_studentNumber.Text);

                studentRepository.Delete(studentNumber);

                Close();
            }
        }
Esempio n. 3
0
        private void dataGridStudent_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Delete)
            {
                if (GeneralTools.ConfirmationBox("Are you sure you want to delete this student?") == true)
                {
                    var studentRepository = new StudentRepository();

                    studentRepository.Delete(Convert.ToInt64(dataGridStudent.CurrentRow.Cells[dataGridStudent.Columns["StudentNumber"].Index].FormattedValue.ToString()));

                    RefreshStudentGrid();
                }
            }
        }