MyBookShop/BookShop/Store/StoreDefault.Master.cs

(完整代码) 1KB

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 StoreDefault : System.Web.UI.MasterPage
    {
        public static List<Carts> mycarts { get; set; }
        public static decimal totalPrice = 0;
        public static int GoodsCount = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ShowData();
            }
        }
        public void ShowData()
        {
            if (Session["Carts"] != null)
            {
                mycarts = (List<Carts>)Session["Carts"];
                GoodsCount = mycarts.Count;
                totalPrice = 0;
                for (int i = 0; i < mycarts.Count; i++)
                {
                    totalPrice += mycarts[i].totalPrice;
                }
            }
            if (Session["LoginInfo"] != null)
            {
                divGoLogin.Visible = false;
                divLoginUser.Visible = true;
                UserInfo user = (UserInfo)Session["LoginInfo"];
                lblUserName.Text = user.UserTrueName;
            }
            else
            {
                divGoLogin.Visible = true;
                divLoginUser.Visible = false;
            }
        }
    }
}

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

AI 解读 AI

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

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