public Pager<MessageRecodeEntity> GetMessageRecodePageList(MessageRecodeQuery query) { int recordCount = 0; string whereSQL = MessageRecodeQueryToSQLWhere(query); string orderBy = MessageRecodeQueryToSQLOrder(query); DataSet ds = db.GetPagingData("MessageRecode", "*", orderBy, whereSQL, query.CurrentPage, query.PageSize, out recordCount); Pager<MessageRecodeEntity> pager = new Pager<MessageRecodeEntity>(); if (ds != null && ds.Tables.Count > 0) { pager.ItemList = MakeMessageRecodeList(ds.Tables[0]); } pager.CurrentPage = query.CurrentPage; pager.PageSize = query.PageSize; pager.TotalRecords = recordCount; return pager; }
public MessageRecodeEntity GetMessageRecode(MessageRecodeQuery query) { MessageRecodeEntity messageRecodeEntity = null; StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append("SELECT TOP 1 * FROM dbo.MessageRecode WITH(NOLOCK)"); sqlCommandText.Append(" WHERE RecodeID=@RecodeID AND JournalID=@JournalID"); DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString()); db.AddInParameter(cmd, "@RecodeID", DbType.Int64, query.RecodeID); db.AddInParameter(cmd, "@JournalID", DbType.Int64, query.JournalID); using (IDataReader dr = db.ExecuteReader(cmd)) { messageRecodeEntity = MakeMessageRecode(dr); } return messageRecodeEntity; }
public List<MessageRecodeEntity> GetMessageRecodeList(MessageRecodeQuery query) { List<MessageRecodeEntity> list = new List<MessageRecodeEntity>(); StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append("SELECT * FROM dbo.MessageRecode WITH(NOLOCK)"); string whereSQL = MessageRecodeQueryToSQLWhere(query); string orderBy = MessageRecodeQueryToSQLOrder(query); if (!string.IsNullOrEmpty(whereSQL)) sqlCommandText.Append(" WHERE " + whereSQL); if (!string.IsNullOrEmpty(orderBy)) sqlCommandText.Append(" ORDER BY " + orderBy); DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString()); using (IDataReader dr = db.ExecuteReader(cmd)) { list = MakeMessageRecodeList(dr); } return list; }
/// <summary> /// 信息内容查看 /// </summary> /// <returns></returns> public ActionResult MsgContentView(MessageRecodeQuery query,Int64 RecodeID) { ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); query.JournalID = CurAuthor.JournalID; query.ReciveUser = CurAuthor.AuthorID; IList<MessageRecodeEntity> pager = service.GetMessageRecodeList(query); if (pager != null) { IList<MessageRecodeEntity> messageList= pager.Where(c => c.RecodeID == RecodeID).ToList<MessageRecodeEntity>(); if (messageList != null && messageList.Count > 0) { MessageRecodeEntity entity= messageList.FirstOrDefault(); ViewBag.content = entity.MsgContent; } } return View(); }
private MessageRecodeEntity GetMsgModel(Int64 RecodeID) { MessageRecodeEntity model = null; if (RecodeID > 0) { ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); MessageRecodeQuery query = new MessageRecodeQuery(); query.JournalID = CurAuthor.JournalID; query.RecodeID = RecodeID; model = service.GetMsgRecodeModel(query); } if (model == null) model = new MessageRecodeEntity(); return model; }
public ActionResult GetReciveSmsPageList(MessageRecodeQuery query) { ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); query.JournalID = CurAuthor.JournalID; query.ReciveUser = CurAuthor.AuthorID; query.CurrentPage = Convert.ToInt32(Request.Params["page"]); query.PageSize = Convert.ToInt32(Request.Params["pagesize"]); Pager<MessageRecodeEntity> pager = service.GetMessageRecodePageList(query); return Json(new { Rows = pager.ItemList, Total = pager.TotalRecords }); }
/// <summary> /// 获取发送记录分页数据 /// </summary> /// <param name="query"></param> /// <returns></returns> public Pager<MessageRecodeEntity> GetMessageRecodePageList(MessageRecodeQuery query) { HttpClientHelper clientHelper = new HttpClientHelper(); Pager<MessageRecodeEntity> pager = clientHelper.Post<Pager<MessageRecodeEntity>, MessageRecodeQuery>(GetAPIUrl(APIConstant.MSGRECODE_GETPAGELIST), query); return pager; }
/// <summary> /// 获取一个实体对象 /// </summary> /// <param name="recodeID"></param> /// <returns>获取一个实体,如果数据不存在返回Null</returns> public MessageRecodeEntity GetMessageRecode(MessageRecodeQuery query) { return MessageRecodeDataAccess.Instance.GetMessageRecode( query); }
/// <summary> /// 获取所有符合查询条件的数据 /// </summary> /// <param name="messageRecodeQuery">MessageRecodeQuery查询实体对象</param> /// <returns>List<MessageRecodeEntity></returns> public List<MessageRecodeEntity> GetMessageRecodeList(MessageRecodeQuery messageRecodeQuery) { return MessageRecodeDataAccess.Instance.GetMessageRecodeList(messageRecodeQuery); }
/// <summary> /// 分页获取符合查询条件的数据 /// </summary> /// <param name="messageRecodeQuery">MessageRecodeQuery查询实体对象</param> /// <returns>Pager<MessageRecodeEntity></returns> public Pager<MessageRecodeEntity> GetMessageRecodePageList(MessageRecodeQuery messageRecodeQuery) { Pager<MessageRecodeEntity> pager = MessageRecodeBusProvider.GetMessageRecodePageList(messageRecodeQuery); if (pager != null) pager.ItemList = GetMsgList(pager.ItemList.ToList(), messageRecodeQuery); return pager; }
/// <summary> /// 组装数据 /// </summary> /// <param name="list"></param> /// <returns></returns> private List<MessageRecodeEntity> GetMsgList(List<MessageRecodeEntity> list, MessageRecodeQuery mQuery) { if (list == null || list.Count == 0) return list; AuthorInfoService service = new AuthorInfoService(); AuthorInfoEntity entity = new AuthorInfoEntity(); AuthorInfoQuery query = new AuthorInfoQuery(); query.JournalID = mQuery.JournalID; var dict = service.AuthorInfoBusProvider.GetAuthorDict(query); //获取稿件作者数据字典 ContributionInfoService cservice = new ContributionInfoService(); ContributionInfoEntity centity = new ContributionInfoEntity(); ContributionInfoQuery cquery = new ContributionInfoQuery(); cquery.JournalID = mQuery.JournalID; cquery.CID = (long)mQuery.CID; var cdict = cservice.GetContributionAuthorDict(cquery); centity = cservice.GetContributionInfo(cquery); foreach (var mode in list) { mode.SendUserName = dict.GetValue(mode.SendUser, mode.SendUser.ToString()); entity = service.GetAuthorInfo(mode.ReciveUser); if(entity!=null) mode.ReciveUserName = dict.GetValue(mode.ReciveUser, mode.ReciveUser.ToString()); else mode.ReciveUserName = cdict.GetValue(mode.ReciveUser, mode.ReciveUser.ToString()); } return list; }
/// <summary> /// 获取所有符合查询条件的数据 /// </summary> /// <param name="messageRecodeQuery">MessageRecodeQuery查询实体对象</param> /// <returns>List<MessageRecodeEntity></returns> public List<MessageRecodeEntity> GetMessageRecodeList(MessageRecodeQuery messageRecodeQuery) { return GetMsgList(MessageRecodeBusProvider.GetMessageRecodeList(messageRecodeQuery), messageRecodeQuery); }
/// <summary> /// 获取一个实体对象 /// </summary> /// <param name="recodeID"></param> /// <returns>获取一个实体,如果数据不存在返回Null</returns> public MessageRecodeEntity GetMessageRecode(MessageRecodeQuery query) { return MessageRecodeBusProvider.GetMessageRecode( query); }
/// <summary> /// 获取发送记录实体 /// </summary> /// <param name="query"></param> /// <returns></returns> public MessageRecodeEntity GetMsgRecodeModel(MessageRecodeQuery query) { HttpClientHelper clientHelper = new HttpClientHelper(); MessageRecodeEntity model = clientHelper.Post<MessageRecodeEntity, MessageRecodeQuery>(GetAPIUrl(APIConstant.MSGRECODE_GETMSGRECODEMODEL), query); return model; }
/// <summary> /// 将查询实体转换为Order语句 /// <param name="query">查询实体</param> /// <returns>获取Order语句,不包含Order</returns> /// </summary> public string MessageRecodeQueryToSQLOrder(MessageRecodeQuery query) { return " RecodeID DESC"; }
public MessageRecodeEntity GetMsgRecodeModel(MessageRecodeQuery query) { IMessageRecodeService service = ServiceContainer.Instance.Container.Resolve<IMessageRecodeService>(); MessageRecodeEntity model = service.GetMessageRecode(query); return model; }
/// <summary> /// 将查询实体转换为Where语句 /// <param name="query">查询实体</param> /// <returns>获取Where语句,不包含Where</returns> /// </summary> public string MessageRecodeQueryToSQLWhere(MessageRecodeQuery query) { StringBuilder strFilter = new StringBuilder(" JournalID=" + query.JournalID); if (query.MsgType != null) strFilter.AppendFormat(" and MsgType={0}", query.MsgType.Value); if (query.SendType != null) strFilter.AppendFormat(" and SendType={0}", query.SendType.Value); if (query.CID != null) strFilter.Append(" and CID=").Append(query.CID.Value); if (query.IsUserRelevant) strFilter.AppendFormat(" and (SendUser={0} or ReciveUser={1})", query.SendUser.Value, query.ReciveUser.Value); else { if (query.SendUser != null) strFilter.AppendFormat(" and SendUser={0}", query.SendUser.Value); if (query.ReciveUser != null) strFilter.AppendFormat(" and ReciveUser={0}", query.ReciveUser.Value); } return strFilter.ToString(); }
public IList<MessageRecodeEntity> GetMsgRecodeList(MessageRecodeQuery query) { IMessageRecodeService service = ServiceContainer.Instance.Container.Resolve<IMessageRecodeService>(); IList<MessageRecodeEntity> pager = service.GetMessageRecodeList(query); return pager; }
/// <summary> /// 获取消息记录 /// </summary> /// <param name="CID"></param> /// <param name="AuthorID"></param> /// <returns></returns> private IList<MessageRecodeEntity> GetMsgList(Int64 CID, Int64 AuthorID, Byte GroupID) { if (CID == 0) return new List<MessageRecodeEntity>(); IList<MessageRecodeEntity> list = null; ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); MessageRecodeQuery query = new MessageRecodeQuery(); query.JournalID = CurAuthor.JournalID; query.CID = CID; if (GroupID != 1) { query.SendUser = AuthorID; query.ReciveUser = AuthorID; query.IsUserRelevant = true; } list = service.GetMessageRecodeList(query); if (list == null) list = new List<MessageRecodeEntity>(); SiteMessageQuery msgQuery = new SiteMessageQuery(); msgQuery.JournalID = CurAuthor.JournalID; msgQuery.CID = CID; if (GroupID != 1) { msgQuery.SendUser = AuthorID; msgQuery.ReciverID = AuthorID; msgQuery.IsUserRelevant = true; } var msgList = service.GetSiteMessageList(msgQuery).ToList(); if (msgList != null && msgList.Count > 0) { MessageRecodeEntity model = null; foreach (var item in msgList) { model = new MessageRecodeEntity(); model.JournalID = item.JournalID; model.CID = item.CID; model.SendUser = item.SendUser; model.SendUserName = item.SendUserName; model.ReciveUser = item.ReciverID; model.ReciveUserName = item.ReciverName; model.ReciveAddress = string.Empty; model.SendDate = item.SendDate; model.MsgType = 3; model.SendType = 0; model.MsgTitle = item.Title; model.MsgContent = item.Content; list.Add(model); } } return list.OrderBy(p => p.SendDate).ToList(); }
/// <summary> /// 获取发送记录数据 /// </summary> /// <param name="query"></param> /// <returns></returns> public IList<MessageRecodeEntity> GetMessageRecodeList(MessageRecodeQuery query) { HttpClientHelper clientHelper = new HttpClientHelper(); IList<MessageRecodeEntity> list = clientHelper.Post<IList<MessageRecodeEntity>, MessageRecodeQuery>(GetAPIUrl(APIConstant.MSGRECODE_GETLIST), query); return list; }