示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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;
            }
        }