コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MoviesWebSite.BLL.MyShoppingCart userShoppingCart =
                new MoviesWebSite.BLL.MyShoppingCart();

            string cartId =
                userShoppingCart.GetShoppingCartSession();
            decimal cartTotal = 0;

            cartTotal = userShoppingCart.GetTotal(cartId);
            if (cartTotal > 0)
            {
                lblTotal.Text = string.Format("{0:c}",
                                              userShoppingCart.GetTotal(cartId));
            }
            else
            {
                lblTotalOrder.Text          = "";
                lblTotal.Text               = "";
                shoppingCartTitle.InnerText =
                    "Shopping Cart is Empty";
                btnUpdate.Visible   = false;
                btnChcekout.Visible = false;
            }
        }
コード例 #2
0
        protected void LoginUser_LoggedIn
            (object sender, EventArgs e)
        {
            MoviesWebSite.BLL.MyShoppingCart userShoppingCart =
                new MoviesWebSite.BLL.MyShoppingCart();
            string cartId = userShoppingCart.GetShoppingCartSession();

            userShoppingCart.MigrateCart(cartId, LoginUser.UserName);

            // Take the current session and refresh
            // the session with new info
            if (Session["TempLoginReference"] != null)
            {
                Response.Redirect
                    (Session["TempLoginReference"].ToString());
            }
            Session["UserName"] = LoginUser.UserName;
        }