public IList<CY.UME.Core.Business.SpaceComment> SearchLeaveList(string Name, DateTime StartTime, DateTime EndTime) { List<CY.UME.Core.Business.SpaceComment> LeaveList = new List<SpaceComment>(); SqlServerUtility sql = new SqlServerUtility(connectionString); StringBuilder sqlstr = new StringBuilder(); sqlstr.Append("Select * From SpaceComment INNER JOIN SpaceCommentExtend ON SpaceComment.Id=SpaceCommentExtend.Id Where SpaceCommentExtend.Type='Killing'"); if (Name != string.Empty) { IList<long> accidlist = CY.UME.Core.Business.Account.GetAccountIdByName(Name); if (accidlist != null && accidlist.Count != 0) { sqlstr.Append(" and ("); for (int i = 0; i < accidlist.Count; i++) { if (i != 0) { sqlstr.Append("or "); } sqlstr.Append("SpaceComment.AuthorId=" + accidlist[i] + " "); } sqlstr.Append(") "); } } if (StartTime.ToString("yyyy-MM-dd") != "0001-01-01") { sqlstr.Append(" and datediff(s,SpaceComment.DateCreated,'" + StartTime + "') <0"); } if (EndTime.ToString("yyyy-MM-dd") != "0001-01-01") { sqlstr.Append(" and datediff(s,SpaceComment.DateCreated,'" + EndTime + "') >0"); } sqlstr.Append(" ORDER by SpaceComment.DateCreated DESC"); SqlDataReader reader = sql.ExecuteSqlReader(sqlstr.ToString()); if (reader != null) { while (reader.Read()) { CY.UME.Core.Business.SpaceComment scomment = new SpaceComment(); long id = reader.GetInt64(0); scomment = Core.Business.SpaceComment.Load(id); scomment.MarkOld(); LeaveList.Add(scomment); } reader.Close(); } return LeaveList; }
/// <summary> /// 得到留言 /// </summary> /// <param name="uid"></param> /// <param name="pinfo"></param> /// <returns></returns> public IList<CY.UME.Core.Business.SpaceComment> GetLevelWordsList(PagingInfo pinfo, CY.UME.Core.Business.InstantlyKilling instantlyKilling) { IList<CY.UME.Core.Business.SpaceComment> LeaveList = new List<CY.UME.Core.Business.SpaceComment>(); SqlServerUtility sql = new SqlServerUtility(connectionString); #region 参数 string tables = "SpaceComment INNER JOIN SpaceCommentExtend ON SpaceComment.Id=SpaceCommentExtend.Id"; string pK = "SpaceComment.Id"; string sort = "SpaceComment.DateCreated Desc"; int pageNum = pinfo.CurrentPage; int pageSize = pinfo.PageSize; string fields = "SpaceComment.Id,SpaceComment.AuthorId,SpaceComment.Content,SpaceComment.DateCreated"; string filter = " SpaceCommentExtend.Type='Killing'"; if (instantlyKilling != null) { filter += " and SpaceCommentExtend.InstanceId=" + instantlyKilling.Id; } string group = String.Empty; #endregion sql.AddParameter("@Tables", SqlDbType.VarChar, tables); sql.AddParameter("@PK", SqlDbType.VarChar, pK); sql.AddParameter("@Sort", SqlDbType.VarChar, sort); sql.AddParameter("@PageNumber", SqlDbType.Int, pageNum); sql.AddParameter("@PageSize", SqlDbType.Int, pageSize); sql.AddParameter("@Fields", SqlDbType.VarChar, fields); sql.AddParameter("@Filter", SqlDbType.VarChar, filter); sql.AddParameter("@Group", SqlDbType.VarChar, group); SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount"); if (reader != null) { while (reader.Read()) { CY.UME.Core.Business.SpaceComment scomment = new SpaceComment(); long id = reader.GetInt64(0); scomment = Core.Business.SpaceComment.Load(id); scomment.MarkOld(); LeaveList.Add(scomment); } reader.Close(); } return LeaveList; }