public SwimmersManager(ClubsManager aClubManager)
 {
     this.aClubManager = aClubManager;
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            IClubsRepository    clbMngr = new ClubsManager();
            ISwimmersRepository swmMngr = new SwimmersManager((ClubsManager)clbMngr);

            try
            {
                clbMngr.Load("Clubs.txt", ',');
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            for (int i = 0; i < clbMngr.Number; i++)
            {
                DisplayInfo(i.ToString(), ((ClubsManager)clbMngr).Clubs[i]);
            }


            swmMngr.Load("Swimmers.txt", ',');

            for (int i = 0; i < swmMngr.Number; i++)
            {
                DisplayInfo(i.ToString(), ((SwimmersManager)swmMngr).Swimmers[i]);
            }
            // Create 3 swimmers
            Swimmer swimmer1;
            Swimmer swimmer2;
            Swimmer swimmer3;

            CreateSwimmers(out swimmer1, out swimmer2, out swimmer3);

            //Create two clubs
            Club club1;
            Club club2;

            CreateClubs(out club1, out club2);

            //Assigne swimmers to club
            AssigneSwimmersToClubs(swimmer1, swimmer2, swimmer3, club1, club2);

            //New code
            Coach coach1;
            Coach coach2;

            CreateCoaches(out coach1, out coach2);

            AssignCoachesAndSwimmers(coach1, coach2, swimmer1, swimmer2, swimmer3);

            //Create swim meets

            SwimMeet meet1;
            SwimMeet meet2;

            CreateSwimMeets(out meet1, out meet2);

            Event _50free1;
            Event _100fly;
            Event _200breast;
            Event _400free;
            Event _1500free;
            Event _1500free2;

            CreateEvents(out _50free1, out _100fly, out _200breast, out _400free, out _1500free, out _1500free2);

            AddEventsToSwimMeets(meet1, meet2, _50free1, _100fly, _200breast, _400free, _1500free, _1500free2);

            AddSwimmersToEvents(swimmer1, swimmer2, swimmer3, meet1, meet2,
                                _50free1, _100fly, _200breast, _400free, _1500free, _1500free2);

            SeedMeets(meet1, meet2);

            EnterTimesForSwims(swimmer1, swimmer2, swimmer3, meet1, meet2,
                               _50free1, _100fly, _200breast, _400free, _1500free, _1500free2);

            Console.WriteLine("Best time for SCM 1500  free for swimmer 1 is: {0}", swimmer1.GetBestTime(PoolType.SCM, Stroke.Freestyle, EventDistance._1500).ToString(@"mm\:ss\.ff"));
            Console.WriteLine("Best time for SCM 1500  free for swimmer 3 is: {0}", swimmer3.GetBestTime(PoolType.SCM, Stroke.Freestyle, EventDistance._1500).ToString(@"mm\:ss\.ff"));

            clbMngr.Add(club1);

            swmMngr.Add(swimmer1);
            swmMngr.Add(swimmer2);
            swmMngr.Add(swimmer3);

            clbMngr.Save("ClubsOut.txt", '|');
            swmMngr.Save("SwimmersOut.txt", '|');
        }