示例#1
0
        public void TestSaveEvents()
        {
            var eEvent = new Event
                             {
                                 Description = "Description",
                                 End = new EventDateTime { Date = DateTime.Today.AddDays(1).ToString("dd.MM.yyyy") },
                                 Start = new EventDateTime { Date = DateTime.Today.ToString("dd.MM.yyyy") },
                                 Summary = "Summary"
                             };

            var calendar = new Calendar();
            bool success = calendar.InsertEvents(new[] { eEvent });

            Assert.True(success);
        }
示例#2
0
        /// <summary>
        /// Creates the events after business info participated.
        /// </summary>
        /// <param name="peopleContact">The people contact.</param>
        /// <param name="calendar">The calendar.</param>
        /// <returns>Task.</returns>
        private void CreateEventsAfterBusinessInfoParticipatedAsync(PeopleContact peopleContact, Calendar calendar)
        {
            CreateEventsAfterBusinessInfoParticipated(peopleContact);

            if (calendar.UseGoogleCalendar && !calendar.Authorized)
                return;

            var events = new Event[1];
            DateTime startDate = peopleContact.BusinessInfoParticipated.GetValueOrDefault(DateTime.Today).AddDays(2);
            events[0] = new Event
            {
                Start = new EventDateTime { DateTime = startDate },
                End = new EventDateTime { DateTime = startDate.AddDays(3) },
                Summary = String.Format(GoogleCalendarResource.PeopleContactController_CreateEventsAfterBusinessInfoParticipatedAsync_Summary, peopleContact.LastName, peopleContact.FirstName),
                Description = String.Format(GoogleCalendarResource.PeopleContactController_CreateEventsAfterBusinessInfoParticipatedAsync_Description, peopleContact.LastName, peopleContact.FirstName)
            };
            calendar.InsertEvents(events);
        }
示例#3
0
        /// <summary>
        /// Creates the events after presented.
        /// </summary>
        /// <param name="peopleContact">The people contact.</param>
        /// <param name="calendar">The calendar.</param>
        /// <returns>Task.</returns>
        private void CreateEventsAfterPresentedAsync(PeopleContact peopleContact, Calendar calendar)
        {
            CreateEventsAfterPresented(peopleContact);

            if (calendar == null || (calendar.UseGoogleCalendar && !calendar.Authorized))
                return;

            var events = new Event[2];
            DateTime startDate = peopleContact.Presented.GetValueOrDefault(DateTime.Today).AddDays(1);
            events[0] = new Event
                            {
                                Start = new EventDateTime { DateTime = startDate },
                                End = new EventDateTime { DateTime = startDate.AddDays(1) },
                                Summary = String.Format(GoogleCalendarResource.PeopleContactController_CreateEventsAfterPresentedAsync1_Summary, peopleContact.LastName, peopleContact.FirstName),
                                Description = String.Format(GoogleCalendarResource.PeopleContactController_CreateEventsAfterPresentedAsync1_Description, peopleContact.LastName, peopleContact.FirstName)
                            };

            events[1] = new Event
                            {
                                Start = new EventDateTime { DateTime = startDate },
                                End = new EventDateTime { DateTime = startDate.AddDays(14) },
                                Summary = String.Format(GoogleCalendarResource.PeopleContactController_CreateEventsAfterPresentedAsync2_Summary, peopleContact.LastName, peopleContact.FirstName),
                                Description = String.Format(GoogleCalendarResource.PeopleContactController_CreateEventsAfterPresentedAsync2_Description, peopleContact.LastName, peopleContact.FirstName)
                            };
            calendar.InsertEvents(events);
        }