Exemple #1
0
 public void CreateOrder(Orders newOrder)
 {
     //get highest id using LINQ
     int newID = Orders().Max(a => a.OrderID)+1;
     newOrder.OrderID = newID;
     context.Orders.Add(newOrder);
     context.SaveChanges();
 }
Exemple #2
0
 /// <summary>
 /// Adds a new order to the Respiratory
 /// </summary>
 /// <param name="requiredDate">The data the oder is required</param>
 /// <param name="name">The name of the ship containing the order</param>
 /// <param name="address">The ships address</param>
 /// <param name="city">The ships city</param>
 /// <param name="region">The ships region</param>
 /// <param name="postalCode">The ships postalCode</param>
 /// <param name="country">The ships country</param>
 public void AddOrder(DateTime requiredDate, string name, string address, string city, string region, string postalCode, string country)
 {
     Orders order = new Orders();
     order.RequiredDate = requiredDate;
     order.ShipName = name;
     order.ShipAddress = address;
     order.ShipCity = city;
     order.ShipRegion = region;
     order.ShipPostalCode = postalCode;
     order.ShipCountry = country;
     order.OrderDate = DateTime.Now;
     respiratory.CreateOrder(order);
         newOrderEvent(order);
 }
Exemple #3
0
 /// <summary>
 /// A event for the NorthWind to run eath time a new event is added.
 /// </summary>
 /// <param name="order">The order ther is added</param>
 public static void subscription(Orders order)
 {
     DateTime dt = order.OrderDate.Value;
     Console.WriteLine("Order added at: " + dt.ToShortDateString());
 }