Exemplo n.º 1
0
 /// <summary>
 /// Delete a Task
 /// </summary>
 /// <param name="taskid"></param>
 /// <returns></returns>
 public async Task <bool> UnCompleteTask(int taskid)
 {
     using (var client = new AuthorizedHttpClient(_client))
     {
         var response = await client.PutAsync("/tasks/" + taskid + "/uncomplete.json", null);
     }
     return(false);
 }
Exemplo n.º 2
0
 /// <summary>
 ///   Mark the specifiec Milestone as completed
 /// </summary>
 /// <param name="milestoneID"></param>
 /// <returns></returns>
 public async Task <bool> MarkCommplete(int milestoneID)
 {
     using (var client = new AuthorizedHttpClient(_client))
     {
         var response = await client.PutAsync("/milestones/" + milestoneID + "/complete.json", null);
     }
     return(false);
 }
Exemplo n.º 3
0
 public async Task <bool> UpdateProjectCategory(Category company)
 {
     using (var client = new AuthorizedHttpClient(_client))
     {
         string post     = JsonConvert.SerializeObject(company);
         var    response =
             await client.PutAsync("/category/" + company.Id + ".json", new StringContent("{\"category\":" + post + "}", Encoding.UTF8));
     }
     return(false);
 }
Exemplo n.º 4
0
 public async Task <bool> UpdateCompany(Company company)
 {
     using (var client = new AuthorizedHttpClient(this.client.ApiKey, this.client.Domain))
     {
         string post     = JsonConvert.SerializeObject(company);
         var    response =
             await client.PutAsync("/companies/" + company.Id + ".json", new StringContent("{\"company\": " + post + "}", Encoding.UTF8));
     }
     return(false);
 }
Exemplo n.º 5
0
 public async Task <bool> UpdateMilestone(Milestone milestone)
 {
     using (var client = new AuthorizedHttpClient(_client))
     {
         string post     = JsonConvert.SerializeObject(milestone);
         var    response =
             await client.PutAsync("/milestones/" + milestone.id + ".json", new StringContent("{\"milestone\":" + post + "}", Encoding.UTF8));
     }
     return(false);
 }
Exemplo n.º 6
0
        /// <summary>
        ///   Add a new Tag
        /// </summary>
        /// <returns></returns>
        public async Task <bool> UpdateTagAsync(Tag theTag)
        {
            try
            {
                using (var client = new AuthorizedHttpClient(_client))
                {
                    string post = JsonConvert.SerializeObject(theTag);
                    await client.PutAsync("/tags.json", new StringContent("{\"tag\": " + theTag + "}", Encoding.UTF8));

                    return(true);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Add event to user´s calendar
 /// http://developer.teamwork.com/events#create_event
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public async void UpdateCalendarEntry(Event data)
 {
     try
     {
         using (var client = new AuthorizedHttpClient(_client))
         {
             var settings = new JsonSerializerSettings()
             {
                 ContractResolver = new NullToEmptyStringResolver()
             };
             string post     = JsonConvert.SerializeObject(data, settings);
             var    response = await client.PutAsync("calendarevents/" + data.id + ".json", new StringContent("{\"event\":" + post + "}", Encoding.UTF8));
         }
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 8
0
 public async Task CopyTaskList2(int taskListId, int projectId)
 {
     try
     {
         using (var client = new AuthorizedHttpClient(_client))
         {
             var settings = new JsonSerializerSettings()
             {
                 ContractResolver = new NullToEmptyStringResolver()
             };
             //string post = JsonConvert.SerializeObject(theTag, settings);
             await client.PutAsync("/tasklist/" + taskListId.ToString() + "/copy.json", new StringContent("{\"projectId\": " + projectId.ToString() + "}", Encoding.UTF8));
         }
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 9
0
        /// <summary>
        ///   Add a new Tag
        /// </summary>
        /// <returns></returns>
        public async Task <bool> UpdateTask(TodoItem theTag, bool notify)
        {
            try
            {
                using (var client = new AuthorizedHttpClient(_client))
                {
                    theTag.notify = notify;
                    var settings = new JsonSerializerSettings()
                    {
                        ContractResolver = new NullToEmptyStringResolver()
                    };
                    string post = JsonConvert.SerializeObject(theTag, settings);
                    await client.PutAsync("/tasks/" + theTag.id + ".json", new StringContent("{\"todo-item\": " + post + "}", Encoding.UTF8));

                    return(true);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }