public ActionResult GetTree()
 {
     SiteChannelQuery query = new SiteChannelQuery();
     query.JournalID = JournalID;
     ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
     return Content(JsonConvert.SerializeObject(service.GetSiteChannelTreeList(query)));
 }
 public ActionResult Delete(Int64 ChannelID)
 {
     ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
     SiteChannelQuery query = new SiteChannelQuery();
     query.JournalID = CurAuthor.JournalID;
     query.ChannelID = ChannelID;
     ExecResult result = service.DelSiteChannel(query);
     return Json(new { result = result.result, msg = result.msg });
 }
 private SiteChannelEntity GetModel(Int64 ChannelID)
 {
     SiteChannelEntity model = null;
     if (ChannelID > 0)
     {
         SiteChannelQuery query = new SiteChannelQuery();
         query.JournalID = CurAuthor.JournalID;
         query.ChannelID = ChannelID;
         ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
         model = service.GetSiteChannelModel(query);
     }
     if (model == null)
         model = new SiteChannelEntity();
     return model;
 }
 public ExecResult Del(SiteChannelQuery query)
 {
     ExecResult execResult = new ExecResult();
     ISiteChannelService service = ServiceContainer.Instance.Container.Resolve<ISiteChannelService>();
     bool result = service.DeleteSiteChannel(query.ChannelID.Value);
     if (result)
     {
         execResult.result = EnumJsonResult.success.ToString();
         execResult.msg = "删除栏目成功!";
     }
     else
     {
         execResult.result = EnumJsonResult.failure.ToString();
         execResult.msg = "删除栏目失败!";
     }
     return execResult;
 }
 /// <summary>
 /// 分页获取符合查询条件的数据
 /// </summary>
 /// <param name="siteChannelQuery">SiteChannelQuery查询实体对象</param>
 /// <returns>Pager<SiteChannelEntity></returns>
 public Pager<SiteChannelEntity> GetSiteChannelPageList(SiteChannelQuery siteChannelQuery)
 {
     return SiteChannelBusProvider.GetSiteChannelPageList(siteChannelQuery);
 }
 /// <summary>
 /// 获取一个实体对象
 /// </summary>
 /// <param name="channelID"></param>
 /// <returns>获取一个实体,如果数据不存在返回Null</returns>
 public SiteChannelEntity GetSiteChannel(SiteChannelQuery query)
 {
     return SiteChannelBusProvider.GetSiteChannel( query );
 }
 /// <summary>
 /// 获取所有符合查询条件的数据
 /// </summary>
 /// <param name="siteChannelQuery">SiteChannelQuery查询实体对象</param>
 /// <returns>List<SiteChannelEntity></returns>
 public List<SiteChannelEntity> GetSiteChannelList(SiteChannelQuery siteChannelQuery)
 {
     return SiteChannelBusProvider.GetSiteChannelList(siteChannelQuery);
 }
