Exemple #1
0
 public void getTwitterStats(TwitterAccount twitterAccount)
 {
     TwitterStatsRepository objTwtstats = new TwitterStatsRepository();
     TwitterMessageRepository objTweetMsgRepo = new TwitterMessageRepository();
     TwitterStats objStats = new TwitterStats();
     Random rNum = new Random();
     objStats.Id = Guid.NewGuid();
     objStats.TwitterId = twitterAccount.TwitterUserId;
     objStats.UserId = twitterAccount.UserId;
     objStats.FollowingCount = twitterAccount.FollowingCount;
     objStats.FollowerCount = twitterAccount.FollowersCount;
     objStats.Age1820 = rNum.Next(twitterAccount.FollowersCount);
     objStats.Age2124 = rNum.Next(twitterAccount.FollowersCount);
     objStats.Age2534 = rNum.Next(twitterAccount.FollowersCount);
     objStats.Age3544 = rNum.Next(twitterAccount.FollowersCount);
     objStats.Age4554 = rNum.Next(twitterAccount.FollowersCount);
     objStats.Age5564 = rNum.Next(twitterAccount.FollowersCount);
     objStats.Age65 = rNum.Next(twitterAccount.FollowersCount);
     int replies = objTweetMsgRepo.getRepliesCount(twitterAccount.UserId, twitterAccount.TwitterUserId);
     int retweets = objTweetMsgRepo.getRetweetCount(twitterAccount.UserId, twitterAccount.TwitterUserId);
     if (twitterAccount.FollowersCount != 0)
         objStats.Engagement = (replies + retweets) / twitterAccount.FollowersCount;
     else
         objStats.Engagement = 0;
     //  objStats.Influence=
     // objStats.Engagement=
     objStats.EntryDate = DateTime.Now;
     if (!objTwtstats.checkTwitterStatsExists(twitterAccount.TwitterUserId, twitterAccount.UserId))
         objTwtstats.addTwitterStats(objStats);
 }