Beispiel #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 }));
        }
Beispiel #2
0
        public ActionResult List(Int32 id = 1)
        {
            ContestEntity contest             = ViewData["Contest"] as ContestEntity;
            PagedList <ForumTopicEntity> list = ForumTopicManager.GetForumTopicList(id, contest.ContestID.ToString(), String.Empty);

            return(ViewWithPager(list, id));
        }
Beispiel #3
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 }));
        }
Beispiel #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)));
        }
Beispiel #5
0
        public ActionResult New(FormCollection form)
        {
            ContestEntity    contest = ViewData["Contest"] as ContestEntity;
            ForumTopicEntity topic   = new ForumTopicEntity()
            {
                Title = form["title"],
            };

            String userip = this.GetCurrentUserIP();

            if (!ForumTopicManager.InsertForumTopic(topic, contest.ContestID.ToString(), String.Empty, form["content"], userip))
            {
                return(RedirectToErrorMessagePage("Failed to post your topic!"));
            }

            return(RedirectToAction("List", "Forum", new { area = "Contest", cid = contest.ContestID }));
        }
Beispiel #6
0
        /// <summary>
        /// 论坛主题列表页面
        /// </summary>
        /// <param name="id">页面索引</param>
        /// <param name="ftids">主题ID列表</param>
        /// <param name="username">发帖人用户名</param>
        /// <param name="title">主题名包含</param>
        /// <param name="type">主题类型</param>
        /// <param name="relativeid">相关ID</param>
        /// <param name="islocked">是否锁定</param>
        /// <param name="ishide">是否隐藏</param>
        /// <param name="startdate">注册时间范围起始</param>
        /// <param name="enddate">注册时间范围结束</param>
        /// <returns>操作后的结果</returns>
        public ActionResult TopicList(Int32 id         = 1,
                                      String ftids     = "", String username = "", String title = "", String type = "", String relativeid = "", String islocked = "", String ishide = "",
                                      String startdate = "", String enddate  = "")
        {
            PagedList <ForumTopicEntity> list = ForumTopicManager.AdminGetForumTopicList(id,
                                                                                         ftids, username, title, type, relativeid, islocked, ishide, startdate, enddate);

            ViewBag.TopicIDs   = ftids;
            ViewBag.UserName   = username;
            ViewBag.Title      = title;
            ViewBag.Type       = type;
            ViewBag.RelativeID = relativeid;
            ViewBag.IsLocked   = islocked;
            ViewBag.IsHide     = ishide;
            ViewBag.StartDate  = startdate;
            ViewBag.EndDate    = enddate;

            return(ViewWithPager(list, id));
        }
Beispiel #7
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)));
        }
Beispiel #8
0
        public ActionResult New(FormCollection form)
        {
            ForumTopicEntity topic = new ForumTopicEntity()
            {
                Title = form["title"]
            };

            String pid    = form["pid"];
            String userip = this.GetCurrentUserIP();

            if (!ForumTopicManager.InsertForumTopic(topic, String.Empty, pid, form["content"], userip))
            {
                return(RedirectToErrorMessagePage("Failed to post your topic!"));
            }

            if (String.IsNullOrEmpty(pid))
            {
                return(RedirectToAction("Main", "Forum"));
            }
            else
            {
                return(RedirectToAction("Problem", "Forum", new { pid = pid }));
            }
        }