Example #1
0
        public void CalendarEntries()
        {
            Console.WriteLine();
            Console.WriteLine("Calendar Entries Contract Tests");
            Console.WriteLine("*******************************");

            var projectService = this.Client.Projects;
            var peopleService = this.Client.People;

            var project = projectService.GetList().FirstOrDefault();

            if (project == null)
            {
                Console.WriteLine("No projects exists under this account");
                return;
            }

            Console.WriteLine("Project Name: {0}", project.Name);

            var service = this.Client.CalendarEntries;

            var entries = service.GetList(project.Id);

            Console.WriteLine("Calendar Entries Count: {0}", entries.Count());

            var entries2 = service.GetListEvents(project.Id);

            Console.WriteLine("Calendar Events Count: {0}", entries2.Count());

            var entries3 = service.GetListMilestones(project.Id, CalendarEntryFilter.All);

            Console.WriteLine("Calendar Milestones Count: {0}", entries3.Count());

            var me = peopleService.Me();

            var item = new CalendarEntryRequest { CalendarEntry = new CalendarEntryNew { Title = "Test", Type = CalendarEntryType.Milestone, Deadline = DateTime.Now, ResponsiblePerson = me.Id } };
            var id = service.Create(project.Id, item);
            var newEntry = service.Get(project.Id, id.Id);

            Console.WriteLine("New Entry: {0}", newEntry.Title);

            item.CalendarEntry.Title = "test content again";
            service.Update(project.Id, id.Id, item);
            var updateEntry = service.Get(project.Id, id.Id);

            Console.WriteLine("Update Entry: {0}", updateEntry.Title);

            service.Complete(project.Id, id.Id);

            Console.WriteLine("Entry Complete");

            service.Uncomplete(project.Id, id.Id);

            Console.WriteLine("Entry Uncomplete");

            service.Delete(project.Id, id.Id);

            Console.WriteLine("Entry Deleted");
        }
 public static CalendarEntry Create(this ICalendarEntriesContract contract, Int64 projectId, CalendarEntryRequest item)
 {
     return contract.Create(projectId.ToString(), item);
 }