/// <summary> /// Adds a new order to the orders list, with its own new orderID. /// </summary> /// <param name="newOrder">The oder to be added</param> public void CreateOrder(Order newOrder) { //get highest id using LINQ orders.Add(newOrder); int newID = orders.Max(a => a.OrderID)+1; newOrder.OrderID = newID; }
/// <summary> /// Set up the dataclasses to be containd. /// </summary> /// <param name="products">A array of the Products</param> /// <param name="categories">A array of the Categories</param> /// <param name="orders">A array of the Orders</param> /// <param name="ordersDetails">A array of the OrdersDetails</param> public Respiratory(Product[] products, Category[] categories, Order[] orders, OrderDetails[] ordersDetails) { this.products = products.ToList(); this.categories = categories.ToList(); this.orders = orders.ToList(); this.ordersDetails = ordersDetails.ToList(); }
public OrderDetails(Order OrderID, Product ProductID, double UnitPrice, int Quantity, double Discount) { this.OrderID = OrderID; this.ProductID = ProductID; this.UnitPrice = UnitPrice; this.Quantity = Quantity; this.Discount = Discount; }
/// <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) { Order order = new Order(0,null,null,DateTime.Now,requiredDate,null,-1,-1,name,address,city,region,postalCode,country); 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); }
/// <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(Order order) { Console.WriteLine("Order added at: " + order.OrderDate.ToShortDateString()); }