/* Xử lý trên order*/ // Cập nhật đơn hàng public static void UpdateOrder(Order order) { if (order.Status == 1) { do { Allproducts.ShowAllproduct(); Console.WriteLine("Enter id of product that you want:"); int id = int.Parse(Console.ReadLine()); order.ProductsList.Add(Allproducts.Products[id]); int index = shop.listorder.ListOrder.IndexOf(order); shop.listorder.ListOrder[index].ProductsList = order.ProductsList; string fulllink = $"{path}{nameFile}"; ReadWriteFile<Listorder>.WriteData(fulllink, shop.listorder); Console.Clear(); Console.WriteLine(order.ToString()); Console.WriteLine("Successfully!"); Console.Write("Do you want to add more? y(Yes)/n(No): "); } while (Console.ReadLine().ToLower() == "y"); } else { Console.WriteLine(order.ToString()); Console.WriteLine(" This order has been paid or has been canceled before!!"); } }
public static Product Addproduct() { Allproducts.ShowAllproduct(); Console.WriteLine("Enter id of product you want to buy:"); int id = int.Parse(Console.ReadLine()); Product pro = Allproducts.Products[id]; Console.WriteLine("Enter count:"); int count = int.Parse(Console.ReadLine()); pro.count = count; return(pro); }
public static void Processproduct(int choice) { Console.Clear(); switch (choice) { case 1: { Allproducts.ShowAllproduct(); break; } case 2: { Allproducts.Addpro(); Allproducts.ShowAllproduct(); break; } case 3: { Allproducts.Updatepro(); Allproducts.ShowAllproduct(); break; } case 4: { Allproducts.Removepro(); Allproducts.ShowAllproduct(); break; } case 5: { Allproducts.Findpro(); break; } case 6: { CreatAdminMenu(); break; } } CreatProManagement(); }