示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Session[SessionVariables.SearchEntity.ToString()] != null)
            {
                this.aSearch = (Search)this.Session[SessionVariables.SearchEntity.ToString()];
            }
            else
            {
                Response.Redirect("/Default.aspx");
            }

            this.DoSearch();
        }
        private void SetSearch(string pKeyWords, int? pMaxTweets, int? pMaxVideos)
        {
            Search mCurrentSearch = new Search();
            mCurrentSearch.KeyWords = pKeyWords;
            mCurrentSearch.SearchedDate = DateTime.Now;

            if (pMaxTweets.HasValue)
            {
                mCurrentSearch.Sources.Add(new TwitterSource(pMaxTweets.Value));
            }

            if (pMaxVideos.HasValue)
            {
                mCurrentSearch.Sources.Add(new YouTubeSource(pMaxVideos.Value));
            }

            this.Session.Add("currentSearch", mCurrentSearch);
        }
示例#3
0
        private void ProceedToResults(Search pPostedSearch)
        {
            this.Session.Add(SessionVariables.SearchEntity.ToString(), pPostedSearch);

            Response.Redirect("./Results.aspx");
        }
示例#4
0
        /// <summary>
        /// Return the search object from the posted web form
        /// </summary>
        /// <returns></returns>
        private Search GetSearchFromWebForm()
        {
            Search mSearch = new Search()
            {
                SearchedDate = DateTime.Now,
                KeyWords = this.tbKeyWords.Text
            };

            if (this.cbSourceTwitter.Checked)
            {
                mSearch.Sources.Add(SourceFactory.GetSource(SourceType.Twitter, Convert.ToInt32(this.tbMaxTweets.Text)));
            }

            if(this.cbSourceYouTube.Checked)
            {
                mSearch.Sources.Add(SourceFactory.GetSource(SourceType.YouTube, Convert.ToInt32(this.tbMaxVideos.Text)));
            }

            foreach (List<Control> mDynamicControls in this.aDynamicControlsArray)
            {
                CheckBox mCheckRSS = (CheckBox)mDynamicControls[1];

                if (mCheckRSS.Checked)
                {
                    TextBox mRssUrl = (TextBox)mDynamicControls[3];
                    TextBox mRssMaxPosts = (TextBox)mDynamicControls[6];

                    RssSource mRssSource = (RssSource)SourceFactory.GetSource(SourceType.RSS, Convert.ToInt32(mRssMaxPosts.Text));
                    mRssSource.URL = mRssUrl.Text;

                    mSearch.Sources.Add(mRssSource);
                }
            }

            return mSearch;
        }