public static AppointmentEntity TrainingGermanLesson()
        {
            DateTime start    = Start.AddHours(15).AddMinutes(40);
            DateTime newStart = start;
            DateTime newEnd   = newStart.AddHours(1.5);
            var      appt     = new AppointmentEntity()
            {
                AppointmentType = (int)AppointmentType.Pattern,
                Start           = newStart,
                End             = newEnd,
                ResourceId      = 2,
                Subject         = "German lesson",
                Label           = 3,
                Description     = "We're learning French but we also need to become fluent in German. The German market for A/V products is huge. We need to be able to communicate in German if we are to have any luck in Germany."
            };

            appt.RecurrenceInfo = RecurrenceBuilder.Weekly(newStart, 10).ByDay(WeekDays.Tuesday | WeekDays.Friday).Build().ToXml();
            return(appt);
        }
        public static AppointmentEntity TrainingFrenchLesson()
        {
            DateTime start    = Start.AddDays(-7).AddHours(11).AddMinutes(10);
            DateTime newStart = start;
            DateTime newEnd   = newStart.AddHours(1.5);
            var      appt     = new AppointmentEntity()
            {
                AppointmentType = (int)AppointmentType.Pattern,
                Start           = newStart,
                End             = newEnd,
                ResourceId      = 2,
                Subject         = "French lesson",
                Label           = 3,
                Description     = "Another french lesson.Once again, without mastering French, our success on the Continent will be less likely.Everyone needs to learn French.",
            };

            appt.RecurrenceInfo = RecurrenceBuilder.Weekly(newStart, 10).ByDay(WeekDays.Monday | WeekDays.Wednesday).Build().ToXml();
            return(appt);
        }
        public static IEnumerable <AppointmentEntity> Gym()
        {
            DateTime start = Start.AddMonths(-1).AddHours(18);

            TimeSpan patternTimeOfDay = start.TimeOfDay;
            DateTime patternStartDate = DateTimeHelper.GetStartOfWeekUI(start.Date, DayOfWeek.Monday).Date;
            DateTime patternStart     = patternStartDate + patternTimeOfDay;

            TimeSpan          patternDuration = TimeSpan.FromHours(1.5);
            AppointmentEntity pattern         = new AppointmentEntity()
            {
                AppointmentType = (int)AppointmentType.Pattern,
                Start           = patternStart,
                End             = patternStart + patternDuration,
                Subject         = "Gym",
                Label           = 3,
                ResourceId      = 1
            };

            RecurrenceInfo info = (RecurrenceInfo)RecurrenceBuilder.Weekly(patternStart)
                                  .ByDay(WeekDays.Monday | WeekDays.Wednesday | WeekDays.Friday)
                                  .Build();

            pattern.RecurrenceInfo = info.ToXml();
            DateTime weekStartDate          = DateTimeHelper.GetStartOfWeekUI(Start.Date, DayOfWeek.Monday).Date;
            DateTime changedStart           = weekStartDate + patternTimeOfDay + TimeSpan.FromHours(-1);
            int      changedOccurrenceIndex = (weekStartDate - patternStartDate).Days / 7 * 3;

            if (changedOccurrenceIndex < 0)
            {
                return new List <AppointmentEntity>(1)
                       {
                           pattern
                       }
            }
            ;

            AppointmentEntity changedOccurrence = new AppointmentEntity()
            {
                AppointmentType = (int)AppointmentType.ChangedOccurrence,
                Start           = changedStart,
                End             = changedStart + patternDuration,
                Subject         = "Gym",
                Label           = 3,
                ResourceId      = 1
            };

            changedOccurrence.RecurrenceInfo = new PatternReferenceXmlPersistenceHelper(new PatternReference(info.Id,
                                                                                                             changedOccurrenceIndex)).ToXml();
            int      deletedOccurrenceIndex = changedOccurrenceIndex + 1;
            DateTime deletedStart           = weekStartDate + patternTimeOfDay + TimeSpan.FromDays(2);

            AppointmentEntity deletedOccurrence = new AppointmentEntity()
            {
                AppointmentType = (int)AppointmentType.DeletedOccurrence,
                Start           = deletedStart,
                End             = deletedStart + patternDuration,
                Subject         = "Gym",
                Label           = 3,
                ResourceId      = 1
            };

            deletedOccurrence.RecurrenceInfo = new PatternReferenceXmlPersistenceHelper(new PatternReference(info.Id,
                                                                                                             deletedOccurrenceIndex)).ToXml();
            return(new List <AppointmentEntity>(3)
            {
                pattern, changedOccurrence, deletedOccurrence
            });
        }
        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;
        }