예제 #1
0
        //public ThreadModel(string forumID, string threadID, Func<string, string, XmlNode> fun = null)
        //{
        //    XmlNode node=null;
        //    if (fun == null)
        //        node = CommunityHelper.ReadThread(forumID, threadID);
        //    else
        //        node = fun(forumID, threadID);

        //    Initialize(node);

        // }

        public void Initialize(XmlNode childNode)
        {
            if (childNode != null)
            {
                ThreadID = childNode.SelectSingleNode("Id").InnerText;
                ForumID  = childNode.SelectSingleNode("ForumId").InnerText;
                // TODO: Complete member initialization
                //this.childNode = childNode;
                Subject      = childNode.SelectSingleNode("Subject").InnerText;
                ReplyCount   = childNode.SelectSingleNode("ReplyCount").InnerText ?? "0";
                LastPostDate = Convert.ToDateTime(childNode.SelectSingleNode("LatestPostDate").InnerText);
                LastPostTime = formatDateFunc(childNode.SelectSingleNode("LatestPostDate").InnerText);
                if (!ReplyCount.Equals("0"))
                {
                    LastPostUser = Replies.OrderByDescending(x => x.Date).First().AuthorName;
                    LastPostBody = Replies.OrderByDescending(x => x.Date).First().Body;
                }
                StartedBy     = childNode.SelectSingleNode("Author/Username").InnerText ?? "admin";
                Snippet       = formatBodyFunc(childNode.SelectSingleNode("Body").InnerText);
                Body          = childNode.SelectSingleNode("Body").InnerText;
                ContentId     = childNode.SelectSingleNode("ContentId").InnerText;
                ContentTypeId = childNode.SelectSingleNode("ContentTypeId").InnerText;
            }
            else
            {
                throw new Exception("Null object");
            }
        }
예제 #2
0
파일: Report.cs 프로젝트: TomeQ2k/_Smile
 public Report SortReplies()
 {
     Replies = Replies.OrderByDescending(r => r.DateSent).ToList();
     return(this);
 }