示例#1
0
 private void btnAgregar_Click(object sender, EventArgs e)
 {
     if (cmbGrupos.SelectedIndex > -1)
     {
         if (lblIdDetalle.Text != "")
         {
             if (lblIAlumno.Text != "")
             {
                 try
                 {
                     Matricula matricula = new Matricula();
                     if (matricula.Matricular(int.Parse(lblIdDetalle.Text), int.Parse(lblIAlumno.Text)) == true)
                     {
                         if (matricula.actualizarEstadoMatricula(int.Parse(lblIAlumno.Text)) == true)
                         {
                             MessageBox.Show("Alumno matriculado con éxito");
                             lblApellidoA.Text = "";
                             lblNombreA.Text   = "";
                             ActualizarDataGrid();
                             mostrarMatriculas();
                         }
                         else
                         {
                             MessageBox.Show("ERROR AL MATRICULAR");
                         }
                     }
                     else
                     {
                         MessageBox.Show("ERROR AL MATRICULAR");
                     }
                 }catch (Exception ex)
                 {
                     MessageBox.Show(ex.Message);
                 }
             }
             else
             {
                 MessageBox.Show("Seleccione un alumno");
             }
         }
         else
         {
             MessageBox.Show("Seleccione un grupo");
         }
     }
     else
     {
         MessageBox.Show("Seleccione un grupo");
     }
 }