public ActionResult Dishes(Guid StallId) { var manager = new DishManager(); List <DishEntity> dishes = manager.GetDishByStallIDEntities(StallId); return(View("BrowseDishes", dishes)); }
//Vue complexe utilisant le modèle OrderDetailsViewModel //Permet d'afficher le nom du restaurant de la commande, le numéro de la commande, les plats choisis (bug, 1 seul plat est affiché), //la quantité par plats, le prix unitaire d'un plat, l'heure de livraison... public ActionResult OrderDetails() { List <OrderDetailsViewModel> listeOrderDetails = new List <OrderDetailsViewModel>(); OrderDetailsViewModel orderDetails = new OrderDetailsViewModel(); int idCustomer = HttpContext.Session.GetInt32("IdCustomer").GetValueOrDefault(); int idOrder = HttpContext.Session.GetInt32("IdOrder").GetValueOrDefault(); int idRestaurant = HttpContext.Session.GetInt32("IdRestaurant").GetValueOrDefault(); int idDeliveryTime = HttpContext.Session.GetInt32("Id_Delivery_time").GetValueOrDefault(); OrderManager.UpdateOrderDeliveryTime(idOrder, idDeliveryTime); List <DTO.Order_Dish> listeOrder_Dishes = Order_DishManager.GetAllOrder_Dish(idOrder); DTO.Customer customer = CustomerManager.GetCustomer(idCustomer); DTO.Order order = OrderManager.GetOrder(idOrder); DTO.Restaurant restaurant = RestaurantManager.GetRestaurant(idRestaurant); orderDetails.Customers = customer; orderDetails.Orders = order; orderDetails.Restaurants = restaurant; orderDetails.Cities = CityManager.GetCity(customer.FK_idCity); orderDetails.Delivery_Times = Delivery_TimeManager.GetDelivery_Time(idDeliveryTime); foreach (DTO.Order_Dish od in listeOrder_Dishes) { orderDetails.Order_Dishes = od; orderDetails.Dishes = DishManager.GetDish(od.FK_idDish); } listeOrderDetails.Add(orderDetails); return(View(listeOrderDetails)); }
public ActionResult RemoveDish(Guid DishId) { var _manager = new DishManager(); _manager.DeleteDishByID(DishId); return(RedirectToAction("Index")); }
public void AddToDish() { DishManager dishManager = GameObject.Find("Dish").GetComponent <DishManager>(); dishManager.AddItem(gameObject.name); gameObject.AddComponent <AddItemToDish>(); }
public void RemoveFromDish() { DishManager dishManager = GameObject.Find("Dish").GetComponent <DishManager>(); dishManager.RemoveItem(gameObject.name); //gameObject.AddComponent<RemoveItemFromDish>(); }
//Method that add an item into the shopping cart public ActionResult AddItem(int id) { if (HttpContext.Session.GetObjectFromJson <List <Cart> >("Cart") == null) { List <Cart> cart = new List <Cart>(); cart.Add(new Cart { dish = DishManager.GetDish(id), quantity = 1, totalPriceProduct = DishManager.GetDish(id).Price }); HttpContext.Session.SetObjectAsJson("Cart", cart); } else { int index = isExist(id); if (index != -1) { List <Cart> cart = HttpContext.Session.GetObjectFromJson <List <Cart> >("Cart"); cart.Select(m => m.dish.IdDish == id); cart[index].quantity++; cart[index].totalPriceProduct += DishManager.GetDish(id).Price; HttpContext.Session.SetObjectAsJson("Cart", cart); } else { List <Cart> cart = HttpContext.Session.GetObjectFromJson <List <Cart> >("Cart"); cart.Add(new Cart { dish = DishManager.GetDish(id), quantity = 1, totalPriceProduct = DishManager.GetDish(id).Price }); HttpContext.Session.SetObjectAsJson("Cart", cart); } } return(RedirectToAction(("ShoppingCart"))); }
void Awake() { _transform = GetComponent <Transform> (); _rigidbody = GetComponent <Rigidbody> (); if (_rigidbody == null) // if Rigidbody is missing { Debug.LogError("Rigidbody2D component missing from this gameobject"); } _animator = GetComponent <Animator>(); if (_animator == null) // if Animator is missing { Debug.LogError("Animator component missing from this gameobject"); } _audio = GetComponent <AudioSource>(); if (_audio == null) { // if AudioSource is missing Debug.LogWarning("AudioSource component missing from this gameobject. Adding one."); //let's just add the AudioSource component dynamically _audio = gameObject.AddComponent <AudioSource>(); } _moveTime = 0f; _moving = true; if (taskNo == 1) { dishManager = GameObject.FindGameObjectWithTag(managerTag).GetComponent <DishManager>(); } else if (taskNo == 2) { fishManager = GameObject.FindGameObjectWithTag(managerTag).GetComponent <FishManager>(); } granyAController = GameObject.Find("GranyA").GetComponent <GranyAController>(); }
public ActionResult Dishes(Guid StallId) { var _manager = new DishManager(); var list = _manager.GetDishByStallIDEntities(StallId); ViewData["StallId"] = StallId; return(View("DishSelection", list)); }
private void Awake() { if (instance != null) { Debug.LogError("There should only be 1 instance of DishManager"); } instance = this; }
public ActionResult Details(int id) { //creation of multiple variables to check conditions and for the display IOrderDB order = new OrderDB(Configuration); IOrderManager om = new OrderManager(order); ICustomerDB customer = new CustomerDB(Configuration); ICustomerManager cm = new CustomerManager(customer); ICityDB citydb = new CityDB(Configuration); ICityManager cityman = new CityManager(citydb); IDelivery_staffDB dsDB = new Delivery_staffDB(Configuration); IDelivery_staffManager dsM = new Delivery_staffManager(dsDB); IDishDB dish = new DishDB(Configuration); IDishManager dishManager = new DishManager(dish); IOrder_dishesDB order_Dishes = new Order_dishesDB(Configuration); IOrder_dishesManager odm = new Order_dishesManager(order_Dishes); IRestaurantDB restaurant = new RestaurantDB(Configuration); IRestaurantManager restaurantManager = new RestaurantManager(restaurant); //Creations of multiple ViewData for the display var customerlist = cm.GetCustomers(); ViewData["Customers"] = customerlist; var citylist = cityman.GetCities(); ViewData["City"] = citylist; var allOrders = om.GetOrders(); ViewData["AllOrders"] = allOrders; var allStaff = dsM.GetDelivery_staffs(); ViewData["AllStaffs"] = allStaff; var allDishes = dishManager.GetAllDishes(); ViewData["AllDishes"] = allDishes; var allOrderDishes = odm.GetAllOrders_dishes(); ViewData["AllOrderDishes"] = allOrderDishes; var allRestaurants = restaurantManager.GetRestaurants(); ViewData["AllRestaurants"] = allRestaurants; ViewBag.nameDL = HttpContext.Session.GetString("nameDL"); var od = om.GetOrders_ds(id); //Get all orders according to the deliverer's id List <Order> odtrie = new List <Order>(); //Creation of a list which will only contain the non delivery order(s) foreach (Order o in od) { if (o.status.Equals("non delivery")) { odtrie.Add(o); } } return(View(odtrie)); //Display the non delivery order(s) }
void init() { GameObject manager = GameObject.FindGameObjectWithTag("Manager"); if (manager != null) { dishManager = manager.GetComponent<DishManager>(); } // Freeze the dish GetComponent<Rigidbody>().isKinematic = true; }
//Show all the dishes of one restaurant public ActionResult Details(int id) { var dishes = DishManager.GetDishes(id); ViewBag.nameResto = RestaurantManager.GetRestaurant(id).Name; var cartest = HttpContext.Session.GetObjectFromJson <List <Cart> >("Cart"); List <Cart> cartlist = cartest; var cart = new List <Cart>(); if (HttpContext.Session.GetObjectFromJson <List <Cart> >("Cart") == null) { } else { if (!cartlist.Any(m => m.dish.IdRestaurant == id)) { HttpContext.Session.SetObjectAsJson("Cart", cart); } else { cart = HttpContext.Session.GetObjectFromJson <List <Cart> >("Cart"); } } var date = DateTime.Now; var timeDay = date.TimeOfDay; var nextFullHour = TimeSpan.FromHours(Math.Ceiling(timeDay.TotalHours)); date.AddMinutes(15); var dt1 = RoundUp(date, TimeSpan.FromMinutes(15)); var timeDay2 = dt1.TimeOfDay; ViewBag.Time = timeDay2; var viewModel = new CartDish(); viewModel.ListA = dishes; viewModel.ListB = cart; double price = 0; foreach (var plat in viewModel.ListB) { price += plat.dish.Price; } viewModel.price = price; return(View(viewModel)); }
public ActionResult Dishes(Guid StallId) { if (!IsAuthorized()) { return(View("Error")); } var _manager = new DishManager(); var list = _manager.GetDishByStallIDEntities(StallId); ViewData["StallId"] = StallId; return(View("DishSelection", list)); }
public ActionResult ConfirmationOrder(IFormCollection fc) { int[] id_dishes = Array.ConvertAll(fc["nameDish"].ToString().Split(','), s => int.TryParse(s, out var i) ? i : 0); int[] quantity = Array.ConvertAll(fc["quantity"].ToString().Split(','), s => int.TryParse(s, out var i) ? i : 0); //With Dictionary, we have a list of two int "linked". //That's the object dish and its quantity Dictionary <int, int> dishes = id_dishes.Zip(quantity, (s, i) => new { s, i }) .ToDictionary(item => item.s, item => item.i); //Calculating the total price the customer will have to pay, and give it to the courrier in the right city decimal total = 0; int idCit = 0; foreach (var i in dishes) { if (i.Value != 0) { total += DishManager.GetPrice(i.Key) * i.Value; idCit = DishManager.GetIdCityRestaurant(i.Key); } } //Taking the dateTime and stocking it in the variable dat DateTime dat = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, Int32.Parse(fc["hour"]), Int32.Parse(fc["min"]), 0); //CHECK if the date is higher than now and if the total isn't zero. //That means the customer has choosen something for a correct/possible delivery time if (dat > DateTime.Now && total != 0) { OrderManager.SetOrder(dishes, idCit, Convert.ToInt32(HttpContext.Session.GetInt32("id")), dat); ViewBag.total = total; ViewBag.dat = dat; return(View()); } else { return(RedirectToAction(nameof(OrderError))); } }
// GET: Customer/Details/5 public ActionResult Details() { if ((string)HttpContext.Session.GetString("login") != "Aucun customer n'est log" && (string)HttpContext.Session.GetString("login") != null) // A customer is logged ? { //Get the login of the current customer ViewBag.login = HttpContext.Session.GetString("login"); //creation of multiple variables to check conditions and for the display IOrderDB order = new OrderDB(Configuration); IOrderManager om = new OrderManager(order); IDelivery_staffDB dsDB = new Delivery_staffDB(Configuration); IDelivery_staffManager dsM = new Delivery_staffManager(dsDB); IDishDB dish = new DishDB(Configuration); IDishManager dishManager = new DishManager(dish); IOrder_dishesDB order_Dishes = new Order_dishesDB(Configuration); IOrder_dishesManager odm = new Order_dishesManager(order_Dishes); IRestaurantDB restaurant = new RestaurantDB(Configuration); IRestaurantManager restaurantManager = new RestaurantManager(restaurant); //Get the id of the current customer var id = (int)HttpContext.Session.GetInt32("id"); //Get an orderlist according to the customer id var ordersList = om.GetOrders(id); //Creations of multiple ViewData for the display var allOrders = om.GetOrders(); ViewData["AllOrders"] = allOrders; var allStaff = dsM.GetDelivery_staffs(); ViewData["AllStaffs"] = allStaff; var allDishes = dishManager.GetAllDishes(); ViewData["AllDishes"] = allDishes; var allOrderDishes = odm.GetAllOrders_dishes(); ViewData["AllOrderDishes"] = allOrderDishes; var allRestaurants = restaurantManager.GetRestaurants(); ViewData["AllRestaurants"] = allRestaurants; //Check if the customer has not order if (ordersList == null) { return(RedirectToAction("DetailsNoOrder", "Customer", new { user = id.ToString() })); } else { return(View(ordersList)); // Return the Details view } } else { return(RedirectToAction("Index", "Customer")); // return to the login page } }
/// <summary> /// 美食展示分页 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult DishesShow(int?id = 1) { int totalCount = 0; int pageIndex = id ?? 1; int pageSize = 6; PagedList <Dishes> objlist = new DishManager().GetDishes("", pageSize, (pageIndex - 1) * 6, out totalCount).AsQueryable().ToPagedList(pageIndex, pageSize); objlist.TotalItemCount = totalCount; objlist.CurrentPageIndex = (int)(id ?? 1); Common.Common info = new Common.Common(); info.objDish = objlist; return(View("DishesShow", info)); }
//Display the list of dishes of a restaurant public ActionResult Plat(int id) { IDishDB dish = new DishDB(Configuration); IDishManager dishManager = new DishManager(dish); var dishes = dishManager.GetDishes(id); HttpContext.Session.SetInt32("idResto", id); //setting a session for the command action ViewBag.id = id; return(View(dishes)); }
// // GET: /CompanyInfo/ public ActionResult Index() { #region News dynamically query List <News> listNews = new NewsManager().GetNews(5); ViewBag.list = listNews; #endregion #region featured dishes dynamically query List <Dish> listDish = new DishManager().GetDishes(4); ViewBag.dish = listDish; #endregion return(View("Index")); }
//Remove the dish from your cart public ActionResult RemoveAllItems(int id) { List <Cart> cart = HttpContext.Session.GetObjectFromJson <List <Cart> >("Cart"); var itemToRemove = cart.Single(r => r.dish.IdDish == id); cart.Remove(itemToRemove); HttpContext.Session.SetObjectAsJson("Cart", cart); Dish dish = DishManager.GetDish(id); int idResto = dish.IdRestaurant; return(RedirectToAction("Details/" + idResto)); }
public ActionResult Stalls() { var _manager = new StallManager(); var _dishmanager = new DishManager(); List <StallEntity> stalls = _manager.GetAllStallEntities(); var list = new List <StallEntity>(); foreach (var stall in stalls) { var dishes = _dishmanager.GetDishByStallIDEntities(stall.ID.Value); if (dishes.Count != 0) { list.Add(stall); } } return(View("BrowseStalls", list)); }
//method that removes a dish from the cart public ActionResult RemoveItem(int id) { List <Cart> cart = HttpContext.Session.GetObjectFromJson <List <Cart> >("Cart"); var itemToRemove = cart.Single(r => r.dish.IdDish == id); int index = isExist(id); if (cart[index].quantity >= 2) { cart[index].quantity--; cart[index].totalPriceProduct -= DishManager.GetDish(id).Price; HttpContext.Session.SetObjectAsJson("Cart", cart); } return(RedirectToAction("ShoppingCart")); }
//Display the dish(es) in a specific order public ActionResult DishesInOrder(int id) { IDishDB dish = new DishDB(Configuration); IDishManager dishManager = new DishManager(dish); IOrder_dishesDB order_Dishes = new Order_dishesDB(Configuration); IOrder_dishesManager odm = new Order_dishesManager(order_Dishes); //Creation of a ViewData for the display var allDishes = dishManager.GetAllDishes(); ViewData["AllDishes"] = allDishes; var orderDishes = odm.GetOrders_dishes(id); return(View(orderDishes)); //Display the list of dish(es) }
//Show the details of an order public ActionResult DetailsOrder(int id) { OrderManager.GetOrder(id); List <Cart> cartlist = new List <Cart>(); var dishes = Order_DishesManager.GetOrder_Dishes(id); foreach (var item in dishes) { Dish dish = DishManager.GetDish(item.IdDish); Cart cart = new Cart(); cart.dish = dish; cart.quantity = item.Quantity; cart.totalPriceProduct = item.Quantity * dish.Price; cartlist.Add(cart); } return(View(cartlist)); }
//Add an item to the shopping cart public ActionResult AddItem(int id) { if (HttpContext.Session.GetObjectFromJson <List <Cart> >("Cart") == null) { List <Cart> cart = new List <Cart>(); cart.Add(new Cart { dish = DishManager.GetDish(id), quantity = 1, totalPriceProduct = DishManager.GetDish(id).Price }); HttpContext.Session.SetObjectAsJson("Cart", cart); } else { int index = isExist(id); if (index != -1) { List <Cart> cart = HttpContext.Session.GetObjectFromJson <List <Cart> >("Cart"); cart.Select(m => m.dish.IdDish == id); cart[index].quantity++; cart[index].totalPriceProduct += DishManager.GetDish(id).Price; HttpContext.Session.SetObjectAsJson("Cart", cart); } else { List <Cart> cart = HttpContext.Session.GetObjectFromJson <List <Cart> >("Cart"); cart.Add(new Cart { dish = DishManager.GetDish(id), quantity = 1, totalPriceProduct = DishManager.GetDish(id).Price }); HttpContext.Session.SetObjectAsJson("Cart", cart); } } Dish dish = DishManager.GetDish(id); int idResto = dish.IdRestaurant; string name = RestaurantManager.GetRestaurant(idResto).Name; return(RedirectToAction("Details/" + idResto)); }
/// <summary> /// 根据ID删除菜品对象,并删除图片 /// </summary> /// <param name="disId"></param> /// <returns></returns> public ActionResult DelDish(string disId) { //先根据ID查询对象模型 Dishes objModel = new DishManager().GetDishById(disId); //找一下有没有图片信息, string filePath = Server.MapPath("~/UploadFile/" + objModel.DishImg); //获取业务逻辑 int result = new BLL.DishManager().DelDishById(disId); if (result > 0) { //判断文件是否存在 if (System.IO.File.Exists(filePath)) { //存在就删除 System.IO.File.Delete(filePath); } return(Content("删除成功!")); } else { return(Content("删除失败!")); } }
public ActionResult RemoveDish(Guid DishId) { if (!IsAuthorized()) { return(View("Error")); } var _manager = new DishManager(); var dish = _manager.GetDishByIDObject(DishId); if (dish != null) { _manager.DeleteDishByID(DishId); var _ordermanager = new OrderManager(); var orders = _ordermanager.GetOrderByStallIDObjects(dish.Fields.StallID); foreach (var item in orders) { if (item.Fields.DishID == DishId) { _ordermanager.DeleteOrderByID(item.Fields.ID.Value); } } } return(RedirectToAction("Index")); }
public void Setup() { _sut = new DishManager(); }
//POST : Restaurtant/command public ActionResult Command() { //take back the Form string platun = Request.Form["platun"]; string platunun = Request.Form["platunun"]; string platununun = Request.Form["platununun"]; string platunununun = Request.Form["platunununun"]; string deliveryTime = Request.Form["deliveryTime"]; IDishDB dish = new DishDB(Configuration); IOrderDB orderdb = new OrderDB(Configuration); IOrder_dishesDB orderddb = new Order_dishesDB(Configuration); IDelivery_staffDB dldb = new Delivery_staffDB(Configuration); IRestaurantDB restodb = new RestaurantDB(Configuration); IDishManager dishManager = new DishManager(dish); IOrderManager orderManager = new OrderManager(orderdb); IOrder_dishesManager order_DishesManager = new Order_dishesManager(orderddb); IDelivery_staffManager dlmanager = new Delivery_staffManager(dldb); IRestaurantManager restoManager = new RestaurantManager(restodb); //creation of lists for create the orders and the order_dishes List <Dish_Order> dishlist = new List <Dish_Order>(); //List of dish List <Dish> plat = dishManager.GetDishes((int)HttpContext.Session.GetInt32("idResto")); //List of quantity List <string> s = new List <string>(); s.Add(platun); s.Add(platunun); if (platununun != null) { s.Add(platununun); } if (platunununun != null) { s.Add(platunununun); } int x = 0; int quantitytemp; float pricetemp; float priceGeneral = 0; //Creation of my ViewModel Dish_Order foreach (Dish d in plat) { Dish_Order order = new Dish_Order(); order.Dish_Id = d.dish_Id; order.Name = d.name; order.Price = d.price; pricetemp = d.price; order.Quantity = Int32.Parse(s.ElementAt(x)); quantitytemp = Int32.Parse(s.ElementAt(x)); order.totalPrice = quantitytemp * pricetemp; priceGeneral += quantitytemp * pricetemp; dishlist.Add(order); x++; } //Set the Final price for the view ViewBag.prix = priceGeneral; //if the customer has select at least 1 dish if (priceGeneral != 0) { //Create a new Order Order ikse = new Order(); ikse.delivery_time = deliveryTime; ikse.totalPrice = priceGeneral; ikse.customer_Id = (int)HttpContext.Session.GetInt32("id"); //select whitch delivery staff is available var dslist = dlmanager.GetDelivery_staffs(); int idDs = -1; var listeresto = restoManager.GetRestaurants(); int cityCodeTemp = 0; //Select the list of delivery staff foreach (Delivery_staff ds in dslist) { //find the city of the restaurant foreach (Dish d in plat) { if (d.dish_Id == dishlist[0].Dish_Id) { foreach (Restaurant r in listeresto) { if (d.restaurant_Id == r.restaurant_Id) { cityCodeTemp = r.cityCode; } } } } //if the delivery staff is at the good city if (ds.cityCode == cityCodeTemp) { var isbusy = false; var oListByDl = orderManager.GetOrders_ds(ds.delivery_staff_Id); int cptOrder = 0; foreach (Order o in oListByDl) { //select the orders non delivery if (o.status == "non delivery") { //change the 11:00 in 1100, change the minutes from base 60 to base 100 for calculation string deliveryTimePourInt = o.delivery_time.Remove(2, 1); string deliveryTimePartOne = deliveryTimePourInt.Substring(0, 2); string deliveryTimePartTwo = deliveryTimePourInt.Substring(2); int test = Int32.Parse(deliveryTimePartTwo); switch (test) { case 0: break; case 15: test = 25; break; case 30: test = 50; break; case 45: test = 75; break; } deliveryTimePartTwo = test.ToString(); int deliveryTimeInt = Int32.Parse(deliveryTimePartOne + deliveryTimePartTwo); //correct the houres if (deliveryTimeInt % 10 == 0) { deliveryTimeInt *= 10; if (deliveryTimeInt / 10000 != 0) { deliveryTimeInt /= 10; } } //same think for the delivery time of the order string deliveryTimeForCompare = deliveryTime.Remove(2, 1); string dtPartOne = deliveryTimeForCompare.Substring(0, 2); string dtPartTwo = deliveryTimeForCompare.Substring(2); int essai = Int32.Parse(dtPartTwo); switch (essai) { case 0: break; case 15: essai = 25; break; case 30: essai = 50; break; case 45: essai = 75; break; } dtPartTwo = essai.ToString(); int dTForCompare = Int32.Parse(dtPartOne + dtPartTwo); if (dTForCompare % 10 == 0) { dTForCompare *= 10; if (dTForCompare / 10000 != 0) { dTForCompare /= 10; } } int compare = (deliveryTimeInt - dTForCompare); //if the order is within 15 minutes before or after the delivery staff's order if (compare <= 25 && compare >= -25) { cptOrder++; } } } //if the staff is busy if (cptOrder >= 5) { isbusy = true; } //if the staff is free if (isbusy == false) { //assign the staff to the order idDs = ds.delivery_staff_Id; } } } //if a staff is free if (idDs != -1) { //assign the staff ikse.delivery_staff_Id = idDs; //create the order in the database var orderaiedi = orderManager.AddOrder(ikse); //create the order dishes and add to the database foreach (Dish_Order disho in dishlist) { Order_dishes order_dishes_ = new Order_dishes(); order_dishes_.order_Id = orderaiedi; order_dishes_.dish_Id = disho.Dish_Id; order_dishes_.quantity = disho.Quantity; order_dishes_.price = disho.totalPrice; if (order_dishes_.quantity != 0) { order_DishesManager.AddOrder_dishes(order_dishes_); } } //return the normal view return(View()); } //if no staff is free else { //return the error view return(RedirectToAction("ErrorNoDs", "Restaurant")); } } //if the customer didn't select any dish, return the error view return(RedirectToAction("ErrorNoQuantity", "Restaurant")); }
void Awake() { control = this; setupDishArray(); initMenuItems(); }
public static void Suite(int idCustomer) { var restaurantDbManager = new RestaurantManager(Configuration); var dishDbManager = new DishManager(Configuration); var delivery_TimeDbManager = new Delivery_TimeManager(Configuration); var orderDbManager = new OrderManager(Configuration); var customerDbManager = new CustomerManager(Configuration); var deliveryDbManager = new DeliveryManager(Configuration); var orderDishDbManager = new Order_DishManager(Configuration); var deliverymanDbMangager = new DeliverymanManager(Configuration); Console.WriteLine("[1] New order, [2] Cancel order"); string orderChoice = Console.ReadLine(); if (orderChoice == "1") { Console.WriteLine("Restaurants list : "); var restaurants = restaurantDbManager.GetAllRestaurants(); foreach (var restaurant in restaurants) { Console.WriteLine(restaurant.ToString()); } Console.WriteLine("Choose the restaurant"); string idRestaurant = Console.ReadLine(); var dishes = dishDbManager.GetAllDishes(int.Parse(idRestaurant)); foreach (var dish in dishes) { Console.WriteLine(dish.ToString()); } Console.WriteLine("Choose your dish"); string dishChoice = Console.ReadLine(); int dishPrice = dishDbManager.GetDishPrice(int.Parse(dishChoice)); Console.WriteLine("How many times do you want this dish ?"); string dishQuantity = Console.ReadLine(); int totalPrice = dishPrice * int.Parse(dishQuantity); var newOrder = orderDbManager.AddOrder(new Order { Status = "In procedure", FK_idCustomer = idCustomer }); orderDishDbManager.AddOrder_Dish(new Order_Dish { Quantity = dishQuantity, FK_idDish = int.Parse(dishChoice), FK_idOrder = newOrder.IdOrder }); //Sans plusieurs ordres, ça fonctionne /*while (dishChoice != "0") * { * Console.WriteLine("Would you like something else ? If your order is done, insert [0]"); * dishChoice = Console.ReadLine(); * dishPrice = dishDbManager.GetDishPrice(int.Parse(dishChoice)); * * if (dishChoice != "0") * { * Console.WriteLine("How many times do you want this dish ?"); * dishQuantity = Console.ReadLine(); * totalPrice += dishPrice * int.Parse(dishQuantity); * } * * //Bug ici à corriger * orderDishDbManager.AddOrder_Dish(new Order_Dish { Quantity = dishQuantity, FK_idDish = int.Parse(dishChoice), FK_idOrder = newOrder.IdOrder}); * }*/ Console.WriteLine("The total of your command is : CHF " + totalPrice + ".-"); Console.WriteLine("When do you want your order to be delivered ? Choose the time with the ID"); var delivery_times = delivery_TimeDbManager.GetAllDelivery_Time(); foreach (var delivery_time in delivery_times) { Console.WriteLine(delivery_time.ToString()); } string deliveryTimeChoice = Console.ReadLine(); Console.WriteLine("Do you validate this order ? Yes [Y], No [N]"); string validationChoice = Console.ReadLine(); if (validationChoice == "Y") { Console.WriteLine("Thank you for ordering with Liam & Mathieu Food Delivery !"); Console.WriteLine("Your order will be there at " + delivery_TimeDbManager.GetDelivery_Time(int.Parse(deliveryTimeChoice))); int idCityFromRestaurant = restaurantDbManager.GetidCityFromRestaurant(int.Parse(idRestaurant)); var deliverymans = deliverymanDbMangager.GetAllDeliveryman(idCityFromRestaurant); foreach (var deliveryman in deliverymans) { //if(deliveryman.FK_idDelivery<5 && deliveryman.) } deliveryDbManager.AddDelivery(new Delivery { FK_idOrder = newOrder.IdOrder, FK_idRestaurant = int.Parse(idRestaurant), FK_idDelivery_Time = int.Parse(deliveryTimeChoice) }); } else { Console.WriteLine("You canceled the order. See you soon !"); } } else { Console.WriteLine("Here is the list of your orders : "); var orders = orderDbManager.GetAllOrdersForOneCustomer(idCustomer); foreach (var order in orders) { Console.WriteLine(order.ToString()); } Console.WriteLine("Choose the order you want to delete with the id"); string orderDelete = Console.ReadLine(); var code = customerDbManager.Code(idCustomer) + orderDelete; Console.WriteLine("Here is your cancellation code for the chosen order :" + ' ' + code); Console.WriteLine("Insert you cancellation code :"); string codeInserted = Console.ReadLine(); while (codeInserted != code) { Console.WriteLine("Cancellation code wrong. Try again."); codeInserted = Console.ReadLine(); } Console.WriteLine("Are you sure you want to cancel this order ? Yes [Y], No [N]"); string choice = Console.ReadLine(); if (choice == "Y") { //Change status order Console.WriteLine("Your order has been successfully cancelled !"); } Console.WriteLine("Your order has not been cancelled"); } }