Esempio n. 1
0
        public Worklog FinishWork()
        {
            DateTime endOfWorkTimestamp = DateTime.Now;
            Worklog  result             = new Worklog(Issue, Start, endOfWorkTimestamp - Start);

            return(result);
        }
Esempio n. 2
0
 public void AddWorklog(Worklog worklog)
 {
    using (SQLiteCommand command = _connection.CreateCommand())
    {
       command.CommandText = "INSERT INTO Worklog (IssueKey, Start, DurationInSeconds) VALUES (@IssueKey, @Start, @DurationInSeconds)";
       command.Parameters.AddWithValue("@IssueKey", worklog.Issue.Key);
       command.Parameters.AddWithValue("@Start", worklog.Start.Ticks);
       command.Parameters.AddWithValue("@DurationInSeconds", worklog.DurationInSeconds);
       command.ExecuteNonQuery();
    }
 }
Esempio n. 3
0
        public void StopCurrentWork()
        {
            if (_currentWork != null)
            {
                Worklog finishedWork = _currentWork.FinishWork();

                if (finishedWork.IsAtLeast(TimeSpan.FromMinutes(2)))
                {
                    _worklogsQueue.Enqueue(finishedWork);
                }
                _currentWork = null;
            }
        }
Esempio n. 4
0
      public void DeleteWorklog(Worklog worklog)
      {
         if (!worklog.Id.HasValue)
         {
            throw new InvalidOperationException();
         }

         using (SQLiteCommand command = _connection.CreateCommand())
         {
            command.CommandText = "DELETE FROM Worklog WHERE Id = @Id";
            command.Parameters.AddWithValue("@Id", worklog.Id.Value);
            command.ExecuteNonQuery();
         }
      }
Esempio n. 5
0
      public async Task LogWork(Worklog worklog)
      {
         if (worklog.IsAtLeast(TimeSpan.FromMinutes(1)))
         {
            RestRequest restRequest = CreateRequest("issue/" + worklog.Issue.Key + "/worklog", Method.POST);
            var worklogJson = new
            {
               started = worklog.Start,
               timeSpentSeconds = worklog.DurationInSeconds
            };
            restRequest.AddJsonBody(worklogJson);

            IRestResponse response = await _restClient.ExecuteTaskAsync(restRequest);
            response.EnsureSuccessStatusCode();
         }
      }
Esempio n. 6
0
 public Worklog FinishWork()
 {
     DateTime endOfWorkTimestamp = DateTime.Now;
      Worklog result = new Worklog(Issue, Start, endOfWorkTimestamp - Start);
      return result;
 }
Esempio n. 7
0
 public WorkLoggedEventArgs(Worklog worklog)
 {
     Worklog = worklog;
 }
Esempio n. 8
0
 public WorklogUploadedEventArgs(Worklog worklog)
 {
    Worklog = worklog;
 }