public static void AddProductService(int Orderid) { int chooseProd = Read_Write.GetPress(); Console.WriteLine("enter amount"); int amount = Convert.ToInt32(Console.ReadLine()); Read_Write.orderList.FindOrderByID(Orderid).AddProd(Read_Write.ProductList.FindProdById(chooseProd), amount); }
public static void employeeService() { do { All_Menu_Text.chooseEmpMenu(); int checkpress = Read_Write.GetPress(); if (checkpress == All_Menu_Text.Back_Exit) { break; } Read_Write.ReadfileEmp(); ManagementStaff(checkpress); } while (true); }
public static void allMenuForBoss() { do { All_Menu_Text.chooseFromAdmin(); int checkpress = Read_Write.GetPress(); if (checkpress == All_Menu_Text.Back_Exit) { break; } if (checkpress == 1) { employeeService(); } else { orderService(); } } while (true); }
public static void orderService() { do { All_Menu_Text.ChooseOrderMenu(); int checkpress = Read_Write.GetPress(); if (checkpress == All_Menu_Text.Back_Exit) { break; } Read_Write.ReadfileOrder(); switch (checkpress) { case 1: Read_Write.orderList.AddOrder(InputOrder()); Read_Write.WirteFile(Read_Write.OrderFile, Read_Write.orderList); break; case 2: Read_Write.orderList.ShowAllOrder(); break; case 3: Read_Write.orderList.SearchOrderById(Read_Write.InputId()); break; case 4: Console.Write("enter custumer's name: "); Read_Write.orderList.SearchOrdersByNameCus(Console.ReadLine()); break; case 5: ChangePassService(); break; case 6: do { All_Menu_Text.EditAndPayMenu(); int checkPress = Read_Write.GetPress(); if (checkPress == All_Menu_Text.Back_Exit) { break; } switch (checkPress) { case 1: Read_Write.orderList.Cancel(Read_Write.InputId()); Read_Write.WirteFile(Read_Write.OrderFile, Read_Write.orderList); break; case 2: Order order = Read_Write.orderList.FindOrderByID(Read_Write.InputId()); if (order != null) { Bill bill = Read_Write.orderList.Pay(order); if (bill != null) { Read_Write.WirteFile($@"{Read_Write.billFile}_{order.orderId}", bill); Read_Write.WirteFile(Read_Write.OrderFile, Read_Write.orderList); } else { Console.WriteLine("the order paid or Cancel"); } } else { Console.WriteLine("not found"); } break; case 3: Read_Write.ReadfileOrder(); int orderId = Read_Write.InputId(); if (Read_Write.orderList.FindOrderByID(orderId) != null) { do { All_Menu_Text.EditOrderMennu(); int press = Read_Write.GetPress(); if (press == All_Menu_Text.Back_Exit) { break; } switch (press) { case 1: All_Menu_Text.ProductMenu(); AddProductService(orderId); Read_Write.WirteFile(Read_Write.OrderFile, Read_Write.orderList); Console.WriteLine("Add product success"); break; case 2: Read_Write.orderList.FindOrderByID(orderId).ShowAllProds(); int ProdId = Read_Write.InputId(); if (Read_Write.orderList.FindOrderByID(orderId).FindProd(ProdId) != null) { Read_Write.orderList.FindOrderByID(orderId).RemoveProd(ProdId); Read_Write.WirteFile(Read_Write.OrderFile, Read_Write.orderList); Console.WriteLine("delete success"); } else { Console.WriteLine($"not found {ProdId}"); } break; case 3: Read_Write.orderList.FindOrderByID(orderId).customer = Customer.CreateCustumer(); Read_Write.WirteFile(Read_Write.OrderFile, Read_Write.orderList); break; } } while (true); } else { Console.WriteLine("not found"); } break; } } while (true); break; case 7: do { All_Menu_Text.ProductServiceMenu(); int checkPress = Read_Write.GetPress(); if (checkPress == All_Menu_Text.Back_Exit) { break; } switch (checkPress) { case 1: Read_Write.ReadfileProdList(); All_Menu_Text.ProductMenu(); break; case 2: Read_Write.ReadfileProdList(); int ProductId = Read_Write.InputId(); if (Read_Write.ProductList.FindProdById(ProductId) != null) { Console.WriteLine(Read_Write.ProductList.FindProdById(ProductId)); } else { Console.WriteLine($"not found {ProductId}"); } break; case 3: Read_Write.ReadfileProdList(); int ProdId = Read_Write.InputId(); if (Read_Write.ProductList.FindProdById(ProdId) != null) { Console.Write("enter new name: "); Read_Write.ProductList.FindProdById(ProdId).prodname = Console.ReadLine(); Console.Write("enter new price: "); Read_Write.ProductList.FindProdById(ProdId).price = double.Parse(Console.ReadLine()); Read_Write.WirteFile(Read_Write.ProdListFile, Read_Write.ProductList); Console.WriteLine($"edit {ProdId} success"); } else { Console.WriteLine($"not found {ProdId}"); } break; case 4: Read_Write.ReadfileProdList(); Read_Write.ProductList.AddNewProduct(Product.CreateProduct()); Read_Write.WirteFile(Read_Write.ProdListFile, Read_Write.ProductList); break; case 5: Read_Write.ReadfileProdList(); Read_Write.ProductList.DeleteProduct(Read_Write.InputId()); Read_Write.WirteFile(Read_Write.ProdListFile, Read_Write.ProductList); break; } } while (true); break; } } while (true); }