private InternalTempoWorklog MapToInternalTempoWorklog(TempoWorklog workLog, User mySelf) { var internalWorklog = new InternalTempoWorklog() { DateStarted = workLog.StartTime.ToIsoDateTimeStrWithoutTimeZone(), TimeSpentSeconds = workLog.Duration, Comment = workLog.Description, Issue = new InternalTempoIssue { Key = workLog.TicketKey, }, Author = new InternalTempoAuthor { Name = mySelf.Name, Self = mySelf.Self.ToString(), } }; internalWorklog.WorklogAttributes.Add( new InternalWorklogAttribute { Key = ActivityAttributeKey, Value = Uri.EscapeDataString(workLog.Activity) }); internalWorklog.Id = workLog.Id; return(internalWorklog); }
private TempoWorklog MapToTempoWorklog(InternalTempoWorklog internalWorkLog) { var worklog = new TempoWorklog { Id = internalWorkLog.Id, Description = internalWorkLog.Comment, StartTime = DateTime.Parse(internalWorkLog.DateStarted), TicketKey = internalWorkLog.Issue.Key, }; worklog.EndTime = worklog.StartTime.AddSeconds(internalWorkLog.TimeSpentSeconds); worklog.Activity = internalWorkLog.WorklogAttributes.FirstOrDefault(x => x.Key == ActivityAttributeKey)?.Value; return(worklog); }
public void AddWorklog(TempoWorklog workLog) { Init(); var internalWorklog = MapToInternalTempoWorklog(workLog, _jiraUser); InternalTempoWorklog result; if (internalWorklog.Id == null) { result = _worklogService.Tempo.CreateAsync(internalWorklog).Result; workLog.Id = result.Id; } else { result = _worklogService.Tempo.UpdateAsync(internalWorklog).Result; } }