public Worklog FinishWork() { DateTime endOfWorkTimestamp = DateTime.Now; Worklog result = new Worklog(Issue, Start, endOfWorkTimestamp - Start); return(result); }
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(); } }
public void StopCurrentWork() { if (_currentWork != null) { Worklog finishedWork = _currentWork.FinishWork(); if (finishedWork.IsAtLeast(TimeSpan.FromMinutes(2))) { _worklogsQueue.Enqueue(finishedWork); } _currentWork = null; } }
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(); } }
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(); } }
public Worklog FinishWork() { DateTime endOfWorkTimestamp = DateTime.Now; Worklog result = new Worklog(Issue, Start, endOfWorkTimestamp - Start); return result; }
public WorkLoggedEventArgs(Worklog worklog) { Worklog = worklog; }
public WorklogUploadedEventArgs(Worklog worklog) { Worklog = worklog; }