Exemple #1
0
    /// <summary>
    /// 说明:dlBind方法用于绑定相关的商品信息
    public void dlBind()
    {
        int UserID = Convert.ToInt32(Session["UserID"]);
        int num    = bc.SearchGoodsIDNumByUserID(UserID);

        this.AllGoodsNum.Text = num + "";
        //绑定商品数据
        DataTable db = bc.SearchCartGoods(UserID);

        this.goodCartList.DataSource = db;
        this.goodCartList.DataBind();
        //总金额
        string    strSql  = "select * from tb_GoodsInfo g,tb_ShoppingCart s where g.GoodsID = s.GoodsID And s.UserID=" + UserID;
        DataTable dsTable = dbobj.GetDataSetStr(strSql, "tbGoodsInfo");

        for (int i = 0; i < dsTable.Rows.Count; i++)
        {
            float price   = float.Parse(dsTable.Rows[i]["DiscountPrice"].ToString());
            float fee     = float.Parse(dsTable.Rows[i]["Freight"].ToString());
            int   numtemp = int.Parse(dsTable.Rows[i]["GoodsNum"].ToString());
            AllPriceValue += price * numtemp + fee;
        }
        this.AllPrice.Text = AllPriceValue + "";
        //goodId[0] = bc.SearchGoodsCartReturnID(UserID);
    }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //调用UserClass类的UserIsLogin方法判断用户是否登录
        int UserIsLogin = Convert.ToInt32(Session["UserIsLogin"]);

        if (UserIsLogin == 1)
        {
            this.Loginbtn.Visible    = false;
            this.Registerbtn.Visible = false;

            this.welcome.Visible         = true;
            this.LoginedUserName.Visible = true;
            this.exit.Visible            = true;
            this.LoginedUserName.Text    = Convert.ToString(Session["UserName"]);
            //获取购物车中的数量
            int UserID = Convert.ToInt32(Session["UserID"]);
            int count  = bc.SearchGoodsIDNumByUserID(UserID);
            this.cartGoodsNum.Text = count + "";
        }
        else
        {
            this.Loginbtn.Visible    = true;
            this.Registerbtn.Visible = true;

            this.welcome.Visible         = false;
            this.LoginedUserName.Visible = false;
            this.exit.Visible            = false;
            this.cartGoodsNum.Text       = 0 + "";
        }
    }