public void SetOrderHandler() { Oh = new OrderHandler(prevOrder.CustomerId, prevOrder.LocationId); var ef = new EfData(); List <Pizza2> pizzas = ef.GetPizza2sForOrder(prevOrder.OrderId); foreach (var pizza in pizzas) { Pizza2 p2 = new Pizza2(); p2.CrustId = pizza.CrustId; p2.SauceId = pizza.SauceId; p2.Cheese1 = pizza.Cheese1; p2.Cheese2 = pizza.Cheese2; p2.Topping1 = pizza.Topping1; p2.Topping2 = pizza.Topping2; p2.Topping3 = pizza.Topping3; p2.Quantity = pizza.Quantity; p2.TotalPizzaCost = pizza.TotalPizzaCost; p2.ModifiedDate = DateTime.Now; Oh.Pizzas.Add(p2); Oh.TotalOrderValue += p2.TotalPizzaCost.Value * p2.Quantity; } }
public void SetPizzaOrder() { var ef = new EfData(); Po = new PizzaOrder(); Po.OrderID = prevOrder.OrderId; Po.CustomerName = ef.GetCustomerNameByID(prevOrder.CustomerId); Po.OrderValue = prevOrder.TotalValue.Value; Po.OrderTime = prevOrder.OrderTime; Po.LocationString = ef.GetLocationByID(ef.GetLocationIDForOrder(prevOrder.OrderId)); Po.PizzaStrings = GetAllPizzasInOrder(ef.GetPizza2sForOrder(prevOrder.OrderId)); }
public void SetPizzaOrders() { var ef = new EfData(); AllPizzaOrders = new List <PizzaOrder>(); List <int> orderIDs = ef.GetOrderIdsForCustomer(CustomerID); foreach (int orderID in orderIDs) { PizzaOrder po = new PizzaOrder(); po.OrderID = orderID; Console.WriteLine("Found previous order: {0}", orderID); Order order = ef.GetOrderById(orderID); po.CustomerName = ef.GetCustomerNameByID(CustomerID); po.OrderValue = order.TotalValue.Value; po.OrderTime = order.OrderTime; po.LocationString = ef.GetLocationByID(ef.GetLocationIDForOrder(orderID)); po.PizzaStrings = GetAllPizzasInOrder(ef.GetPizza2sForOrder(orderID)); AllPizzaOrders.Add(po); } Console.WriteLine("There are {0} total orders.", AllPizzaOrders.Count); }