public ActionResult OverAllTweets()
        {
            try
            {
                IList <BOTweetMentions> tweetMentionTopicList = BOTweetMentions.TweetMentionsDistinctTopics(User.Identity.GetUserId());
                List <string>           distinctTopicList     = tweetMentionTopicList.Select(data => data.Topic).ToList();

                List <DataPoint> tweetSpeeder = new List <DataPoint>();

                foreach (var topic in distinctTopicList)
                {
                    int speed = 0;
                    speed = BOTweetCount.TweetSpeed(User.Identity.GetUserId(), topic);

                    tweetSpeeder.Add(new DataPoint(speed, topic));
                }



                ViewBag.TopicSpeeder = JsonConvert.SerializeObject(tweetSpeeder, _jsonSetting);

                return(PartialView());
            }
            catch (Exception ex)
            {
                //error = ex.StackTrace;
                logger.Log(ex.StackTrace, LOGLEVELS.ERROR);
                ViewBag.TopicSpeeder = JsonConvert.SerializeObject(dummylist, _jsonSetting);

                return(PartialView());
            }
        }
示例#2
0
        public ActionResult OverAllTweets()
        {
            try
            {
                IList <BOTweetMentions> tweetMentionTopicList = BOTweetMentions.TweetMentionsDistinctTopics(User.Identity.GetUserId());
                List <string>           distinctTopicList     = tweetMentionTopicList.Select(data => data.Topic).ToList();

                List <DataPoint> tweetSpeeder = new List <DataPoint>();

                foreach (var topic in distinctTopicList)
                {
                    int speed = 0;
                    speed = BOTweetCount.TweetSpeed(User.Identity.GetUserId(), topic);

                    tweetSpeeder.Add(new DataPoint(speed, topic));
                }


                //IList<BOTweetCount> listLatestTenTweetCount = BOTweetCount.TweetCountCollection(User.Identity.GetUserId());

                //Dictionary<string, int> allTweetsCountbyTopic = new Dictionary<string, int>();
                //Dictionary<string, Dictionary<string, int>> allSentimentsbyTopic = new Dictionary<string, Dictionary<string, int>>();

                //foreach (BOTweetCount tweetCount in listLatestTenTweetCount)
                //{
                //    if (!allTweetsCountbyTopic.ContainsKey(tweetCount.Topic.ToUpper()))
                //    {
                //        allTweetsCountbyTopic.Add(tweetCount.Topic.ToUpper(), 0);
                //    }
                //    else
                //    {
                //        allTweetsCountbyTopic[tweetCount.Topic.ToUpper()] += 1;
                //    }

                //};

                ////var xDataMonths = allTweetsCountbyTopic.Keys.ToArray();
                ////var yDataCounts = allTweetsCountbyTopic.Values.Select(count => (object)count).ToArray();

                //List<DataPoint> barcharTopicsCount = new List<DataPoint>();

                ////Highcharts overAllSentimentChart = barChartTweetsByTopic("OverAllTweets", xDataMonths, yDataCounts);
                //foreach(string key in allTweetsCountbyTopic.Keys)
                //{
                //    barcharTopicsCount.Add(new DataPoint(allTweetsCountbyTopic[key], key));
                //}

                ViewBag.TopicSpeeder = JsonConvert.SerializeObject(tweetSpeeder, _jsonSetting);

                return(PartialView());
            }
            catch (Exception ex)
            {
                //error = ex.StackTrace;
                logger.Log(ex.StackTrace, LOGLEVELS.ERROR);
                ViewBag.TopicSpeeder = JsonConvert.SerializeObject(dummylist, _jsonSetting);

                return(PartialView());
            }
        }