コード例 #1
0
ファイル: ForumPageBase.cs プロジェクト: zhangbo27/bbsmax
        //根据主题分类ID返回该分类的名称
        protected string GetThreadCatalogName(int threadCatalogID, string style)
        {
            if (threadCatalogID != 0)
            {
                ThreadCatalog catalog = ForumBO.Instance.GetAllThreadCatalogs().GetValue(threadCatalogID);
                if (catalog != null)
                {
                    return(string.Format(style, catalog.ThreadCatalogName));
                }
            }

            return(string.Empty);
        }
コード例 #2
0
ファイル: ForumBO.cs プロジェクト: zhangbo27/bbsmax
        /// <summary>
        /// 获得某个论坛下的所有主题分类
        /// </summary>
        /// <param name="forumID"></param>
        /// <returns></returns>
        public ThreadCatalogCollection GetThreadCatalogs(int forumID)
        {
            Dictionary <int, ThreadCatalogCollection> allForumThreadCatalogs = s_AllForumThreadCatalogs;

            if (allForumThreadCatalogs == null)
            {
                allForumThreadCatalogs = new Dictionary <int, ThreadCatalogCollection>();

                ForumThreadCatalogCollection forumThreadCatalogs = ForumDaoV5.Instance.GetThreadCatalogsInForums();

                foreach (ForumThreadCatalog forumThreadCatalog in forumThreadCatalogs)
                {
                    ThreadCatalog tempThreadCatalog = GetThreadCatalog(forumThreadCatalog.ThreadCatalogID);
                    if (tempThreadCatalog == null)
                    {
                        continue;
                    }

                    ThreadCatalog catalog = tempThreadCatalog.Clone();
                    catalog.ThreadCount = forumThreadCatalog.TotalThreads;

                    if (allForumThreadCatalogs.ContainsKey(forumThreadCatalog.ForumID) == false)
                    {
                        allForumThreadCatalogs.Add(forumThreadCatalog.ForumID, new ThreadCatalogCollection());
                    }
                    allForumThreadCatalogs[forumThreadCatalog.ForumID].Add(catalog);
                }

                s_AllForumThreadCatalogs = allForumThreadCatalogs;
            }

            ThreadCatalogCollection threadCatalogs;

            if (!allForumThreadCatalogs.TryGetValue(forumID, out threadCatalogs))
            {
                return(new ThreadCatalogCollection());
            }

            return(threadCatalogs);
        }
