Exemplo n.º 1
0
        public void TimeTracking()
        {
            Console.WriteLine();
            Console.WriteLine("Time Tracking 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.TimeTracking;

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

            Console.WriteLine("Time Tracking Count: {0}", entries.Count());

            var me = peopleService.Me();
            var item = new TimeEntryNew { Date = DateTime.Now, Description = "testing", Hours = 8, PersonId = me.Id };
            var id = service.Create(project.Id, item);
            var newEntry = service.Get(id.Id);

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

            item.Description = "testing again";
            service.Update(id.Id, item);
            var updateEntry = service.Get(id.Id);

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

            service.Delete(id.Id);

            Console.WriteLine("Entry Deleted");

            var from = new DateTime(2011, 07, 01);
            var to = new DateTime(2011, 12, 31);
            var results = service.Report(c => c.From == from && c.To == to);

            Console.WriteLine("Entry Count: {0}", results.Count());
        }
 public static NewEntity Create(this ITimeTrackingContract contract, Int64 projectId, TimeEntryNew item)
 {
     return contract.Create(projectId.ToString(), item);
 }
 public static NewEntity CreateForTodoItem(this ITimeTrackingContract contract, Int64 todoItemId, TimeEntryNew item)
 {
     return contract.CreateForTodoItem(todoItemId.ToString(), item);
 }
 public static void Update(this ITimeTrackingContract contract, Int64 timeEntryId, TimeEntryNew item)
 {
     contract.Update(timeEntryId.ToString(), item);
 }