Beispiel #1
0
        private readonly DTcms.Model.siteconfig siteConfig = new DTcms.BLL.siteconfig().loadConfig(); //获得站点配置信息
        /// <summary>
        /// 获取主题列表
        /// </summary>
        /// <returns></returns>
        public DataTable get_topic_list(int top, string strwhere, string orderby)
        {
            DataTable dt = new DataTable();

            if (!string.IsNullOrEmpty(strwhere))
            {
                strwhere += " and ";
            }

            strwhere += " BoardId in (SELECT [Id] FROM [" + siteConfig.sysdatabaseprefix + "Forum_Board] where Show=1)";

            dt = new BLL.Forum_Topic().GetList(top, strwhere, orderby).Tables[0];

            return(dt);
        }
Beispiel #2
0
        /// <summary>
        /// 删除一条数据,所有标题和回贴都清掉
        /// </summary>
        public bool Delete(int Id)
        {
            //循环清除

            BLL.Forum_Topic bllTopic = new Forum_Topic();

            List <Model.Forum_Topic> listTopic = new BLL.Forum_Topic().GetModelList(" 1=1 ");

            foreach (Model.Forum_Topic item in listTopic)
            {
                bllTopic.Delete(item.Id);
            }

            return(dal.Delete(Id));
        }
Beispiel #3
0
        public static void BoardTodayTopicCount(bool bol = false)
        {
            //没有统计过
            if (HttpContext.Current.Application["BoardTodayTopicTime"] == null)
            {
                bol = true;

                HttpContext.Current.Application["BoardTodayTopicTime"] = Convert.ToDateTime(System.DateTime.Now.ToString("yyyy-MM-dd 00:00:01"));
            }


            DateTime dtTime = Convert.ToDateTime(HttpContext.Current.Application["BoardTodayTopicTime"]);

            TimeSpan ts = System.DateTime.Now - dtTime;


            //时间已经超过了24小时
            if (ts.TotalSeconds > 86400.0)
            {
                bol = true;
            }


            if (bol)
            {
                BLL.Forum_Board bll = new BLL.Forum_Board();

                bll.UpdateField(" 1=1 ", "TodayTopicCount=0");

                List <Model.Forum_Board> list = bll.GetModelList(" 1=1 ");

                //所有版块重新统计

                foreach (Model.Forum_Board modelBoard in list)
                {
                    int _total = new BLL.Forum_Topic().GetTotal(" BoardId=" + modelBoard.Id + " and PostDatetime>'" + System.DateTime.Now.ToString("yyyy-MM-dd 00:00:01") + "' ");

                    string strValue = "[TodayTopicCount]=[TodayTopicCount]+" + _total + "";

                    bll.UpdateField(" Id in (0" + modelBoard.ClassList + "0) ", strValue);
                }

                HttpContext.Current.Application["BoardTodayTopicTime"] = Convert.ToDateTime(System.DateTime.Now.ToString("yyyy-MM-dd 00:00:01"));
            }
        }
Beispiel #4
0
        /// <summary>
        /// 删除一条数据,相关会员贴子和记录都清掉,掉用和前端一样的方法
        /// </summary>
        public bool Delete(int UserId)
        {
            BLL.Forum_MyTopic bllMyTopic = new Forum_MyTopic();
            BLL.Forum_MyPost  bllMyPost  = new Forum_MyPost();
            BLL.Forum_Topic   bllTopic   = new Forum_Topic();

            //清我的贴子
            List <Model.Forum_MyTopic> listMyTopic = bllMyTopic.GetModelList("UserId=" + UserId);

            foreach (Model.Forum_MyTopic item in listMyTopic)
            {
                bllTopic.Delete(item.TopicId);
            }

            //清我的回贴记录
            bllMyPost.Delete("UserId=" + UserId);

            return(dal.Delete(UserId));
        }