コード例 #3
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            //点击了快速发帖按钮
            if (_Request.IsClick("postButton"))
            {
                ProcessThread();
            }

            ForumBO.Instance.SetForumsLastThread(Forum.SubForumsForList);

            int totalThreads = 0;

            int pageSize = AllSettings.Current.BbsSettings.ThreadsPageSize;

            if (_Request.IsSpider)
            {
                if (ThreadCatalogID != -1)
                {
                    m_ThreadCatalogID = -1;
                }

                if (Action != "list")
                {
                    m_Action = "list";
                }
            }

            //如果要显示某个主题分类的主题
            if (ThreadCatalogID != -1)
            {
                AddNavigationItem(Forum.ForumName, BbsUrlHelper.GetForumUrl(CodeName));

                Action = "";
                if (ThreadCatalogID != 0)
                {
                    ThreadCatalog threadCatalog = ForumBO.Instance.GetThreadCatalog(ThreadCatalogID);
                    if (threadCatalog == null)
                    {
                        Response.End();
                    }

                    AddNavigationItem(string.Concat("[", threadCatalog.ThreadCatalogName, "]"));
                    //navigation += "  [" + threadCatalog.ThreadCatalogName + "]";
                }
                else
                {
                    AddNavigationItem("[其他]");
                }
                //navigation += "    [其他]";


                threads = PostBOV5.Instance.GetThreads(ForumID, ThreadCatalogID, PageNumber, pageSize, SortType, BeginDate, EndDate, IsDesc, out totalThreads);

                //设置分页控件的显示
                SetPager("ThreadListPager", BbsUrlHelper.GetThreadCatalogUrlForPager(CodeName, ThreadCatalogID) + (parms == null ? "" : "?" + parms), PageNumber, pageSize, totalThreads);
                //url = BbsUrlHelper.GetForumEmoticonUrlForPager(CodeName, ThreadCatalogID, PageNumber, IsGetAllDefaultEmoticon, EmoticonGroupID);
            }
            else
            {
                string navigation = null;

                switch (Action)
                {
                //精华帖
                case "valued":

                    navigation = "[精华帖]";
                    threads    = PostBOV5.Instance.GetValuedThreads(ForumID, PageNumber, pageSize, SortType, BeginDate, EndDate, IsDesc, true, out totalThreads);

                    break;

                //投票帖
                case "poll":

                    navigation = "[投票帖]";
                    threads    = PostBOV5.Instance.GetThreads(ForumID, ThreadType.Poll, PageNumber, pageSize, SortType, BeginDate, EndDate, IsDesc, true, out totalThreads);
                    break;

                //问题帖
                case "question":

                    navigation = "[提问帖]";
                    threads    = PostBOV5.Instance.GetThreads(ForumID, ThreadType.Question, PageNumber, pageSize, SortType, BeginDate, EndDate, IsDesc, true, out totalThreads);
                    break;

                //辩论帖
                case "polemize":

                    navigation = "[辩论帖]";
                    threads    = PostBOV5.Instance.GetThreads(ForumID, ThreadType.Polemize, PageNumber, pageSize, SortType, BeginDate, EndDate, IsDesc, true, out totalThreads);
                    break;

                //回收
                case "recycled":

                    IsNormalThreads = false;
                    IsRecycleBin    = true;
                    navigation      = "[回收站]";
                    if (ForumManagePermission.HasPermissionForSomeone(My, ManageForumPermissionSetNode.ActionWithTarget.SetThreadsRecycled) == false)
                    {
                        ShowError("您没有权限进入回收站");
                    }
                    threads = PostBOV5.Instance.GetThreadsByStatus(ThreadStatus.Recycled, ForumID, SortType, BeginDate, EndDate, IsDesc, PageNumber, pageSize, out totalThreads);
                    break;

                //未审核主题
                case "unapproved":

                    IsNormalThreads     = false;
                    IsUnapprovedThreads = true;
                    navigation          = "[未审核主题]";
                    if (ForumManagePermission.HasPermissionForSomeone(My, ManageForumPermissionSetNode.ActionWithTarget.ApproveThreads) == false)
                    {
                        ShowError("您没有权限查看未审核的主题");
                    }

                    threads = PostBOV5.Instance.GetThreadsByStatus(ThreadStatus.UnApproved, ForumID, SortType, BeginDate, EndDate, IsDesc, PageNumber, pageSize, out totalThreads);
                    break;

                //未审核回复
                case "unapprovedpost":

                    IsNormalThreads          = false;
                    IsUnapprovedPostsThreads = true;
                    navigation = "[未审核回复]";
                    if (ForumManagePermission.Can(My, ManageForumPermissionSetNode.Action.ApprovePosts) == false)
                    {
                        ShowError("您没有权限查看未审核的回复");
                    }
                    threads      = PostBOV5.Instance.GetUnapprovedPostThreads(ForumID, PageNumber, pageSize);
                    totalThreads = threads.TotalRecords;
                    break;

                //正常帖子
                default:

                    IsDefaultList = true;
                    Action        = "list";
                    threads       = PostBOV5.Instance.GetThreads(ForumID, SortType, BeginDate, EndDate, IsDesc, PageNumber, pageSize, _Request.IsSpider, out totalThreads);
                    break;
                }

                if (navigation == null)
                {
                    AddNavigationItem(Forum.ForumName);
                }
                else
                {
                    AddNavigationItem(Forum.ForumName, BbsUrlHelper.GetForumUrl(CodeName));
                    AddNavigationItem(navigation);
                }

                //设置分页控件的显示
                SetPager("ThreadListPager", BbsUrlHelper.GetForumUrlForPager(CodeName, Action) + (parms == null ? "" : "?" + parms), PageNumber, pageSize, totalThreads);
                //url = BbsUrlHelper.GetForumEmoticonUrlForPager(CodeName, Action, PageNumber, IsGetAllDefaultEmoticon, EmoticonGroupID);
            }

            if (PageNumber > 1 && threads.Count == 0)
            {
                Response.Redirect(AttachQueryString("page=1"));
            }


            //更新用户在在线列表中的状态
            UpdateOnlineStatus(OnlineAction.ViewThreadList, 0, "");
            //OnlineManager.UpdateOnlineUser(MyUserID, ForumID, 0, My.OnlineStatus, OnlineAction.ViewThreadList, Request, Response);

            if (IsNormalThreads)
            {
                PostBOV5.Instance.ProcessKeyword(threads, ProcessKeywordMode.TryUpdateKeyword);
            }
            else
            {
                PostBOV5.Instance.ProcessKeyword(threads, ProcessKeywordMode.FillOriginalText);
            }

            if (CanManageThread)
            {
                List <int> userIDs = new List <int>();
                foreach (BasicThread thread in threads)
                {
                    if (userIDs.Contains(thread.PostUserID) == false)
                    {
                        userIDs.Add(thread.PostUserID);
                    }
                }

                UserBO.Instance.GetUsers(userIDs, GetUserOption.WithAll);
            }

            WaitForFillSimpleUsers <Moderator>(Forum.Moderators);
            foreach (Forum subForum in Forum.SubForumsForList)
            {
                WaitForFillSimpleUsers <Moderator>(subForum.Moderators);
            }

            SubmitFillUsers();
        }
