private void DeleteEvents(CalendarService _service)
        {
            string CalendarId = "";

            EventsResource.DeleteRequest Delrequest = new EventsResource.DeleteRequest(_service, UserEmail, CalendarId);
            Delrequest.Execute();
        }
Пример #2
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            if (selEvent != null)
            {
                try
                {
                    EventsResource.DeleteRequest delReq = new EventsResource.DeleteRequest(myService, "primary", selEvent.Id);
                    string deletedTitle = selEvent.Summary;
                    addAttendees(selEvent);
                    delReq.Execute();

                    if (deletedTitle == null)
                    {
                        MessageBox.Show("The selected event has been deleted.");
                    }
                    else
                    {
                        MessageBox.Show("The selected event, titled " + deletedTitle + ", has been deleted.");
                    }
                }
                catch (Google.GoogleApiException)
                {
                    MessageBox.Show("The selected event has already been deleted.");
                }

                selEvent = null;
                EventListBox.SelectedItem = null;

                setReadRequest();
                EventListBox.DataContext = request.Execute();
            }
        }
Пример #3
0
        private void ClearCalendarEventsByDatetime(CalendarService service, string startDate, string endDate, string group)
        {
            // Define parameters of request.
            EventsResource.ListRequest request2 = service.Events.List("primary");
            request2.TimeMin = DateTime.Parse(startDate);
            request2.TimeMax = DateTime.Parse(endDate);
            request2.SharedExtendedProperty = "GroupName=" + group;
            request2.ShowDeleted            = false;
            request2.SingleEvents           = true;
            request2.MaxResults             = 100;
            request2.OrderBy = EventsResource.ListRequest.OrderByEnum.StartTime;

            // List events.
            Events events = request2.Execute();

            //richTextBox2.Text = richTextBox2.Text + "Founded events:\n\n";
            if (events.Items != null && events.Items.Count > 0)
            {
                foreach (var eventItem in events.Items)
                {
                    richTextBox2.Text = richTextBox2.Text + "Delete event '" + eventItem.Summary + "'\n";
                    EventsResource.DeleteRequest request3 = service.Events.Delete(CalendarId, eventItem.Id);
                    request3.Execute();
                }
            }
        }
        /// <summary>
        /// Удаление событие календаря
        /// </summary>
        /// <param name="eventForDel">Событие</param>
        public void DeleteEvent(Event eventForDel, string calendarName)
        {
            if (isConnect)
            {
                EventsResource.DeleteRequest request = new EventsResource.DeleteRequest(Service, calendarName, eventForDel.Id);
                WorkBD.Execution_query($"delete from Events_calendar where Id_Event = N'{eventForDel.Id}'");
                request.Execute();
            }
            else
            {
                int idEvent = 0;

                var result = WorkBD.Select_query($"select Id from Events_Calendar where Id_Event = N'{eventForDel.Id}'");

                if (result.Rows.Count > 0)
                {
                    idEvent = int.Parse(result.Rows[0].ItemArray[0].ToString());
                    WorkBD.Execution_query($"insert into Del_Event (Event_Cal_id) values ((select Id from Activity where EvendId = {idEvent}))");
                }
                else
                {
                    var nextVariant = WorkBD.Select_query($"select Id from Ins_Event where Id_New_Ev = N'{eventForDel.Id}'");

                    if (nextVariant.Rows.Count > 0)
                    {
                        idEvent = int.Parse(nextVariant.Rows[0].ItemArray[0].ToString());

                        WorkBD.Execution_query($"delete from Ins_Event where Id = {idEvent}");
                    }
                }
            }
        }
Пример #5
0
        public void ClearCalendarEventByGroupName(string groupname)
        {
            // If modifying these scopes, delete your previously saved credentials
            // at ~/.credentials/calendar-dotnet-quickstart.json

            using (CalendarService service = new CalendarService(new BaseClientService.Initializer {
                HttpClientInitializer = credential, ApplicationName = ApplicationName,
            }))
            {
                // Define parameters of request.
                EventsResource.ListRequest request2 = service.Events.List("primary");
                request2.SharedExtendedProperty = "GroupName=" + groupname;
                request2.ShowDeleted            = false;
                request2.SingleEvents           = true;
                request2.MaxResults             = 100;
                request2.OrderBy = EventsResource.ListRequest.OrderByEnum.StartTime;

                // List events.
                Events events = request2.Execute();
                if (events.Items != null && events.Items.Count > 0)
                {
                    foreach (var eventItem in events.Items)
                    {
                        richTextBox2.Text = richTextBox2.Text + "Delete event '" + eventItem.Summary + "'\n";
                        EventsResource.DeleteRequest request3 = service.Events.Delete(CalendarId, eventItem.Id);
                        request3.Execute();
                        Thread.Sleep(1000);
                    }
                }
            }
        }
Пример #6
0
 public void DeleteAppointment(string id)
 {
     EventsResource.DeleteRequest deleteRequest = service.Events.Delete("primary", id);
     try
     {
         deleteRequest.Execute();
     }
     catch
     {
     }
 }
Пример #7
0
 private static void tryExecuteEvent(EventsResource.DeleteRequest gEvent, int tries)
 {
     for (int i = 0; i < tries; i++)
     {
         try
         {
             gEvent.Execute();
             return;
         }
         catch { };
     }
 }
Пример #8
0
 // Kill spezifischen Eintrag, return Erfolg oder Misserfolg
 public Boolean kalenderEventRemove(String ID)
 {
     try
     {
         EventsResource.DeleteRequest request = dienst.Events.Delete("primary", ID);
         request.Execute();
     }
     catch (Exception)
     {
         return(false);
     }
     return(true);
 }
 public string deleteFromGoogleCalendar(Event googleAppointment)
 {
     EventsResource.DeleteRequest request = service.Events.Delete(calendarId, googleAppointment.Id);
     return(request.Execute());
 }