Example #1
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;
		}
Example #2
0
 /// <summary>
 /// 获得所有版主信息
 /// </summary>
 /// <returns>所有版主信息</returns>
 public static List<ModeratorInfo> GetModeratorList()
 {
     List<ModeratorInfo> morderatorList = new List<ModeratorInfo>();
     
     foreach (DataRow dr in DatabaseProvider.GetInstance().GetModeratorList().Rows)
     {
         ModeratorInfo info = new ModeratorInfo();
         info.Uid = TypeConverter.ObjectToInt(dr["uid"]);
         info.Fid = TypeConverter.ObjectToInt(dr["fid"]);
         info.Displayorder = TypeConverter.ObjectToInt(dr["Displayorder"]);
         info.Inherited = TypeConverter.ObjectToInt(dr["inherited"]);
         morderatorList.Add(info);
     }
     return morderatorList;
 }
Example #3
0
 /// <summary>
 /// 添加ModeratorInfo类型数据缓存
 /// </summary>
 /// <param name="xpath">分级对象的路径</param>
 /// <param name="moderatorInfoArray">缓存的数据</param>
 public virtual void AddObject(string xpath, ModeratorInfo[] moderatorInfoArray)
 {
     lock (lockHelper)
     {
         if (moderatorInfoArray.Length > 0)
         {
             AddObject(xpath + "flag", CacheFlag.CacheHaveData);
         }
         else
         {
             AddObject(xpath + "flag", CacheFlag.CacheNoData);
         }
         AddObject(xpath, (object)moderatorInfoArray);
     }
 }