public bool UpdateStatistics(StatisticsInfo statistics) { string cmdText = @"update [loachs_sites] set PostCount=@PostCount, CommentCount=@CommentCount, VisitCount=@VisitCount, TagCount=@TagCount"; OleDbParameter[] prams = { OleDbHelper.MakeInParam("@PostCount", OleDbType.Integer,4,statistics.PostCount), OleDbHelper.MakeInParam("@CommentCount", OleDbType.Integer,4,statistics.CommentCount), OleDbHelper.MakeInParam("@VisitCount", OleDbType.Integer,4,statistics.VisitCount), OleDbHelper.MakeInParam("@TagCount", OleDbType.Integer,4,statistics.TagCount), }; return OleDbHelper.ExecuteNonQuery(CommandType.Text, cmdText, prams) == 1; }
/// <summary> /// 转换实体 /// </summary> /// <param name="read">OleDbDataReader</param> /// <returns>TermInfo</returns> private static List<StatisticsInfo> DataReaderToList(OleDbDataReader read) { List<StatisticsInfo> list = new List<StatisticsInfo>(); while (read.Read()) { StatisticsInfo _site = new StatisticsInfo(); _site.PostCount = Convert.ToInt32(read["PostCount"]); _site.CommentCount = Convert.ToInt32(read["CommentCount"]); _site.VisitCount = Convert.ToInt32(read["VisitCount"]); _site.TagCount = Convert.ToInt32(read["TagCount"]); list.Add(_site); } read.Close(); return list; }
/// <summary> /// 初始化 /// </summary> private static void LoadStatistics() { if (_statistics == null) { lock (lockHelper) { if (_statistics == null) { _statistics = dao.GetStatistics(); } } } }