Exemplo n.º 1
0
 /// <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(Orders newOrder)
 {
     //get highest id using LINQ
     orders.Add(newOrder);
     int newID = orders.Max(a => a.OrderID)+1;
     newOrder.OrderID = newID;
 }
Exemplo n.º 2
0
 /// <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(Orders newOrder)
 {
     //get highest id using LINQ
     int newID = Orders().Max(a => a.OrderID)+1;
     newOrder.OrderID = newID;
     context.Orders.Add(newOrder);
     context.SaveChanges();
 }
Exemplo n.º 3
0
 public Order_Details(Orders order, Products product, decimal unitPrice, short quantity, float discount)
 {
     this.OrderID = order.OrderID;
     this.ProductID = product.ProductID;
     this.UnitPrice = unitPrice;
     this.Quantity = quantity;
     this.Discount = discount;
     this.Orders = order;
     this.Products = product;
 }
Exemplo n.º 4
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);
 }
Exemplo n.º 5
0
        public void TestOrderIdPlus1()
        {
            for (int i = 0; i < 10; i++)
            {
                Orders order = new Orders(0,
                                    null, null,
                                    DateTime.Parse("1996-07-08 00:00:00"),
                                    DateTime.Parse("1996-07-08 00:00:00"),
                                    DateTime.Parse("1996-07-08 00:00:00"),
                                    1, 2,
                                    "name", "address", "city", "region", "pcode", "country");

                respiratory.CreateOrder(order);

                Assert.AreEqual(i + 4, order.OrderID);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Set up the dataclasses to be contained.
        /// </summary>
        public RespiratoryTestStub()
        {
            products = new List<Products>();
            categories = new List<Categories>();
            orders = new List<Orders>();

            Categories category_electronics = new Categories();
            category_electronics.CategoryID = 0;
            Orders order = new Orders();
            order.OrderDate = new DateTime(2014, 10, 2);
            Products product_computer = new Products();
            product_computer.ProductID = 1;
            Order_Details order_details = new Order_Details();
            order_details.Discount = 500;
            order_details.OrderID = 1;
            order_details.Orders = order;
            order_details.ProductID = product_computer.ProductID;
            order_details.Products = product_computer;
            order_details.Quantity = 1;
            order_details.UnitPrice = 4000;
            Customers custommer = new Customers();
            custommer.ContactName = "Niels";
            custommer.CustomerID = "1";
            order.CustomerID = custommer.CustomerID;
            order.Customers = custommer;
            order.OrderID = 1;
            order.Order_Details.Add(order_details);
            product_computer.CategoryID = category_electronics.CategoryID;
            product_computer.Categories = category_electronics;
            product_computer.Order_Details.Add(order_details);
            product_computer.ProductID = 1;
            product_computer.ProductName = "Laptop";
            product_computer.QuantityPerUnit = "0";
            product_computer.ReorderLevel = 0;
            product_computer.UnitsInStock = 2;
            product_computer.UnitsOnOrder = 0;
            products.Add(product_computer);
            orders.Add(order);
            categories.Add(category_electronics);
        }
Exemplo n.º 7
0
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="northWind">NorthWind instance</param>
 /// <param name="order">Inherited order</param>
 public OrdersByTotalPriceDto(INorthWind northWind, Orders order)
 {
     this.northWind = northWind;
     this.order = order;
 }
Exemplo n.º 8
0
 /// <summary>
 /// Set up the dataclasses to be contained.
 /// </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 CSVRespiratory(Products[] products, Categories[] categories, Orders[] orders)
 {
     this.products = products.ToList();
     this.categories = categories.ToList();
     this.orders = orders.ToList();
 }
Exemplo n.º 9
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());
 }