Beispiel #1
0
        private static void ButtonDeleteClick(object sender, System.EventArgs e)
        {
            int registro = (int)alumnoView.RegistroText.Value;

            try
            {
                alumnoDao.DeleteAlumno(registro);
                chargeTable();
            }
            catch (CustomException ex)
            {
                switch (ex.type)
                {
                case CustomException.REGISTER_NOTEXISTS:
                    MessageBox.Show(alumnoView, ex.message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    chargeTable();
                    break;

                case CustomException.USER_HAVE_LOAN:
                    MessageBox.Show(alumnoView, ex.message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    chargeTable();
                    break;
                }
            }
            catch (MySqlException)
            {
                MessageBox.Show(alumnoView, "Error Fatal: No se puede ejecutar la sentencia", "Error Fatal", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }