Ejemplo n.º 1
0
        protected override void CreateObject()
        {
            // Create the correct forum object given query string parrameters in order
            // to perform correct CreateChildControls, OnPreRender and Render operations.
            int postID = Convert.ToInt32(Page.Request.QueryString["postid"]);
            string action = Page.Request.QueryString["forumaction"];

            if (postID == 0)
            {
                if (action == "new")
                {
                    WebSolutionObject = new ForumForm(this, postID, action);
                }
                else if (action == "search")
                {
                    int searchPage = Convert.ToInt32(Page.Request.QueryString["searchpage"]);
                    if (searchPage > 0)
                        searchPage = searchPage - 1;

                    string searchTerms = Page.Request.QueryString["searchterms"];
                    if (searchTerms != null && searchTerms != string.Empty)
                    {
                        searchTerms = searchTerms.Replace(":amp:", "&");
                        searchTerms = searchTerms.Replace("'", "''");
                    }

                    WebSolutionObject = new ForumSearch(this, searchPage, searchTerms);
                }
                else
                {
                    int threadsPage = Convert.ToInt32(Page.Request.QueryString["threadspage"]);
                    if (threadsPage > 0)
                        threadsPage = threadsPage - 1;

                    WebSolutionObject = new ForumThreads(this, threadsPage);
                }
            }
            else
            {
                if (action == "edit" || action == "reply" || action == "quote")
                    WebSolutionObject = new ForumForm(this, postID, action);
                else
                    WebSolutionObject = new ForumThread(this, postID);
            }
        }