private void btnGenerarPlanDePago_Click(object sender, EventArgs e) { var tieneDeuda = PagosRepository.ObtenerDeudaPorAlumno(txtNroDocumento.DecValue).Any(); if (tieneDeuda) { MessageBox.Show("El alumno registra cuotas impagas.", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } using (var f = new PlanesPago.frmEdición(txtNombre.Text, NombreCursoSeleccionado, NombreCurso)) { if (f.ShowDialog() == DialogResult.OK) { try { var c = PlanesPagoRepository.Insertar(_alumno.Id, CursoSeleccionado.Id, f.PorcentajeBeca, f.Modalidad, f.TipoBeca); ConsultarPlanesPago(); dgvPlanesPago.SetRow(r => Convert.ToInt32(r.Cells[0].Value) == c.Id); } catch (Exception ex) { ShowError("Error al intentar grabar los datos: \n" + ex.Message); } } } }