コード例 #1
0
        /// <summary>
        /// 绑定行业资讯
        /// </summary>
        protected void BindNews()
        {
            //绑定行业资讯
            IList <EyouSoft.Model.NewsStructure.WebSiteNews> newList = EyouSoft.BLL.NewsStructure.NewsBll.CreateInstance().GetHeadNews(10);

            if (newList != null)
            {
                if (newList.Count >= 1)
                {   //获取第一条行业资讯
                    EyouSoft.Model.NewsStructure.WebSiteNews newModel = newList[0];
                    newImg = string.Format("<a href=\"{0}\" target=\"_blank\"><img src=\"{1}\" alt=\"{2}\" /></a>", GetUrl(newModel.GotoUrl, newModel.Id), Utils.GetNewImgUrl(newModel.PicPath, 2), newModel.AfficheTitle);
                }
                rptNew1.DataSource = newList.Skip(1).Take(5);
                rptNew1.DataBind();
                if (newList.Count > 6)
                {
                    rptNew2.DataSource = newList.Skip(6).Take(4);
                    rptNew2.DataBind();
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// 初始化详细资讯
        /// </summary>
        private void InitNewsDetail()
        {
            if (Request["TypeId"] != null)
            {
                //存在资讯大类
                if (newTypeBll.GetCategoryById(int.Parse(Request["TypeId"].ToString())) != null)
                {
                    cateName = ((EyouSoft.Model.NewsStructure.NewsCategory)newTypeBll.GetCategoryById(int.Parse(Request["TypeId"].ToString()))).ToString();
                }
                className = newTypeBll.GetNewsTypeName(int.Parse(Request["TypeId"].ToString()));
            }
            if (Request["NewsId"] != null)
            {
                bll.SetClicks(int.Parse(Request["NewsId"].ToString()));

                model = bll.GetModel(int.Parse(Request["NewsId"].ToString()), pageIndex);

                if (model != null)
                {
                    recordCount = model.AffichePageNum;

                    //新闻内容总数为1,则不分页
                    if (recordCount == 1)
                    {
                        ExportPageInfo.Visible = false;
                    }

                    preModel  = model.PrevNewsInfo;
                    nextModel = model.NextNewsInfo;

                    AddPageMetaTag(model.NewsKeyWordItem, model.AfficheDesc);

                    this.Page.Title = String.Format(EyouSoft.Common.PageTitle.Information_Detail_Title, model.AfficheTitle, className);

                    BindPage();
                }
            }
        }