public ExecResult Del(SiteContentQuery query) { ExecResult execResult = new ExecResult(); ISiteContentService service = ServiceContainer.Instance.Container.Resolve<ISiteContentService>(); Int64[] ContentIDs = query.ContentIDs; if (ContentIDs == null) { execResult.result = EnumJsonResult.failure.ToString(); execResult.msg = "没有删除任何数据!"; return execResult; } string msg = string.Empty; bool result = service.BatchDeleteSiteContent(ContentIDs); if (result) { execResult.result = EnumJsonResult.success.ToString(); execResult.msg = "删除新闻资讯成功!"; } else { execResult.result = EnumJsonResult.failure.ToString(); execResult.msg = "删除新闻资讯失败!"; } return execResult; }
public ActionResult GetList(SiteContentQuery query) { ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); query.JournalID = CurAuthor.JournalID; IList<SiteContentEntity> list = service.GetSiteContentList(query); return Json(new { list }); }
public ActionResult GetPageList(SiteContentQuery query) { ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); query.JournalID = CurAuthor.JournalID; query.CurrentPage = Convert.ToInt32(Request.Params["page"]); query.PageSize = Convert.ToInt32(Request.Params["pagesize"]); Pager<SiteContentEntity> pager = service.GetSiteContentPageList(query); return Json(new { Rows = pager.ItemList, Total = pager.TotalRecords }); }
public ActionResult Delete(Int64[] ContentIDs) { ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); SiteContentQuery query = new SiteContentQuery(); query.JournalID = CurAuthor.JournalID; query.ContentIDs = ContentIDs; ExecResult result = service.DelSiteContent(query); return Json(new { result = result.result, msg = result.msg }); }
public ActionResult zjjy(string ChannelUrl, int page = 1) { ((dynamic)base.ViewBag).Title = ""; ((dynamic)base.ViewBag).ChannelName = ""; SiteModel model = new SiteModel(); ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(new ResolverOverride[0]); SiteChannelQuery query = new SiteChannelQuery { JournalID = base.JournalID, ChannelUrl = ChannelUrl }; SiteChannelEntity siteChannelModel = service.GetSiteChannelModel(query); if (siteChannelModel != null) { ((dynamic)base.ViewBag).ChannelName = siteChannelModel.Keywords; if (siteChannelModel.ContentType == 4) { SiteNoticeQuery query2 = new SiteNoticeQuery { ChannelID = siteChannelModel.ChannelID, JournalID = base.JournalID, CurrentPage = 1, PageSize = 1 }; Pager<SiteNoticeEntity> siteNoticePageList = service.GetSiteNoticePageList(query2); if ((siteNoticePageList != null) && (siteNoticePageList.ItemList.Count > 0)) { model.ConentEntity.Title = siteNoticePageList.ItemList[0].Title; model.ConentEntity.Content = siteNoticePageList.ItemList[0].Content; model.ConentEntity.PublishDate = siteNoticePageList.ItemList[0].AddDate; } } else if (siteChannelModel.ContentType == 1) { SiteContentQuery query3 = new SiteContentQuery { ChannelID = new long?(siteChannelModel.ChannelID), JournalID = base.JournalID, CurrentPage = page, PageSize = this.PageSize }; Pager<SiteContentEntity> siteContentPageList = service.GetSiteContentPageList(query3); if (siteContentPageList != null) { ((dynamic)base.ViewBag).PagerInfo = WKT.Common.Utils.Utils.GetPageNumbers(page, siteContentPageList.TotalPage, "/zjjy/" + siteChannelModel.ChannelID, 10); model.SiteContentList = new List<SiteContentEntity>(); foreach (SiteContentEntity entity2 in siteContentPageList.ItemList) { NewsModel item = new NewsModel { Title = entity2.Title, Content = entity2.Content, ChannelID = siteChannelModel.ChannelID, PKID = entity2.ContentID, PublishDate = entity2.AddDate }; model.ListConentEntity.Add(item); model.SiteContentList.Add(entity2); } } } } ((dynamic)base.ViewBag).Title = model.ConentEntity.Title; if ((siteChannelModel != null) && ((siteChannelModel.ContentType == 1) && (siteChannelModel.ChannelUrl == "list"))) { return base.View("list", model); } return base.View(model); }
public ActionResult spjz(long ChannelID, int page = 1) { ViewBag.ChannelName = ""; ViewBag.PagerInfo = ""; SiteModel siteModel = new SiteModel(); ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); SiteChannelQuery query = new SiteChannelQuery(); query.JournalID = JournalID; query.ChannelID = ChannelID; SiteChannelEntity channelEntity = service.GetSiteChannelModel(query); if (channelEntity != null) { ViewBag.ChannelName = channelEntity.Keywords; if (channelEntity.ContentType == (int)EnumContentType.Information) { SiteContentQuery contentQuery = new SiteContentQuery(); contentQuery.ChannelID = ChannelID; contentQuery.JournalID = JournalID; contentQuery.CurrentPage = page; contentQuery.PageSize = PageSize; Pager<SiteContentEntity> pagerContentEntity = service.GetSiteContentPageList(contentQuery); if (pagerContentEntity != null) { ViewBag.PagerInfo = Utils.GetPageNumbers(page, pagerContentEntity.TotalPage, "/spjz/" + ChannelID, 10); foreach (SiteContentEntity item in pagerContentEntity.ItemList) { NewsModel newsItem = new NewsModel(); newsItem.Title = item.Title; newsItem.Content = item.Content; newsItem.ChannelID = ChannelID; newsItem.PKID = item.ContentID; newsItem.FJPath = item.FJPath; newsItem.LinkUrl = item.Linkurl; newsItem.PublishDate = item.AddDate; siteModel.ListConentEntity.Add(newsItem); } } } else if (channelEntity.ContentType == (int)EnumContentType.SiteDescribe) { SiteNoticeQuery noticeQuery = new SiteNoticeQuery(); noticeQuery.ChannelID = ChannelID; noticeQuery.JournalID = JournalID; noticeQuery.CurrentPage = page; noticeQuery.PageSize = PageSize; Pager<SiteNoticeEntity> pagerNoticeEntity = service.GetSiteNoticePageList(noticeQuery); if (pagerNoticeEntity != null) { ViewBag.PagerInfo = Utils.GetPageNumbers(page, pagerNoticeEntity.TotalPage, "/spjz/" + ChannelID, 10); foreach (SiteNoticeEntity item in pagerNoticeEntity.ItemList) { NewsModel newsItem = new NewsModel(); newsItem.Title = item.Title; newsItem.Content = item.Content; newsItem.ChannelID = ChannelID; newsItem.PKID = item.NoticeID; newsItem.FJPath = item.FjPath; newsItem.LinkUrl = string.Format("/show/{0}/?itemid={1}", item.ChannelID, item.NoticeID); newsItem.PublishDate = item.AddDate; siteModel.ListConentEntity.Add(newsItem); } } } else if (channelEntity.ContentType == (int)EnumContentType.Resources) { SiteResourceQuery resourceQuery = new SiteResourceQuery(); resourceQuery.ChannelID = ChannelID; resourceQuery.JournalID = JournalID; resourceQuery.CurrentPage = page; resourceQuery.PageSize = PageSize; Pager<SiteResourceEntity> pagerResourceEntity = service.GetSiteResourcePageList(resourceQuery); if (pagerResourceEntity != null) { ViewBag.PagerInfo = Utils.GetPageNumbers(page, pagerResourceEntity.TotalPage, "/spjz/" + ChannelID, 10); foreach (SiteResourceEntity item in pagerResourceEntity.ItemList) { NewsModel newsItem = new NewsModel(); newsItem.Title = item.Name; newsItem.LinkUrl = string.Format("/resource/?id={0}", item.ResourceID); newsItem.PublishDate = item.AddDate; siteModel.ListConentEntity.Add(newsItem); } } } } return View(siteModel); }
/// <summary> /// 显示指定的频道页面 /// </summary> /// <param name="ChannelID"></param> /// <param name="NewsID"></param> /// <returns></returns> public ActionResult channel(string ChannelUrl,int page=1) { ViewBag.Title = ""; ViewBag.ChannelName = ""; SiteModel siteModel = new SiteModel(); ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); SiteChannelQuery query = new SiteChannelQuery(); query.JournalID = JournalID; query.ChannelUrl = ChannelUrl; SiteChannelEntity channelEntity = service.GetSiteChannelModel(query); if (channelEntity != null) { ViewBag.ChannelName = channelEntity.Keywords; if (channelEntity.ContentType == (int)EnumContentType.SiteDescribe) { SiteNoticeQuery noticeQuery = new SiteNoticeQuery(); noticeQuery.ChannelID = channelEntity.ChannelID; noticeQuery.JournalID = JournalID; noticeQuery.CurrentPage = 1; noticeQuery.PageSize = 1; Pager<SiteNoticeEntity> pagerNoticeEntity = service.GetSiteNoticePageList(noticeQuery); if (pagerNoticeEntity != null && pagerNoticeEntity.ItemList.Count > 0) { siteModel.ConentEntity.Title = pagerNoticeEntity.ItemList[0].Title; siteModel.ConentEntity.Content = pagerNoticeEntity.ItemList[0].Content; siteModel.ConentEntity.FJPath = pagerNoticeEntity.ItemList[0].FjPath; siteModel.ConentEntity.PublishDate = pagerNoticeEntity.ItemList[0].AddDate; } } else if (channelEntity.ContentType == (int)EnumContentType.Information) { SiteContentQuery contentQuery = new SiteContentQuery(); contentQuery.ChannelID = channelEntity.ChannelID; contentQuery.JournalID = JournalID; contentQuery.CurrentPage = page; contentQuery.PageSize = PageSize; Pager<SiteContentEntity> pagerContentEntity = service.GetSiteContentPageList(contentQuery); if (pagerContentEntity != null) { ViewBag.PagerInfo = Utils.GetPageNumbers(page, pagerContentEntity.TotalPage, "/channel/" + channelEntity.ChannelID, 10); siteModel.SiteContentList = new List<SiteContentEntity>(); foreach (SiteContentEntity item in pagerContentEntity.ItemList) { NewsModel newsItem = new NewsModel(); newsItem.Title = item.Title; newsItem.Content = item.Content; newsItem.ChannelID = channelEntity.ChannelID; newsItem.PKID = item.ContentID; newsItem.FJPath = item.FJPath; newsItem.PublishDate = item.AddDate; siteModel.ListConentEntity.Add(newsItem); siteModel.SiteContentList.Add(item); } } } } ViewBag.Title = siteModel.ConentEntity.Title; if (channelEntity != null) { if (channelEntity.ContentType == (int)EnumContentType.Information && channelEntity.ChannelUrl=="list") { return View("list", siteModel); } } return View(siteModel); }
/// <summary> /// 获取新闻资讯数据 /// </summary> /// <param name="query"></param> /// <returns></returns> public IList<SiteContentEntity> GetSiteContentList(SiteContentQuery query) { HttpClientHelper clientHelper = new HttpClientHelper(); IList<SiteContentEntity> list = clientHelper.Post<IList<SiteContentEntity>, SiteContentQuery>(GetAPIUrl(APIConstant.SITECONTENT_GETLIST), query); return list; }
/// <summary> /// 获取条件 /// </summary> /// <param name="query"></param> /// <returns></returns> private string GetSiteContentFilter(SiteContentQuery query) { StringBuilder strFilter = new StringBuilder(" JournalID="+query.JournalID); if (query.ChannelID != null) strFilter.AppendFormat(" and ChannelID={0}", query.ChannelID.Value); if (query.IsPhoto) { strFilter.Append(" and TitlePhoto<>''"); } return strFilter.ToString(); }
public Pager<SiteContentEntity> GetPageList(SiteContentQuery query) { ISiteContentService service = ServiceContainer.Instance.Container.Resolve<ISiteContentService>(); Pager<SiteContentEntity> pager = service.GetSiteContentPageList(query); return pager; }
public SiteContentEntity GetModel(SiteContentQuery query) { ISiteContentService service = ServiceContainer.Instance.Container.Resolve<ISiteContentService>(); SiteContentEntity model = service.GetSiteContentModel(query.ContentID); return model; }
public IList<SiteContentEntity> GetList(SiteContentQuery query) { ISiteContentService service = ServiceContainer.Instance.Container.Resolve<ISiteContentService>(); IList<SiteContentEntity> list = service.GetSiteContentList(query); return list; }
/// <summary> /// 获取新闻资讯分页数据 /// </summary> /// <param name="query"></param> /// <returns></returns> public Pager<SiteContentEntity> GetSiteContentPageList(SiteContentQuery query) { HttpClientHelper clientHelper = new HttpClientHelper(); Pager<SiteContentEntity> pager = clientHelper.Post<Pager<SiteContentEntity>, SiteContentQuery>(GetAPIUrl(APIConstant.SITECONTENT_GETPAGELIST), query); return pager; }
/// <summary> /// 获取新闻资讯实体 /// </summary> /// <param name="query"></param> /// <returns></returns> public SiteContentEntity GetSiteContentModel(SiteContentQuery query) { HttpClientHelper clientHelper = new HttpClientHelper(); SiteContentEntity model = clientHelper.Post<SiteContentEntity, SiteContentQuery>(GetAPIUrl(APIConstant.SITECONTENT_GETMODEL), query); return model; }
/// <summary> /// 获取资讯数据 /// </summary> /// <param name="query"></param> /// <returns></returns> public IList<SiteContentEntity> GetSiteContentList(SiteContentQuery query) { string strSql = "SELECT * FROM dbo.SiteContent a with(nolock)"; string whereSQL = GetSiteContentFilter(query); if (!string.IsNullOrWhiteSpace(whereSQL)) { strSql += " WHERE " + whereSQL; } strSql += " order by SortID"; return db.GetList<SiteContentEntity>(strSql, MakeSiteContentList); }
/// <summary> /// 获取资讯分页数据 /// </summary> /// <param name="query"></param> /// <returns></returns> public Pager<SiteContentEntity> GetSiteContentPageList(SiteContentQuery query) { string strSql = "SELECT *,ROW_NUMBER() OVER(ORDER BY SortID ASC) AS ROW_ID FROM dbo.SiteContent a with(nolock)", sumStr = "SELECT RecordCount=COUNT(1) FROM dbo.SiteContent with(nolock)"; string whereSQL = GetSiteContentFilter(query); if (!string.IsNullOrWhiteSpace(whereSQL)) { strSql += " WHERE " + whereSQL; sumStr += " WHERE " + whereSQL; } return db.GetPageList<SiteContentEntity>(string.Format(SQL_Page_Select, strSql, query.StartIndex, query.EndIndex) , sumStr , query.CurrentPage, query.PageSize , (dr, pager) => { pager.TotalRecords = TypeParse.ToLong(dr["RecordCount"]); } , MakeSiteContentList); }
/// <summary> /// 获取资讯分页数据 /// </summary> /// <param name="query"></param> /// <returns></returns> public Pager<SiteContentEntity> GetSiteContentPageList(SiteContentQuery query) { Pager<SiteContentEntity> pager= SiteContentBusProvider.GetSiteContentPageList(query); if (pager != null) pager.ItemList = GetSiteContentList(pager.ItemList, query); return pager; }
/// <summary> /// 获取资讯分页数据 /// </summary> /// <param name="query"></param> /// <returns></returns> public Pager<SiteContentEntity> GetSiteContentPageList(SiteContentQuery query) { return SiteContentDataAccess.Instance.GetSiteContentPageList(query); }
/// <summary> /// 组装数据 /// </summary> /// <param name="list"></param> /// <returns></returns> private IList<SiteContentEntity> GetSiteContentList(IList<SiteContentEntity> list, SiteContentQuery siteContentQuery) { if (list == null || list.Count == 0) return list; AuthorInfoService service = new AuthorInfoService(); AuthorInfoQuery query = new AuthorInfoQuery(); query.JournalID = siteContentQuery.JournalID; var dict = service.AuthorInfoBusProvider.GetAuthorDict(query); foreach (var mode in list) { mode.InAuthorName = dict.GetValue(mode.InAuthor, mode.InAuthor.ToString()); } return list; }
/// <summary> /// 获取资讯数据 /// </summary> /// <param name="query"></param> /// <returns></returns> public IList<SiteContentEntity> GetSiteContentList(SiteContentQuery query) { return GetSiteContentList(SiteContentBusProvider.GetSiteContentList(query), query); }
/// <summary> /// 显示指定的频道页面 /// </summary> /// <param name="ChannelID"></param> /// <param name="NewsID"></param> /// <returns></returns> public ActionResult show(long ChannelID) { ViewBag.Title = ""; ViewBag.ChannelName = ""; SiteModel siteModel = new SiteModel(); long ItemID = TypeParse.ToLong(Request.QueryString["itemid"]); if (ItemID > 0) { ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); SiteChannelQuery query = new SiteChannelQuery(); query.JournalID = JournalID; query.ChannelID = ChannelID; SiteChannelEntity channelEntity = service.GetSiteChannelModel(query); if (channelEntity != null) { ViewBag.ChannelName = channelEntity.Keywords; if (channelEntity.ContentType == (int)EnumContentType.Information) { SiteContentQuery contentQuery = new SiteContentQuery(); contentQuery.ChannelID = ChannelID; contentQuery.JournalID = JournalID; contentQuery.ContentID = ItemID; SiteContentEntity contentEntity = service.GetSiteContentModel(contentQuery); if (contentEntity != null) { string contentTitle = ""; contentTitle = string.Format("<span style=\"font-weight:{2};font-style:{3};color:{1}\">{0}</span>", contentEntity.Title, !string.IsNullOrEmpty(contentEntity.TitleColor) ? contentEntity.TitleColor : "#000", contentEntity.IsBold ? "bold" : "normal", contentEntity.IsItalic ? "italic" : "normal"); siteModel.ConentEntity.Title = contentTitle; siteModel.ConentEntity.FJPath = contentEntity.FJPath; siteModel.ConentEntity.Content = contentEntity.Content; siteModel.ConentEntity.ChannelID = contentEntity.ChannelID; siteModel.ConentEntity.PublishDate = contentEntity.AddDate; } } else if (channelEntity.ContentType == (int)EnumContentType.SiteDescribe) { SiteNoticeQuery noticeQuery = new SiteNoticeQuery(); noticeQuery.ChannelID = ChannelID; noticeQuery.JournalID = JournalID; noticeQuery.NoticeID = ItemID; SiteNoticeEntity noticeEntity = service.GetSiteNoticeModel(noticeQuery); if (noticeEntity != null) { siteModel.ConentEntity.Title = noticeEntity.Title; siteModel.ConentEntity.Content = noticeEntity.Content; siteModel.ConentEntity.ChannelID = noticeEntity.ChannelID; siteModel.ConentEntity.PublishDate = noticeEntity.AddDate; } } } } ViewBag.Title = Utils.ClearHtml(siteModel.ConentEntity.Title); return View(siteModel); }
private SiteContentEntity GetModel(Int64 ContentID) { SiteContentEntity model = null; if (ContentID > 0) { SiteContentQuery query = new SiteContentQuery(); query.JournalID = CurAuthor.JournalID; query.ContentID = ContentID; ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); model = service.GetSiteContentModel(query); } if (model == null) model = new SiteContentEntity(); return model; }
/// <summary> /// 删除新闻资讯 /// </summary> /// <param name="query"></param> /// <returns></returns> public ExecResult DelSiteContent(SiteContentQuery query) { HttpClientHelper clientHelper = new HttpClientHelper(); ExecResult result = clientHelper.Post<ExecResult, SiteContentQuery>(GetAPIUrl(APIConstant.SITECONTENT_DEL), query); return result; }