Exemple #1
0
        private ICommentProperties CreateComment(XmlNode commentNode)
        {
            ICommentProperties commentProperties = PropertiesFactory.CreateCommentProperties();

            var createdBy = commentNode.Attributes["created-by"]?.Value;
            var resolved  = commentNode.Attributes["resolved"]?.Value;

            string author = string.Empty;

            if (createdBy != null)
            {
                author = users[createdBy];
            }

            Severity severity = Severity.Low;

            if (resolved != null && (resolved == "false"))
            {
                severity = Severity.Medium;
            }

            var comment = PropertiesFactory.CreateComment(commentNode.InnerText,
                                                          author, severity);

            commentProperties.Add(comment);

            return(commentProperties);
        }
        private ICommentProperties CreateComment(string commentText)
        {
            ICommentProperties commentProperties = PropertiesFactory.CreateCommentProperties();
            IComment           comment           = PropertiesFactory.CreateComment(commentText, "SDK Sample", Severity.Medium);

            commentProperties.Add(comment);

            return(commentProperties);
        }
        private ICommentProperties CreateComment(XmlNode item)
        {
            ICommentProperties commentProperties = PropertiesFactory.CreateCommentProperties();

            var xmlNodeList = item.SelectNodes("comment");

            if (xmlNodeList != null)
            {
                foreach (XmlNode commentNode in xmlNodeList)
                {
                    var commentSeverity = Severity.Undefined;

                    var selectSingleNode = commentNode.SelectSingleNode("./@type");
                    if (selectSingleNode != null)
                    {
                        if (selectSingleNode.InnerText == "text")
                        {
                            commentSeverity = Severity.Low;
                        }
                        if (selectSingleNode.InnerText == "question")
                        {
                            commentSeverity = Severity.Medium;
                        }
                        if (selectSingleNode.InnerText == "important")
                        {
                            commentSeverity = Severity.High;
                        }
                    }

                    var singleNode = commentNode.SelectSingleNode("./@creationid");
                    if (singleNode != null)
                    {
                        IComment comment = PropertiesFactory.CreateComment(commentNode.InnerText,
                                                                           singleNode.InnerText, commentSeverity);
                        commentProperties.Add(comment);
                    }
                }
            }

            return(commentProperties);
        }