public async Task <FacturaIngreso> ObtenerIngresoIdAsync(Guid id) { using (SqlConnection sql = new SqlConnection(_conexionSql)) { using (SqlCommand cmd = new SqlCommand("IngresosRegistrosPorId", sql)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@Id", id)); FacturaIngreso response = null; await sql.OpenAsync(); using (var reader = await cmd.ExecuteReaderAsync()) { while (await reader.ReadAsync()) { response = MapToFacturaIngreso(reader); } } return(response); } } }
public void Modificar(FacturaIngreso facturaIngreso) { try { facturaIngreso_DAL.Modificar(facturaIngreso); } catch (Exception ex) { throw ex; } }
public void Agregar(FacturaIngreso facturaIngreso) { try { facturaIngreso_DAL.Agregar(facturaIngreso); } catch (Exception ex) { throw ex; } }
public void Eliminar(int numeroFacturaIngreso) { try { FacturaIngreso facturaIngreso = miContexto.FacturaIngreso.First(FacturaIngreso => FacturaIngreso.NumeroFacturaIngreso == numeroFacturaIngreso); miContexto.FacturaIngreso.Remove(facturaIngreso); miContexto.SaveChanges(); } catch (Exception ex) { throw ex; } }
public void Modificar(FacturaIngreso pFacturaIngreso) { try { FacturaIngreso facturaIngreso = Consultar(pFacturaIngreso.NumeroFacturaIngreso); facturaIngreso.Semana = pFacturaIngreso.Semana; facturaIngreso.Descripcion = pFacturaIngreso.Descripcion; facturaIngreso.Total = pFacturaIngreso.Total; miContexto.SaveChanges(); } catch (Exception ex) { throw ex; } }
public void Agregar(FacturaIngreso facturaIngreso) { try { using (DB_ConstruccionesEntities contexto = new DB_ConstruccionesEntities()) { contexto.FacturaIngreso.Add(facturaIngreso); contexto.SaveChanges(); } } catch (Exception ex) { throw ex; } }
private void btnModificar_Click(object sender, EventArgs e) { try { FacturaIngreso facturaIngreso = new FacturaIngreso { NumeroFacturaIngreso = Convert.ToInt32(txtFacturaIngreso.Text), NumeroFactura = Convert.ToInt32(txtFactura.Text), Fecha = Convert.ToDateTime(dtpFecha.Text), Semana = Convert.ToInt32(txtSemana.Text), Descripcion = rtxtDescripcion.Text, Total = Convert.ToInt32(txtTotal.Text) }; new Cls_FacturaIngreso().Modificar(facturaIngreso); MessageBox.Show("Factura Modificada correctamente", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }