Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        public static List<WishJSON> TranslateWishes(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();
                }

                wj.comments = TranslateComments(w.Comments.GetAll());

                jsonList.Add(wj);
            }

            return jsonList;
        }