コード例 #1
0
ファイル: Translator.cs プロジェクト: kyvkri/MG
        public static List<WishJSON> translate(List<Wish> list)
        {
            List<WishJSON> jsonList = new List<WishJSON>();

            foreach (Wish w in list)
            {
                WishJSON wj = new WishJSON();
                wj.nodeId = w.NodeId;
                wj.name = w.Name;
                wj.description = w.Description;
                wj.numComments = w.Comments.Count;

                if (w.HyperLink.LinkType == WAF.Engine.Property.LinkType.ExternalAddress)
                {
                    wj.hyperLink = w.HyperLink.GetUrl();
                }

                List<CommentJSON> commentList = new List<CommentJSON>();
                foreach (Comment c in w.Comments.GetAll())
                {
                    CommentJSON commentJSON = new CommentJSON();
                    commentJSON.commentText = c.CommentText;
                    commentJSON.commenter = c.Commenter;
                    commentJSON.commentedDate = c.CommentedDate.ToShortDateString();
                    commentList.Add(commentJSON);
                }
                wj.comments = commentList;

                jsonList.Add(wj);
            }

            return jsonList;
        }
コード例 #2
0
ファイル: Translator.cs プロジェクト: kyvkri/mg-git
 public static List<CommentJSON> TranslateComments(List<Comment> comments)
 {
     List<CommentJSON> commentList = new List<CommentJSON>();
     foreach (Comment c in comments)
     {
         CommentJSON commentJSON = new CommentJSON();
         commentJSON.commentText = c.CommentText;
         commentJSON.commenter = c.Commenter;
         commentJSON.commentedDate = c.CommentedDate.ToShortDateString();
         commentJSON.contentId = c.ContentId;
         commentList.Add(commentJSON);
     }
     return commentList;
 }