Esempio n. 1
0
        public ActionResult Reply(Int32 id, FormCollection form)
        {
            ForumPostEntity  post  = ForumPostManager.GetForumPost(id);
            ForumTopicEntity topic = ForumTopicManager.GetForumTopic(post.TopicID);

            if (topic.Type == ForumTopicType.Contest)
            {
                return(RedirectToErrorMessagePage("This topic is not in the main disscus board!"));
            }

            ForumPostEntity reply = new ForumPostEntity()
            {
                Title   = form["title"],
                Content = form["content"]
            };

            String userip = this.GetCurrentUserIP();
            String link   = Url.Action("Reply", "Forum", new { id = post.PostID });

            if (!ForumPostManager.InsertForumPost(reply, topic, post, userip, link))
            {
                return(RedirectToErrorMessagePage("Failed to post your reply!"));
            }

            return(RedirectToAction("Reply", "Forum", new { id = post.PostID }));
        }
Esempio n. 2
0
        public ActionResult Reply(String id, FormCollection form)
        {
            ContestEntity    contest = ViewData["Contest"] as ContestEntity;
            ForumPostEntity  post    = ForumPostManager.GetForumPostByTopicID(id);
            ForumTopicEntity topic   = ForumTopicManager.GetForumTopic(post.TopicID);

            if (topic.Type != ForumTopicType.Contest || topic.RelativeID != contest.ContestID)
            {
                return(RedirectToErrorMessagePage("This contest does not have this topic!"));
            }

            ForumPostEntity reply = new ForumPostEntity()
            {
                Title   = form["title"],
                Content = form["content"]
            };

            String userip = this.GetCurrentUserIP();
            String link   = Url.Action("Topic", "Forum", new { area = "Contest", cid = contest.ContestID, id = post.TopicID });

            if (!ForumPostManager.InsertForumPost(reply, topic, post, userip, link))
            {
                return(RedirectToErrorMessagePage("Failed to post your reply!"));
            }

            return(RedirectToAction("Topic", "Forum", new { area = "Contest", cid = contest.ContestID, id = post.TopicID }));
        }
Esempio n. 3
0
        public ActionResult Problem(String pid, Int32 id = 1)
        {
            if (String.IsNullOrEmpty(pid))
            {
                throw new InvalidRequstException(RequestType.Problem);
            }

            PagedList <TreeNode <ForumPostEntity> > list = ForumPostManager.GetPostTreeList(id, pid);

            ViewBag.ProblemID = pid;

            return(ViewWithPager("Main", list, id));
        }
Esempio n. 4
0
        /// <summary>
        /// 讨论版主题页面
        /// </summary>
        /// <param name="id">主题ID</param>
        /// <returns>操作后的结果</returns>
        public ActionResult Topic(Int32 id = -1)
        {
            ContestEntity    contest = ViewData["Contest"] as ContestEntity;
            ForumPostEntity  post    = ForumPostManager.GetForumPostByTopicID(id.ToString());
            ForumTopicEntity topic   = ForumTopicManager.GetForumTopic(post.TopicID);

            if (topic.Type != ForumTopicType.Contest || topic.RelativeID != contest.ContestID)
            {
                return(RedirectToErrorMessagePage("This contest does not have this topic!"));
            }

            List <ForumPostEntity> list = ForumPostManager.GetForumPostList(topic, false);

            return(View(new Tuple <ForumTopicEntity, List <ForumPostEntity> >(topic, list)));
        }
Esempio n. 5
0
        /// <summary>
        /// 论坛帖子列表页面
        /// </summary>
        /// <param name="id">页面索引</param>
        /// <param name="fpids">帖子ID列表</param>
        /// <param name="ftids">主题ID列表</param>
        /// <param name="username">发帖人用户名</param>
        /// <param name="title">主题名包含</param>
        /// <param name="content">帖子内容包含</param>
        /// <param name="ishide">是否隐藏</param>
        /// <param name="startdate">注册时间范围起始</param>
        /// <param name="enddate">注册时间范围结束</param>
        /// <param name="postip">发帖IP包含</param>
        /// <returns>操作后的结果</returns>
        public ActionResult PostList(Int32 id         = 1,
                                     String fpids     = "", String ftids   = "", String username = "", String title = "", String content = "", String ishide = "",
                                     String startdate = "", String enddate = "", String postip   = "")
        {
            PagedList <ForumPostEntity> list = ForumPostManager.AdminGetForumPostList(id,
                                                                                      fpids, ftids, username, title, content, ishide, startdate, enddate, postip);

            ViewBag.PostIDs   = fpids;
            ViewBag.TopicIDs  = ftids;
            ViewBag.UserName  = username;
            ViewBag.Title     = title;
            ViewBag.Content   = content;
            ViewBag.IsHide    = ishide;
            ViewBag.StartDate = startdate;
            ViewBag.EndDate   = enddate;
            ViewBag.PostIP    = postip;

            return(ViewWithPager(list, id));
        }
Esempio n. 6
0
        /// <summary>
        /// 讨论版回复页面
        /// </summary>
        /// <param name="id">帖子ID</param>
        /// <param name="tid">主题ID</param>
        /// <returns>操作后的结果</returns>
        public ActionResult Reply(Int32 id = -1, String tid = "")
        {
            ForumPostEntity  post  = (String.IsNullOrEmpty(tid) ? ForumPostManager.GetForumPost(id) : ForumPostManager.GetForumPostByTopicID(tid));
            ForumTopicEntity topic = ForumTopicManager.GetForumTopic(post.TopicID);

            if (topic.Type == ForumTopicType.Contest)
            {
                return(RedirectToErrorMessagePage("This topic is not in the main disscus board!"));
            }

            post.RelativeType = (topic.Type == ForumTopicType.Problem ? topic.Type : ForumTopicType.Default);
            post.RelativeID   = (topic.Type == ForumTopicType.Problem ? topic.RelativeID : -1);

            List <TreeNode <ForumPostEntity> > listTreeNode = ForumPostManager.GetPostTreeList(topic, post.PostID);

            ViewBag.IsLocked = topic.IsLocked;

            return(View(new Tuple <ForumPostEntity, List <TreeNode <ForumPostEntity> > >(post, listTreeNode)));
        }
Esempio n. 7
0
        public ActionResult Main(Int32 id = 1)
        {
            PagedList <TreeNode <ForumPostEntity> > list = ForumPostManager.GetPostTreeList(id, String.Empty);

            return(ViewWithPager("Main", list, id));
        }