コード例 #1
0
ファイル: frmListado.cs プロジェクト: lariaspaz/SMPorres
 private void btnNuevo_Click(object sender, EventArgs e)
 {
     using (var f = new frmEdición())
     {
         if (f.ShowDialog() == DialogResult.OK)
         {
             try
             {
                 var c = CursosRepository.Insertar(f.Nombre, f.IdCarrera, f.ImporteMatrícula, f.DescuentoPagoAdelantadoMatricula, f.PagoAdelantadoHasta,
                                                   f.ImporteCuota1, f.ImporteCuota2, f.ImporteCuota3, f.ImporteCuota, f.Modalidad, f.Estado);
                 ConsultarDatos();
                 dgvDatos.SetRow(r => Convert.ToInt32(r.Cells[0].Value) == c.Id);
             }
             catch (Exception ex)
             {
                 ShowError("Error al intentar grabar los datos: \n" + ex.Message);
             }
         }
     }
 }
コード例 #2
0
ファイル: frmListado.cs プロジェクト: lariaspaz/SMPorres
 private void btnEditar_Click(object sender, EventArgs e)
 {
     Models.Curso c = ObtenerCursoSeleccionado();
     using (var f = new frmEdición(c))
     {
         if (f.ShowDialog() == DialogResult.OK)
         {
             try
             {
                 CursosRepository.Actualizar(c.Id, f.Nombre, f.IdCarrera, f.ImporteMatrícula, f.DescuentoPagoAdelantadoMatricula, f.PagoAdelantadoHasta,
                                             f.ImporteCuota1, f.ImporteCuota2, f.ImporteCuota3, f.ImporteCuota, f.Modalidad, f.Estado);
                 ConsultarDatos();
                 dgvDatos.SetRow(r => Convert.ToDecimal(r.Cells[0].Value) == c.Id);
             }
             catch (Exception ex)
             {
                 ShowError("Error al intentar grabar los datos: \n" + ex.Message);
             }
         }
     }
 }