Exemplo n.º 1
0
        public void ShowNewsByResourceCode(int ResourceSiteCode)
        {
            try
            {
                strPageNo = Request["PageNo"];

                PageNo = Convert.ToInt32(strPageNo);

                if (PageNo == 0)
                {
                    PageNo = 1;
                }
                if (PageNo > 50)
                {
                    PageNo = 50;
                }

                BOLNews NewsBOL = new BOLNews();
                IQueryable <vLatestNews> ItemList = NewsBOL.GetLatestNewsByResourceCode(ResourceSiteCode, _pageSize, PageNo);
                int ResultCount = NewsBOL.GetLatestNewsByResourceCodeCount(ResourceSiteCode);
                rptNewsList.DataSource = ItemList;
                rptNewsList.DataBind();

                ConcatUrl = "&Code=" + ResourceSiteCode;
                int PageCount = ResultCount / _pageSize;
                if (ResultCount % _pageSize > 0)
                {
                    PageCount++;
                }
                pgrToolbar.PageNo    = PageNo;
                pgrToolbar.PageCount = PageCount;
                pgrToolbar.ConcatUrl = ConcatUrl;
                pgrToolbar.PageBind();
            }
            catch (Exception exp)
            {
                BOLErrorLogs ErrorLogsBOL = new BOLErrorLogs();
                ErrorLogsBOL.Insert(exp.Message, DateTime.Now, Request.Url.AbsolutePath, "UCNewsList::ShowNewsByResourceCode");
            }
        }