Ejemplo n.º 1
0
        /// <summary>
        /// Generate Meetings for the selected User
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="numberMeetings">The number meetings.</param>
        public static void MeetingsForUser(User user, int numberMeetings)
        {
            IEnumerable <Contact> contacts = ContactDAL.GetAllByUser(user);

            if (user.Contacts.Count > 3)
            {
                contacts = user.Contacts.Where(x => x.ID % 3 == 0);
            }
            else if (user.Contacts.Count > 0)
            {
                contacts.First();
            }
            else
            {
                //Console.WriteLine("The selected User don't have any contacts");
            }

            for (int i = 0; i < numberMeetings; i++)
            {
                DateTime date        = Faker.DateTimeFaker.DateTime();
                string   location    = Faker.LocationFaker.City() + ", " + Faker.LocationFaker.Street();
                string   description = Faker.CompanyFaker.BS();
                Category category    = user.Categories.ToArray()[Faker.NumberFaker.Number(0, user.Categories.ToArray().Count() - 1)];

                MeetingDAL.Create(user, category, contacts, date, description, location);
            }
        }