private void btnCheckout_Click(object sender, System.EventArgs e) { UpdateShoppingCartDatabase(); // If cart is not empty, proceed on to checkout page funstore.cartDB cart = new funstore.cartDB(); // 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 { lberror.Text = "You can't proceed to the Check Out page with an empty cart."; } }
void PopulateShoppingCartList() { funstore.cartDB cart = new funstore.cartDB(); // Obtain current user's shopping cart ID String cartId = cart.GetShoppingCartId(); // If no items, hide details and display message if (cart.GetItemCount(cartId) == 0) { Panel1.Visible = false; lberror.Text = "There are currently no items in your shopping cart."; } else { // Databind Gridcontrol with Shopping Cart Items this.DataGrid1.DataSource = cart.GetItems(cartId); this.DataGrid1.DataBind(); //Update Total Price Label lblTotal.Text = String.Format("{0:c}", cart.GetTotal(cartId)); } }