Exemplo n.º 1
0
        void AddInstructors()
        {
            Console.WriteLine();
            Console.WriteLine("ADDING INSTRUCTORS...");

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

                Gym g = c.FindGymByName("Gym1");

                // Instructor(String address, String IBAN, String id, String name, int zipCode, String ssn)
                Instructor i = new Instructor("Xuan-Lan's address", "ES891234121234567891", "00000001R", "Xuan Lan", 46001, "SSN01010101");
                c.AddPerson(i);
                service.AddInstructor(i);

                Activity a = g.FindActivityByName("Yoga 101");
                a.SetInstructor(i);
                service.Commit();
                Console.WriteLine("   " + a.Instructor.Name + " assigned to " + a.Description + " activity");;

                i = new Instructor("Mercedes de la Rosa's address", "ES891234121234567892", "00000002W", "Mercedes de la Rosa", 46002, "SSN02020202");
                c.AddPerson(i);
                service.AddInstructor(i);

                i = new Instructor("Keila Velón's address", "ES891234121234567893", "00000003A", "Keila Velón", 46003, "SSN03030303");
                c.AddPerson(i);
                service.AddInstructor(i);

                a = g.FindActivityByName("Zumba 101");
                i = service.FindInstructorById("00000001R"); // Podría hacerse desde CityHall
                a.SetInstructor(i);
                service.Commit();
                Console.WriteLine("   " + a.Instructor.Name + " assigned to " + a.Description + " activity");;
            }
            catch (Exception e)
            {
                printError(e);
            }
        }