Exemplo n.º 1
0
        /// <summary>
        /// 获得模板变量列表
        /// </summary>
        /// <param name="forumpath">模板路径</param>
        /// <param name="skinName">皮肤名</param>
        /// <returns></returns>
        public static DataTable GetTemplateVarList(string forumpath, string skinName)
        {
            Discuz.Cache.DNTCache cache = Cache.DNTCache.GetCacheService();
            DataTable             dt    = cache.RetrieveObject("/Forum/" + skinName + "/TemplateVariable") as DataTable;

            if (dt == null)
            {
                DataSet dsSrc = new DataSet("template");

                string[] filename = { Utils.GetMapPath(forumpath + "templates/" + skinName + "/templatevariable.xml") };

                if (Utils.FileExists(filename[0]))
                {
                    dsSrc.ReadXml(filename[0]);
                    if (dsSrc.Tables.Count == 0)
                    {
                        dsSrc.Tables.Add(TemplateVariableTable());
                    }
                }
                else
                {
                    dsSrc.Tables.Add(TemplateVariableTable());
                }
                dt = dsSrc.Tables[0];
                cache.AddObject("/Forum/" + skinName + "/TemplateVariable", dt, filename);
            }
            return(dt);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 重新用户自定义标签
        ///</summary>
        public static void ReSetCustomEditButtonList()
        {
            Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
            cache.RemoveObject("/UI/CustomEditButtonList");

            cache.RemoveObject("/UI/CustomEditButtonInfo");
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获得所有版主信息
        /// </summary>
        /// <returns>所有版主信息</returns>
        public static ModeratorInfo[] GetModeratorList()
        {
            Discuz.Cache.DNTCache cache     = Discuz.Cache.DNTCache.GetCacheService();
            ModeratorInfo[]       infoArray = cache.RetrieveObject("/ModeratorList") as ModeratorInfo[];
            if (infoArray == null)
            {
                DataTable dt = DatabaseProvider.GetInstance().GetModeratorList();
                infoArray = new ModeratorInfo[dt.Rows.Count];
                ModeratorInfo info;
                // id为索引
                int id = 0;
                foreach (DataRow dr in dt.Rows)
                {
                    info              = new ModeratorInfo();
                    info.Uid          = Int32.Parse(dr["uid"].ToString());
                    info.Fid          = Int16.Parse(dr["fid"].ToString());
                    info.Displayorder = Int16.Parse(dr["Displayorder"].ToString());
                    info.Inherited    = Int16.Parse(dr["inherited"].ToString());
                    infoArray[id]     = info;
                    id++;
                }

                cache.AddObject("/ModeratorList", infoArray);
            }
            return(infoArray);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获得置顶主题信息列表
        /// </summary>
        /// <param name="fid">版块ID</param>
        /// <param name="pageSize">每页显示主题数</param>
        /// <param name="pageIndex">当前页数</param>
        /// <param name="tids">主题id列表</param>
        /// <returns>主题信息列表</returns>
        public static Discuz.Common.Generic.List <TopicInfo> GetTopTopicList(int fid, int pageSize, int pageIndex, string tids, int autocloseTime, int topicTypePrefix)
        {
            if (pageIndex < 1)
            {
                pageIndex = 1;
            }

            Discuz.Common.Generic.List <TopicInfo> list;
            //只有在应用memcached的情况下才可以使用主题缓存
            if ((mcci != null && mcci.ApplyMemCached) || (rci != null && rci.ApplyRedis))
            {
                Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
                list = cache.RetrieveObject("/Forum/ShowTopic/TopList/" + fid + "/") as List <TopicInfo>;

                if (list == null)
                {
                    list = Data.Topics.GetTopTopicList(fid, pageSize, pageIndex, tids);
                    LoadTopTopicListExtraInfo(topicTypePrefix, list);
                    cache.AddObject("/Forum/ShowTopic/TopList/" + fid + "/", list, 300);
                }
            }
            else
            {
                list = Data.Topics.GetTopTopicList(fid, pageSize, pageIndex, tids);
                LoadTopTopicListExtraInfo(topicTypePrefix, list);
            }
            return(list);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 获得在线用户总数量
        /// </summary>
        /// <returns>用户数量</returns>
        public static int GetOnlineAllUserCount()
        {
            int onlineUserCountCacheMinute = GeneralConfigs.GetConfig().OnlineUserCountCacheMinute;

            if (onlineUserCountCacheMinute == 0)
            {
                return(Discuz.Data.OnlineUsers.GetOnlineAllUserCount());
            }

            Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
            int onlineAllUserCount      = TypeConverter.ObjectToInt(cache.RetrieveObject("/Forum/OnlineUserCount"));

            if (onlineAllUserCount != 0)
            {
                return(onlineAllUserCount);
            }

            onlineAllUserCount = Discuz.Data.OnlineUsers.GetOnlineAllUserCount();
            //Discuz.Cache.ICacheStrategy ics = new RssCacheStrategy();
            //ics.TimeOut = onlineUserCountCacheMinute * 60;
            //cache.LoadCacheStrategy(ics);
            cache.AddObject("/Forum/OnlineUserCount", onlineAllUserCount, onlineUserCountCacheMinute * 60);
            //cache.LoadDefaultCacheStrategy();
            return(onlineAllUserCount);
        }
Exemplo n.º 6
0
        public static DataTable GetForumAggerationHotTopics()
        {
            //从缓存读取主题列表
            Discuz.Cache.DNTCache cache        = Discuz.Cache.DNTCache.GetCacheService();
            DataTable             hotTopicList = cache.RetrieveObject("/Aggregation/Hottopiclist") as DataTable;

            if (hotTopicList != null)
            {
                return(hotTopicList);
            }

            //无缓存查检config文件存在否
            string configPath = HttpContext.Current.Server.MapPath(BaseConfigs.GetForumPath + "config/agg_hottopics.config");

            if (!File.Exists(configPath))
            {
                return(new DataTable());
            }

            //从config文件中重建缓存
            XmlDocument xmlDoc = new XmlDocument();

            try
            {
                xmlDoc.Load(configPath);
                XmlNode node = xmlDoc.SelectSingleNode("/Aggregationinfo/Forum");
                if (node != null)
                {
                    DataSet topicDataSet = new DataSet();
                    using (MemoryStream topicListXml = new MemoryStream(Encoding.UTF8.GetBytes(Regex.Replace(node.InnerXml, "[\x00-\x08|\x0b-\x0c|\x0e-\x1f]", ""))))
                    {
                        topicDataSet.ReadXml(topicListXml);
                    }
                    if (topicDataSet.Tables.Count != 0)
                    {
                        hotTopicList = topicDataSet.Tables[0];
                    }
                    else
                    {
                        hotTopicList = new DataTable();
                    }
                }
                else
                {
                    hotTopicList = new DataTable();
                }
            }
            catch
            {
                hotTopicList = new DataTable();
            }

            //声明新的缓存策略接口
            //Discuz.Cache.ICacheStrategy ics = new AggregationCacheStrategy();
            //ics.TimeOut = 300;
            //cache.LoadCacheStrategy(ics);
            cache.AddObject("/Aggregation/Hottopiclist", hotTopicList, 300);
            //cache.LoadDefaultCacheStrategy();
            return(hotTopicList);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 将缓存中的表情信息返回为SmiliesInfo[],不包括表情分类
        /// </summary>
        /// <returns></returns>
        public static SmiliesInfo[] GetSmiliesListWithInfo()
        {
            Discuz.Cache.DNTCache cache           = Discuz.Cache.DNTCache.GetCacheService();
            SmiliesInfo[]         smilieslistinfo = cache.RetrieveObject("/UI/SmiliesListWithInfo") as SmiliesInfo[];
            if (smilieslistinfo == null)
            {
                DataTable dt = GetSmiliesListWithoutType();
                if (dt == null)
                {
                    return(null);
                }
                if (dt.Rows.Count <= 0)
                {
                    return(null);
                }

                smilieslistinfo = new SmiliesInfo[dt.Rows.Count];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    smilieslistinfo[i]              = new SmiliesInfo();
                    smilieslistinfo[i].Id           = Utils.StrToInt(dt.Rows[i]["id"], 0);
                    smilieslistinfo[i].Code         = dt.Rows[i]["Code"].ToString();
                    smilieslistinfo[i].Displayorder = Utils.StrToInt(dt.Rows[i]["Displayorder"], 0);
                    smilieslistinfo[i].Type         = Utils.StrToInt(dt.Rows[i]["Type"], 0);
                    smilieslistinfo[i].Url          = dt.Rows[i]["Url"].ToString();
                }
                cache.AddObject("/UI/SmiliesListWithInfo", smilieslistinfo);

                //表情缓存重新加载时重新初始化表情正则对象数组
                ResetRegexSmilies(smilieslistinfo);
            }
            return(smilieslistinfo);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 按查询字符串得到广告列表
        /// </summary>
        /// <param name="selectstr">查询字符串</param>
        /// <returns>广告列表</returns>
        private static AdShowInfo[] GetAdsTable(string selectstr)
        {
            Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
            DataTable             dt    = cache.RetrieveObject("/Advertisements") as DataTable;

            if (dt == null)
            {
                dt = DatabaseProvider.GetInstance().GetAdsTable();
                cache.AddObject("/Advertisements", dt);
            }

            DataRow[] drs      = dt.Select(selectstr);
            int       adlength = drs.Length;

            AdShowInfo[] adarray = new AdShowInfo[adlength];

            for (int i = 0; i < adlength; i++)
            {
                adarray[i]              = new AdShowInfo();
                adarray[i].Advid        = Convert.ToInt32(drs[i]["advid"].ToString());
                adarray[i].Displayorder = Convert.ToInt32(drs[i]["displayorder"].ToString());
                adarray[i].Code         = drs[i]["code"].ToString().Trim();
                adarray[i].Parameters   = drs[i]["parameters"].ToString().Trim();
            }

            return(adarray);
        }
Exemplo n.º 9
0
        private void DeleteAvatar_Click(object sender, EventArgs e)
        {
            #region  除选中的头像

            if (this.CheckCookie())
            {
                if (DNTRequest.GetString("id") != "")
                {
                    foreach (string filepathname in DNTRequest.GetString("id").Split(','))
                    {
                        if (Utils.FileExists(Utils.GetMapPath(@"..\..\" + filepathname)))
                        {
                            File.Delete(Utils.GetMapPath(@"..\..\" + filepathname));
                        }
                    }

                    Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
                    cache.RemoveObject("/Forum/CommonAvatarList");

                    base.RegisterStartupScript("PAGE", "window.location.href='global_avatargrid.aspx';");
                }
                else
                {
                    base.RegisterStartupScript("", "<script>alert('您未选中任何选项');</script>");
                }
            }

            #endregion
        }
Exemplo n.º 10
0
        /// <summary>
        /// 返回fid与categoryid对应的JSON数据
        /// </summary>
        /// <returns>JSON数据</returns>
        public static string GetGoodsCategoryWithFid()
        {
            Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
            string categoryfid          = cache.RetrieveObject("/Mall/MallSetting/GoodsCategoryWithFid") as string;

            if (categoryfid == null)
            {
                categoryfid = "[";

                IDataReader iDataReader = DbProvider.GetInstance().GetGoodsCategoryWithFid();
                if (iDataReader != null)
                {
                    while (iDataReader.Read())
                    {
                        categoryfid += string.Format("{{'fid' : {0}, 'categoryid' : {1}}},",
                                                     iDataReader["fid"],
                                                     iDataReader["categoryid"]);
                    }
                    iDataReader.Dispose();
                }
                if (categoryfid.EndsWith(","))
                {
                    categoryfid = categoryfid.Substring(0, categoryfid.Length - 1);
                }

                categoryfid += "]";
                cache.AddObject("/Mall/MallSetting/GoodsCategoryWithFid", categoryfid);
            }

            return(categoryfid);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 获得前台有效的模板ID列表
        /// </summary>
        /// <returns>模板ID列表</returns>
        public static string GetValidTemplateIDList()
        {
            lock (SynObject)
            {
                Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
                string templateidlist       = cache.RetrieveObject("/TemplateIDList") as string;
                if (templateidlist == null)
                {
                    DataTable     dt = DatabaseProvider.GetInstance().GetValidTemplateIDList();
                    StringBuilder sb = new StringBuilder();
                    foreach (DataRow dr in dt.Rows)
                    {
                        sb.Append(",");
                        sb.Append(dr[0].ToString());
                    }

                    try
                    {
                        if (!Utils.StrIsNullOrEmpty(sb.ToString()))
                        {
                            templateidlist = sb.ToString().Substring(1);
                        }
                        cache.AddObject("/TemplateIDList", templateidlist);
                    }
                    finally
                    {
                        dt.Dispose();
                    }
                }
                return(templateidlist);
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// 重新设置表情
        ///</summary>
        public static void ReSetSmiliesList()
        {
            Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
            cache.RemoveObject("/UI/SmiliesList");

            cache = Discuz.Cache.DNTCache.GetCacheService();
            cache.RemoveObject("/UI/SmiliesListWithInfo");
        }
Exemplo n.º 13
0
        /// <summary>
        /// 重建统计缓存
        /// </summary>
        public static void ReSetStatisticsCache()
        {
            Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
            DataRow dr = DatabaseProvider.GetInstance().GetStatisticsRow();

            cache.RemoveObject("/Statistics");
            cache.AddObject("/Statistics", dr);
        }
Exemplo n.º 14
0
 private void UpdateAvatarCache_Click(object sender, EventArgs e)
 {
     if (this.CheckCookie())
     {
         Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
         cache.RemoveObject("/Forum/CommonAvatarList");
         url.UpdateFile();
         base.RegisterStartupScript("PAGE", "window.location.href='global_avatargrid.aspx';");
     }
 }
Exemplo n.º 15
0
        protected void SaveVar_Click(Object sender, EventArgs e)
        {
            #region 保存变量修改
            dsSrc = LoadDataTable();
            int row = 0;
            //bool error = false;
            foreach (object o in DataGrid1.GetKeyIDArray())
            {
                int    id            = int.Parse(o.ToString());
                string variablename  = DataGrid1.GetControlValue(row, "variablename").Trim();
                string variablevalue = DataGrid1.GetControlValue(row, "variablevalue").Trim();
                if (variablename == "" || variablevalue == "")
                {
                    //error = true;
                    continue;
                }
                foreach (DataRow dr in dsSrc.Tables["TemplateVariable"].Rows)
                {
                    if (id.ToString() == dr["id"].ToString())
                    {
                        dr["variablename"]  = variablename;
                        dr["variablevalue"] = variablevalue;
                        break;
                    }
                }
                try
                {
                    if (dsSrc.Tables[0].Rows.Count == 0)
                    {
                        File.Delete(Utils.GetMapPath("../../templates/" + DNTRequest.GetString("path") + "/templatevariable.xml"));
                        dsSrc.Reset();
                        dsSrc.Dispose();
                    }
                    else
                    {
                        string filename = Server.MapPath("../../templates/" + DNTRequest.GetString("path") + "/templatevariable.xml");
                        dsSrc.WriteXml(filename);
                        dsSrc.Reset();
                        dsSrc.Dispose();

                        Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
                        cache.RemoveObject("/Forum/" + DNTRequest.GetString("path") + "/TemplateVariable");
                        base.RegisterStartupScript("PAGE", "window.location.href='global_templatevariable.aspx?templateid=" + DNTRequest.GetString("templateid") + "&path=" + DNTRequest.GetString("path") + "&templatename=" + DNTRequest.GetString("templatename") + "';");
                    }
                }
                catch
                {
                    base.RegisterStartupScript("", "<script>alert('无法更新数据库.');window.location.href='global_templatevariable.aspx?templateid=" + DNTRequest.GetString("templateid") + "&path=" + DNTRequest.GetString("path") + "&templatename=" + DNTRequest.GetString("templatename") + "';</script>");
                    return;
                }
                row++;
            }
            #endregion
        }
Exemplo n.º 16
0
 /// <summary>
 /// 获得到指定管理组信息
 /// </summary>
 /// <returns>管理组信息</returns>
 public static AdminGroupInfo[] GetAdminGroupList()
 {
     Discuz.Cache.DNTCache cache           = Discuz.Cache.DNTCache.GetCacheService();
     AdminGroupInfo[]      admingroupArray = cache.RetrieveObject("/Forum/AdminGroupList") as AdminGroupInfo[];
     if (admingroupArray == null)
     {
         admingroupArray = Discuz.Data.AdminGroups.GetAdminGroupList();
         cache.AddObject("/Forum/AdminGroupList", admingroupArray);
     }
     return(admingroupArray);
 }
Exemplo n.º 17
0
        /// <summary>
        /// 获得统计列
        /// </summary>
        /// <returns>统计列</returns>
        public static DataRow GetStatisticsRow()
        {
            Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
            DataRow dr = cache.RetrieveObject("/Statistics") as DataRow;

            if (dr == null)
            {
                dr = DatabaseProvider.GetInstance().GetStatisticsRow();
                cache.AddObject("/Statistics", dr);
            }
            return(dr);
        }
Exemplo n.º 18
0
        /// <summary>
        /// 得到上一次执行搜索操作的时间
        /// </summary>
        /// <returns></returns>
        public static string GetStatisticsSearchtime()
        {
            Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
            string searchtime           = cache.RetrieveObject("/StatisticsSearchtime") as string;

            if (searchtime == null)
            {
                searchtime = DateTime.Now.ToString();
                cache.AddObject("/StatisticsSearchtime", searchtime);
            }
            return(searchtime);
        }
Exemplo n.º 19
0
        /// <summary>
        /// 获取指定路径下模板的宽度
        /// </summary>
        /// <param name="templatePath">模板名称</param>
        /// <returns></returns>
        public static int GetTemplateWidth(string templatePath)
        {
            Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
            string width = cache.RetrieveObject("/Forum/TemplateWidth/" + templatePath) as string;

            if (width == null)
            {
                width = GetTemplateAboutInfo(Utils.GetMapPath(BaseConfigs.GetForumPath + "templates/" + templatePath + "/")).width;
                cache.AddObject("/Forum/TemplateWidth/" + templatePath, width);
            }
            return(TypeConverter.StrToInt(width));
        }
Exemplo n.º 20
0
        /// <summary>
        /// 获得全部指定时间段内的前n条公告列表
        /// </summary>
        /// <param name="startDateTime">开始时间</param>
        /// <param name="endDateTime">结束时间</param>
        /// <param name="maxcount">最大记录数,小于0返回全部</param>
        /// <returns>公告列表</returns>
        public static DataTable GetSpecificAnnouncementList(string starttime, string endtime, int maxcount)
        {
            Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
            DataTable             dt    = cache.RetrieveObject("/Forum/SimplifiedAnnouncementList") as DataTable;

            if (dt == null)
            {
                dt = Data.Announcements.GetAnnouncementList(maxcount);
                cache.AddObject("/Forum/SimplifiedAnnouncementList", dt);
            }
            return(dt);
        }
Exemplo n.º 21
0
        /// <summary>
        /// 将店铺主题表以DataTable的方式存入缓存
        /// </summary>
        /// <returns>商品分类表</returns>
        public static DataTable GetShopThemesTable()
        {
            Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
            DataTable             dt    = cache.RetrieveObject("/Mall/MallSetting/ShopTheme") as DataTable;

            if (dt == null)
            {
                dt = DbProvider.GetInstance().GetShopThemes();
                cache.AddObject("/Mall/MallSetting/ShopTheme", dt);
            }
            return(dt);
        }
Exemplo n.º 22
0
        /// <summary>
        /// 得到用户在一分钟内搜索的次数。
        /// </summary>
        /// <returns></returns>
        public static int GetStatisticsSearchcount()
        {
            Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
            int searchcount             = Utils.StrToInt(cache.RetrieveObject("/StatisticsSearchcount"), 0);

            if (searchcount == 0)
            {
                searchcount = 1;
                cache.AddObject("/StatisticsSearchcount", searchcount);
            }
            return(Utils.StrToInt(searchcount, 1));
        }
 private void UpdateOnLineIncoCache_Click(object sender, EventArgs e)
 {
     #region 更新在线图例缓存
     if (this.CheckCookie())
     {
         Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
         cache.RemoveObject("/Forum/UI/OnlineIconList");
         image.UpdateFile();
         base.RegisterStartupScript("PAGE", "window.location.href='global_onlinelistgrid.aspx';");
     }
     #endregion
 }
Exemplo n.º 24
0
        /// <summary>
        /// 获取指定层数的商品分类
        /// </summary>
        /// <returns>json格式信息串</returns>
        public static string GetRootGoodsCategoriesJson()
        {
            Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
            string goodsCategoriesJson  = cache.RetrieveObject("/Mall/MallSetting/RootGoodsCategories") as string;

            if (goodsCategoriesJson == null)
            {
                goodsCategoriesJson = GetGoodsCategoryJsonData(DbProvider.GetInstance().GetGoodsCategoriesByLayer(1));
                cache.AddObject("/Mall/MallSetting/RootGoodsCategories", goodsCategoriesJson);
            }
            return(goodsCategoriesJson);
        }
Exemplo n.º 25
0
        /// <summary>
        /// 获得所有版主信息
        /// </summary>
        /// <returns>所有版主信息</returns>
        public static List <ModeratorInfo> GetModeratorList()
        {
            Discuz.Cache.DNTCache cache          = Discuz.Cache.DNTCache.GetCacheService();
            List <ModeratorInfo>  morderatorList = cache.RetrieveObject("/Forum/ModeratorList") as List <ModeratorInfo>;

            if (morderatorList == null)
            {
                morderatorList = Discuz.Data.Moderators.GetModeratorList();
                cache.AddObject("/Forum/ModeratorList", morderatorList);
            }
            return(morderatorList);
        }
Exemplo n.º 26
0
        /// <summary>
        /// 获得用户组数据
        /// </summary>
        /// <returns>用户组数据</returns>
        public static List <UserGroupInfo> GetUserGroupList()
        {
            Discuz.Cache.DNTCache cache             = Discuz.Cache.DNTCache.GetCacheService();
            List <UserGroupInfo>  userGruopInfoList = cache.RetrieveObject("/Forum/UserGroupList") as List <UserGroupInfo>;

            if (userGruopInfoList == null)
            {
                userGruopInfoList = Discuz.Data.UserGroups.GetUserGroupList();
                cache.AddObject("/Forum/UserGroupList", userGruopInfoList);
            }
            return(userGruopInfoList);
        }
Exemplo n.º 27
0
        /// <summary>
        /// 获得全部指定时间段内的前n条公告列表
        /// </summary>
        /// <param name="starttime">开始时间</param>
        /// <param name="endtime">结束时间</param>
        /// <param name="maxcount">最大记录数,小于0返回全部</param>
        /// <returns>公告列表</returns>
        public static DataTable GetSimplifiedAnnouncementList(string starttime, string endtime, int maxcount)
        {
            Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
            DataTable             dt    = cache.RetrieveObject("/SimplifiedAnnouncementList") as DataTable;

            if (dt == null)
            {
                dt = DatabaseProvider.GetInstance().GetSimplifiedAnnouncementList(starttime, endtime, maxcount);
                cache.AddObject("/SimplifiedAnnouncementList", dt);
            }
            return(dt);
        }
Exemplo n.º 28
0
        /// <summary>
        /// 将系统设置的附件类型以DataTable的方式存入缓存
        /// </summary>
        /// <returns>系统设置的附件类型</returns>
        public static DataTable GetAttachmentType()
        {
            Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
            DataTable             dt    = cache.RetrieveObject("/ForumSetting/AttachmentType") as DataTable;

            if (dt == null)
            {
                dt = DatabaseProvider.GetInstance().GetAttachmentType();

                cache.AddObject("/ForumSetting/AttachmentType", dt);
            }
            return(dt);
        }
Exemplo n.º 29
0
 /// <summary>
 /// 重新设置论坛积分
 ///</summary>
 public static void ReSetScoreset()
 {
     Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
     cache.RemoveObject("/Scoreset");
     cache.RemoveObject("/ValidScoreName");
     cache.RemoveObject("/Scoreset/CreditsTax");
     cache.RemoveObject("/Scoreset/CreditsTrans");
     cache.RemoveObject("/Scoreset/TransferMinCredits");
     cache.RemoveObject("/Scoreset/ExchangeMinCredits");
     cache.RemoveObject("/Scoreset/MaxIncPerThread");
     cache.RemoveObject("/Scoreset/MaxChargeSpan");
     cache.RemoveObject("/ValidScoreUnit");
 }
Exemplo n.º 30
0
 /// <summary>
 /// 获得前台有效的模板列表
 /// </summary>
 /// <returns>模板列表</returns>
 public static DataTable GetValidTemplateList()
 {
     lock (SynObject)
     {
         Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService();
         DataTable             dt    = cache.RetrieveObject("/TemplateList") as DataTable;
         if (dt == null)
         {
             dt = DatabaseProvider.GetInstance().GetValidTemplateList();
             cache.AddObject("/TemplateList", dt);
         }
         return(dt);
     }
 }