MyBookShop/BookShop/Store/details.aspx.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using BLL;
using BookShop.Store.cart;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace BookShopProject.Store
{
public partial class details : System.Web.UI.Page
{
public static Books bookInfo { get; set; }
BLLBooks bll = new BLLBooks();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.QueryString["bookid"] != null)
{
bookInfo = bll.GetEntity(int.Parse(Request.QueryString["bookid"].ToString()));
AddCarts();
}
else
{
Response.Redirect("category.aspx", true);
}
}
}
/// <summary>
/// 添加商品到购物车
/// </summary>
public void AddCarts()
{
if (Request.QueryString["num"] != null)
{
//if (Session["LoginInfo"] != null)
//{
int num = int.Parse(Request.QueryString["num"].ToString());
Carts carts = new Carts();
carts.GoodsID = bookInfo.Id;
carts.GoodsImg = bookInfo.ISBN;
carts.GoodsName = bookInfo.Title;
carts.UnitPrice = bookInfo.UnitPrice;
carts.Count = num;
carts.totalPrice = num * bookInfo.UnitPrice;
List<Carts> list = new List<Carts>();
if (Session["Carts"] == null)
{
list.Add(carts);
Session["Carts"] = list;
Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "", "alert('添加到购物车成功!快到购物车查看吧!');", true);
}
else
{
list = (List<Carts>)Session["Carts"];
bool flag = true;
for (int i = 0; i < list.Count; i++)
后面还有 31 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。