示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!us.IsLogin())
         {
             Response.Redirect("login.aspx?ReturnUrl=userinfo.aspx");
         }
         else
         {
             userid = us.getUserID();
             DataTable db = us.getUser(userid);
             Label1.Text   = db.Rows[0][1].ToString();
             TextBox1.Text = db.Rows[0][4].ToString();
             TextBox2.Text = db.Rows[0][5].ToString();
             TextBox3.Text = db.Rows[0][6].ToString();
             ObjectDataSource1.SelectParameters.Clear();
             ObjectDataSource1.SelectParameters.Add("userid", userid.ToString());
             //DataTable orderdb = Oorder.getordersbyuserid(userid);
             //ListView1.DataSource = orderdb;
             ListView1.DataBind();
         }
     }
 }
示例#2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (!user.IsLogin())
         {
             Response.Redirect("login.aspx?ReturnUrl=feedback.aspx");
         }
         else
         {
             userid = user.getUserID();
             DataTable db = user.getUser(userid);
             TextBox4.Text = db.Rows[0][1].ToString();
         }
     }
 }
示例#3
0
    protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        if (e.CommandName == "buy")
        {
            Label productidlabel = e.Item.FindControl("productid") as Label;
            Userinfo user = new Userinfo();
            {
                product pro = new product();
                DataRow dr = pro.getoneproduct(int.Parse(productidlabel.Text));
                if ((int.Parse(dr["count"].ToString()) > int.Parse(dr["sellcount"].ToString())))
                {
                    cart ocart = new cart();
                    if (ocart.isexitproduct(int.Parse(productidlabel.Text)) == false)
                    {
                        if (ocart.addtocart(int.Parse(productidlabel.Text), user.getUserID(), 1, false) == 1)
                        {
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('购物成功')</script>", false);
                        }
                        else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('购物失败')</script>", false);
                        }
                    }
                    else
                    {
                        if (ocart.updatecartbyid(int.Parse(productidlabel.Text)) == 1)
                        {
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('购物成功')</script>", false);
                        }
                        else
                        {
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('购物失败')</script>", false);
                        }
                    }

                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('该商品缺货中')</script>", false);
                }


            }
        }
    }
示例#4
0
    protected void addorderbt_Click(object sender, EventArgs e)
    {
        DateTime ordertime  = DateTime.Now;
        string   orderid    = ordertime.ToString("yyyyMMddhhmmss");
        double   orderprice = double.Parse(Session["price"].ToString());
        int      ordercount = int.Parse(Session["count"].ToString());
        order    ord        = new order();

        if (ord.createorder(orderid, user.getUserID(), this.acceptnametb.Text.Trim(),
                            this.addresstb.Text.Trim(), this.postalcodetb.Text.Trim(), this.phonetb.Text.Trim(),
                            this.deliverylist.SelectedItem.Text, this.paymentlist.SelectedItem.Text, 1, ordertime, orderprice, ordercount) == 1)
        {
            cart mycart = new cart();
            mycart.updatecartstate();
            this.Response.Redirect("success.aspx");
        }
        else
        {
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('订单出错!')</script>", false);
        }
    }
示例#5
0
    protected void addcart_Click(object sender, ImageClickEventArgs e)
    {
        Userinfo user = new Userinfo();

        if (this.countliteral.Text.Trim() != "缺货")
        {
            cart ocart = new cart();
            if (ocart.isexitproduct(int.Parse(this.Request.QueryString["pid"].ToString())) == false)
            {
                if (ocart.addtocart(int.Parse(this.Request.QueryString["pid"].ToString()), user.getUserID(), 1, false) == 1)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('购物成功')</script>", false);
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('购物失败')</script>", false);
                }
            }
            else
            {
                if (ocart.updatecartbyid(int.Parse(this.Request.QueryString["pid"].ToString())) == 1)
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('购物成功')</script>", false);
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "<script>alert('购物失败')</script>", false);
                }
            }
        }
        else
        {
            this.addcart.Enabled = false;
        }
    }