public ActionResult Delete(Int64[] MessageIDs) { ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); SiteMessageQuery query = new SiteMessageQuery(); query.JournalID = CurAuthor.JournalID; query.MessageIDs = MessageIDs; ExecResult result = service.DelSiteMessage(query); return Json(new { result = result.result, msg = result.msg }); }
public ActionResult GetCurrentMsgList() { ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); SiteMessageQuery query = new SiteMessageQuery(); query.JournalID = CurAuthor.JournalID; query.ReciverID = CurAuthor.AuthorID; query.IsUserRelevant = false; query.IsView = 0; IList<SiteMessageEntity> list = service.GetSiteMessageList(query); var result = list.Select(p => new { ID = p.MessageID, Title = p.Title, SendUser = p.SendUserName, SendDate = p.SendDate.ToString("yyyy-MM-dd hh:mm") }).ToList(); return Json(new { list = result }); }
/// <summary> /// 获取所有符合查询条件的数据 /// </summary> /// <param name="siteMessageQuery">SiteMessageQuery查询实体对象</param> /// <returns>List<SiteMessageEntity></returns> public List<SiteMessageEntity> GetSiteMessageList(SiteMessageQuery siteMessageQuery) { return GetMsgList(SiteMessageBusProvider.GetSiteMessageList(siteMessageQuery), siteMessageQuery); }
/// <summary> /// 将查询实体转换为Where语句 /// <param name="query">查询实体</param> /// <returns>获取Where语句,不包含Where</returns> /// </summary> public string SiteMessageQueryToSQLWhere(SiteMessageQuery query) { StringBuilder strFilter = new StringBuilder(" JournalID=" + query.JournalID); if (query.IsView != null) strFilter.Append(" and IsView=").Append(query.IsView.Value); if (query.CID != null) strFilter.Append(" and CID=").Append(query.CID.Value); if (query.IsUserRelevant) strFilter.AppendFormat(" and (SendUser={0} or ReciverID={1})", query.SendUser.Value, query.ReciverID.Value); else { if (query.SendUser != null) strFilter.Append(" and SendUser="******" and ReciverID=").Append(query.ReciverID.Value); } return strFilter.ToString(); }
/// <summary> /// 删除站内消息 /// </summary> /// <param name="query"></param> /// <returns></returns> public ExecResult DelSiteMessage(SiteMessageQuery query) { HttpClientHelper clientHelper = new HttpClientHelper(); ExecResult result = clientHelper.Post<ExecResult, SiteMessageQuery>(GetAPIUrl(APIConstant.SITEMESSAGE_DEL), query); return result; }
public ActionResult GetPageList(SiteMessageQuery query, Int32? MsgType) { ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); query.JournalID = CurAuthor.JournalID; if (MsgType == null) { query.IsUserRelevant = true; query.SendUser = CurAuthor.AuthorID; query.ReciverID = CurAuthor.AuthorID; } else if (MsgType.Value == 1) query.SendUser = CurAuthor.AuthorID; else if (MsgType.Value == 2) query.ReciverID = CurAuthor.AuthorID; query.CurrentPage = Convert.ToInt32(Request.Params["page"]); query.PageSize = Convert.ToInt32(Request.Params["pagesize"]); Pager<SiteMessageEntity> pager = service.GetSiteMessagePageList(query); return Json(new { Rows = pager.ItemList, Total = pager.TotalRecords }); }
public ActionResult Content(SiteMessageQuery query) { return View(GetModel(query.MessageID)); }
public ActionResult Viewed(Int64 MessageID) { ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); SiteMessageQuery query = new SiteMessageQuery(); query.JournalID = CurAuthor.JournalID; query.MessageID = MessageID; bool result = service.UpdateMsgViewed(query); return Json(new { result = result ? EnumJsonResult.success.ToString() : EnumJsonResult.failure.ToString() }); }
public SiteMessageEntity GetModel(SiteMessageQuery query) { ISiteMessageService service = ServiceContainer.Instance.Container.Resolve<ISiteMessageService>(); SiteMessageEntity model = service.GetSiteMessage(query.JournalID, query.MessageID); return model; }
public IList<SiteMessageEntity> GetList(SiteMessageQuery query) { ISiteMessageService service = ServiceContainer.Instance.Container.Resolve<ISiteMessageService>(); IList<SiteMessageEntity> list = service.GetSiteMessageList(query); return list; }
public ExecResult Del(SiteMessageQuery query) { ISiteMessageService service = ServiceContainer.Instance.Container.Resolve<ISiteMessageService>(); return service.Del(query.MessageIDs); }
/// <summary> /// 获取所有符合查询条件的数据 /// </summary> /// <param name="siteMessageQuery">SiteMessageQuery查询实体对象</param> /// <returns>List<SiteMessageEntity></returns> public List<SiteMessageEntity> GetSiteMessageList(SiteMessageQuery siteMessageQuery) { return SiteMessageDataAccess.Instance.GetSiteMessageList(siteMessageQuery); }
/// <summary> /// 获取站内消息分页数据 /// </summary> /// <param name="query"></param> /// <returns></returns> public Pager<SiteMessageEntity> GetSiteMessagePageList(SiteMessageQuery query) { HttpClientHelper clientHelper = new HttpClientHelper(); Pager<SiteMessageEntity> pager = clientHelper.Post<Pager<SiteMessageEntity>, SiteMessageQuery>(GetAPIUrl(APIConstant.SITEMESSAGE_GETPAGELIST), query); return pager; }
/// <summary> /// 获取站内消息实体 /// </summary> /// <param name="query"></param> /// <returns></returns> public SiteMessageEntity GetSiteMessageModel(SiteMessageQuery query) { HttpClientHelper clientHelper = new HttpClientHelper(); SiteMessageEntity model = clientHelper.Post<SiteMessageEntity, SiteMessageQuery>(GetAPIUrl(APIConstant.SITEMESSAGE_GETMODEL), query); return model; }
/// <summary> /// 获取站内消息数据 /// </summary> /// <param name="query"></param> /// <returns></returns> public IList<SiteMessageEntity> GetSiteMessageList(SiteMessageQuery query) { HttpClientHelper clientHelper = new HttpClientHelper(); IList<SiteMessageEntity> list = clientHelper.Post<IList<SiteMessageEntity>, SiteMessageQuery>(GetAPIUrl(APIConstant.SITEMESSAGE_GETLIST), query); return list; }
/// <summary> /// 分页获取符合查询条件的数据 /// </summary> /// <param name="siteMessageQuery">SiteMessageQuery查询实体对象</param> /// <returns>Pager<SiteMessageEntity></returns> public Pager<SiteMessageEntity> GetSiteMessagePageList(SiteMessageQuery siteMessageQuery) { Pager<SiteMessageEntity> pager = SiteMessageBusProvider.GetSiteMessagePageList(siteMessageQuery); if (pager != null) pager.ItemList = GetMsgList(pager.ItemList.ToList(), siteMessageQuery); return pager; }
/// <summary> /// 组装数据 /// </summary> /// <param name="list"></param> /// <returns></returns> private List<SiteMessageEntity> GetMsgList(List<SiteMessageEntity> list, SiteMessageQuery sQuery) { if (list == null || list.Count == 0) return list; AuthorInfoService service = new AuthorInfoService(); AuthorInfoQuery query = new AuthorInfoQuery(); query.JournalID = sQuery.JournalID; var dict = service.AuthorInfoBusProvider.GetAuthorDict(query); foreach (var model in list) { model.SendUserName = dict.GetValue(model.SendUser, model.SendUser.ToString()); model.ReciverName = dict.GetValue(model.ReciverID, model.ReciverID.ToString()); model.SimpleContent = TextHelper.GetSubHtmlText(model.Content, 100); } return list; }
public Pager<SiteMessageEntity> GetPageList(SiteMessageQuery query) { ISiteMessageService service = ServiceContainer.Instance.Container.Resolve<ISiteMessageService>(); Pager<SiteMessageEntity> pager = service.GetSiteMessagePageList(query); return pager; }
private SiteMessageEntity GetModel(Int64 MessageID) { SiteMessageEntity model = null; if (MessageID > 0) { SiteMessageQuery query = new SiteMessageQuery(); query.JournalID = CurAuthor.JournalID; query.MessageID = MessageID; ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); model = service.GetSiteMessageModel(query); } if (model == null) model = new SiteMessageEntity(); return model; }
public bool Viewed(SiteMessageQuery query) { ISiteMessageService service = ServiceContainer.Instance.Container.Resolve<ISiteMessageService>(); return service.UpdateMsgViewed(query.JournalID, query.MessageID); }
public List<SiteMessageEntity> GetSiteMessageList(SiteMessageQuery query) { List<SiteMessageEntity> list = new List<SiteMessageEntity>(); StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append("SELECT * FROM dbo.SiteMessage WITH(NOLOCK)"); string whereSQL = SiteMessageQueryToSQLWhere(query); string orderBy=SiteMessageQueryToSQLOrder(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 = MakeSiteMessageList(dr); } return list; }
public Pager<SiteMessageEntity> GetSiteMessagePageList(SiteMessageQuery query) { int recordCount=0; string whereSQL=SiteMessageQueryToSQLWhere(query); string orderBy=SiteMessageQueryToSQLOrder(query); DataSet ds = db.GetPagingData("SiteMessage", "*", orderBy, whereSQL, query.CurrentPage, query.PageSize, out recordCount); Pager<SiteMessageEntity> pager=new Pager<SiteMessageEntity>(); if(ds!=null && ds.Tables.Count>0) { pager.ItemList= MakeSiteMessageList(ds.Tables[0]); } pager.CurrentPage=query.CurrentPage; pager.PageSize=query.PageSize; pager.TotalRecords=recordCount; return pager; }
public ActionResult GetList(SiteMessageQuery query) { ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); query.JournalID = CurAuthor.JournalID; IList<SiteMessageEntity> list = service.GetSiteMessageList(query); return Json(new { list }); }
/// <summary> /// 将查询实体转换为Order语句 /// <param name="query">查询实体</param> /// <returns>获取Order语句,不包含Order</returns> /// </summary> public string SiteMessageQueryToSQLOrder(SiteMessageQuery query) { return " SendDate DESC"; }
/// <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 bool UpdateMsgViewed(SiteMessageQuery query) { HttpClientHelper clientHelper = new HttpClientHelper(); bool result = clientHelper.Post<bool, SiteMessageQuery>(GetAPIUrl(APIConstant.SITEMESSAGE_VIEWED), query); return result; }