Example #1
0
        public List<VentaxProductoBean> retornadetalle(string idventa)
        {
            SqlConnection objDB = null;
            try
            {
                objDB = new SqlConnection(cadenaDB);
                List<VentaxProductoBean> Listaproduc = new List<VentaxProductoBean>();
                objDB.Open();
                String strQuery = "SELECT * FROM VentaDetalle where idVenta= @id ";
                SqlCommand objQuery = new SqlCommand(strQuery, objDB);
                BaseDatos.agregarParametro(objQuery, "@id", idventa);
                SqlDataReader objDataReader = objQuery.ExecuteReader();
                if (objDataReader.HasRows)
                {
                    while (objDataReader.Read())
                    {

                        VentaxProductoBean detalle = new VentaxProductoBean();
                        detalle.id = Convert.ToString(objDataReader["idProducto"]);
                        detalle.cantidadsolicitada = Convert.ToInt32(objDataReader["cantidad"]);
                        detalle.subtotal = Convert.ToDecimal(objDataReader["subtotal"]);

                        Listaproduc.Add(detalle);
                    }
                }

                return Listaproduc;
            }
            catch (Exception e)
            {
                log.Error("Lista de ordenes de compra(EXCEPTION): ", e);
                throw (e);
            }
            finally
            {
                if (objDB != null)
                {
                    objDB.Close();
                }
            }
        }
Example #2
0
        public List<VentaxProductoBean> obtenerlistaproductos(string idSucursal)
        {
            SqlConnection objDB = null;
            try
            {
                objDB = new SqlConnection(cadenaDB);
                List<VentaxProductoBean> Listadeproductos = new List<VentaxProductoBean>();
                VentaxProductoBean prod = new VentaxProductoBean();
                objDB.Open();
                String strQuery = "SELECT * FROM Cafeteria_x_Producto WHERE UPPER(idCafeteria) LIKE '%" + idSucursal.ToUpper() + "%'";

                SqlCommand objQuery = new SqlCommand(strQuery, objDB);
                SqlDataReader objDataReader = objQuery.ExecuteReader();
                if (objDataReader.HasRows)
                {
                    while (objDataReader.Read())
                    {
                        prod = new VentaxProductoBean();
                        prod.id = Convert.ToString(objDataReader["idProducto"]);
                        prod.preciouniario = Convert.ToDecimal(objDataReader["precioventa"]);
                        prod.cantidad = Convert.ToInt32(objDataReader["cantidad"]);

                        Listadeproductos.Add(prod);
                    }
                }

                return Listadeproductos;
            }
            catch (Exception e)
            {
                log.Error("Lista_productos_sucursal(EXCEPTION): ", e);
                throw (e);
            }
            finally
            {
                if (objDB != null)
                {
                    objDB.Close();
                }
            }
        }