Exemplo n.º 1
0
 private void loadproducts()
 {
     productos = new List <Producto>();
     foreach (string code in user.favoritos)
     {
         Producto aux = new Producto();
         aux = productoBusiness.buscarid(code);
         productos.Add(aux);
     }
 }
        private void readproduct()
        {
            string code = Request.QueryString["prod"];

            if (code == null)
            {
                Response.Redirect("Tienda.aspx");
            }
            producto = productoBusiness.buscarid(code);
        }
        private bool isdel()
        {
            string code = Request.QueryString["del"];

            if (code == null)
            {
                return(false);
            }
            producto = productoBusiness.buscarid(code);
            return(true);
        }
Exemplo n.º 4
0
        private void Additem()
        {
            var comp = new ItemCarrito();

            try
            {
                string code = (string)Request.QueryString["ART"];
                if (code != null)
                {
                    page = findProductPage();


                    bool    nuevo = true;
                    Carrito aux   = (Carrito)Session["chart"];
                    foreach (ItemCarrito item in aux.items)
                    {
                        if (item.code == code)
                        {
                            item.ammount++;
                            nuevo = false;
                        }
                    }
                    if (nuevo)
                    {
                        var auxproduct = productoBusiness.buscarid(code);
                        comp.name      = auxproduct.name;
                        comp.code      = auxproduct.code;
                        comp.ammount   = 1;
                        comp.unitPrice = (float)auxproduct.unitPrice();
                        aux.items.Add(comp);
                    }



                    Session.Remove("chart");
                    Session["chart"] = aux;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        //----------MODIFICAR PRODUCTO

        private void loadProduct(string code)
        {
            producto          = productoBusiness.buscarid(code);
            TextCode.Text     = producto.code;
            TextCode.ReadOnly = true;
            TextName.Text     = producto.name;
            TextDesc.Text     = producto.desc;
            BrandSelector.Items.FindByText(producto.marca.name).Selected = true;
            TextMargin.Text = producto.margin.ToString();
            for (int x = 0; x < Categorybox.Items.Count; x++)
            {
                Categoria aux = categoriaBusiness.getFromName(Categorybox.Items[x].Text);
                if (categoriaBusiness.checkItemInCategory(aux.id, producto.code))
                {
                    Categorybox.Items[x].Selected = true;
                }
            }
            Session["oldimagepath"] = producto.urlimagen;
        }