protected void btnAdd_Click(object sender, EventArgs e) { if (txtQuantity.Text != "") { // Response.Redirect("~/Cart.aspx"); TP_Amazon_ClassLibrary.Cart cart = (TP_Amazon_ClassLibrary.Cart)Session["Cart"]; TP_Amazon_ClassLibrary.Product product = new TP_Amazon_ClassLibrary.Product(); product.ProductID = Session["sessionProdID"].ToString(); product.Description = Session["sessionProdDesc"].ToString(); product.Price = decimal.Parse(lblUnitPrice.Text.Substring(1)); string prodMerchName = Session["sessionProdMerch"].ToString(); if (prodMerchName == "One Stop Munchie Shop") { product.merchantName = "One Stop Munchie Shop"; } else { product.merchantName = "Apocalypse Trading Co."; } product.URL = Session["sessionImgURL"].ToString(); CartItem Item = new CartItem(product, int.Parse(txtQuantity.Text)); cart.AddItem(Item); Session["Cart"] = cart; lblQOHError.Text = ""; } else { lblQOHError.Text = "Select a Quantity!"; } }
public void RemoveItem(CartItem Item) { cartItems.Remove(Item); }
public void AddItem(CartItem Item) { cartItems.Add(Item); }