Example #1
0
        public void AddModelToGoogleCalendar(Reservation reservation)
        {
            Event newEvent = new Event
            {
                //Summary = reservation.Type,
                Start = new EventDateTime()
                {
                    DateTime = new System.DateTime(reservation.SinceReservation.Date.Year, reservation.SinceReservation.Date.Month, reservation.SinceReservation.Date.Day, reservation.SinceReservation.Date.Hour, reservation.SinceReservation.Date.Minute, 0)
                },
                End = new EventDateTime()
                {
                    DateTime = new System.DateTime(reservation.UntilReservation.Date.Year, reservation.UntilReservation.Date.Month, reservation.UntilReservation.Date.Day, reservation.UntilReservation.Date.Hour, reservation.UntilReservation.Date.Minute, 0)
                }
            };

            _googleCalendarService.CreateEvent(newEvent);
        }
Example #2
0
        public void AddModelToGoogleCalendar(CompanyCalendar companyCalendar)
        {
            Event newEvent = new Event
            {
                Description = companyCalendar.Type,
                Summary     = companyCalendar.Comments,
                Start       = new EventDateTime()
                {
                    DateTime = new System.DateTime(companyCalendar.Date.Date.Year, companyCalendar.Date.Date.Month, companyCalendar.Date.Date.Day, 8, 0, 0)
                },
                End = new EventDateTime()
                {
                    DateTime = new System.DateTime(companyCalendar.Date.Date.Year, companyCalendar.Date.Date.Month, companyCalendar.Date.Date.Day, 19, 0, 0)
                }
            };

            _googleCalendarService.CreateEvent(newEvent);
        }
Example #3
0
        public string AddModelToGoogleCalendar(DaysOff daysOff)
        {
            Event newEvent = new Event
            {
                Summary = ((DaysOffType)daysOff.Type).ToString(),
                Start   = new EventDateTime()
                {
                    DateTime = new System.DateTime(daysOff.Date.Date.Year, daysOff.Date.Date.Month, daysOff.Date.Date.Day, 8, 0, 0)
                },
                End = new EventDateTime()
                {
                    DateTime = new System.DateTime(daysOff.EndDate.Date.Year, daysOff.EndDate.Date.Month, daysOff.EndDate.Date.Day, 8, 0, 0)
                },
                Attendees = new List <EventAttendee>()
            };

            newEvent.Attendees.Add(new EventAttendee()
            {
                Email = daysOff.Employee.EmailAddress
            });
            //newEvent.Attendees.Add(new EventAttendee() { Email = "*****@*****.**" });

            return(_googleCalendarService.CreateEvent(newEvent));
        }