Exemple #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);
        }
Exemple #2
0
        private ListProductsPortal GetProductPortal(SearchProductPortalRequest productPortalRequest)
        {
            var total     = 0;
            var ds        = _productDa.GetProductPortal(productPortalRequest, ref total);
            var list      = CBO.Fill2ListFromDataSet <Products>(ds, typeof(Products));
            var totalPage = Math.Ceiling((decimal)total / ConfigInfo.RecordOnPageIndex);
            var paging    = HtmlControllHelpers.WritePagingPortal(totalPage, productPortalRequest.CurrentPage, total,
                                                                  ConfigInfo.RecordOnPageIndex);
            var listNews = new ListProductsPortal
            {
                Start       = productPortalRequest.Start,
                Collection  = list,
                Paging      = paging,
                TotalRecord = total,
                TotalPage   = totalPage,
                CurrentPage = productPortalRequest.CurrentPage,
                PageName    = productPortalRequest.GroupName
            };

            return(listNews);
        }
Exemple #3
0
        private ListProductsPortal GetProductPortal(SearchProductPortalRequest productPortalRequest)
        {
            var             total = 0;
            var             ds    = _productDa.GetProductPortal(productPortalRequest, ref total);
            List <Products> list  = CBO <Products> .FillCollectionFromDataSet(ds);

            list = list.OrderByDescending(m => m.Price).ThenByDescending(m => m.Id).ToList();
            var totalPage = Math.Ceiling((decimal)total / ConfigInfo.RecordOnPageIndex);
            var paging    = HtmlControllHelpers.WritePagingPortal(totalPage, productPortalRequest.CurrentPage, total,
                                                                  ConfigInfo.RecordOnPageIndex);
            var listNews = new ListProductsPortal
            {
                Start       = productPortalRequest.Start,
                Collection  = list,
                Paging      = paging,
                TotalRecord = total,
                TotalPage   = totalPage,
                CurrentPage = productPortalRequest.CurrentPage,
                PageName    = productPortalRequest.GroupName
            };

            return(listNews);
        }