Beispiel #1
0
        protected void Btn_Barrow_Click(object sender, EventArgs e)
        {
            if (Session["cart"] != null)
            {
                tbl_order ne = new tbl_order();
                ne.UserID    = int.Parse(Session["userID"].ToString());
                ne.StartDate = DateTime.Now;
                ne.State     = "Waiting";
                db.tbl_orders.InsertOnSubmit(ne);
                db.SubmitChanges();

                var item = from o in db.tbl_orders
                           select o;
                int id = 0;
                foreach (var z in item)
                {
                    id = z.OrderID;
                }


                string   cart = Session["cart"].ToString();
                string[] crt  = cart.Split('+');
                for (int i = 0; i < crt.Length; i++)
                {
                    tbl_indexOrder n = new tbl_indexOrder();
                    n.OrderID = id;
                    n.BookID  = int.Parse(crt[i]);
                    db.tbl_indexOrders.InsertOnSubmit(n);
                    db.SubmitChanges();
                }
                Session["cart"] = "";
                Label1.Text     = "Your Cart has sent succesfully";
                Response.Redirect("Cart.aspx");
            }
        }
 partial void Deletetbl_indexOrder(tbl_indexOrder instance);
 partial void Updatetbl_indexOrder(tbl_indexOrder instance);
 partial void Inserttbl_indexOrder(tbl_indexOrder instance);