Beispiel #1
0
        internal RemoteIssue ToRemote()
        {
            var remote = new RemoteIssue()
            {
                assignee    = this.Assignee,
                description = this.Description,
                environment = this.Environment,
                project     = this.Project,
                reporter    = this.Reporter,
                summary     = this.Summary,
                votes       = this.Votes,
                duedate     = this.DueDate
            };

            remote.key = this.Key != null ? this.Key.Value : null;

            if (Status != null)
            {
                remote.status = Status.Id ?? Status.LoadByName(_jira, Project).Id;
            }

            if (Resolution != null)
            {
                remote.resolution = Resolution.Id ?? Resolution.LoadByName(_jira, Project).Id;
            }

            if (Priority != null)
            {
                remote.priority = Priority.Id ?? Priority.LoadByName(_jira, Project).Id;
            }

            if (Type != null)
            {
                remote.type = Type.Id ?? Type.LoadByName(_jira, Project).Id;
            }

            if (this.AffectsVersions.Count > 0)
            {
                remote.affectsVersions = this.AffectsVersions.Select(v => v.RemoteVersion).ToArray();
            }

            if (this.FixVersions.Count > 0)
            {
                remote.fixVersions = this.FixVersions.Select(v => v.RemoteVersion).ToArray();
            }

            if (this.Components.Count > 0)
            {
                remote.components = this.Components.Select(c => c.RemoteComponent).ToArray();
            }

            if (this.CustomFields.Count > 0)
            {
                remote.customFieldValues = this.CustomFields.Select(f => new RemoteCustomFieldValue()
                {
                    customfieldId = f.Id,
                    values        = f.Values
                }).ToArray();
            }

            return(remote);
        }