static IEnumerable <TeamAppointment> CreateTrainingAppts(DateTime start) { DateTime newStart = start.AddYears(-1).AddHours(8.5); var appt = new TeamAppointment() { AppointmentType = (int)AppointmentType.Pattern, AllDay = false, Start = newStart, End = newStart.AddHours(1.5), Subject = "Sport Training", Status = 1, Label = 3, CalendarId = 0, }; appt.RecurrenceInfo = new RecurrenceInfo() { AllDay = false, Start = newStart, Type = RecurrenceType.Weekly, WeekDays = WeekDays.Monday | WeekDays.Wednesday | WeekDays.Friday, Range = RecurrenceRange.NoEndDate }.ToXml(); return(new[] { appt }); }
static IEnumerable <TeamAppointment> CreatePayBillsAppts(DateTime start) { DateTime newStart = start.AddDays(2).AddYears(-1); var appt = new TeamAppointment() { AppointmentType = (int)AppointmentType.Pattern, AllDay = true, Start = newStart, End = newStart.AddDays(1), Subject = "Pay Bills", Status = 0, Label = 3, CalendarId = 0, }; appt.RecurrenceInfo = new RecurrenceInfo() { AllDay = true, Start = newStart, Type = RecurrenceType.Monthly, DayNumber = newStart.Day, WeekOfMonth = WeekOfMonth.None, Range = RecurrenceRange.NoEndDate, }.ToXml(); return(new[] { appt }); }
static TeamAppointment CreateBirthdayAppt(Employee employee) { if (employee.BirthDate == null) { return(null); } DateTime date = employee.BirthDate.Value; var appt = new TeamAppointment() { AppointmentType = (int)AppointmentType.Pattern, AllDay = true, Start = date, End = date.AddDays(1), Subject = string.Format("{0}'s Birthday", employee.FirstName), Status = 0, Label = 8, CalendarId = 0, }; appt.RecurrenceInfo = new RecurrenceInfo() { AllDay = true, Start = date, Month = date.Month, DayNumber = date.Day, WeekOfMonth = WeekOfMonth.None, Type = RecurrenceType.Yearly, Range = RecurrenceRange.NoEndDate }.ToXml(); return(appt); }
static IEnumerable <TeamAppointment> CreateCompanyBirthdayAppts(DateTime start) { DateTime newStart = new DateTime(start.Year - 1, start.Month, start.Day); newStart = newStart.AddDays(5); var appt = new TeamAppointment() { AppointmentType = (int)AppointmentType.Pattern, AllDay = true, Start = newStart, End = newStart.AddDays(1), Subject = "Company Birthday Party", Status = 0, Label = 8, CalendarId = 1, }; appt.RecurrenceInfo = new RecurrenceInfo() { AllDay = true, Start = newStart, Type = RecurrenceType.Yearly, Month = newStart.Month, DayNumber = newStart.Day, WeekOfMonth = WeekOfMonth.None, Range = RecurrenceRange.NoEndDate }.ToXml(); return(new[] { appt }); }
static TeamAppointment CreateDentistAppt(DateTime start) { var appt = new TeamAppointment() { AppointmentType = (int)AppointmentType.Normal, AllDay = false, Start = start, End = start.AddHours(2), Subject = string.Format("Dentist"), Status = 3, Label = 3, CalendarId = 0, }; return(appt); }
static TeamAppointment CreateLunchAppt(Employee emp, DateTime start) { var appt = new TeamAppointment() { AppointmentType = (int)AppointmentType.Normal, AllDay = false, Start = start, End = start.AddHours(1), Subject = string.Format("Lunch with {0}", emp.FirstName), Status = 3, Label = 3, CalendarId = 0, }; return(appt); }
static TeamAppointment CreateConferenceAppt(string subject, DateTime start) { Employee emp = GetRandomEmployee(); var appt = new TeamAppointment() { AppointmentType = (int)AppointmentType.Normal, AllDay = false, Start = start, End = start.AddHours(1.5), Subject = string.Format("Conference: {0}", subject), Description = string.Format("{0} {1} tells us about {2}.", emp.FirstName, emp.LastName, subject), Status = 2, Label = 2, Location = "Conference Room", CalendarId = 1, }; return(appt); }
static TeamAppointment CreateDinnerAppt(DateTime start, TimeSpan?duration = null) { DateTime newStart = start.AddMinutes(Random.Next(0, 4) * 15); DateTime newEnd = duration != null ? newStart.Add(duration.Value) : newStart.AddMinutes(Random.Next(4, 8) * 20); var appt = new TeamAppointment() { AppointmentType = (int)AppointmentType.Normal, AllDay = false, Start = newStart, End = newEnd, Subject = string.Format("Dinner"), Status = 0, Label = 5, CalendarId = 0, }; return(appt); }
static TeamAppointment CreatePhoneCallAppt(Employee emp, DateTime start, TimeSpan?duration = null) { DateTime newStart = start.AddMinutes(Random.Next(0, 4) * 15); DateTime newEnd = duration != null ? newStart.Add(duration.Value) : newStart.AddMinutes(Random.Next(1, 6) * 5); var appt = new TeamAppointment() { AppointmentType = (int)AppointmentType.Normal, AllDay = false, Start = newStart, End = newEnd, Subject = string.Format("Phone Call with {0}", emp.FirstName), Status = 2, Label = 10, CalendarId = 0, }; return(appt); }
static TeamAppointment CreateMeetingRecurrenceAppt(string subject, DateTime start) { var appt = new TeamAppointment() { AppointmentType = (int)AppointmentType.Pattern, AllDay = false, Start = start, End = start.AddHours(1), Subject = subject, Status = 2, Label = 2, CalendarId = 1, }; appt.RecurrenceInfo = new RecurrenceInfo() { Start = start, Type = RecurrenceType.Weekly, WeekDays = WeekDays.Friday, Month = 12, Range = RecurrenceRange.NoEndDate }.ToXml(); return(appt); }
static TeamData() { Random = new Random(); Start = GetStart(); if (ViewModelBase.IsInDesignMode) { Employees = new List <Employee>(); Calendars = CreateCalendars().ToList(); VacationAppointments = new TeamAppointment[] { }; CompanyBirthdayAppointments = new TeamAppointment[] { }; BirthdayAppointments = new TeamAppointment[] { }; ConferenceAppointments = new TeamAppointment[] { }; MeetingAppointments = new TeamAppointment[] { }; PhoneCallsAppointments = new TeamAppointment[] { }; CarWashAppointments = new TeamAppointment[] { }; PayBillsAppointments = new TeamAppointment[] { }; DentistAppointments = new TeamAppointment[] { }; RestaurantAppointments = new TeamAppointment[] { }; AllAppointments = new TeamAppointment[] { }; return; } Employees = new List <Employee>(); Employees.Add(new Employee() { FirstName = "John1", LastName = "Smith1" }); Employees.Add(new Employee() { FirstName = "John2", LastName = "Smith2" }); Employees.Add(new Employee() { FirstName = "John3", LastName = "Smith3" }); Employees.Add(new Employee() { FirstName = "John4", LastName = "Smith4" }); Employees.Add(new Employee() { FirstName = "John5", LastName = "Smith5" }); Employees.Add(new Employee() { FirstName = "John6", LastName = "Smith6" }); Employees[0].BirthDate = Start.AddDays(4).AddYears(-30); Employees[1].BirthDate = Start.AddDays(1).AddYears(-27); Employees[2].BirthDate = Start.AddDays(14).AddYears(-32); Employees[3].BirthDate = Start.AddDays(-8).AddYears(-41); Employees[4].BirthDate = Start.AddDays(-18).AddYears(-41); Employees[5].BirthDate = Start.AddDays(48).AddYears(-25); Calendars = CreateCalendars().ToList(); VacationAppointments = CreateVacationsAppts(Start).ToList(); CompanyBirthdayAppointments = CreateCompanyBirthdayAppts(Start).ToList(); BirthdayAppointments = CreateBirthdayAppts(Start).ToList(); ConferenceAppointments = CreateConferenceAppts(Start).ToList(); MeetingAppointments = CreateMeetingAppts(Start).ToList(); PhoneCallsAppointments = CreatePhoneCallsAppts(Start).ToList(); CarWashAppointments = CreateCarWashAppts(Start).ToList(); TrainingAppointments = CreateTrainingAppts(Start).ToList(); PayBillsAppointments = CreatePayBillsAppts(Start).ToList(); DentistAppointments = CreateDentistAppts(Start).ToList(); RestaurantAppointments = CreateRestaurantAppts(Start).ToList(); AllAppointments = VacationAppointments .Concat(BirthdayAppointments) .Concat(CompanyBirthdayAppointments) .Concat(ConferenceAppointments) .Concat(MeetingAppointments) .Concat(PhoneCallsAppointments) .Concat(CarWashAppointments) .Concat(TrainingAppointments) .Concat(PayBillsAppointments) .Concat(DentistAppointments) .Concat(RestaurantAppointments) .ToList(); int id = 0; foreach (TeamAppointment appt in AllAppointments) { appt.Id = id++; } List <TimeRegion> regions = new List <TimeRegion>(); regions.Add(new TimeRegion() { Id = 0, Start = DateTime.Today.AddHours(13).AddMinutes(20), End = DateTime.Today.AddHours(14).AddMinutes(45), Brush = new SolidColorBrush(Colors.Blue) { Opacity = 0.4 }, CalendarId = 0, Type = (int)TimeRegionType.Pattern, RecurrenceInfo = ((RecurrenceInfo)RecurrenceBuilder.Daily(new DateTime(DateTime.Today.Year, 1, 1).AddHours(13).AddMinutes(20)).Build()).ToXml() }); regions.Add(new TimeRegion() { Id = 2, Start = DateTime.Today.AddHours(20), End = DateTime.Today.AddHours(22), Brush = new SolidColorBrush(Colors.DarkBlue) { Opacity = 0.4 }, CalendarId = 0, Type = (int)TimeRegionType.Pattern, RecurrenceInfo = ((RecurrenceInfo)RecurrenceBuilder.Daily(new DateTime(DateTime.Today.Year, 1, 1).AddHours(20)).Build()).ToXml() }); regions.Add(new TimeRegion() { Id = 1, Start = DateTime.Today.AddHours(13), End = DateTime.Today.AddHours(14), Brush = new SolidColorBrush(Colors.Blue) { Opacity = 0.4 }, CalendarId = 1, Type = (int)TimeRegionType.Pattern, RecurrenceInfo = ((RecurrenceInfo)RecurrenceBuilder.Daily(new DateTime(DateTime.Today.Year, 1, 1).AddHours(13)).Build()).ToXml() }); TimeRegions = regions; }