Esempio n. 1
0
        /// <summary>
        /// 获得主题类型数组
        /// </summary>
        /// <returns>主题类型数组</returns>
        public static Discuz.Common.Generic.SortedList <int, string> GetTopicTypeArray()
        {
            DNTCache cache = DNTCache.GetCacheService();

            Discuz.Common.Generic.SortedList <int, string> topictypeList;
            topictypeList = cache.RetrieveObject("/Forum/TopicTypes") as Discuz.Common.Generic.SortedList <int, string>;

            if (topictypeList == null)
            {
                topictypeList = new Discuz.Common.Generic.SortedList <int, string>();
                DataTable dt = DatabaseProvider.GetInstance().GetTopicTypeList();
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (!Utils.StrIsNullOrEmpty(dr["typeid"].ToString()) && !Utils.StrIsNullOrEmpty(dr["name"].ToString()))
                        {
                            topictypeList.Add(TypeConverter.ObjectToInt(dr["typeid"]), dr["name"].ToString());
                        }
                    }
                }
                cache.AddObject("/Forum/TopicTypes", topictypeList);
            }
            return(topictypeList);
        }
Esempio n. 2
0
        /// <summary>
        /// ���������������
        /// </summary>
        /// <returns>������������</returns>
        public static Discuz.Common.Generic.SortedList<int, string> GetTopicTypeArray()
        {
            DNTCache cache = DNTCache.GetCacheService();
            Discuz.Common.Generic.SortedList<int, string> topictypeList;
            topictypeList = cache.RetrieveObject("/Forum/TopicTypes") as Discuz.Common.Generic.SortedList<int, string>;

            if (topictypeList == null)
            {
                topictypeList = new Discuz.Common.Generic.SortedList<int, string>();
                DataTable dt = DatabaseProvider.GetInstance().GetTopicTypeList();
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (!Utils.StrIsNullOrEmpty(dr["typeid"].ToString()) && !Utils.StrIsNullOrEmpty(dr["name"].ToString()))
                        {
                            topictypeList.Add(TypeConverter.ObjectToInt(dr["typeid"]), dr["name"].ToString());
                        }
                    }
                }
                cache.AddObject("/Forum/TopicTypes", topictypeList);
            }
            return topictypeList;
        }