public void Remove_order_test() { Hotel_management.Clear_hotels_list(); Client_management.Clear_clients_list(); Hotel_management.Add_hotel("Ukraine", 50, 100); Hotel_management.Make_order_request("Ukraine", 5, 2, "5555555555"); Client_management.Add_client("Gene", "Bloch", "MK754645", "5555555555"); Room_ordering_management.Order_room(0, "Ukraine", "5555555555"); Room_ordering_management.Remove_order(0, "Ukraine", 5); Assert.IsTrue(Hotel_management.Find("Ukraine").approved_orders[0] == null); }
private static void Room_ordering_menu() { Console.Clear(); Console.WriteLine("Room ordering management"); Console.WriteLine("\t1 - Order room"); Console.WriteLine("\t2 - Remove order"); Console.WriteLine("\t3 - Order info"); Console.WriteLine("\t4 - Show ordered rooms"); Console.WriteLine("\t5 - Show free rooms"); Console.WriteLine("\t6 - Show total price"); Console.WriteLine("\t7 - Show clients"); Console.WriteLine("\t0 - Turn back to main menu"); try { int command = int.Parse(Console.ReadLine()); switch (command) { case 0: Main_menu(); break; case 1: Console.Clear(); Client_management.Info_about_all_clients(); Console.Write("Hotel name: "); string hotel_name = Check.Check_value(Console.ReadLine(), hotel_name_regex); Console.Write("Client id: "); int id = int.Parse(Console.ReadLine()); Console.Write("Phone number: "); string phone_number = Check.Check_value(Console.ReadLine(), phone_number_regex); Console.Clear(); if (hotel_name != "" && phone_number != "") { Room_ordering_management.Order_room(id, hotel_name, phone_number); Console.WriteLine("Successfully ordered"); } else { Console.Clear(); Console.WriteLine("Incorrect input"); } Console.WriteLine("Press any key to continue"); Console.ReadKey(); Room_ordering_menu(); break; case 2: Console.Clear(); Console.Write("Hotel name: "); hotel_name = Check.Check_value(Console.ReadLine(), hotel_name_regex); Console.Write("Client id: "); id = int.Parse(Console.ReadLine()); Console.Write("Room number: "); int room_number = int.Parse(Console.ReadLine()); Console.Clear(); if (hotel_name != "") { Room_ordering_management.Remove_order(id, hotel_name, room_number); Console.WriteLine("Successfully removed"); } else { Console.Clear(); Console.WriteLine("Incorrect input"); } Console.WriteLine("Press any key to continue"); Console.ReadKey(); Room_ordering_menu(); break; case 3: Console.Clear(); Console.Write("Hotel name: "); hotel_name = Check.Check_value(Console.ReadLine(), hotel_name_regex); Console.Write("Order id: "); int order_id = int.Parse(Console.ReadLine()); Console.Clear(); if (hotel_name != "") { Room_ordering_management.Order_info(hotel_name, order_id); } else { Console.Clear(); Console.WriteLine("Incorrect input"); } Console.WriteLine("Press any key to continue"); Console.ReadKey(); Room_ordering_menu(); break; case 4: Console.Clear(); Console.Write("Hotel name: "); hotel_name = Check.Check_value(Console.ReadLine(), hotel_name_regex); Console.Clear(); if (hotel_name != "") { if (Hotel_management.Find(hotel_name).approved_orders.Count == 0) { Console.WriteLine("There are no orders in the hotel"); } else { Room_ordering_management.Show_ordered_rooms(hotel_name); } } else { Console.Clear(); Console.WriteLine("Incorrect input"); } Console.WriteLine("Press any key to continue"); Console.ReadKey(); Room_ordering_menu(); break; case 5: Console.Clear(); Console.Write("Hotel name: "); hotel_name = Check.Check_value(Console.ReadLine(), hotel_name_regex); Console.Clear(); if (hotel_name != "") { Room_ordering_management.Show_free_rooms(hotel_name); } else { Console.Clear(); Console.WriteLine("Incorrect input"); } Console.WriteLine("Press any key to continue"); Console.ReadKey(); Room_ordering_menu(); break; case 6: Console.Clear(); Console.Write("Hotel name: "); hotel_name = Check.Check_value(Console.ReadLine(), hotel_name_regex); Console.Write("Order id: "); order_id = int.Parse(Console.ReadLine()); Console.Clear(); if (hotel_name != "") { Room_ordering_management.Show_price(hotel_name, order_id); } else { Console.Clear(); Console.WriteLine("Incorrect input"); } Console.WriteLine("Press any key to continue"); Console.ReadKey(); Room_ordering_menu(); break; case 7: Console.Clear(); Console.Write("Hotel name: "); hotel_name = Check.Check_value(Console.ReadLine(), hotel_name_regex); Console.Clear(); if (hotel_name != "") { if (Hotel_management.Find(hotel_name).approved_orders.Count == 0) { Console.WriteLine("There are no clients"); } else { Room_ordering_management.Show_clients(hotel_name); } } else { Console.Clear(); Console.WriteLine("Incorrect input"); } Console.WriteLine("Press any key to continue"); Console.ReadKey(); Room_ordering_menu(); break; default: Console.Clear(); Console.WriteLine("Invalid input"); Console.ReadKey(); break; } } catch { Console.WriteLine("ERROR"); Console.ReadKey(); } }