//Order History User Interface //Displays total order history of user //total, date/time, amount of pizzas, type of pizza, size, crust, and location for each order public static void historyUI() { while (true) { string address; Console.Clear(); Console.WriteLine("Order History"); Console.WriteLine(); Console.WriteLine(" Total Date/Time Amount of Pizzas Type of Pizza Size Crust Location"); Console.WriteLine("-----------------------------------------------------------------------------------------------------------------"); Entity db = AccessDb.acc(); //Singleton used to access data var records = Repository.GetRecordsReverse(db); foreach (var rec in records) { if (rec.UserId == PCustomer.Id) // runs through record and check if user id matches foreign key in records, then displays history { TypeChange type = new TypeChange(); address = type.returnLocation(rec.LocatId); decimal?value = rec.Total; decimal total = value ?? 0; total = Math.Round(total, 2); Console.WriteLine(String.Format("{0,5:C} {1,22} {2,7} {3,-12} {4,-6} {5,-11} {6,0}" , total, rec.DateT, rec.AmountP, rec.PizzaType, rec.Size, rec.Crust, address)); } } Console.WriteLine(); Console.WriteLine("Press any key to return to other options"); Console.ReadKey(); optionsUI(); break; } }