Exemple #1
0
        public void ProcessHashTag(string hashtag, PatternCard patternCard, Goal goal)
        {
            // Get all tweets from hashtag
            var tweets = _twitter.GetTweets(hashtag, TwitterSearchResultType.Recent, 200);

            foreach (var tweet in tweets)
            {
                // Create Contact + Identifier + Personal Info
                var contact = CreateOrGetContact(hashtag, tweet);
                if (contact == null)
                {
                    continue;
                }

                // Create Interaction
                var isNewInteraction = false;
                var interaction      = CreateOrGetInteraction(hashtag, contact, tweet, goal, out isNewInteraction);
                if (interaction == null)
                {
                    continue;
                }

                // Apply Pattern Card to the Contact if the Interaction is new
                if (isNewInteraction && patternCard != null)
                {
                    ApplyPatternCard(contact, tweet, patternCard);
                }
            }
        }
        public ActionResult UserTimeLine()
        {
            //TODO: Fix input form so user can search for user and amount, instead of hardcoded.


            var twitter = new Twitter.Twitter("4rNfhgUrI6yklSBVhmU3U1F8q",
                                              "kYsjQzU7QVof9USCQHucFi3p2ox61q2GxNVYcDSzTiBzu0C0vT",
                                              "1001781311051390978-Tj0aXHjC3GSuqGFde9AFp6z9Wjp4i2",
                                              "BxYSpsScwSW9oxMIozpYpNv7efJhXIihvXduGgUU32S3K");

            string        user     = "******";
            int           count    = 5;
            var           response = twitter.GetTweets(user, count);
            List <string> timeLine = new List <string>();

            dynamic timeline = System.Web.Helpers.Json.Decode(response);

            var homeModel = new Home()
            {
                TimeLine = timeLine
            };

            foreach (dynamic tweet in timeline)
            {
                string text = tweet.text;
                timeLine.Add(text);
            }

            ViewBag.Header = "@" + user;

            return(View(homeModel));
        }