Exemplo n.º 1
0
        void AddCityHallGymAndRooms()
        {
            Console.WriteLine();
            Console.WriteLine("ADDING CITYHALL, GYM AND ROOMS...");

            try
            {
                CityHall c = new CityHall("Valencia");
                service.AddCityHall(c);

                //public Gym(DateTime closingHour, int discountLocal, int discountRetired, double freeUserPrice, String name, DateTime openingHour, int zipCode)
                Gym g = new Gym(Convert.ToDateTime("14:00:00"), 5, 5, 2.00, "Gym1", Convert.ToDateTime("08:00:00"), 46122);
                c.AddGym(g);

                for (int j = 1; j < 7; j++)
                {
                    Room r = new Room(j);
                    g.AddRoom(r);
                }
                service.AddGym(g);

                foreach (CityHall ci in service.GetAllCityHalls())
                {
                    Console.WriteLine("CityHall: " + ci.Name);
                    foreach (Gym gy in ci.Gyms)
                    {
                        Console.WriteLine(" Gym: " + gy.Name);
                        foreach (Room r in gy.Rooms)
                        {
                            Console.WriteLine("   Room: " + r.Number);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                printError(e);
            }
        }