protected void CheckoutBtn_Click(object sender, ImageClickEventArgs e) { // Update Shopping Cart UpdateShoppingCartDatabase(); // If cart is not empty, proceed on to checkout page AWC.BusinessLayer.ShoppingCart cart = new AWC.BusinessLayer.ShoppingCart(); // Calculate shopping cart ID String cartId = cart.GetShoppingCartId(); // If the cart isn't empty, navigate to checkout page if (cart.GetItemCount(cartId) != 0) { Response.Redirect("Checkout.aspx"); } else { MyError.Text = "You can't proceed to the Check Out page with an empty cart."; } }
void PopulateShoppingCartList() { AWC.BusinessLayer.ShoppingCart cart = new AWC.BusinessLayer.ShoppingCart(); // Obtain current user's shopping cart ID String cartId = cart.GetShoppingCartId(); // If no items, hide details and display message if (cart.GetItemCount(cartId) == 0) { DetailsPanel.Visible = false; MyError.Text = "There are currently no items in your shopping cart."; } else { // Databind Gridcontrol with Shopping Cart Items MyList.DataSource = cart.GetItems(cartId); MyList.DataBind(); //Update Total Price Label lblTotal.Text = String.Format("{0:c}", cart.GetTotal(cartId)); } }