Exemplo n.º 1
0
 public DataClasses.Projects GetTodo(int id)
 {
     var todoBase = DeserializeFromResponse<todolist>(new StreamReader(CreateWebRequest(ServiceURL + "/todo_lists/" + id, "GET", APIToken).GetResponseStream()).ReadToEnd());
     var todo = new TodoLists(todoBase);
     var project = GetProject(todo.ProjectID);
     project.TodoLists.Add(todo);
     return project;
 }
Exemplo n.º 2
0
 public DataClasses.Projects[] GetProjects()
 {
     var projectsBase = DeserializeFromResponse<projects>(new StreamReader(CreateWebRequest(ServiceURL + "/projects.xml", "GET", APIToken).GetResponseStream()).ReadToEnd());
     var projects = new List<DataClasses.Projects>();
     for (var i = 0; i < projectsBase.project.Count(); i ++) {
         var proj = new DataClasses.Projects(projectsBase.project[i]);
         var todoBase = DeserializeFromResponse<todolists>(new StreamReader(CreateWebRequest(ServiceURL + "/projects/" + proj.ID + "/todo_lists.xml?filter=pending", "GET", APIToken).GetResponseStream()).ReadToEnd());
         for (var j = 0; j < todoBase.todolist.Count(); j ++) {
             var todo = new TodoLists(todoBase.todolist[j]);
             if (!todo.TimeTracked) { continue; }
             var todoItemBase = DeserializeFromResponse<todolist>(new StreamReader(CreateWebRequest(ServiceURL + "/todo_lists/" + todo.ID, "GET", APIToken).GetResponseStream()).ReadToEnd());
             proj.TodoLists.Add(new TodoLists(todoItemBase));
         }
         projects.Add(proj);
     }
     return projects.OrderBy(x => x.Company).ThenBy(x => x.Name).ToArray();
 }