예제 #1
0
 public int CreateOrder(int customerID)
 {
     // ---------------------
     Order order = new Order
     {
         OrdersID = 0,
         FKMenuCustomerID = customerID,
         DateOrder = DateTime.Now
     };
     SaveOrder(order);
     return order.OrdersID;
 }
예제 #2
0
 public void SaveOrder(Order order)
 {
     // If its a new product, just attach it to the DataContext
     if (order.OrdersID == 0)
         orderTable.InsertOnSubmit(order);
     else if (orderTable.GetOriginalEntityState(order) == null)
     {
         // Were updating an existing menu item, but its not attached to the
         // this data context, so attach it and detect the changes
         orderTable.Attach(order);
         orderTable.Context.Refresh(RefreshMode.KeepCurrentValues, order);
     }
     orderTable.Context.SubmitChanges();
 }
예제 #3
0
 public void DeleteItems(Order orders)
 {
     orderTable.DeleteOnSubmit(orders);
     orderTable.Context.SubmitChanges();
 }
예제 #4
0
 public void CompleteOrder(Order order)
 {
     orderTable.Attach(order);
     orderTable.Context.Refresh(RefreshMode.KeepCurrentValues, order);
     orderTable.Context.SubmitChanges();
 }