private void seedClubs()
        {
            ClubEvent firstClub = new ClubEvent();

            firstClub.attendees     = new List <Member>();
            firstClub.StartDateTime = DateTime.Now;
            firstClub.EndDateTime   = DateTime.Now.AddHours(3);
            firstClub.Venue         = "O****m Ville";

            Member hoemor = new Member();

            hoemor.memberID  = Guid.NewGuid();
            hoemor.StudentID = Guid.NewGuid();
            hoemor.approved  = true;


            // Create a list of clubs and populate it test data
            Clubs = new List <Club>()
                    // Club collection
            {
                // First club record
                new Club {
                    id       = Guid.NewGuid(),
                    ClubName = "ITS FC",
                    // Select a random student
                    adminID    = GetRandomAdmin(),
                    ClubEvents = new List <ClubEvent>()
                    {
                        firstClub
                    },
                    ClubMembers = new List <Member>()
                    {
                        hoemor
                    },
                    CreationDate = DateTime.Now
                },
                // Second Club record
                new Club {
                    id       = Guid.NewGuid(),
                    ClubName = "ITS GAA ",
                    // Select a random student
                    adminID      = GetRandomAdmin(),
                    ClubEvents   = new List <ClubEvent>(),
                    ClubMembers  = new List <Member>(),
                    CreationDate = DateTime.Now
                },
                // Third Club record
                new Club {
                    id       = Guid.NewGuid(),
                    ClubName = "The Chess Club ",
                    // Select a random student
                    adminID      = GetRandomAdmin(),
                    ClubEvents   = new List <ClubEvent>(),
                    ClubMembers  = new List <Member>(),
                    CreationDate = DateTime.Now
                },
            };
        }
Exemplo n.º 2
0
        public void AddEvent(string ClubName, ClubEvent clubEvent)
        {
            Club clubFound = Clubs.FirstOrDefault(c => c.ClubName == ClubName);

            if (clubFound != null)
            {
                clubFound.ClubEvents.Add(clubEvent);
            }
            else
            {
                Console.WriteLine("Club Name not found {0}", ClubName);
            }
        }
Exemplo n.º 3
0
        private List <ClubEvent> CreateEvents()
        {
            List <ClubEvent> events = new List <ClubEvent>();
            int numEvents           = rng.Next(0, 6);

            for (var i = 0; i < numEvents; i++)
            {
                int      randomDate    = rng.Next(1, 181); // create a random number of days to add to the current date
                DateTime dateStart     = DateTime.Now.AddDays(randomDate);
                int      randomDateEnd = rng.Next(1, 11);  // random number of days added to the start date
                DateTime dateEnd       = dateStart.AddDays(randomDateEnd);

                ClubEvent evt = new ClubEvent();
                evt.attendees     = new List <Member>(); // add an empty member
                evt.StartDateTime = dateStart;
                evt.EndDateTime   = dateEnd;
                events.Add(evt);
            }

            return(events);
        }