Esempio n. 1
0
        public List <shoppingCart> UpdateCartItems()
        {
            using (ShoppingCartActions usersShoppingCart = new ShoppingCartActions())
            {
                String cartId = usersShoppingCart.GetCatrId();

                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].ProductId = Convert.ToInt32(rowValues["productID"]);

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

                    TextBox quantityTextBox = new TextBox();
                    quantityTextBox = (TextBox)CartList.Rows[i].FindControl("PurchaseQuantity");
                    cartUpdates[i].PurchaseQuantity = Convert.ToInt16(quantityTextBox.Text.ToString());
                }
                usersShoppingCart.UpdateShoppingCartDatabase(cartId, cartUpdates);
                CartList.DataBind();
                lblTotal1.Text = String.Format("{0:c}", usersShoppingCart.GetTotal());

                return(usersShoppingCart.CartItems());
            }
        }
Esempio n. 2
0
        public List <shoppingCart> GetShoppingCartItems()
        {
            //Team2_BookDBEntities DB = new Team2_BookDBEntities();

            // var data = from s in DB.shoppingCarts where s.userID == session select s;
            //  WebDL.shoppingCart cartitem = shoppingcart.
            // List<shoppingCart> cartItems = data.ToList();
            ShoppingCartActions Action = new ShoppingCartActions();   //  CALL METHOD FROM LOGIC FILE AND RETRIVE FROM DATABASE

            return(Action.CartItems());
        }