atlassian.net-sdk-v2.0 /Atlassian.Jira/Worklog.cs

Language C# Lines 84
MD5 Hash a112bd7ab254be35dd165e40e7a65962 Estimated Cost $1,532 (why?)
Repository https://bitbucket.org/yyo/atlassian.net-sdk-v2.0.git View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Atlassian.Jira.Remote;

namespace Atlassian.Jira
{
    /// <summary>
    /// Represents the worklog of an issue
    /// </summary>
    public class Worklog
    {
        private readonly DateTime? _created;
        private readonly string _id;
        private readonly long _timeSpentInSeconds;
        private readonly DateTime? _updated;

        public string Author { get; set; }
        public string Comment { get; set; }
        public DateTime? StartDate { get; set; }
        public string TimeSpent { get; set; }

        public string Id
        {
            get { return _id; }
        }

        public long TimeSpentInSeconds
        {
            get { return _timeSpentInSeconds; }
        }

        public DateTime? CreateDate
        {
            get { return _created; }
        }

        public DateTime? UpdateDate
        {
            get { return _updated; }
        }

        /// <summary>
        /// Creates a new worklog instance
        /// </summary>
        /// <param name="timeSpent">Specifies a time duration in JIRA duration format, representing the time spent working</param>
        /// <param name="startDate">When the work was started</param>
        /// <param name="comment">An optional comment to describe the work</param>
        public Worklog(string timeSpent, DateTime startDate, string comment = null)
        {
            this.TimeSpent = timeSpent;
            this.StartDate = startDate;
            this.Comment = comment;
        }

        internal Worklog(RemoteWorklog remoteWorklog)
        {
            if (remoteWorklog != null)
            {
                this.Author = remoteWorklog.author;
                this.Comment = remoteWorklog.comment;
                this.StartDate = remoteWorklog.startDate;
                this.TimeSpent = remoteWorklog.timeSpent;
                _id = remoteWorklog.id;
                _created = remoteWorklog.created;
                _timeSpentInSeconds = remoteWorklog.timeSpentInSeconds;
                _updated = remoteWorklog.updated;
            }
        }

        internal RemoteWorklog ToRemote()
        {
            return new RemoteWorklog()
            {
                author = this.Author,
                comment = this.Comment,
                startDate = this.StartDate,
                timeSpent = this.TimeSpent
            };
        }
    }
}
Back to Top