Beispiel #1
0
        /// <summary>
        /// 重建指定论坛帖数
        /// </summary>
        public static void ReSetFourmTopicAPost(int fid, out int topiccount, out int postcount, out int lasttid, out string lasttitle, out string lastpost, out int lastposterid, out string lastposter, out int todaypostcount)
        {
            topiccount     = 0;
            postcount      = 0;
            lasttid        = 0;
            lasttitle      = "";
            lastpost       = "";
            lastposterid   = 0;
            lastposter     = "";
            todaypostcount = 0;
            if (fid < 1)
            {
                return;
            }

            topiccount = Topics.GetAllTopicCount(fid);
            postcount  = GetPostsCountByFid(fid, out todaypostcount);

            IDataReader postreader = DatabaseProvider.GetInstance().GetLastPostByFid(fid, Posts.GetPostTableName());

            if (postreader.Read())
            {
                lasttid      = Utils.StrToInt(postreader["tid"], 0);
                lasttitle    = Topics.GetTopicInfo(lasttid).Title;//postreader["title"].ToString();
                lastpost     = postreader["postdatetime"].ToString();
                lastposterid = Utils.StrToInt(postreader["posterid"], 0);
                lastposter   = postreader["poster"].ToString();
            }

            postreader.Close();
        }
Beispiel #2
0
        /// <summary>
        /// 重建论坛帖数
        /// </summary>
        /// <param name="statcount">要设置的版块数量</param>
        /// <param name="lastfid">输出参数:最后一个版块ID</param>
        public static void ReSetFourmTopicAPost(int statcount, ref int lastfid)
        {
            if (statcount < 1)
            {
                lastfid = -1;
                return;
            }


            Forums.SetRealCurrentTopics(lastfid);


            IDataReader reader = DatabaseProvider.GetInstance().GetTopForumFids(lastfid, statcount);

            lastfid = -1;
            if (reader != null)
            {
                int topiccount     = 0;
                int postcount      = 0;
                int todaypostcount = 0;

                while (reader.Read())
                {
                    lastfid = Utils.StrToInt(reader["fid"], -1);

                    topiccount = Topics.GetAllTopicCount(lastfid);

                    postcount = GetPostsCountByFid(lastfid, out todaypostcount);
                    int    lasttid      = 0;
                    string lasttitle    = "";
                    string lastpost     = "1900-1-1";
                    int    lastposterid = 0;
                    string lastposter   = "";

                    IDataReader postreader = DatabaseProvider.GetInstance().GetForumLastPost(lastfid, Posts.GetPostTableName(), topiccount, postcount, 0, "", "1900-1-1", 0, "", todaypostcount);
                    if (postreader.Read())
                    {
                        lasttid      = Utils.StrToInt(postreader["tid"], 0);
                        lasttitle    = Topics.GetTopicInfo(lasttid).Title;//postreader["title"].ToString();
                        lastpost     = postreader["postdatetime"].ToString();
                        lastposterid = Utils.StrToInt(postreader["posterid"], 0);
                        lastposter   = postreader["poster"].ToString();
                    }
                    postreader.Close();

                    DatabaseProvider.GetInstance().UpdateForum(lastfid, topiccount, postcount, lasttid, lasttitle, lastpost, lastposterid, lastposter, todaypostcount);
                }
                reader.Close();
            }
        }
Beispiel #3
0
        /// <summary>
        /// 重建论坛帖数
        /// </summary>
        /// <param name="start_fid">要设置的起始版块</param>
        /// <param name="end_fid">要设置的终止版块</param>
        public static void ReSetFourmTopicAPost(int start_fid, int end_fid)
        {
            IDataReader reader      = DatabaseProvider.GetInstance().GetForums(start_fid, end_fid);
            int         current_fid = start_fid;

            if (reader != null)
            {
                int    topiccount     = 0;
                int    postcount      = 0;
                int    todaypostcount = 0;
                int    lasttid        = 0;
                string lasttitle      = "";
                string lastpost       = "";
                int    lastposterid   = 0;
                string lastposter     = "";

                while (reader.Read())
                {
                    current_fid = Utils.StrToInt(reader["fid"], -1);

                    Forums.SetRealCurrentTopics(current_fid);

                    topiccount = Topics.GetAllTopicCount(current_fid);

                    postcount = GetPostsCountByFid(current_fid, out todaypostcount);

                    IDataReader postreader = DatabaseProvider.GetInstance().GetForumLastPost(current_fid, Posts.GetPostTableName(), topiccount, postcount, lasttid, lasttitle, lastpost, lastposterid, lastposter, todaypostcount);

                    if (postreader.Read())
                    {
                        lasttid      = Utils.StrToInt(postreader["tid"], 0);
                        lasttitle    = Topics.GetTopicInfo(lasttid).Title;//postreader["title"].ToString();
                        lastpost     = postreader["postdatetime"].ToString();
                        lastposterid = Utils.StrToInt(postreader["posterid"], 0);
                        lastposter   = postreader["poster"].ToString();
                        DatabaseProvider.GetInstance().UpdateForum(current_fid, topiccount, postcount, lasttid, lasttitle, lastpost, lastposterid, lastposter, todaypostcount);
                    }
                    postreader.Close();
                }
                reader.Close();
            }
        }