Esempio n. 1
0
        public static Producto GetProductoById(int Idprocuto)
        {
            ProductoTableAdapter localAdapter = new ProductoTableAdapter();

            if (Idprocuto <= 0)
            {
                return(null);
            }

            Producto theUser = null;

            try
            {
                ProductoDS.ProductoDataTable table = localAdapter.GetProductoById(Idprocuto);

                if (table != null && table.Rows.Count > 0)
                {
                    ProductoDS.ProductoRow row = table[0];
                    theUser = FillProdutowithImagenRecord(row);
                }
            }
            catch (Exception q)
            {
                log.Error("Un error ocurrio mientras obtenia el modulo de la base de dato", q);
                return(null);
            }

            return(theUser);
        }
Esempio n. 2
0
 private static Producto GetProductoFromRow(ProductoDS.ProductoRow row)
 {
     return(new Producto()
     {
         Nombre = row.nombre,
         ProductoId = row.productoId,
         Precio = row.precio,
         Stock = row.stock
     });
 }
Esempio n. 3
0
    private static Producto FillReccord(ProductoDS.ProductoRow row)
    {
        Producto obj = new Producto()
        {
            ProductoId   = row.productoId,
            Descripcion  = row.descripcion,
            PrecioCompra = row.precioCompra,
            PrecioVenta  = row.precioVenta
        };

        return(obj);
    }
Esempio n. 4
0
        private static Producto FillProdutoRecord(ProductoDS.ProductoRow row)
        {
            Producto theNewRecord = new Producto(
                row.productoId,
                row.IsdescripcionNull() ? "" : row.nombre,
                row.IsdescripcionNull() ? "" : row.descripcion,
                row.IsdescripcionNull() ? "" : row.unidadMedidaId,
                row.precio,
                row.stock,
                row.familiaId);

            return(theNewRecord);
        }
Esempio n. 5
0
    public static Producto GetProductoById(int ProductoId)
    {
        Producto theData = null;

        try
        {
            ProductoDSTableAdapters.ProductoTableAdapter localAdapter = new ProductoDSTableAdapters.ProductoTableAdapter();
            ProductoDS.ProductoDataTable table = localAdapter.GetProductoById(ProductoId);

            if (table != null && table.Rows.Count > 0)
            {
                ProductoDS.ProductoRow row = table[0];
                theData = FillReccord(row);
            }
        }
        catch (Exception q)
        {
            throw new ArgumentException(q.Message, q);
        }

        return(theData);
    }