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); }
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); }
/// <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); }