コード例 #4
0
        private void SaveThreadCatalogs()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("sortOrder", "threadcatalogname");

            ThreadCatalogStatus threadCatalogStatus = _Request.Get <ThreadCatalogStatus>("threadCategorySet", Method.Post, ThreadCatalogStatus.Enable);

            if (threadCatalogStatus == ThreadCatalogStatus.DisEnable)
            {
                if (Forum.ThreadCatalogStatus != threadCatalogStatus)
                {
                    try
                    {
                        bool success = ForumBO.Instance.UpdateForumThreadCatalogStatus(Forum.ForumID, threadCatalogStatus);
                        if (!success)
                        {
                            CatchError <ErrorInfo>(delegate(ErrorInfo error)
                            {
                                msgDisplay.AddError(error);
                            });
                        }
                        else
                        {
                            forum = null;
                            _Request.Clear(Method.Post);
                        }
                    }
                    catch (Exception ex)
                    {
                        msgDisplay.AddError(ex.Message);
                    }

                    return;
                }
            }


            int[] indexs = _Request.GetList <int>("catagories", Method.Post, new int[0]);

            //names = new Dictionary<int, string>();


            //List<ForumThreadCatalog> forumThreadCatalogs = new List<ForumThreadCatalog>();

            forumThreadCatalogs = new ForumThreadCatalogCollection();

            Dictionary <int, string> indexAndNames = new Dictionary <int, string>();

            List <int> sortOrders = new List <int>();

            List <string> newCatalogNames = new List <string>();

            foreach (int i in indexs)
            {
                ForumThreadCatalog catalog = new ForumThreadCatalog();
                catalog.ForumID         = Forum.ForumID;
                catalog.ThreadCatalogID = _Request.Get <int>("threadCatagories_" + i, Method.Post, 0);
                catalog.SortOrder       = _Request.Get <int>("sortorder_" + i, Method.Post, 0);
                string name = _Request.Get("threadCatalogName_" + i, Method.Post, string.Empty, false).Trim();
                catalog.ThreadCatalog = new ThreadCatalog();
                catalog.ThreadCatalog.ThreadCatalogName = name;


                if (name == string.Empty)
                {
                    msgDisplay.AddError("threadcatalogname", i, "分类名称不能为空");
                }
                else
                {
                    if (indexAndNames.ContainsValue(name))
                    {
                        msgDisplay.AddError("threadcatalogname", i, "重复的分类名称");
                    }
                    indexAndNames.Add(i, name);
                }


                if (sortOrders.Contains(catalog.SortOrder))
                {
                    msgDisplay.AddError("SortOrder", i, "重复的排序数字");
                }

                if (catalog.ThreadCatalogID == 0)
                {
                    newCatalogNames.Add(name);
                }

                sortOrders.Add(catalog.SortOrder);

                if (forumThreadCatalogs.GetValue(catalog.ForumID, catalog.ThreadCatalogID) == null)
                {
                    forumThreadCatalogs.Add(catalog);
                }
            }


            int[] newIndexs = _Request.GetList <int>("newcatagories", Method.Post, new int[0]);


            List <ForumThreadCatalog> newForumThreadCatalogs = new List <ForumThreadCatalog>();
            int j = 0;

            foreach (int i in newIndexs)
            {
                int tempI = j + indexs.Length;
                ForumThreadCatalog catalog = new ForumThreadCatalog();
                catalog.ForumID         = Forum.ForumID;
                catalog.ThreadCatalogID = _Request.Get <int>("new_threadCatagories_" + i, Method.Post, 0);
                catalog.SortOrder       = _Request.Get <int>("new_sortorder_" + i, Method.Post, 0);
                string name = _Request.Get("new_threadCatalogName_" + i, Method.Post, string.Empty, false);
                catalog.ThreadCatalog = new ThreadCatalog();
                catalog.ThreadCatalog.ThreadCatalogName = name;
                catalog.IsNew = true;


                if (name == string.Empty)
                {
                    msgDisplay.AddError("threadcatalogname", tempI, "分类名称不能为空");
                }
                else
                {
                    if (indexAndNames.ContainsValue(name))
                    {
                        msgDisplay.AddError("threadcatalogname", tempI, "重复的分类名称");
                    }
                    indexAndNames.Add(tempI, name);
                }


                if (sortOrders.Contains(catalog.SortOrder))
                {
                    msgDisplay.AddError("SortOrder", tempI, "重复的排序数字");
                }

                if (catalog.ThreadCatalogID == 0)
                {
                    newCatalogNames.Add(name);
                }

                sortOrders.Add(catalog.SortOrder);

                //if (forumThreadCatalogs.GetValue(catalog.ForumID, catalog.ThreadCatalogID) == null)
                //forumThreadCatalogs.Add(catalog);
                newForumThreadCatalogs.Add(catalog);
                j++;
            }



            if (msgDisplay.HasAnyError())
            {
                //forumThreadCatalogs.AddRange(newForumThreadCatalogs);
                int i = 0;
                foreach (ForumThreadCatalog catalog in newForumThreadCatalogs)
                {
                    catalog.ThreadCatalogID = i;
                    forumThreadCatalogs.Add(catalog);
                    i--;
                }
                return;
            }

            try
            {
                if (indexAndNames.Count == 0)
                {
                    msgDisplay.AddError("您已经启用了主题分类,必须至少添加一个主题分类");
                    return;
                }

                if (Forum.ThreadCatalogStatus != threadCatalogStatus)
                {
                    try
                    {
                        bool success = ForumBO.Instance.UpdateForumThreadCatalogStatus(Forum.ForumID, threadCatalogStatus);
                        if (!success)
                        {
                            CatchError <ErrorInfo>(delegate(ErrorInfo error)
                            {
                                msgDisplay.AddError(error);
                            });
                        }
                    }
                    catch (Exception ex)
                    {
                        msgDisplay.AddError(ex.Message);
                        return;
                    }
                }

                ThreadCatalogCollection threadCatalogs = ForumBO.Instance.CreateThreadCatelogs(newCatalogNames);

                //List<ForumThreadCatalog> results = new List<ForumThreadCatalog>();

                //ForumManager.UpdateThreadCatalogs

                ThreadCatalogCollection needUpdateThreadCatalogs = new ThreadCatalogCollection();
                for (int i = 0; i < forumThreadCatalogs.Count; i++)
                {
                    //if (forumThreadCatalogs[i].ThreadCatalogID != 0)
                    //{
                    ThreadCatalog tempThreadCatalog = new ThreadCatalog();
                    tempThreadCatalog.ThreadCatalogName = forumThreadCatalogs[i].ThreadCatalog.ThreadCatalogName;
                    tempThreadCatalog.ThreadCatalogID   = forumThreadCatalogs[i].ThreadCatalogID;
                    tempThreadCatalog.LogoUrl           = string.Empty;
                    needUpdateThreadCatalogs.Add(tempThreadCatalog);
                    //}
                    //else
                    //{
                    //    foreach (ThreadCatalog threadCatalog in threadCatalogs)
                    //    {
                    //        if (forumThreadCatalogs[i].ThreadCatalog.ThreadCatalogName == threadCatalog.ThreadCatalogName)
                    //        {
                    //            forumThreadCatalogs[i].ThreadCatalogID = threadCatalog.ThreadCatalogID;
                    //            //results.Add(forumThreadCatalogs[i]);
                    //            break;
                    //        }

                    //    }
                    //}
                }

                ForumBO.Instance.UpdateThreadCatalogs(needUpdateThreadCatalogs);
                //ForumManager.UpdateThreadCatalogs(needUpdateThreadCatalogs);

                for (int i = 0; i < newForumThreadCatalogs.Count; i++)
                {
                    foreach (ThreadCatalog threadCatalog in threadCatalogs)
                    {
                        if (newForumThreadCatalogs[i].ThreadCatalog.ThreadCatalogName == threadCatalog.ThreadCatalogName)
                        {
                            newForumThreadCatalogs[i].ThreadCatalogID = threadCatalog.ThreadCatalogID;
                            forumThreadCatalogs.Add(newForumThreadCatalogs[i]);
                            //results.Add(forumThreadCatalogs[i]);
                            break;
                        }
                    }
                }


                //if (ForumManager.AddThreadCatalogToForum(Forum.ForumID, forumThreadCatalogs) == true)
                if (ForumBO.Instance.AddThreadCatalogToForum(Forum.ForumID, forumThreadCatalogs) == true)
                {
                    forumThreadCatalogs = null;
                    forum = null;
                    _Request.Clear(Method.Post);
                }
                else
                {
                    msgDisplay.AddError("添加主题分类失败");
                }
            }
            catch (Exception ex)
            {
                msgDisplay.AddError(ex.Message);
            }
        }
