示例#1
0
 public static void PlaceOrder(string CustomerID, ShoppingCart.ShippingAddress ShipAddress, DateTime OrderDate, DateTime RequiredDate, int ShipVIA, decimal FreightCost)
 {
     int orderid = DB.AddOrder(CustomerID, OrderDate, 12, RequiredDate, null, ShipVIA, FreightCost);
     foreach (CartItem item in CurrentCart.Cart)
     {
         DB.AddOrderDetails(orderid, item.ProductID, item.UnitPrice, (short)item.Quantity, 0.0F);
         DB.RemoveCartItem(CurrentUser.CustomerID, item.ProductID);
     }
     CurrentCart.Cart.Clear();
     DB.ChangeOrderAddress(orderid, ShipAddress.Address, ShipAddress.Shipname, ShipAddress.City, ShipAddress.Region, ShipAddress.PostalCode, ShipAddress.Country);
 }
示例#2
0
 public void SetCart(ShoppingCart Cart)
 {
     CurrentCart = Cart;
 }
示例#3
0
 //Gets cart items for a customer from the DB
 public static List<CartItem> LoadShoppingCart(string CustomerID)
 {
     CurrentCart = new ShoppingCart(CustomerID);
     DataTable Items = DB.GetCart(CustomerID);
     foreach (DataRow item in Items.Rows)
     {
         CartItem tmp = new CartItem((int)item["ProductID"], (decimal)item["UnitPrice"], (int)(short)item["Quantity"]);
         CurrentCart.AddToCart(tmp);
     }
     return CurrentCart.Cart;
 }