GoodsInfo.aspx.cs

(开头部分) 2KB

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

using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class GoodsInfo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
           
            string  sql = "select   * from tb_Goods order by AddDate desc ";
            DataSet result = DBHelper.GetDataSet(sql);
            this.WebPager1.DataSource = result.Tables[0];
            this.WebPager1.DataBind();    
            

           
             
         
        } 
    } 


    protected void dlstGoods_ItemCommand(object source, DataListCommandEventArgs e)
    {
        if (e.CommandName == "detail")
        {
            //获得当前商品编号
            Int32 id = Int32.Parse(dlstGoods.DataKeys[e.Item.ItemIndex].ToString());
            //在新窗口中弹出商品详细信息页面
            Response.Redirect("goodsdetail.aspx?goodsid=" + id);
        } 
        else if (e.CommandName == "buy")
        {
            //当前用户是否登陆? 只有登陆用户才可以购物
            if (Session["MemberName"] != null)
            {


                int goodsid = Int32.Parse(dlstGoods.DataKeys[e.Item.ItemIndex].ToString());
                float price = BuyCar.GetPriceByGoodsID(Int32.Parse(dlstGoods.DataKeys[e.Item.ItemIndex].ToString()));
                //添加商品到表tb_BuyInfo
                BuyCar.AddShopCart(goodsid, price, Int32.Parse(Session["MemberID"].ToString()), 1);
                //提示添加成功
                Response.Write("<script>alert('恭喜您,添加成功!');document.location=document.location;</script>");

            } 
            else //没有登陆。提示:请先登录,谢谢合作!
            {
                Response.Write("<script>alert('请先登录,谢谢合作!');document.location=document.location;</script>");
            } 
        } 
    }
    protected void WebPager1_PageIndexChanged(object sender, wf.WebPager.PageChangedEventArgs e)
    {
后面还有 8 行代码,购买后查看完整代码

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

AI 解读 AI

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

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