コード例 #5
0
        private void SaveThreadCatalogs()
        {
            MessageDisplay msgDisplay = CreateMessageDisplay("sortOrder", "threadcatalogname");

            ThreadCatalogStatus threadCatalogStatus = _Request.Get<ThreadCatalogStatus>("threadCategorySet", Method.Post, ThreadCatalogStatus.Enable);

            if (threadCatalogStatus == ThreadCatalogStatus.DisEnable)
            {
                if (Forum.ThreadCatalogStatus != threadCatalogStatus)
                {
                    try
                    {
                        bool success = ForumBO.Instance.UpdateForumThreadCatalogStatus(Forum.ForumID, threadCatalogStatus);
                        if (!success)
                        {
                            CatchError<ErrorInfo>(delegate(ErrorInfo error)
                            {
                                msgDisplay.AddError(error);
                            });
                        }
                        else
                        {
                            forum = null;
                            _Request.Clear(Method.Post);
                        }
                    }
                    catch (Exception ex)
                    {
                        msgDisplay.AddError(ex.Message);
                    }

                    return;
                }
            }


            int[] indexs = _Request.GetList<int>("catagories", Method.Post, new int[0]);

            //names = new Dictionary<int, string>();


            //List<ForumThreadCatalog> forumThreadCatalogs = new List<ForumThreadCatalog>();

            forumThreadCatalogs = new ForumThreadCatalogCollection();

            Dictionary<int, string> indexAndNames = new Dictionary<int, string>();

            List<int> sortOrders = new List<int>();

            List<string> newCatalogNames = new List<string>();

            foreach (int i in indexs)
            {
                ForumThreadCatalog catalog = new ForumThreadCatalog();
                catalog.ForumID = Forum.ForumID;
                catalog.ThreadCatalogID = _Request.Get<int>("threadCatagories_" + i, Method.Post, 0);
                catalog.SortOrder = _Request.Get<int>("sortorder_" + i, Method.Post, 0);
                string name = _Request.Get("threadCatalogName_" + i, Method.Post, string.Empty, false).Trim();
                catalog.ThreadCatalog = new ThreadCatalog();
                catalog.ThreadCatalog.ThreadCatalogName = name;


                if (name == string.Empty)
                {
                    msgDisplay.AddError("threadcatalogname", i, "分类名称不能为空");
                }
                else
                {
                    if (indexAndNames.ContainsValue(name))
                    {
                        msgDisplay.AddError("threadcatalogname", i, "重复的分类名称");
                    }
                    indexAndNames.Add(i, name);
                }


                if (sortOrders.Contains(catalog.SortOrder))
                {
                    msgDisplay.AddError("SortOrder", i, "重复的排序数字");
                }

                if (catalog.ThreadCatalogID == 0)
                    newCatalogNames.Add(name);

                sortOrders.Add(catalog.SortOrder);

                if (forumThreadCatalogs.GetValue(catalog.ForumID, catalog.ThreadCatalogID) == null)
                    forumThreadCatalogs.Add(catalog);

            }


            int[] newIndexs = _Request.GetList<int>("newcatagories", Method.Post, new int[0]);


            List<ForumThreadCatalog> newForumThreadCatalogs = new List<ForumThreadCatalog>();
            int j = 0;
            foreach (int i in newIndexs)
            {
                int tempI = j + indexs.Length;
                ForumThreadCatalog catalog = new ForumThreadCatalog();
                catalog.ForumID = Forum.ForumID;
                catalog.ThreadCatalogID = _Request.Get<int>("new_threadCatagories_" + i, Method.Post, 0);
                catalog.SortOrder = _Request.Get<int>("new_sortorder_" + i, Method.Post, 0);
                string name = _Request.Get("new_threadCatalogName_" + i, Method.Post, string.Empty, false);
                catalog.ThreadCatalog = new ThreadCatalog();
                catalog.ThreadCatalog.ThreadCatalogName = name;
                catalog.IsNew = true;


                if (name == string.Empty)
                {
                    msgDisplay.AddError("threadcatalogname", tempI, "分类名称不能为空");
                }
                else
                {
                    if (indexAndNames.ContainsValue(name))
                    {
                        msgDisplay.AddError("threadcatalogname", tempI, "重复的分类名称");
                    }
                    indexAndNames.Add(tempI, name);
                }


                if (sortOrders.Contains(catalog.SortOrder))
                {
                    msgDisplay.AddError("SortOrder", tempI, "重复的排序数字");
                }

                if (catalog.ThreadCatalogID == 0)
                    newCatalogNames.Add(name);

                sortOrders.Add(catalog.SortOrder);

                //if (forumThreadCatalogs.GetValue(catalog.ForumID, catalog.ThreadCatalogID) == null)
                //forumThreadCatalogs.Add(catalog);
                newForumThreadCatalogs.Add(catalog);
                j++;
            }



            if (msgDisplay.HasAnyError())
            {
                //forumThreadCatalogs.AddRange(newForumThreadCatalogs);
                int i = 0;
                foreach (ForumThreadCatalog catalog in newForumThreadCatalogs)
                {
                    catalog.ThreadCatalogID = i;
                    forumThreadCatalogs.Add(catalog);
                    i--;
                }
                return;
            }

            try
            {
                if (indexAndNames.Count == 0)
                {
                    msgDisplay.AddError("您已经启用了主题分类,必须至少添加一个主题分类");
                    return;
                }

                if (Forum.ThreadCatalogStatus != threadCatalogStatus)
                {
                    try
                    {
                        bool success = ForumBO.Instance.UpdateForumThreadCatalogStatus(Forum.ForumID, threadCatalogStatus);
                        if (!success)
                        {
                            CatchError<ErrorInfo>(delegate(ErrorInfo error)
                            {
                                msgDisplay.AddError(error);
                            });
                        }
                    }
                    catch (Exception ex)
                    {
                        msgDisplay.AddError(ex.Message);
                        return;
                    }
                }

                ThreadCatalogCollection threadCatalogs = ForumBO.Instance.CreateThreadCatelogs(newCatalogNames);

                //List<ForumThreadCatalog> results = new List<ForumThreadCatalog>();

                //ForumManager.UpdateThreadCatalogs

                ThreadCatalogCollection needUpdateThreadCatalogs = new ThreadCatalogCollection();
                for (int i = 0; i < forumThreadCatalogs.Count; i++)
                {
                    //if (forumThreadCatalogs[i].ThreadCatalogID != 0)
                    //{
                        ThreadCatalog tempThreadCatalog = new ThreadCatalog();
                        tempThreadCatalog.ThreadCatalogName = forumThreadCatalogs[i].ThreadCatalog.ThreadCatalogName;
                        tempThreadCatalog.ThreadCatalogID = forumThreadCatalogs[i].ThreadCatalogID;
                        tempThreadCatalog.LogoUrl = string.Empty;
                        needUpdateThreadCatalogs.Add(tempThreadCatalog);
                    //}
                    //else
                    //{
                    //    foreach (ThreadCatalog threadCatalog in threadCatalogs)
                    //    {
                    //        if (forumThreadCatalogs[i].ThreadCatalog.ThreadCatalogName == threadCatalog.ThreadCatalogName)
                    //        {
                    //            forumThreadCatalogs[i].ThreadCatalogID = threadCatalog.ThreadCatalogID;
                    //            //results.Add(forumThreadCatalogs[i]);
                    //            break;
                    //        }

                    //    }
                    //}

                }

                ForumBO.Instance.UpdateThreadCatalogs(needUpdateThreadCatalogs);
                //ForumManager.UpdateThreadCatalogs(needUpdateThreadCatalogs);

                for (int i = 0; i < newForumThreadCatalogs.Count; i++)
                {
                    foreach (ThreadCatalog threadCatalog in threadCatalogs)
                    {
                        if (newForumThreadCatalogs[i].ThreadCatalog.ThreadCatalogName == threadCatalog.ThreadCatalogName)
                        {
                            newForumThreadCatalogs[i].ThreadCatalogID = threadCatalog.ThreadCatalogID;
                            forumThreadCatalogs.Add(newForumThreadCatalogs[i]);
                            //results.Add(forumThreadCatalogs[i]);
                            break;
                        }

                    }
                }


                //if (ForumManager.AddThreadCatalogToForum(Forum.ForumID, forumThreadCatalogs) == true)
                if (ForumBO.Instance.AddThreadCatalogToForum(Forum.ForumID, forumThreadCatalogs) == true)
                {
                    forumThreadCatalogs = null;
                    forum = null;
                    _Request.Clear(Method.Post);
                }
                else
                {
                    msgDisplay.AddError("添加主题分类失败");
                }
            }
            catch (Exception ex)
            {
                msgDisplay.AddError(ex.Message);
            }

        }