Beispiel #1
0
        private static string GetFormattedCodePlexWorkItemDetails(WorkItem workItem)
        {
            var stringBuilder = new StringBuilder()
                                .AppendLine(MarkdownFormatter.H4(Resources.MigratedCodePlexWorkItemDetails))
                                .AppendLine(GetFormattedWorkItemId(workItem.Id));

            if (!string.IsNullOrEmpty(workItem.AssignedTo))
            {
                stringBuilder.AppendLine(string.Format(GetPropertyFormat(Resources.AssignedTo), workItem.AssignedTo));
            }

            return(stringBuilder
                   .AppendLine(string.Format(GetPropertyFormat(Resources.VoteCount), workItem.VoteCount))
                   .ToString());
        }
Beispiel #2
0
        private static string GetFormattedAttachmentHyperlinks(IEnumerable <WorkItemFileAttachment> attachments)
        {
            bool hasAttachments = attachments?.Any() ?? false;

            if (hasAttachments)
            {
                var stringBuilder = new StringBuilder();
                stringBuilder.AppendLine(MarkdownFormatter.H4(Resources.Attachments));

                foreach (WorkItemFileAttachment attachment in attachments)
                {
                    stringBuilder.AppendLine(MarkdownFormatter.HyperLink(attachment.FileName, attachment.DownloadUrl));
                }

                return(stringBuilder.ToString());
            }

            return(string.Empty);
        }
Beispiel #3
0
        private static string GetFormattedClosingComment(WorkItemDetails workItemDetails)
        {
            string closingComment = workItemDetails.WorkItem.ClosedComment;
            string closedBy       = workItemDetails.WorkItem.ClosedBy;
            string reasonClosed   = workItemDetails.WorkItem.ReasonClosed?.Name;

            // TODO: Produce a different comment if closedBy != null.
            if (!string.IsNullOrEmpty(closingComment) &&
                !string.IsNullOrEmpty(closedBy) &&
                !string.IsNullOrEmpty(reasonClosed))
            {
                string closingCommentTitle = string.Format(Resources.IssueClosedByXWithComment, MarkdownFormatter.Italic(closedBy));

                var stringBuilder =
                    new StringBuilder()
                    .AppendLine(MarkdownFormatter.Bold(closingCommentTitle))
                    .AppendLine(closingComment);

                if (!string.IsNullOrEmpty(reasonClosed) && !StringComparer.Equals(reasonClosed, CodePlexStrings.Unassigned))
                {
                    stringBuilder
                    .AppendLine()
                    .AppendLine(MarkdownFormatter.Bold(Resources.ReasonClosed))
                    .AppendLine(reasonClosed);
                }

                return(stringBuilder.ToString());
            }

            return(string.Empty);
        }