static IEnumerable <TeamAppointment> CreatePhoneCallsAppts(DateTime start) { List <TeamAppointment> res = new List <TeamAppointment>() { CreatePhoneCallAppt(Employees[0], start.AddDays(0).AddHours(10)), CreatePhoneCallAppt(Employees[1], start.AddDays(3).AddHours(11)), CreatePhoneCallAppt(Employees[2], start.AddDays(3).AddHours(12).AddMinutes(40), TimeSpan.FromMinutes(15)), CreatePhoneCallAppt(Employees[3], start.AddDays(-4).AddHours(14)), CreatePhoneCallAppt(Employees[4], start.AddDays(9).AddHours(15)), CreatePhoneCallAppt(Employees[5], start.AddDays(12).AddHours(15)), CreatePhoneCallAppt(GetRandomEmployee(), start.AddDays(0).AddHours(16)), CreatePhoneCallAppt(GetRandomEmployee(), start.AddDays(2).AddHours(15.6)), CreatePhoneCallAppt(GetRandomEmployee(), start.AddDays(4).AddHours(15)), CreatePhoneCallAppt(GetRandomEmployee(), start.AddDays(5).AddHours(10.5)), CreatePhoneCallAppt(GetRandomEmployee(), start.AddDays(5).AddHours(16)), CreatePhoneCallAppt(GetRandomEmployee(), start.AddDays(6).AddHours(9.7)), CreatePhoneCallAppt(GetRandomEmployee(), start.AddDays(6).AddHours(16.8)), }; DateTimeRange interval = new DateTimeRange(start.AddDays(-7), start.AddDays(21)); for (int i = 0; i < 50; i++) { Employee emp = Employees[Random.Next(0, Employees.Count)]; DateTime newStart = start.AddYears(-1); newStart = newStart.AddDays(Random.Next(365)); if (interval.Start <= newStart && interval.End >= newStart) { continue; } if (VacationAppointments.Any(x => x.Start <= newStart && x.End >= newStart)) { continue; } res.Add(CreatePhoneCallAppt(emp, newStart.AddHours(Random.Next(9, 18)))); } return(res); }
static IEnumerable <TeamAppointment> CreateCarWashAppts(DateTime start) { List <TeamAppointment> res = new List <TeamAppointment>() { CreateCarWashAppt(start.AddDays(1).AddHours(17)), }; DateTime newStart = start.AddYears(-1); while (newStart < start.AddMonths(1)) { newStart = newStart.AddDays(Random.Next(18, 35)); if (VacationAppointments.Any(x => x.Start <= newStart && x.End >= newStart)) { continue; } if (newStart >= start && newStart <= start.AddDays(7)) { continue; } CreateCarWashAppt(newStart); } return(res); }
static IEnumerable <TeamAppointment> CreateMeetingAppts(DateTime start) { List <TeamAppointment> res = new List <TeamAppointment>() { CreateMeetingRecurrenceAppt("Weekly meeting", start.AddMonths(-6).Add(new TimeSpan(5, 14, 00, 0))), CreateLunchAppt(Employees[0], start.AddDays(1).AddHours(13)), CreateLunchAppt(Employees[1], start.AddDays(3).AddHours(13)), CreateLunchAppt(Employees[2], start.AddDays(-4).AddHours(13)), CreateLunchAppt(Employees[3], start.AddDays(9).AddHours(13)), CreateLunchAppt(Employees[4], start.AddDays(12).AddHours(13)), }; DateTimeRange interval = new DateTimeRange(start.AddDays(-7), start.AddDays(21)); List <int> days = new List <int>(); for (int i = 0; i < 50; i++) { Employee emp = Employees[Random.Next(0, Employees.Count)]; DateTime newStart = start.AddYears(-1); newStart = newStart.AddDays(Random.Next(365)); if (interval.Start <= newStart && interval.End >= newStart) { continue; } if (days.Contains(newStart.DayOfYear)) { continue; } if (VacationAppointments.Any(x => x.Start <= newStart && x.End >= newStart)) { continue; } days.Add(newStart.DayOfYear); res.Add(CreateLunchAppt(emp, newStart.AddHours(13))); } return(res); }