BookShop.Web/Ajax/Ajax_ShoppingCart.aspx.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using CTL.Common;

namespace BookShop.Web.Ajax
{
    public partial class Ajax_ShoppingCart : System.Web.UI.Page
    {
        /// <summary>
        /// 页面加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Response.Expires = 0;//清除缓存
            string action = Requests.All("action");
            string result = "";
            switch (action)
            {
                case "buy":
                    result = Buy();
                    break;
                case "addbooktocart":
                    result = AddBookToShoppingCart();
                    break;
                case "remove": 
                    {
                        int shoppingcartId = Utils.StrToInt(Requests.All("s"));
                        result = (ShoppingCartItemInfoBLL.DeleteShoppingCart(shoppingcartId) ? "" : "移除失败");
                    }
                    break;
                case "minus":
                    {
                        int shoppingcartId = Utils.StrToInt(Requests.All("s"));
                        Model.ShoppingCartItemInfo model = ShoppingCartItemInfoBLL.GetShoppingCartInfo(shoppingcartId);
                        if (model != null)
                        {
                            model.Quantity -= 1;
                            ShoppingCartItemInfoBLL.UpdateShoppingCart(model);
                        }
                    } break;
                case "add":
                    {
                        int shoppingcartId = Utils.StrToInt(Requests.All("s"));
                        int quantity = Utils.StrToInt(Requests.All("q"));
                        Model.ShoppingCartItemInfo model = ShoppingCartItemInfoBLL.GetShoppingCartInfo(shoppingcartId);

                        if (model != null)
                        {
                            Model.Book bookInfo = BookBLL.GetBookInfo(model.BookID);
                            if (bookInfo != null)
                            {
                                if (bookInfo.Stock < quantity + 1)
                                {
后面还有 96 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。