Пример #1
0
 private void btnNuevo_Click(object sender, EventArgs e)
 {
     using (var f = new frmEdicion())
     {
         if (f.ShowDialog() == DialogResult.OK)
         {
             try
             {
                 var a = ProveedoresRepository.Insertar(f.RazonSocial, f.IdTipoDocumento, f.NroDocumento,
                                                        f.FechaNacimiento, f.Email, f.Dirección, f.Domicilio, f.Teléfono, f.Estado);
                 ConsultarDatos();
                 dgvDatos.SetRow(r => Convert.ToDecimal(r.Cells[0].Value) == a.Id);
             }
             catch (Exception ex)
             {
                 ShowError("Error al intentar grabar los datos: \n" + ex.Message);
             }
         }
     }
 }
Пример #2
0
 private void btnEditar_Click(object sender, EventArgs e)
 {
     Models.Proveedores a = ObtenerProveedoresSeleccionado();
     using (var f = new frmEdicion(a))
     {
         if (f.ShowDialog() == DialogResult.OK)
         {
             try
             {
                 int IdEmpresa = Lib.Configuration.IdEmpresa;
                 ProveedoresRepository.Actualizar(a.Id, IdEmpresa, f.RazonSocial, f.IdTipoDocumento, f.NroDocumento,
                                                  f.FechaNacimiento, f.Email, f.Dirección, f.Teléfono, f.Domicilio, f.Estado);
                 ConsultarDatos();
                 dgvDatos.SetRow(r => Convert.ToDecimal(r.Cells[0].Value) == a.Id);
             }
             catch (Exception ex)
             {
                 ShowError("Error al intentar grabar los datos: \n" + ex.Message);
             }
         }
     }
 }