Ejemplo n.º 1
0
 public Medida GetMedidaPorId(int id)
 {
     try
     {
         _conexion    = new ConexionBd();
         _repositorio = new RepositorioMedidas(_conexion.AbrirConexion());
         return(_repositorio.GetMedidaPorId(id));
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
Ejemplo n.º 2
0
 public Medida GetMedidaPorId(int id)
 {
     try
     {
         conexion    = new ConexionBd();
         repositorio = new RepositorioMedidas(conexion.AbrirConexion());
         var medida = repositorio.GetMedidaPorId(id);
         conexion.CerrarConexion();
         return(medida);
     }
     catch (Exception e)
     {
         throw new Exception(e.Message);
     }
 }
        private Producto ConstruirProductoTotal(SqlDataReader reader)
        {
            Producto producto = new Producto();

            producto.ProductoId     = reader.GetInt32(0);
            producto.Descripcion    = reader.GetString(1);
            producto.Marca          = _repositorioMarcas.GetMarcaPorId(reader.GetInt32(2));
            producto.Categoria      = _repositorioCategorias.GetCategoriaPorId(reader.GetInt32(3));
            producto.PrecioUnitario = reader.GetDecimal(4);
            producto.Stock          = reader.GetDecimal(5);
            producto.CodigoBarra    = reader[6] != DBNull.Value?reader.GetString(6):null;
            producto.Medida         = _repositorioMedidas.GetMedidaPorId(reader.GetInt32(7));
            producto.Imagen         = reader[8] != DBNull.Value?reader.GetString(8):null;
            producto.Suspendido     = reader.GetBoolean(9);
            return(producto);
        }
Ejemplo n.º 4
0
 private Producto ConstruirProductoTotal(SqlDataReader reader)
 {
     return(new Producto()
     {
         ProductoId = reader.GetInt32(0),
         Descripcion = reader.GetString(1),
         Marca = repositorioMarcas.GetMarcaPorId(reader.GetInt32(2)),
         Categoria = repositorioCategorias.GetCategoriaPorId(reader.GetInt32(3)),
         PrecioUnitario = reader.GetDecimal(4),
         Stock = reader.GetDecimal(5),
         CodigoBarra = reader[6] != DBNull.Value? reader.GetString(6):null,
         Medida = repositorioMedidas.GetMedidaPorId(reader.GetInt32(7)),
         Imagen = reader[8] != DBNull.Value?reader.GetString(8):null,
         Suspendido = reader.GetBoolean(9)
     });
 }