public ActionResult Tweets(TweetsModel model) { try { GetTweets G = new GetTweets(); G.T_F(model.ScreenNameTweets); return(Content("Done with Downloading Tweets of the Following Screen Name: " + model.ScreenNameTweets)); } catch (ArgumentOutOfRangeException ex) { return(Content("Error Handle: Account does not exist in Twitter Network")); } catch (OverflowException ec) { return(Content("Error Handle: Account exist in Twitter Network but contains NO Tweets\n")); } catch (AggregateException cd) { return(Content("Error Handle: Either the Internet Connection is BAD! or Account and Tweets exist but are Protected in Twitter Network at line 68\n")); } catch (SqlException se) { return(Content("Error Handle: Sql Conntection(String) or Command(Qurey) Error")); } catch (Exception ee) { return(Content("Error Handle : Some Unknow Exception as occured ::\n" + ee.ToString())); } }
public MainMenu(TwitterService twitter) { InitializeComponent(); this.twitter = twitter; this.getTweets = new GetTweets(this.twitter.service); ShowUserInfo(getTweets.GetUserInfo()); DataContext = this; }
public IList <GetTweetDto> GetAllTweet(int userId) { GetTweetDto tweet; getTweets = new GetTweets(); tweetList = new List <TweetDto>(); IList <GetTweetDto> allTweets = new List <GetTweetDto>(); tweetList = getTweets.GetAllTweets(userId); foreach (var i in tweetList) { tweet = new GetTweetDto(); tweet.id = i.id; tweet.Body = i.Body; tweet.User_id = i.User_id; tweet.User_name = i.User_name; tweet.Like_count = i.Like_count; tweet.dislike_count = i.dislike_count; tweet.Created_at = i.Created_at.ToShortDateString().ToString(); if (i.reaction == true) { tweet.reaction = "Liked"; } else if (i.reaction == false) { tweet.reaction = "Disliked"; } else { tweet.reaction = "not reacted"; } allTweets.Add(tweet); } // tweetList.Sort((obj1, obj2) => DateTime.Compare(obj2.CreatedAt, obj1.CreatedAt)); //tweetList.OrderByDescending(f => f.id); IList <GetTweetDto> x = allTweets.OrderByDescending(i => i.id).ToList(); return(x); }
/// <summary> /// Searches the tweet. /// </summary> /// <param name="tag">The tag.</param> /// <returns></returns> public IList <GetTweetDto> SearchTweet(string tag) { getTweet = new GetTweets(); GetTweetDto tweet; IList <GetTweetDto> allTweets = new List <GetTweetDto>(); IList <TweetDto> searchedtweet = getTweet.GetTagTweet(tag); if (searchedtweet == null) { return(null); } foreach (var i in searchedtweet) { tweet = new GetTweetDto(); tweet.id = i.id; tweet.Body = i.Body; tweet.User_id = i.User_id; tweet.User_name = i.User_name; tweet.Like_count = i.Like_count; tweet.dislike_count = i.dislike_count; tweet.Created_at = i.Created_at.ToShortDateString().ToString(); if (i.reaction == true) { tweet.reaction = "Liked"; } else if (i.reaction == false) { tweet.reaction = "Disliked"; } else { tweet.reaction = "not reacted"; } allTweets.Add(tweet); } return(allTweets); }
public async Task ITriggerTheFunctionGetTweets() { var getTweets = new GetTweets(); await getTweets.RunAsync(); }