Ejemplo n.º 1
0
        public IEnumerable <ITopNews> SelectTopNewsForActivate()
        {
            IEnumerable <ITopNews> list = null;

            try
            {
                var objTopNewsDB = new TopNewsDB();
                list = objTopNewsDB.SelectTopNewsForActivate();
            }
            catch (Exception objExp)
            {
                throw objExp;
            }
            return(list.ToList().FindAll(v => v.IsActive == 0 && v.IsApproved == 1).OrderByDescending(v => v.DttmModified));
        }
Ejemplo n.º 2
0
        public IEnumerable <ITopNews> SelectAll(DateTime dateFrom, DateTime dateTo, string Heading)
        {
            IEnumerable <ITopNews> list = null;

            try
            {
                var objTopNewsDB = new TopNewsDB();
                list = objTopNewsDB.Search(dateFrom, dateTo, Heading);
            }
            catch (Exception objExp)
            {
                throw objExp;
            }
            return(list);
        }
Ejemplo n.º 3
0
        //public IEnumerable<ITopNews> Select20TopNews(int topNumber)
        //{
        //    var top20 = TopNewsDB.Instance.Select20TopNews();

        //    return (top20.ToList().FindAll(v => !string.IsNullOrEmpty(v.ImageUrl))).Take(topNumber);
        //}

        public IEnumerable <ITopNews> SelectFirst10TopNews()
        {
            try
            {
                int             newsCount  = 10;
                int             remainNews = newsCount;
                List <ITopNews> newsList   = new List <ITopNews>();
                var             top20      = new TopNewsDB().Select20TopNews();
                if (top20 != null)
                {
                    newsList.AddRange(top20.OrderByDescending(v => v.DttmCreated).Take(newsCount).ToList());
                }

                if (newsList.Count < newsCount)
                {
                    remainNews = remainNews - newsList.Count;
                    if (remainNews > 0)
                    {
                        var topRssNews = new RssProviderService().GetFirstTopNews();
                        if (topRssNews != null && topRssNews.Count() > 0)
                        {
                            int newsCounter = 0;
                            foreach (var val in topRssNews.OrderByDescending(v => v.DttmCreated))
                            {
                                if (newsCounter++ >= remainNews)
                                {
                                    break;
                                }

                                val.IsRss = true;
                                newsList.Add(val);
                            }
                        }
                    }
                }

                return(newsList.Take(newsCount));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 4
0
        //public IEnumerable<ITopNews> Select20TopNews(int topNumber)
        //{
        //    var top20 = TopNewsDB.Instance.Select20TopNews();

        //    return (top20.ToList().FindAll(v => !string.IsNullOrEmpty(v.ImageUrl))).Take(topNumber);
        //}

        public IEnumerable<ITopNews> SelectFirst10TopNews()
        {           
            try
            {
                int newsCount = 10;
                int remainNews = newsCount;
                List<ITopNews> newsList = new List<ITopNews>();
                var top20 = new TopNewsDB().Select20TopNews();
                if (top20 != null)
                {
                    newsList.AddRange(top20.OrderByDescending(v => v.DttmCreated).Take(newsCount).ToList());
                }
                
                if (newsList.Count < newsCount)
                {
                    remainNews = remainNews - newsList.Count;
                    if (remainNews > 0)
                    {
                        var topRssNews = new RssProviderService().GetFirstTopNews();
                        if (topRssNews != null && topRssNews.Count() > 0)
                        {
                            int newsCounter = 0;
                            foreach (var val in topRssNews.OrderByDescending(v => v.DttmCreated))
                            {
                                if (newsCounter++ >= remainNews)
                                    break;

                                val.IsRss = true;
                                newsList.Add(val);
                            }
                        }
                    }
                }

                return newsList.Take(newsCount);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 5
0
 public IEnumerable<ITopNews> SelectTopNewsForActivate()
 {
     IEnumerable<ITopNews> list = null;
     try
     {
         var objTopNewsDB = new TopNewsDB();
         list = objTopNewsDB.SelectTopNewsForActivate();
     }
     catch (Exception objExp)
     {
         throw objExp;
     }
     return list.ToList().FindAll(v => v.IsActive == 0 && v.IsApproved == 1).OrderByDescending(v => v.DttmModified);
 }
Ejemplo n.º 6
0
 public IEnumerable<ITopNews> SelectAll(DateTime dateFrom, DateTime dateTo, string Heading)
 {
     IEnumerable<ITopNews> list = null;
     try
     {
         var objTopNewsDB = new TopNewsDB();
         list = objTopNewsDB.Search(dateFrom, dateTo, Heading);
     }
     catch (Exception objExp)
     {
         throw objExp;
     }
     return list;
 }