Example #1
0
        //*******************************************************
        //
        // The SubmitBtn_Click event handle is used to order the
        // items within the current shopping cart.  It then
        // displays the orderid and order status to the screen
        // (hiding the "SubmitBtn" button to ensure that the
        // user can't click it twice).
        //
        //*******************************************************
        private void SubmitBtn_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            AWC.BusinessLayer.ShoppingCart cart = new AWC.BusinessLayer.ShoppingCart();

            // Calculate end-user's shopping cart ID
            String cartId = cart.GetShoppingCartId();

            // Calculate end-user's customerID
            String customerId = User.Identity.Name;

            if ((cartId != null) && (customerId != null)) {

                // Place the order
                AWC.BusinessLayer.Orders ordersDatabase = new AWC.BusinessLayer.Orders();
                int orderId = ordersDatabase.PlaceOrder(customerId, cartId);

                //Update labels to reflect the fact that the order has taken place
                Header.Text="Check Out Complete!";
                Message.Text = "<b>Your Order Number Is: </b>" + orderId;
                SubmitBtn.Visible = false;
            }
        }