Beispiel #8
0
 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="query"></param>
        /// <returns></returns>
        public IList<TreeModel> GetHaveRightMenu(RoleMenuQuery queryRoleMenu)
        {
            if (queryRoleMenu.GroupID == 2)
            {
                MenuQuery query = new MenuQuery();
                query.JournalID = queryRoleMenu.JournalID;
                query.GroupID = 2;
                query.Status = 1;
                return GetTreeNodeList(query);
            }

            # region 找到内容菜单,添加栏目列表

            Func<IList<TreeModel>> funcGetSiteChanneNodes = () =>
            {
                IList<TreeModel> channelTreeList = new List<TreeModel>();
                SiteChannelQuery channelQuery = new SiteChannelQuery();
                channelQuery.JournalID = queryRoleMenu.JournalID;
                channelQuery.Status = 1;
                SiteConfigFacadeAPIService siteConfigAPIService = new SiteConfigFacadeAPIService();
                channelTreeList = siteConfigAPIService.GetSiteChannelTreeList(channelQuery,true);
                TreeModel root = channelTreeList.Single(p => p.Id == 0);
                return root.children;
            };

            # endregion

            IList<TreeModel> listResult = new List<TreeModel>();

            HttpClientHelper clientHelper = new HttpClientHelper();

            // 给指定的作者设置了例外的菜单
            IDictionary<long, string> dictExceptionRightMenu = new Dictionary<long, string>();
            if (queryRoleMenu.AuthorID != null)
            {
                AuthorMenuRightExceptionEntity authorExecEntity = new AuthorMenuRightExceptionEntity();
                authorExecEntity.AuthorID = queryRoleMenu.AuthorID.Value;
                authorExecEntity.JournalID = queryRoleMenu.JournalID;
                dictExceptionRightMenu = clientHelper.PostAuth<IDictionary<long, string>, AuthorMenuRightExceptionEntity>(GetAPIUrl(APIConstant.SYSGETAUTHOREXCEPTIONRIGHTMENU), authorExecEntity);
            }
            IList<MenuEntity> listHaveRightMenuList = clientHelper.Post<IList<MenuEntity>, RoleMenuQuery>(GetAPIUrl(APIConstant.SYSGETHAVERIGHTMENULIST), queryRoleMenu);

            if (listHaveRightMenuList != null)
            {
                IList<MenuEntity> listRoot = listHaveRightMenuList.Where(item => item.PMenuID == 0).ToList<MenuEntity>();
                TreeModel treeNode = null;
                foreach (MenuEntity item in listRoot)
                {
                    if (!dictExceptionRightMenu.ContainsKey(item.MenuID))
                    {
                        bool first = true;

                        treeNode = new TreeModel();
                        treeNode.key = item.MenuID.ToString();
                        treeNode.text = item.MenuName;
                        treeNode.url = SiteConfig.RootPath + item.MenuUrl;
                        treeNode.icon = SiteConfig.RootPath + item.IconUrl;
                        treeNode.isexpand = queryRoleMenu.IsExpend;

                        IList<MenuEntity> listChild = listHaveRightMenuList.Where(p => p.PMenuID == item.MenuID).ToList<MenuEntity>();
                        if (listChild != null)
                        {
                            treeNode.isexpand = (first != queryRoleMenu.IsExpend) && first ? first : queryRoleMenu.IsExpend;
                            // 二级
                            foreach (MenuEntity itemChild in listChild)
                            {
                                if (!dictExceptionRightMenu.ContainsKey(itemChild.MenuID))
                                {
                                    TreeModel treeChildNode = new TreeModel();
                                    treeChildNode.key = itemChild.MenuID.ToString();
                                    treeChildNode.text = itemChild.MenuName;
                                    treeChildNode.url = SiteConfig.RootPath + itemChild.MenuUrl;
                                    treeChildNode.icon = SiteConfig.RootPath + itemChild.IconUrl;
                                    treeChildNode.isexpand = queryRoleMenu.IsExpend;
                                    // 如果是网站内容管理节点,则载入站点栏目设置
                                    if (itemChild.IsContentMenu)
                                    {
                                        treeChildNode.children = funcGetSiteChanneNodes();
                                        treeNode.children.Add(treeChildNode);
                                    }
                                    else
                                    {
                                        treeNode.children.Add(treeChildNode);
                                        // 三级
                                        IList<MenuEntity> lastListChild = listHaveRightMenuList.Where(p => p.PMenuID == itemChild.MenuID).ToList<MenuEntity>();
                                        foreach (MenuEntity lastChild in lastListChild)
                                        {
                                            if (!dictExceptionRightMenu.ContainsKey(lastChild.MenuID))
                                            {
                                                TreeModel treeLastNode = new TreeModel();
                                                treeLastNode.key = lastChild.MenuID.ToString();
                                                treeLastNode.text = lastChild.MenuName;
                                                treeLastNode.url = SiteConfig.RootPath + lastChild.MenuUrl;
                                                treeLastNode.icon = SiteConfig.RootPath + lastChild.IconUrl;
                                                treeLastNode.isexpand = queryRoleMenu.IsExpend;
                                                treeChildNode.children.Add(treeLastNode);
                                            }
                                        }
                                    }
                                }
                            }
                            first = false;
                        }
                        listResult.Add(treeNode);
                    }
                }
            }
            return listResult;
        }
 /// <summary>
 /// 获取一个实体对象
 /// </summary>
 /// <param name="channelID"></param>
 /// <returns>获取一个实体,如果数据不存在返回Null</returns>
 public SiteChannelEntity GetSiteChannel(SiteChannelQuery query)
 {
     return SiteChannelDataAccess.Instance.GetSiteChannel( query);
 }
