Esempio n. 1
0
 public static string ShowTopic(TopicGetResponse tgr)
 {
     string topicStyle = "Topictitle:{0}<br/>LastPostTime:{1}<br/>Author:{2}<br/>TypeName:{3}<br/>";
     string postStyle = "User:{0}<br/>DateTime:{1}<br/>Message:{2}<br/>";
     topicStyle = string.Format(topicStyle, tgr.Title, tgr.LastPostTime, tgr.Author, tgr.TypeName);
     string posts = "";
     if (tgr.Posts != null)
     {
         foreach (Post p in tgr.Posts)
         {
             string post = string.Format(postStyle, p.PosterName, p.PostDateTime, p.Message);
             if (tgr.Attachments != null)
             {
                 foreach (AttachmentInfo a in tgr.Attachments)
                 {
                     if (a.Pid == p.Pid)
                         post += "Attachment:" + a.Filename + "<br/>";
                 }
             }
             post += "<br/>";
             posts += post;
         }
     }
     return topicStyle + "<br/>" + posts;
 }
Esempio n. 2
0
        //uid:用户ID;tid:帖子id;fid:板块id;maxpostscount:每页显示最大帖数;postsLength:主题内帖子总数;maxpageindex:主题的最大页码数
        //部分变量赋值在aspx页面上的OnInit方法中
        protected void Page_Load(object sender, EventArgs e)
        {
            UserAuthrity();

            ReplyBtn.Attributes.Add("onclick", "");

            tid = Util.GetIntFromString(Request["tid"]);
            int pageIndex = Util.GetIntFromString(Request["pageindex"]);
            string[] next;
            if (Request["next"] != null)
            {
                next = Request["next"].Split(',');
                tid = Util.GetIntFromString(next[0]);
                pageIndex = Util.GetIntFromString(next[1]);
            }
            TopicGetResponse tgr = new TopicGetResponse();
            if (tid > 0 && pageIndex > 0)
            {
                tgr = ds.GetTopic(tid, pageIndex, maxpostscount);
                title = tgr.Title;
                posts = ShowPosts(tgr.Posts);
                posturl = tgr.Url;
                postsLength = tgr.ReplyCount + 1;
                maxpageindex = (postsLength / maxpostscount) + 1;
                pagelink = ShowPageLink(tid, maxpageindex, pageIndex);
            }
            fid = tgr.Fid;
        }