Beispiel #1
0
        /// <summary>
        /// If no keyword is given, general news are returned
        /// </summary>
        /// <returns></returns>
        private string QueryGeneralNews()
        {
            string         answer      = String.Empty;
            SourceSelector srcSelector = new SourceSelector();
            Source         src         = srcSelector.SelectSource(String.Empty);

            if (src != null)
            {
                NewsSelector   newsSelector = new NewsSelector();
                List <Article> news         = newsSelector.SelectNewsBySource(src.Id);
                if (news != null)
                {
                    answer  = "Es werden Ihnen allgemeine News aus \"" + src.Name.ToString() + "\" angezeigt:";
                    answer += BuildAnswerString(news);
                }
            }
            return(answer);
        }
Beispiel #2
0
        /// <summary>
        /// Searches and returns news by querying a specific keyword
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        private string QueryByKeyword(Entity entity)
        {
            string       answer       = String.Empty;
            string       keyword      = "";
            NewsSelector newsSelector = new NewsSelector();

            if (entity != null)
            {
                keyword = entity.entity;
            }
            List <Article> news = newsSelector.SelectNewsByKeyword(keyword);

            if (news != null)
            {
                answer  = "Es werden Ihnen News über \"" + entity.entity + "\" angezeigt:";
                answer += BuildAnswerString(news);
            }
            return(answer);
        }