Esempio n. 1
0
        public List <CartItem> UpdateCartItems()
        {
            using (ShoppingCartActions usc = new Logic.ShoppingCartActions())
            {
                String cartId = usc.GetCartId();

                ShoppingCartActions.ShoppingCartUpdates[] cartUpdates = new ShoppingCartActions.ShoppingCartUpdates[CartList.Rows.Count];
                for (int i = 0; i < CartList.Rows.Count; i++)
                {
                    IOrderedDictionary rowValues = new OrderedDictionary();
                    rowValues = GetValues(CartList.Rows[i]);
                    cartUpdates[i].ObjectId = rowValues["CatalogObject.ObjectId"].ToString();

                    CheckBox cbRemove = new CheckBox();
                    cbRemove = (CheckBox)CartList.Rows[i].FindControl("RemoveItem");
                    cartUpdates[i].RemoveItem = cbRemove.Checked;

                    TextBox quantityTextBox = new TextBox();
                    quantityTextBox = (TextBox)CartList.Rows[i].FindControl("txtServiceQty");
                    cartUpdates[i].PurchaseQuantity = Convert.ToInt16(quantityTextBox.Text.ToString());
                }

                usc.UpdateShoppingCartDatabase(cartId, cartUpdates);
                CartList.DataBind();
                lblTotalText.Text = string.Format("{0:c}", usc.GetTotal());
                return(usc.GetCartItems());
            }
        }
Esempio n. 2
0
 public ShoppingCartActions GetCart(HttpContext context)
 {
     using (var cart = new ShoppingCartActions())
     {
         cart.ShoppingCartId = cart.GetCartId();
         return(cart);
     }
 }