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

            try
            {
                var objTopNewsDB = new InterNewsDB();
                list = objTopNewsDB.SelectToActive();
            }
            catch (Exception objExp)
            {
                throw objExp;
            }
            return(list.ToList().OrderByDescending(v => v.DttmModified));
        }
Ejemplo n.º 2
0
        public IEnumerable <IInterNews> Search(DateTime dateFrom, DateTime dateTo, string Heading)
        {
            IEnumerable <IInterNews> list = null;

            try
            {
                var objNewsDB = new InterNewsDB();
                list = objNewsDB.Search(dateFrom, dateTo, Heading);
            }
            catch (Exception objExp)
            {
                throw objExp;
            }
            return(list);
        }
Ejemplo n.º 3
0
        public IEnumerable <IInterNews> SelectTopNews()
        {
            try
            {
                int newsCount              = 10;
                int remainNews             = newsCount;
                List <IInterNews> newsList = new List <IInterNews>();
                var top20 = new InterNewsDB().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().GetInternationalNews();
                        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<IInterNews> SelectTopNews()
        {
            try
            {
                int newsCount = 10;
                int remainNews = newsCount;
                List<IInterNews> newsList = new List<IInterNews>();
                var top20 = new InterNewsDB().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().GetInternationalNews();
                        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<IInterNews> SelectToApprove()
 {
     IEnumerable<IInterNews> list = null;
     try
     {
         var objNewsDB = new InterNewsDB();
         list = objNewsDB.SelectToApprove();
     }
     catch (Exception objExp)
     {
         throw objExp;
     }
     return list.ToList().OrderByDescending(v => v.DttmModified);
 }
Ejemplo n.º 6
0
 public IEnumerable<IInterNews> Search(DateTime dateFrom, DateTime dateTo, string Heading)
 {
     IEnumerable<IInterNews> list = null;
     try
     {
         var objNewsDB = new InterNewsDB();
         list = objNewsDB.Search(dateFrom, dateTo, Heading);
     }
     catch (Exception objExp)
     {
         throw objExp;
     }
     return list;
 }