GwcList.aspx.cs

(开头部分) 2KB

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

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class GwcList : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Session["UserID"] == null)
            {
                Response.Write("<script>alert('请先登陆!');window.location.href='Index.aspx';</script>");
            }
            else
            {
                BindGWCXX();
            }
        }
    }

    private void BindGWCXX()
    {
        //将购物车的当前人员的数据显示在当前列表中 
        DataTable tmpda = new DataTable();
        tmpda = DataBase.Get_Table("select * from 购物车,药品信息  where 购物车.药品代码=药品信息.代码 and 购物车.会员帐号='" + Session["UserID"].ToString() + "'");
        if (tmpda.Rows.Count < 1)
            tmpda.Rows.Add(tmpda.NewRow());
        this.GridView1.DataSource = tmpda;        
        this.GridView1.DataBind();
        //从数据库中计算出购物车中当前人员的总数量和总金额
        tmpda = DataBase.Get_Table("select sum(购物车.数量),sum(购物车.数量 * 药品信息.价格) from 购物车,药品信息  where 购物车.药品代码=药品信息.代码 and 购物车.会员帐号='" + Session["UserID"].ToString() + "'");
        if (tmpda.Rows.Count > 0)
        {
            this.Label2.Text = tmpda.Rows[0][0].ToString();
            this.Label1.Text = tmpda.Rows[0][1].ToString();
        }
    }

    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        //删除购物车里的当前货物
        string Key = this.GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)].Value.ToString();
        if (e.CommandName == "Del")
        {
            DataBase.ExecSql("delete from 购物车 where 购物车代码=" + Key + "");
            BindGWCXX();
        }
    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        if (this.Label2.Text == "" || this.Label2.Text == "&nbsp;")
            return;
后面还有 15 行代码,购买后查看完整代码

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

AI 解读 AI

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

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