public string GetCommentInfos(CommentSearchView commentSearchView, MiicPage page) { string result = CommonService.InitialJsonList; DataTable dt = ((CommentInfoDao)IcommentInfo).GetCommentList(commentSearchView, page); if (dt != null && dt.Rows.Count > 0) { var temp = from dr in dt.AsEnumerable() select new { ID = dr[Config.Attribute.GetSqlColumnNameByPropertyName <CommentInfo, string>(o => o.ID)].ToString(), PublishID = dr[Config.Attribute.GetSqlColumnNameByPropertyName <CommentInfo, string>(o => o.PublishID)].ToString(), Content = dr[Config.Attribute.GetSqlColumnNameByPropertyName <CommentInfo, string>(o => o.Content)].ToString(), FromCommenterID = dr[Config.Attribute.GetSqlColumnNameByPropertyName <CommentInfo, string>(o => o.FromCommenterID)].ToString(), FromCommenterName = dr[Config.Attribute.GetSqlColumnNameByPropertyName <CommentInfo, string>(o => o.FromCommenterName)].ToString(), FromCommenterUrl = CommonService.GetManageFullUrl(dr["FROM_USER_URL"].ToString()), FromCommenterType = dr["FROM_USER_TYPE"].ToString(), FromCommenterRemark = dr["FROM_USER_REMARK"].ToString(), FromCommenterRealName = dr["FROM_USER_REAL_NAME"].ToString(), FromCommenterIsFriend = dr["FROM_USER_IS_FRIEND"].ToString(), CommentTime = (DateTime?)dr[Config.Attribute.GetSqlColumnNameByPropertyName <CommentInfo, DateTime?>(o => o.CommentTime)], ToCommenterID = Convert.IsDBNull(dr[Config.Attribute.GetSqlColumnNameByPropertyName <CommentInfo, string>(o => o.ToCommenterID)]) ? string.Empty : dr[Config.Attribute.GetSqlColumnNameByPropertyName <CommentInfo, string>(o => o.ToCommenterID)].ToString(), ToCommenterName = Convert.IsDBNull(dr[Config.Attribute.GetSqlColumnNameByPropertyName <CommentInfo, string>(o => o.ToCommenterName)]) ? string.Empty : dr[Config.Attribute.GetSqlColumnNameByPropertyName <CommentInfo, string>(o => o.ToCommenterName)].ToString(), ToCommenterUrl = CommonService.GetManageFullUrl(dr["TO_USER_URL"].ToString()), ToCommenterType = dr["TO_USER_TYPE"].ToString(), ToCommenterRemark = dr["TO_USER_REMARK"].ToString(), ToCommenterRealName = dr["TO_USER_REAL_NAME"].ToString(), ToCommenterIsFriend = dr["TO_USER_IS_FRIEND"].ToString() }; result = Config.Serializer.Serialize(temp); } return(result); }
/// <summary> /// 获取朋友圈信息评论总数 /// </summary> /// <param name="commentSearchView">评论查询视图</param> /// <returns>评论总数</returns> public int GetCommentCount(CommentSearchView commentSearchView) { int result = 0; string message = string.Empty; MiicCondition infoCondition = new MiicCondition(Config.Attribute.GetSqlColumnNameByPropertyName <CommentInfo, string>(o => o.PublishID), commentSearchView.PublishID, DbType.String, MiicDBOperatorSetting.Equal); MiicConditionSingle condition = new MiicConditionSingle(infoCondition); MiicColumn column = new MiicColumn(Config.Attribute.GetSqlTableNameByClassName <CommentInfo>(), Config.Attribute.GetSqlColumnNameByPropertyName <CommentInfo, string>(o => o.ID)); try { if (commentSearchView.WithAddress == MiicYesNoSetting.No) { result = dbService.GetCount <CommentInfo>(column, condition, out message); } else { Dictionary <String, String> paras = new Dictionary <String, String>(); paras.Add("PUBLISH_ID", commentSearchView.PublishID); paras.Add("USER_ID", commentSearchView.UserID); string storeProcedureName = "GetAddressMomentsCommentCount"; DataTable countDt = dbService.QueryStoredProcedure <string>(storeProcedureName, paras, out message); if (countDt != null && countDt.Rows.Count == 1) { result = (int)countDt.Rows[0]["COUNT"]; } } } catch (Exception ex) { Config.IlogicLogService.Write(new LogicLog() { AppName = Config.AppName, ClassName = ClassName, NamespaceName = NamespaceName, MethodName = MethodBase.GetCurrentMethod().Name, Message = ex.Message, Oper = Config.Oper }); } return(result); }
/// <summary> /// 获取朋友圈信息的所有评论 /// </summary> /// <param name="commentSearchView">评论查询视图</param> /// <param name="page">分页</param> /// <returns>朋友圈信息评论列表</returns> public DataTable GetCommentList(CommentSearchView commentSearchView, MiicPage page) { DataTable result = new DataTable(); MiicColumnCollections column = new MiicColumnCollections(); List <MiicOrderBy> orders = new List <MiicOrderBy>(); string message = string.Empty; string sql = string.Empty; sql += "SELECT * FROM GetCommentListWithAddress('" + commentSearchView.UserID + "','" + commentSearchView.PublishID + "') "; if (page != null) { sql = "WITH INFO_PAGE AS ( SELECT row_number() OVER ( ORDER BY Temp.COMMENT_TIME DESC) as row,Temp.* FROM ( " + sql; sql += " ) as Temp) "; sql += "SELECT * FROM INFO_PAGE where row between " + page.pageStart + " and " + page.pageEnd + ";"; } else { sql += " ORDER BY COMMENT_TIME DESC"; } try { //if (commentSearchView.WithAddress == MiicYesNoSetting.No) //{ result = dbService.querySql(sql, out message); //} //else //{ // if (page == null) // { // Dictionary<String, String> paras = new Dictionary<String, String>(); // paras.Add("PUBLISH_ID", commentSearchView.PublishID); // paras.Add("USER_ID", commentSearchView.UserID); // paras.Add("PAGE_START", string.Empty); // paras.Add("PAGE_END", string.Empty); // string storeProcedureName = "GetAddressMomentsComment"; // result = dbService.QueryStoredProcedure<string>(storeProcedureName, paras, out message); // } // else // { // Dictionary<String, String> paras = new Dictionary<String, String>(); // paras.Add("PUBLISH_ID", commentSearchView.PublishID); // paras.Add("USER_ID", commentSearchView.UserID); // paras.Add("PAGE_START", page.pageStart); // paras.Add("PAGE_END", page.pageEnd); // string storeProcedureName = "GetAddressMomentsComment"; // result = dbService.QueryStoredProcedure<string>(storeProcedureName, paras, out message); // } //} } catch (Exception ex) { Config.IlogicLogService.Write(new LogicLog() { AppName = Config.AppName, ClassName = ClassName, NamespaceName = NamespaceName, MethodName = MethodBase.GetCurrentMethod().Name, Message = ex.Message, Oper = Config.Oper }); } return(result); }
public int GetCommentInfoCount(CommentSearchView commentSearchView) { return(((CommentInfoDao)IcommentInfo).GetCommentCount(commentSearchView)); }