예제 #1
0
        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 });
        }
예제 #2
0
        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 });
        }
예제 #3
0
        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 });
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }
예제 #8
0
        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);
        }
예제 #9
0
        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);
        }
예제 #10
0
        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);
        }
예제 #11
0
        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 = "Andrew", LastName = "Glover"
            });
            Employees.Add(new Employee()
            {
                FirstName = "Mark", LastName = "Oliver"
            });
            Employees.Add(new Employee()
            {
                FirstName = "John", LastName = "Heart"
            });
            Employees.Add(new Employee()
            {
                FirstName = "Olivia", LastName = "Peyton"
            });
            Employees.Add(new Employee()
            {
                FirstName = "Sandra", LastName = "Johnson"
            });
            Employees.Add(new Employee()
            {
                FirstName = "Amelia", LastName = "Harper"
            });
            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++;
            }
        }