Exemple #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,
                ResourceId      = 0,
            };

            appt.RecurrenceInfo = new RecurrenceInfo()
            {
                AllDay    = true,
                Start     = newStart,
                Type      = RecurrenceType.Monthly,
                DayNumber = newStart.Day,
                Range     = RecurrenceRange.NoEndDate,
            }.ToString();
            return(new[] { appt });
        }
Exemple #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,
                ResourceId      = 1,
            };

            appt.RecurrenceInfo = new RecurrenceInfo()
            {
                AllDay    = true,
                Start     = newStart,
                Type      = RecurrenceType.Yearly,
                Month     = newStart.Month,
                DayNumber = newStart.Day,
                Range     = RecurrenceRange.NoEndDate
            }.ToString();

            return(new[] { appt });
        }
Exemple #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,
                ResourceId      = 0,
            };

            appt.RecurrenceInfo = new RecurrenceInfo()
            {
                AllDay   = false,
                Start    = newStart,
                Type     = RecurrenceType.Weekly,
                WeekDays = WeekDays.Monday | WeekDays.Wednesday | WeekDays.Friday,
                Range    = RecurrenceRange.NoEndDate
            }.ToString();
            return(new[] { appt });
        }
Exemple #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,
                ResourceId      = 0,
            };

            appt.RecurrenceInfo = new RecurrenceInfo()
            {
                AllDay    = true,
                Start     = date,
                Month     = date.Month,
                DayNumber = date.Day,
                Type      = RecurrenceType.Yearly,
                Range     = RecurrenceRange.NoEndDate
            }.ToString();
            return(appt);
        }
Exemple #5
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 = NWindContext.Create().Employees.ToList();
            Employees[0].BirthDate = Start.AddDays(4).AddYears(-30);

            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++;
            }
        }
Exemple #6
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,
                ResourceId      = 0,
            };

            return(appt);
        }
Exemple #7
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,
                ResourceId      = 0,
            };

            return(appt);
        }
        OutlookEvent CreateEvent(TeamAppointment appt, int?resourceId, int categoryId)
        {
            OutlookEvent outlookEvent = OutlookEvent.Create();

            outlookEvent.AllDay         = appt.AllDay;
            outlookEvent.StartTime      = appt.Start;
            outlookEvent.EndTime        = appt.End;
            outlookEvent.ResourceId     = resourceId;
            outlookEvent.Subject        = appt.Subject;
            outlookEvent.Location       = appt.Location;
            outlookEvent.StatusId       = appt.Status;
            outlookEvent.CategorizeId   = categoryId;
            outlookEvent.Type           = appt.AppointmentType;
            outlookEvent.RecurrenceInfo = appt.RecurrenceInfo;
            outlookEvent.ReminderInfo   = appt.ReminderInfo;
            return(outlookEvent);
        }
Exemple #9
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",
                ResourceId      = 1,
            };

            return(appt);
        }
Exemple #10
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,
                ResourceId      = 0,
            };

            return(appt);
        }
Exemple #11
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,
                ResourceId      = 0,
            };

            return(appt);
        }
Exemple #12
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,
                ResourceId      = 1,
            };

            appt.RecurrenceInfo = new RecurrenceInfo()
            {
                Start    = start,
                Type     = RecurrenceType.Weekly,
                WeekDays = WeekDays.Friday,
                Month    = 12,
                Range    = RecurrenceRange.NoEndDate
            }.ToString();
            return(appt);
        }