public static void Remove_order(int client_id, string hotel_name, int room_number) { try { Client client = Client_management.Find_by_id(client_id); Hotel hotel = Hotel_management.Find(hotel_name); if (!Is_free(hotel_name, room_number)) { int i = 0; while (i < hotel.approved_orders.Count) { Order order = hotel.approved_orders[i]; if (order.Room_number == room_number) { hotel.approved_orders[i] = null; hotel.empty_rooms.Insert(room_number - 1, room_number); order.Client = null; break; } } } else { Console.WriteLine("There is no such order request"); } } catch { Console.WriteLine("ERROR"); } }
public static void Order_room(int client_id, string hotel_name, string phone_number) { try { Client client = Client_management.Find_by_id(client_id); Hotel hotel = Hotel_management.Find(hotel_name); foreach (Order order in hotel.order_requests) { if (order.Phone_number_for_request == phone_number) { order.Id = Find_free_id(hotel); hotel.order_requests.Remove(order); hotel.approved_orders.Add(order); hotel.empty_rooms.RemoveAt(order.Room_number - 1); order.Client = client; break; } } } catch { Console.WriteLine("ERROR"); } }