public partial class gouwuche : System.Web.UI.Page
    {
        DataTable cart;
        Double TtlPrice;
        BLL.goods goodsbll = new BLL.goods();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Image9.Visible = false;
                LabMessage.Visible = false;                shoplist();
            }
        }
                     protected void shoplist()
        {
            Hashtable Hash;
            if (Session["car"] == null)
            {
                Hash = new Hashtable();
            }
            else
            {
                Hash = (Hashtable)Session["car"];
            }
            if (Hash.Count == 0)
            {
                Image9.Visible = true;
                LabMessage.Visible = true;
                LabMessage.Text = "您还没有购物呢?赶快购物吧!";
            }            string[] ArrKey = new string[Hash.Count];
            int[] ArrVal = new int[Hash.Count];
            string Goods = "('";
            Hash.Keys.CopyTo(ArrKey, 0);
            Hash.Values.CopyTo(ArrVal, 0);
            int k = 0;
            for (int j = 0; j < ArrKey.Length; j++)
            {
                if (k > 0) Goods += "','"; k++;
                Goods += ArrKey.GetValue(j).ToString();
            }
            Goods += "')";
            DataSet ds = goods.GetList("G_No in" + Goods);            DataTable Table1 = new DataTable();
            Table1 = ds.Tables[0] ;
           //Table1 = ds.Tables["Goods"];
            Table1.Columns.Add(new DataColumn("Number", System.Type.GetType("System.Int32")));            DataColumn[] Keys = { Table1.Columns["ID"] };
            Table1.PrimaryKey = Keys;
            foreach (string X in Hash.Keys)
            {
                Table1.Rows.Find(X)["Number"] = Hash[X];            }
            Table1.Columns.Add(new DataColumn("Label1", System.Type.GetType("System.Double"), "price*Number"));
            for (int I = 0; I < Table1.Rows.Count; I++)
            {                TtlPrice += Convert.ToDouble(Table1.Rows[I]["price"]);            }            Label1.Text = TtlPrice.ToString();
            Session["Total"] = Label1.Text.ToString();
            GridView2.DataSource = Table1.DefaultView;
            GridView2.DataBind();        }
             protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            Hashtable Hash;
            if (Session["car"] == null)
            {
                Hash = new Hashtable();
            }
            else
            {
                Hash = (Hashtable)Session["car"];
            }            if (Hash.ContainsKey(e.CommandArgument))
            {
                Hash.Remove(e.CommandArgument);
            }
            LabMessage.Text = (string)e.CommandArgument;            Session["car"] = Hash;
            shoplist();
        }
             protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
             {
                 Response.Redirect("default.aspx");
             }
             protected void ImageButton5_Click(object sender, ImageClickEventArgs e)
             {                 if (GridView2.Rows.Count == 0)
                 {
                     LTP.Common.MessageBox.Show(this, "请先购物!");                     // Page.RegisterClientScriptBlock("e", "<script>alert('请先购物!')</script>");
                 }
                 else if (Session["username"] == null)
                 {
                     ScriptManager.RegisterStartupScript(this.ImageButton5, this.GetType(), "alertScript", "window.open('ssnotice.aspx');", true);
                     //Response.Write("<script>alert('请先登录!');location.href='denglu.aspx'</script>");                     // Server.Transfer("userlogin.aspx");
                 }
                 else
                 {                     Response.Redirect("pay1.aspx");
                 }
             }
    }