protected void Button1_Click(object sender, EventArgs e)
    {
        string orderid = "order" + User.Identity.Name + DateTime.Now.ToShortTimeString();
        int    i       = Com.Recruitment.DataBase.Connection.ConnectionPool.getConnection().ExecuteNonQuery("Insert into [order](orderno,userid)values('" + orderid + "','" + User.Identity.Name + "')");
        Dictionary <string, Product> prodt = (Dictionary <string, Product>)Session["pro"];

        foreach (Product p in prodt.Values)
        {
            if (p.Quantity > 0)
            {
                Com.Recruitment.DataBase.Connection.Connection con = Com.Recruitment.DataBase.Connection.ConnectionPool.getConnection();
                int j = con.ExecuteNonQuery("Insert into [orderdetails] values('" + p.Id + "','" + p.Quantity + "','" + orderid + "')");
            }
        }



        Response.Redirect("Paymentdetail.aspx");
    }
示例#2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Session["total"] != null)
        {
            i = (int)Session["total"];
            if (i > 0)

            {
                Com.Recruitment.DataBase.Connection.Connection con = Com.Recruitment.DataBase.Connection.ConnectionPool.getConnection();
                DataSet ds = con.getDataSet("select * from cartdetail where ccno=" + TextBox1.Text + " and acountno=" + TextBox2.Text + " and password='******'");
                // DataSet ds = Com.Recruitment.DataBase.Connection.ConnectionPool.getConnection().getDataSet("select * from cartdetail where ccno=" + TextBox1.Text + " and acountno=" + TextBox2.Text + " and password='******'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (Convert.ToInt32(ds.Tables[0].Rows[0][5]) > (int)Session["total"])
                    {
                        System.Windows.Forms.DialogResult dg = System.Windows.Forms.MessageBox.Show("you can purchase.Are you sure?");
                        if (dg == System.Windows.Forms.DialogResult.OK)
                        {
                            int     k   = Com.Recruitment.DataBase.Connection.ConnectionPool.getConnection().ExecuteNonQuery("update cartdetail set total=total- " + i + " where ccno=" + TextBox1.Text + "");
                            DataSet ds1 = Com.Recruitment.DataBase.Connection.ConnectionPool.getConnection().getDataSet("select * from cartdetail");
                            System.Windows.Forms.MessageBox.Show("your current balance is" + ds1.Tables[0].Rows[0][5].ToString());
                        }
                        else
                        {
                            System.Windows.Forms.MessageBox.Show("Sorry!you have less amount");
                        }
                    }
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Your inormations are not corrent");
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("First purchase a product");
            }
        }
    }