Beispiel #1
0
        private ListNews SearchNewsForPortal(PortalSearchNews portalSearchNews, out News news)
        {
            news = new News();
            var total = 0;
            var ds    = _newsDa.GetForPortalIndex(portalSearchNews, ref total);
            //var list = CBO.Fill2ListFromDataSet<News>(ds, typeof(News));
            List <News> list = CBO <News> .FillCollectionFromDataSet(ds);

            var totalPage = Math.Ceiling((decimal)total / ConfigInfo.RecordOnPageIndex);
            var paging    = HtmlControllHelpers.WritePagingPortal(totalPage, portalSearchNews.CurrentPage, total,
                                                                  ConfigInfo.RecordOnPageIndex);
            var listNews = new ListNews
            {
                Start       = portalSearchNews.Start,
                Collection  = list,
                Paging      = paging,
                TotalRecord = total,
                TotalPage   = totalPage,
                CurrentPage = portalSearchNews.CurrentPage
            };

            ds = _newsDa.GetSpecialNews();

            news = (News)CBO.FillObjectFromDataSet(ds, typeof(News));
            return(listNews);
        }