/// <summary> /// 获取指定主题的给分记录 /// </summary> /// <param name="tid">主题Id</param> /// <returns></returns> public static Dictionary<int, BonusLogInfo> GetLogsForEachPost(int tid) { IDataReader reader = DatabaseProvider.GetInstance().GetTopicBonusLogsByPost(tid); Dictionary<int, BonusLogInfo> blis = new Dictionary<int, BonusLogInfo>(); while (reader.Read()) { BonusLogInfo bli = new BonusLogInfo(); bli.Pid = TypeConverter.ObjectToInt(reader["pid"], 0); bli.Bonus = TypeConverter.ObjectToInt(reader["bonus"], 0); bli.Isbest = TypeConverter.ObjectToInt(reader["isbest"], 0); bli.Extid = (byte)reader["extid"]; blis[bli.Pid] = bli; } reader.Close(); return blis; }
/// <summary> /// 获取指定主题的给分记录 /// </summary> /// <param name="tid">主题ID</param> /// <param name="postTableId">主题所在的分表ID</param> /// <returns>悬赏日志集合</returns> public static List<BonusLogInfo> GetLogs(int tid, string postTableId) { IDataReader reader = DatabaseProvider.GetInstance().GetTopicBonusLogs(tid, postTableId); List<BonusLogInfo> blis = new List<BonusLogInfo>(); while (reader.Read()) { BonusLogInfo bli = new BonusLogInfo(); bli.Tid = TypeConverter.ObjectToInt(reader["tid"], 0); bli.Authorid = TypeConverter.ObjectToInt(reader["authorid"], 0); bli.Answerid = TypeConverter.ObjectToInt(reader["answerid"], 0); bli.Answername = reader["answername"].ToString(); bli.Pid = TypeConverter.ObjectToInt(reader["pid"], 0); bli.Bonus = TypeConverter.ObjectToInt(reader["bonus"], 0); bli.Isbest = TypeConverter.ObjectToInt(reader["isbest"], 0); bli.Extid = Convert.ToByte(reader["extid"]); bli.Message = reader["message"].ToString(); blis.Add(bli); } reader.Close(); return blis; }