Beispiel #11
0
        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="query"></param>
 /// <param name="isGetSysFun">是否获取系统功能菜单</param>
 /// <returns></returns>
 public IList<TreeModel> GetSiteChannelTreeList(SiteChannelQuery query, bool isGetSysFun)
 {
     var list = GetSiteChannelList(query);
     TreeModel treeNode = new TreeModel();
     treeNode.Id = 0;
     treeNode.text = "栏目";
     treeNode.url = "";
     treeNode.icon = "";
     treeNode.isexpand = true;
     if (list != null && list.Count > 0)
     {
         var first = list.Where(p => p.PChannelID == 0);
         TreeModel node = null;
         foreach (var item in first)
         {
             if (isGetSysFun)
             {
                 if (item.ContentType > 0 && (item.ContentType != (byte)EnumContentType.SystemFun))
                 {
                     node = new TreeModel();
                     node.Id = item.ChannelID;
                     node.text = item.Keywords;
                     node.url = GetChannelContentTypeUrl(item.ContentType, item.ChannelID);
                     node.icon = "";
                     node.isexpand = true;
                     GetSiteChannelTreeList(node, list);
                     treeNode.children.Add(node);
                 }
             }
             else
             {
                 if (item.ContentType > 0)
                 {
                     node = new TreeModel();
                     node.Id = item.ChannelID;
                     node.text = item.Keywords;
                     node.url = GetChannelContentTypeUrl(item.ContentType, item.ChannelID);
                     node.icon = "";
                     node.isexpand = true;
                     GetSiteChannelTreeList(node, list);
                     treeNode.children.Add(node);
                 }
             }
         }
     }
     IList<TreeModel> resultList = new List<TreeModel>();
     resultList.Add(treeNode);
     return resultList;
 }
 public IList<SiteChannelEntity> GetList(SiteChannelQuery query)
 {
     ISiteChannelService service = ServiceContainer.Instance.Container.Resolve<ISiteChannelService>();
     IList<SiteChannelEntity> list = service.GetSiteChannelList(query);
     return list;
 }
 public Pager<SiteChannelEntity> GetSiteChannelPageList(SiteChannelQuery query)
 {
     int recordCount=0;
     string whereSQL=SiteChannelQueryToSQLWhere(query);
     string orderBy=SiteChannelQueryToSQLOrder(query);
     DataSet ds = db.GetPagingData("SiteChannel", "ChannelID,JournalID,PChannelID,ContentType,IsNav,Keywords,Description,ChannelUrl,SortID,Status,AddDate", orderBy, whereSQL, query.CurrentPage, query.PageSize, out recordCount);
     Pager<SiteChannelEntity>  pager=new Pager<SiteChannelEntity>();
     if(ds!=null && ds.Tables.Count>0)
     {
          pager.ItemList= MakeSiteChannelList(ds.Tables[0]);
     }
     pager.CurrentPage=query.CurrentPage;
     pager.PageSize=query.PageSize;
     pager.TotalRecords=recordCount;
     return pager;
 }
 /// <summary>
 /// 将查询实体转换为Order语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Order语句,不包含Order</returns>
 /// </summary>
 public string SiteChannelQueryToSQLOrder(SiteChannelQuery query)
 {
     return " SortID ASC,ChannelID DESC";
 }
 public List<SiteChannelEntity> GetSiteChannelList(SiteChannelQuery query)
 {
     List<SiteChannelEntity> list = new List<SiteChannelEntity>();
     StringBuilder sqlCommandText = new StringBuilder();
     sqlCommandText.Append("SELECT ChannelID,JournalID,PChannelID,ContentType,IsNav,Keywords,Description,ChannelUrl,SortID,Status,AddDate FROM dbo.SiteChannel WITH(NOLOCK)");
     string whereSQL = SiteChannelQueryToSQLWhere(query);
     string orderBy=SiteChannelQueryToSQLOrder(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 = MakeSiteChannelList(dr);
     }
     return list;
 }
 public SiteChannelEntity GetSiteChannel(SiteChannelQuery query)
 {
     SiteChannelEntity siteChannelEntity=null;
     StringBuilder sqlCommandText = new StringBuilder();
     sqlCommandText.Append("SELECT TOP 1  ChannelID,JournalID,PChannelID,ContentType,IsNav,Keywords,Description,ChannelUrl,SortID,Status,AddDate FROM dbo.SiteChannel WITH(NOLOCK)");
     sqlCommandText.Append(" WHERE " + SiteChannelQueryToSQLWhere(query));
     DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());
     using(IDataReader dr = db.ExecuteReader(cmd))
     {
         siteChannelEntity = MakeSiteChannel(dr);
     }
     return siteChannelEntity;
 }
 /// <summary>
 /// 获取所有符合查询条件的数据
 /// </summary>
 /// <param name="siteChannelQuery">SiteChannelQuery查询实体对象</param>
 /// <returns>List<SiteChannelEntity></returns>
 public List<SiteChannelEntity> GetSiteChannelList(SiteChannelQuery siteChannelQuery)
 {
     return SiteChannelDataAccess.Instance.GetSiteChannelList(siteChannelQuery);
 }
 /// <summary>
 /// 获取栏目实体
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public SiteChannelEntity GetSiteChannelModel(SiteChannelQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     SiteChannelEntity model = clientHelper.Post<SiteChannelEntity, SiteChannelQuery>(GetAPIUrl(APIConstant.SITECHANNEL_GETMODEL), query);
     return model;
 }
 /// <summary>
 /// 获取栏目属性数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public IList<SiteChannelEntity> GetSiteChannelList(SiteChannelQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     IList<SiteChannelEntity> list = clientHelper.Post<IList<SiteChannelEntity>, SiteChannelQuery>(GetAPIUrl(APIConstant.SITECHANNEL_GETLIST), query);
     return list;
 }
 /// <summary>
 /// 将查询实体转换为Where语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Where语句,不包含Where</returns>
 /// </summary>
 public string SiteChannelQueryToSQLWhere(SiteChannelQuery query)
 {
     StringBuilder sbWhere = new StringBuilder(" JournalID=" + query.JournalID);
     if (query.ChannelID != null && query.ChannelID > 0)
     {
         sbWhere.Append(" AND ChannelID = ").Append(query.ChannelID.Value);
     }
     if (query.Status != null)
     {
         sbWhere.Append(" AND Status = ").Append(query.Status.Value);
     }
     if (query.IsNav != null)
     {
         sbWhere.Append(" AND IsNav = ").Append(query.IsNav.Value);
     }
     if (!string.IsNullOrEmpty(query.ChannelUrl))
     {
         sbWhere.Append(" AND ChannelUrl = '").Append(WKT.Common.Security.SecurityUtils.SafeSqlString(query.ChannelUrl)).Append("'");
     }
     return sbWhere.ToString();
 }
 /// <summary>
 /// 获取栏目属性数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public IList<TreeModel> GetSiteChannelTreeList(SiteChannelQuery query)
 {
     return GetSiteChannelTreeList(query, false);
 }
Beispiel #23
0
        /// <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);
        }
Beispiel #24
0
        /// <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);
        }
 public SiteChannelEntity GetModel(SiteChannelQuery query)
 {
     ISiteChannelService service = ServiceContainer.Instance.Container.Resolve<ISiteChannelService>();
     SiteChannelEntity model = service.GetSiteChannel(query);
     return model;
 }
 /// <summary>
 /// 删除栏目
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public ExecResult DelSiteChannel(SiteChannelQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     ExecResult result = clientHelper.Post<ExecResult, SiteChannelQuery>(GetAPIUrl(APIConstant.SITECHANNEL_DEL), query);
     return result;
 }