Example #1
0
 public void DeleteTime(MainTimer timer)
 {
     if (timer.HasTimeId())
     {
         timeAPI.DeleteTimeSpent(timer.TimeId);
     }
     timer.Reset();
 }
Example #2
0
 private int StartTime(MainTimer timer)
 {
     var body = new Dictionary<string, string>()
     {
         {"note", timer.Note},
         {"date", DateTime.UtcNow.ToString()},
         {"personId", timer.MyId},
         {"hours", timer.GetHours().ToString()},
         {"projectId", Convert.ToString(timer.ProjectId)}
     };
     JTime time = timeAPI.AddTaskTime(timer.TaskId, body);
     return time.id;
 }
Example #3
0
        public void UpdateTaskTime(MainTimer timer)
        {
            if (timer.LastUploadedHours == timer.GetHours()) return;
            // if it is something to update
            var body = new Dictionary<string, string>
            {
                {"note", timer.Note},
                {"date", DateTime.Now.ToString(CultureInfo.InvariantCulture)},
                {"personId", timer.MyId},
                {"hours", timer.GetHours()}
            };

            if (timer.TimeId == -1)
            {
                body.Add("projectId", Convert.ToString(timer.ProjectId));
                timer.TimeId = (timeAPI.AddTaskTime(timer.TaskId, body)).id;
            }
            else
            {
                timeAPI.UpdateTaskTime(timer.TimeId, body);
            }
        }