Пример #1
0
        /// <summary>
        /// gets all the stats for twitter messages
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_getStats_Click(object sender, RoutedEventArgs e)
        {
            trendingList = new Dictionary <string, int>();
            mentions     = new Dictionary <string, int>();
            txt_stats.Items.Clear();

            foreach (Message m in msgList)
            {
                if (m is TwitterMessage)
                {
                    TwitterMessage tweet = (TwitterMessage)m;
                    sortTwitterStats(tweet);
                }
            }

            foreach (KeyValuePair <string, int> key in trendingList)
            {
                txt_stats.Items.Add(key);
            }

            foreach (KeyValuePair <string, int> key in mentions)
            {
                txt_stats.Items.Add(key);
            }
        }
 /// <deleteTwitterMessage>
 /// Delete Twitter Message
 /// </summary>
 /// <param name="twtmsg">Set Values of profile id and user id in a TwitterMessage Class Property and Pass the Object of Class.(Domein.TwitterMessage)</param>
 /// <returns>Return 1 for success and 0 for failure.(int) </returns>
 public int deleteTwitterMessage(TwitterMessage twtmsg)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, open up a Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             try
             {
                 //Proceed action, to delete twitter message by twitter user id and user id
                 NHibernate.IQuery query = session.CreateQuery("delete from TwitterMessage where ProfileId = :twtuserid and UserId = :userid")
                                           .SetParameter("twtuserid", twtmsg.ProfileId)
                                           .SetParameter("userid", twtmsg.UserId);
                 int isUpdated = query.ExecuteUpdate();
                 transaction.Commit();
                 return(isUpdated);
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
                 return(0);
             }
         } //End Transaction
     }     //End Session
 }
Пример #3
0
 public void DeleteTwitterMessage(TwitterMessage twitterMessage)
 {
     lock (_dbLock)
     {
         _db.Remove(twitterMessage);
         _db.SaveChanges();
     }
 }
Пример #4
0
 public TwitterMessage CreateTwitterMessage(string text)
 {
     lock (_dbLock)
     {
         var twm = new TwitterMessage {
             Text = text, CreateDate = DateTime.Now
         };
         _db.Add(twm);
         _db.SaveChanges();
         return(twm);
     }
 }
 /// <addTwitterMessage>
 /// Add New Twitter Message
 /// </summary>
 /// <param name="twtmsg">Set Values in a TwitterMessage Class Property and Pass the Object of Class.(Domein.TwitterMessage)</param>
 public void addTwitterMessage(TwitterMessage twtmsg)
 {
     //Creates a database connection and opens up a session
     using (NHibernate.ISession session = SessionFactory.GetNewSession())
     {
         //After Session creation, open up a Transaction.
         using (NHibernate.ITransaction transaction = session.BeginTransaction())
         {
             //Proceed action, to save data.
             session.Save(twtmsg);
             transaction.Commit();
         } //End Transaction
     }     //End Session
 }
Пример #6
0
        public TwitterMessage CreateResponse(DuelCommand command)
        {
            if(command is DuelStartCommand)
            {
                var duelStart = command as DuelStartCommand;
                var victim = duelStart.Victim;
                var formattedText = String.Format("{0}, do you bite your thumb at {1} in a #ContestOfTwit?",
                                                  duelStart.Victim.screen_name, duelStart.Aggressor.screen_name);
                var message = new TwitterMessage()
                                  {
                                      SendToUsername = victim.screen_name,
                                      Message = formattedText
                                  };

                return message;
            }

            return null;
        }
Пример #7
0
        /*
         * Posting messages is used for creating a message that anybody can see and isn't directed
         * to a specific person.
         */
        public void Post(TwitterMessage message)
        {
            if (message.ToId != null)
            {
                throw new Exception("Message cannot be posted to a person.\nMaybe try send?");
            }

            if (message.FromId == null)
            {
                throw new Exception("Message cannot be posted by a null user.");
            }

            if (message.Message.Length > MAX_MESSAGE_SIZE)
            {
                throw new Exception("Message cannot be larger than " + MAX_MESSAGE_SIZE);
            }

            _messages.Add(message);
        }
Пример #8
0
        /*
         * A message should only be sent if the ToId is filled in.  Otherwise the message would go
         * to nobody.
         */
        public void Send(TwitterMessage message)
        {
            if (message.FromId == null)
            {
                throw new Exception("Message cannot come from a null user.");
            }

            if (message.ToId == null)
            {
                throw new Exception("Unable to send message to null user.\nMaybe try post?");
            }

            if (message.Message.Length > MAX_MESSAGE_SIZE)
            {
                throw new Exception("Message cannot be larger than " + MAX_MESSAGE_SIZE);
            }

            _messages.Add(message);
        }
Пример #9
0
        public ObservableCollection <TwitterMessage> CollectMessage(IEnumerable <IMessage> messages)
        {
            MessageCollection collection = new MessageCollection();

            foreach (var message in messages)
            {
                TwitterMessage m = new TwitterMessage
                {
                    Id                  = message.Id,
                    SenderId            = message.SenderId,
                    SenderScreenname    = message.SenderScreenName,
                    RecipientId         = message.RecipientId,
                    RecipientScreenname = message.RecipientScreenName,
                    Text                = message.Text,
                    CreatedAt           = message.CreatedAt
                };
                collection.Add(m);
            }
            return(collection);
        }
Пример #10
0
        /*
         *
         * gets twitter stats and displays them in list
         *
         */
        private void sortTwitterStats(TwitterMessage tweet)
        {
            foreach (KeyValuePair <string, int> keyValue in tweet.TrendingList)
            {
                foreach (KeyValuePair <string, int> item in txt_stats.Items)
                {
                    var selectedItem = (dynamic)item;
                    trendingList.Add(selectedItem.Key, Convert.ToInt32(selectedItem.Value));
                }

                if (trendingList.ContainsKey(keyValue.Key))
                {
                    trendingList[keyValue.Key] += keyValue.Value;
                }
                else
                {
                    trendingList.Add(keyValue.Key, keyValue.Value);
                }
            }

            foreach (KeyValuePair <string, int> keyValue in tweet.Mentions)
            {
                foreach (KeyValuePair <string, int> item in txt_stats.Items)
                {
                    var selectedItem = (dynamic)item;
                    mentions.Add(selectedItem.Key, Convert.ToInt32(selectedItem.Value));
                }

                if (mentions.ContainsKey(keyValue.Key))
                {
                    mentions[keyValue.Key] += keyValue.Value;
                }
                else
                {
                    mentions.Add(keyValue.Key, keyValue.Value);
                }
            }
        }
Пример #11
0
        public void getUserFeeds(string profileid)
        {
            TwitterUser              twtuser    = new TwitterUser();
            User                     user       = (User)HttpContext.Current.Session["LoggedUser"];
            oAuthTwitter             OAuth      = new oAuthTwitter();
            JArray                   data       = twtuser.GetStatuses_User_Timeline(OAuth);
            TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository();
            TwitterAccountRepository twtrepo    = new TwitterAccountRepository();
            TwitterAccount           twtaccount = twtrepo.getUserInformation(user.Id, profileid);

            OAuth.CallBackUrl       = ConfigurationManager.AppSettings["callbackurl"];
            OAuth.ConsumerKey       = ConfigurationManager.AppSettings["consumerKey"];
            OAuth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"];
            OAuth.TwitterScreenName = twtaccount.TwitterScreenName;
            OAuth.AccessTokenSecret = twtaccount.OAuthSecret;
            OAuth.AccessToken       = twtaccount.OAuthToken;
            OAuth.ProfileImage      = twtaccount.ProfileImageUrl;


            TwitterMessage twtmsg = new TwitterMessage();

            foreach (var item in data)
            {
                twtmsg.UserId = user.Id;
                twtmsg.Type   = "twt_usertweets";
                try
                {
                    twtmsg.TwitterMsg = item["text"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    twtmsg.SourceUrl = item["source"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    twtmsg.ScreenName = twtaccount.TwitterScreenName;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    twtmsg.ProfileId = twtaccount.TwitterUserId;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    twtmsg.MessageId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    twtmsg.MessageDate = SocioBoard.Helper.Extensions.ParseTwitterTime(item["created_at"].ToString().TrimStart('"').TrimEnd('"'));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    twtmsg.InReplyToStatusUserId = item["in_reply_to_status_id_str"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    twtmsg.Id = Guid.NewGuid();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    twtmsg.FromProfileUrl = item["user"]["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    twtmsg.FromName = item["user"]["name"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    twtmsg.FromId = item["user"]["id_str"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                twtmsg.EntryDate = DateTime.Now;
                try
                {
                    twtmsg.FromScreenName = item["user"]["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                if (!twtmsgrepo.checkTwitterMessageExists(twtmsg.MessageId))
                {
                    twtmsgrepo.addTwitterMessage(twtmsg);
                }
            }
        }
 public int updateTwitterMessage(TwitterMessage fbaccount)
 {
     throw new NotImplementedException();
 }
Пример #13
0
        public override IMessage CreateMessage(string text, string source, string target)
        {
            var message = new TwitterMessage(text, source, target);

            return(message);
        }
Пример #14
0
 public void getUserTweets(oAuthTwitter OAuth, string TwitterScreenName, string TwitterUserId, Guid userId)
 {
     try
     {
         TwitterUser twtuser = new TwitterUser();
         JArray      data    = twtuser.GetStatuses_User_Timeline(OAuth);
         TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository();
         TwitterMessage           twtmsg     = new TwitterMessage();
         foreach (var item in data)
         {
             twtmsg.UserId = userId;
             twtmsg.Type   = "twt_usertweets";
             try
             {
                 twtmsg.TwitterMsg = item["text"].ToString().TrimStart('"').TrimEnd('"');
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
             }
             try
             {
                 twtmsg.SourceUrl = item["source"].ToString().TrimStart('"').TrimEnd('"');
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
             }
             try
             {
                 twtmsg.ScreenName = TwitterScreenName;
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
             }
             try
             {
                 twtmsg.ProfileId = TwitterUserId;
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
             }
             try
             {
                 twtmsg.MessageId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
             }
             try
             {
                 twtmsg.MessageDate = SocioBoard.Helper.Extensions.ParseTwitterTime(item["created_at"].ToString().TrimStart('"').TrimEnd('"'));
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
             }
             try
             {
                 twtmsg.InReplyToStatusUserId = item["in_reply_to_status_id_str"].ToString().TrimStart('"').TrimEnd('"');
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
             }
             try
             {
                 twtmsg.Id = Guid.NewGuid();
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
             }
             try
             {
                 twtmsg.FromProfileUrl = item["user"]["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
             }
             try
             {
                 twtmsg.FromName = item["user"]["name"].ToString().TrimStart('"').TrimEnd('"');
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
             }
             try
             {
                 twtmsg.FromId = item["user"]["id_str"].ToString().TrimStart('"').TrimEnd('"');
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
             }
             twtmsg.EntryDate = DateTime.Now;
             try
             {
                 twtmsg.FromScreenName = item["user"]["screen_name"].ToString().TrimStart('"').TrimEnd('"');
             }
             catch (Exception ex)
             {
                 Console.WriteLine(ex.StackTrace);
             }
             if (!twtmsgrepo.checkTwitterMessageExists(twtmsg.ProfileId, twtmsg.UserId, twtmsg.MessageId))
             {
                 twtmsgrepo.addTwitterMessage(twtmsg);
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
     }
 }
Пример #15
0
        public string GetTeamMembeDetailsForGroupReport(string TeamId, string userid, string days)
        {
            string FacebookprofileId = string.Empty;
            string TwitterprofileId = string.Empty;
            string FacebookFanPageId = string.Empty;
            string profid = string.Empty;
            string FacebookInboxMessagecount = string.Empty;
            string TwitterInboxMessagecount = string.Empty;
            Domain.Socioboard.Domain.GroupStatDetails _GroupStatDetails = new Domain.Socioboard.Domain.GroupStatDetails();

            Guid UserId = Guid.Parse(userid);
            try
            {
                List<FacebookAccount> _facebookAccount = new List<FacebookAccount>();
                List<Domain.Socioboard.Domain.TeamMemberProfile> lstTeamMember = teammemberrepo.getAllTeamMemberProfilesOfTeam(Guid.Parse(TeamId));


                foreach (Domain.Socioboard.Domain.TeamMemberProfile TeamMemberProfile in lstTeamMember)
                {

                    #region MyRegion
                    try
                    {
                        if (TeamMemberProfile.ProfileType == "facebook" || TeamMemberProfile.ProfileType == "twitter")
                        {
                            profid += TeamMemberProfile.ProfileId + ',';
                        }

                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        if (TeamMemberProfile.ProfileType == "facebook")
                        {
                            FacebookprofileId += TeamMemberProfile.ProfileId + ',';
                        }

                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        if (TeamMemberProfile.ProfileType == "twitter")
                        {
                            TwitterprofileId += TeamMemberProfile.ProfileId + ',';
                        }

                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        if (TeamMemberProfile.ProfileType == "facebook_page")
                        {
                            FacebookFanPageId += TeamMemberProfile.ProfileId + ',';
                        }

                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    #endregion

                }

                #region MyRegion
                try
                {
                    profid = profid.Substring(0, profid.Length - 1);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    FacebookFanPageId = FacebookFanPageId.Substring(0, FacebookFanPageId.Length - 1);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    TwitterprofileId = TwitterprofileId.Substring(0, TwitterprofileId.Length - 1);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                try
                {
                    FacebookprofileId = FacebookprofileId.Substring(0, FacebookprofileId.Length - 1);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }
                #endregion

                #region Inboxmessagecount
                if (!string.IsNullOrEmpty(FacebookprofileId))
                {
                    try
                    {
                        FacebookMessage _FacebookMessage = new FacebookMessage();
                        FacebookInboxMessagecount = _FacebookMessage.GetAllInboxMessage(userid, FacebookprofileId, days);
                    }
                    catch (Exception ex)
                    {
                        FacebookInboxMessagecount = (0).ToString();
                        Console.WriteLine(ex.StackTrace);
                    }
                }
               
                if (!string.IsNullOrEmpty(TwitterprofileId))
                {
                    try
                    {
                        TwitterFeed _TwitterFeed = new TwitterFeed();
                        TwitterInboxMessagecount = _TwitterFeed.TwitterInboxMessagecount(userid, TwitterprofileId, days);
                    }
                    catch (Exception ex)
                    {
                        TwitterInboxMessagecount = (0).ToString();
                        Console.WriteLine(ex.StackTrace);
                    }
                }
               
                   
               
                _GroupStatDetails.IncommingMessage = (Convert.ToInt32(FacebookInboxMessagecount) + Convert.ToInt32(TwitterInboxMessagecount));
                #endregion

                #region sentmessage
                if (!string.IsNullOrEmpty(profid))
                {
                    try
                    {
                        ScheduledMessage _ScheduledMessage = new ScheduledMessage();
                        _GroupStatDetails.SentMessage = _ScheduledMessage.GetAllScheduledMessage(userid, profid, days);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        _GroupStatDetails.SentMessage = 0;
                    }
                }
                #endregion

                #region twitterfolllower
                try
                {
                    TwitterAccountFollowers _TwitterAccountFollowers = new TwitterAccountFollowers();
                    _GroupStatDetails.TwitterFollower = _TwitterAccountFollowers.FollowerCount(userid, TwitterprofileId, days);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                    _GroupStatDetails.TwitterFollower = 0;
                }

                #endregion

                #region fancount
                try
                {
                    FacebookFanPage _FacebookFanPage = new FacebookFanPage();
                    _GroupStatDetails.FacebookFan = _FacebookFanPage.FacebookFans(userid, FacebookFanPageId, days);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                    _GroupStatDetails.FacebookFan = 0;
                }

                #endregion


                #region MentionRetweetDetails
                try
                {

                    TwitterMessage _TwitterMessage = new TwitterMessage();
                    _GroupStatDetails.MentionGraph = string.Empty;
                    string graphdetails = _TwitterMessage.GetAllRetweetMentionBydays(userid, TwitterprofileId, days);

                    string[] data = graphdetails.Split('@');
                    foreach (var item in data)
                    {
                        if (item.Contains("usrtwet^"))
                        {
                            _GroupStatDetails.UserTweetGraph = item.Replace("usrtwet^", "");
                        }
                        else if (item.Contains("mention^"))
                        {
                            _GroupStatDetails.MentionGraph = item.Replace("mention^", "");
                        }
                        else if (item.Contains("retwet^"))
                        {
                            _GroupStatDetails.RetweetGraph = item.Replace("retwet^", "");
                        }
                        else if (item.Contains("metion"))
                        {
                            _GroupStatDetails.Mention = Convert.ToInt32(item.Replace("metion", ""));
                        }
                        else if (item.Contains("retwet"))
                        {
                            _GroupStatDetails.Retweet = Convert.ToInt32(item.Replace("retwet", ""));
                        }


                    }


                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                } 
                #endregion

                try
                {
                    ScheduledMessage _ScheduledMessage = new ScheduledMessage();

                    string details = _ScheduledMessage.GetAllScheduleMsgDetailsForReport(userid, TwitterprofileId, days);
                    string[] data = details.Split('@');
                    foreach (var item in data)
                    {
                        if (item.Contains("plaintext_"))
                        { 
                        _GroupStatDetails.PlainText = Convert.ToInt32(item.Replace("plaintext_",""));
                        
                        }

                        else
                        {
                          _GroupStatDetails.PhotoLink = Convert.ToInt32(item);
                        }
                    }

                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                }

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                return "Something Went Wrong";
            }

            return new JavaScriptSerializer().Serialize(_GroupStatDetails);

           
        }
Пример #16
0
        public string AddTwitterAccount(string client_id, string client_secret, string redirect_uri, string UserId, string GroupId, string requestToken, string requestSecret, string requestVerifier)
        {
            try
            {
                System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls;

                string ret = string.Empty;
                Users userinfo = new Users();
                oAuthTwitter OAuth = new oAuthTwitter(client_id, client_secret, redirect_uri);
                OAuth.AccessToken = requestToken;
                OAuth.AccessTokenSecret = requestVerifier;
                OAuth.AccessTokenGet(requestToken, requestVerifier);
                JArray profile = userinfo.Get_Users_LookUp_ByScreenName(OAuth, OAuth.TwitterScreenName);

                if (profile!=null)
                {
                    logger.Error("Twitter.asmx >> AddTwitterAccount >> Twitter profile : " + profile); 
                }
                else
                {
                    logger.Error("Twitter.asmx >> AddTwitterAccount >> NULL Twitter profile : " + profile); 
                }

                objTwitterAccount = new Domain.Socioboard.Domain.TwitterAccount();
                TwitterUser twtuser;
                foreach (var item in profile)
                {
                    #region Add Twitter Account
                    try
                    {
                        objTwitterAccount.FollowingCount = Convert.ToInt32(item["friends_count"].ToString());
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterAccount.FollowersCount = Convert.ToInt32(item["followers_count"].ToString());
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    objTwitterAccount.Id = Guid.NewGuid();
                    objTwitterAccount.IsActive = true;
                    objTwitterAccount.OAuthSecret = OAuth.AccessTokenSecret;
                    objTwitterAccount.OAuthToken = OAuth.AccessToken;
                    try
                    {
                        objTwitterAccount.ProfileImageUrl = item["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);

                    }
                    try
                    {
                        objTwitterAccount.ProfileUrl = string.Empty;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterAccount.TwitterUserId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception er)
                    {
                        try
                        {
                            objTwitterAccount.TwitterUserId = item["id"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            logger.Error(ex.StackTrace);
                        }
                        Console.WriteLine(er.StackTrace);

                    }

                    try
                    {
                        objTwitterAccount.TwitterScreenName = item["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.StackTrace);
                    }
                    objTwitterAccount.UserId = Guid.Parse(UserId);
                    #endregion
                    if (!objTwitterAccountRepository.checkTwitterUserExists(objTwitterAccount.TwitterUserId, Guid.Parse(UserId)))
                    {
                        objTwitterAccountRepository.addTwitterkUser(objTwitterAccount);
                        #region Add TeamMemberProfile
                        Domain.Socioboard.Domain.Team objTeam = objTeamRepository.GetTeamByGroupId(Guid.Parse(GroupId));
                        Domain.Socioboard.Domain.TeamMemberProfile objTeamMemberProfile = new Domain.Socioboard.Domain.TeamMemberProfile();
                        objTeamMemberProfile.Id = Guid.NewGuid();
                        objTeamMemberProfile.TeamId = objTeam.Id;
                        objTeamMemberProfile.Status = 1;
                        objTeamMemberProfile.ProfileType = "twitter";
                        objTeamMemberProfile.StatusUpdateDate = DateTime.Now;
                        objTeamMemberProfile.ProfileId = objTwitterAccount.TwitterUserId;

                        objTeamMemberProfile.ProfileName = objTwitterAccount.TwitterScreenName;
                        objTeamMemberProfile.ProfilePicUrl = objTwitterAccount.ProfileImageUrl;

                        objTeamMemberProfileRepository.addNewTeamMember(objTeamMemberProfile);
                        #endregion
                        #region SocialProfile
                        Domain.Socioboard.Domain.SocialProfile objSocialProfile = new Domain.Socioboard.Domain.SocialProfile();
                        objSocialProfile.Id = Guid.NewGuid();
                        objSocialProfile.ProfileType = "twitter";
                        objSocialProfile.ProfileId = objTwitterAccount.TwitterUserId;
                        objSocialProfile.UserId = Guid.Parse(UserId);
                        objSocialProfile.ProfileDate = DateTime.Now;
                        objSocialProfile.ProfileStatus = 1;
                        #endregion
                        #region Add Twitter Stats
                        if (!objSocialProfilesRepository.checkUserProfileExist(objSocialProfile))
                        {
                            objSocialProfilesRepository.addNewProfileForUser(objSocialProfile);
                        }
                        objTwitterStats = new Domain.Socioboard.Domain.TwitterStats();
                        Random rNum = new Random();
                        objTwitterStats.Id = Guid.NewGuid();
                        objTwitterStats.TwitterId = objTwitterAccount.TwitterUserId;
                        objTwitterStats.UserId = Guid.Parse(UserId);
                        objTwitterStats.FollowingCount = objTwitterAccount.FollowingCount;
                        objTwitterStats.FollowerCount = objTwitterAccount.FollowersCount;
                        objTwitterStats.Age1820 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.Age2124 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.Age2534 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.Age3544 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.Age4554 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.Age5564 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.Age65 = rNum.Next(objTwitterAccount.FollowersCount);
                        objTwitterStats.EntryDate = DateTime.Now;
                        if (!objTwtstats.checkTwitterStatsExists(objTwitterAccount.TwitterUserId, Guid.Parse(UserId)))
                        {
                            objTwtstats.addTwitterStats(objTwitterStats);
                        }
                        #endregion
                        ret = "Account Added Successfully";
                    }
                    else
                    {
                        ret = "Account already Exist !";
                    }
                }
                #region Add Twitter Messages
                twtuser = new TwitterUser();
                try
                {
                    TimeLine tl = new TimeLine();
                    JArray data = null;
                    try
                    {
                        data = tl.Get_Statuses_Mentions_Timeline(OAuth);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        logger.Error("tl.Get_Statuses_Mentions_Timeline ex.StackTrace >> " + ex.StackTrace);
                        logger.Error("tl.Get_Statuses_Mentions_Timeline ex.Message >> " + ex.Message);
                    }
                    objTwitterMessage = new Domain.Socioboard.Domain.TwitterMessage();
                    foreach (var item in data)
                    {
                        objTwitterMessage.UserId = Guid.Parse(UserId);
                        objTwitterMessage.Type = "twt_mentions";
                        objTwitterMessage.Id = Guid.NewGuid();

                        try
                        {
                            objTwitterMessage.MessageId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterMessage.MessageDate = Utility.ParseTwitterTime(item["created_at"].ToString().TrimStart('"').TrimEnd('"'));
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterMessage.TwitterMsg = item["text"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }

                        try
                        {
                            objTwitterMessage.FromId = item["user"]["id_str"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }

                        try
                        {
                            objTwitterMessage.FromScreenName = item["user"]["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }

                        try
                        {
                            objTwitterMessage.FromProfileUrl = item["user"]["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }

                        try
                        {
                            objTwitterMessage.InReplyToStatusUserId = item["in_reply_to_status_id_str"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }

                        try
                        {
                            objTwitterMessage.SourceUrl = item["source"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        } try
                        {
                            objTwitterMessage.ProfileId = objTwitterAccount.TwitterUserId;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterMessage.ScreenName = item["user"]["screen_name"].ToString();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }

                        try
                        {
                            objTwitterMessage.EntryDate = DateTime.Now;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        if (!objTwitterMessageRepository.checkTwitterMessageExists(objTwitterMessage.MessageId))
                        {
                            objTwitterMessageRepository.addTwitterMessage(objTwitterMessage);
                        }

                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                    logger.Error("tl.Get_Statuses_Mentions_Timeline ex.StackTrace >> " + ex.StackTrace);
                    logger.Error("tl.Get_Statuses_Mentions_Timeline ex.Message >> " + ex.Message);
                }
                #endregion
                #region Add User Retweet
                twtuser = new TwitterUser();
                try
                {
                    JArray Retweet = null;
                    try
                    {
                        Retweet = twtuser.GetStatuses_Retweet_Of_Me(OAuth);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                        logger.Error("twtuser.GetStatuses_Retweet_Of_Me ex.StackTrace >> " + ex.StackTrace);
                        logger.Error("twtuser.GetStatuses_Retweet_Of_Me ex.Message >> " + ex.Message);
                    }
                    objTwitterMessage = new Domain.Socioboard.Domain.TwitterMessage();
                    foreach (var item in Retweet)
                    {
                        objTwitterMessage.UserId = Guid.Parse(UserId);
                        objTwitterMessage.Type = "twt_retweets";
                        objTwitterMessage.Id = Guid.NewGuid();

                        try
                        {
                            objTwitterMessage.MessageId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterMessage.MessageDate = Utility.ParseTwitterTime(item["created_at"].ToString().TrimStart('"').TrimEnd('"'));
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterMessage.TwitterMsg = item["text"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }

                        try
                        {
                            objTwitterMessage.FromId = item["user"]["id_str"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }

                        try
                        {
                            objTwitterMessage.FromScreenName = item["user"]["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }

                        try
                        {
                            objTwitterMessage.FromProfileUrl = item["user"]["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }

                        try
                        {
                            objTwitterMessage.InReplyToStatusUserId = item["in_reply_to_status_id_str"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }

                        try
                        {
                            objTwitterMessage.SourceUrl = item["source"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        } try
                        {
                            objTwitterMessage.ProfileId = objTwitterAccount.TwitterUserId;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        } try
                        {
                            objTwitterMessage.EntryDate = DateTime.Now;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        if (!objTwitterMessageRepository.checkTwitterMessageExists(objTwitterMessage.MessageId))
                        {
                            objTwitterMessageRepository.addTwitterMessage(objTwitterMessage);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                    logger.Error("twtuser.GetStatuses_Retweet_Of_Me ex.StackTrace >> " + ex.StackTrace);
                    logger.Error("twtuser.GetStatuses_Retweet_Of_Me ex.Message >> " + ex.Message);
                }
                #endregion
                #region Add User Tweets
                try
                {

                    JArray Timeline = twtuser.GetStatuses_User_Timeline(OAuth);
                    TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository();
                    TwitterMessage twtmsg = new TwitterMessage();
                    foreach (var item in Timeline)
                    {
                        objTwitterMessage.UserId = Guid.Parse(UserId);
                        objTwitterMessage.Type = "twt_usertweets";
                        try
                        {
                            objTwitterMessage.TwitterMsg = item["text"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterMessage.SourceUrl = item["source"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterMessage.ScreenName = objTwitterAccount.TwitterScreenName;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterMessage.ProfileId = objTwitterAccount.TwitterUserId;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterMessage.MessageId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterMessage.MessageDate = Utility.ParseTwitterTime(item["created_at"].ToString().TrimStart('"').TrimEnd('"'));
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterMessage.InReplyToStatusUserId = item["in_reply_to_status_id_str"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterMessage.Id = Guid.NewGuid();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterMessage.FromProfileUrl = item["user"]["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterMessage.FromName = item["user"]["name"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterMessage.FromId = item["user"]["id_str"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        objTwitterMessage.EntryDate = DateTime.Now;
                        try
                        {
                            objTwitterMessage.FromScreenName = item["user"]["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        if (!objTwitterMessageRepository.checkTwitterMessageExists(objTwitterMessage.MessageId))
                        {
                            objTwitterMessageRepository.addTwitterMessage(objTwitterMessage);
                        }

                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.StackTrace);
                    logger.Error("twtuser.GetStatuses_User_Timeline ex.StackTrace >> " + ex.StackTrace);
                    logger.Error("twtuser.GetStatuses_User_Timeline ex.Message >> " + ex.Message);
                }
                #endregion
                #region Add Twitter User Feed

                twtuser = new TwitterUser();
                try
                {
                    JArray Home_Timeline = twtuser.GetStatuses_Home_Timeline(OAuth);
                    objTwitterFeed = new Domain.Socioboard.Domain.TwitterFeed();
                    foreach (var item in Home_Timeline)
                    {
                        objTwitterFeed.UserId = Guid.Parse(UserId);
                        objTwitterFeed.Type = "twt_feeds";
                        try
                        {
                            objTwitterFeed.Feed = item["text"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterFeed.SourceUrl = item["source"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterFeed.ScreenName = objTwitterAccount.TwitterScreenName;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterFeed.ProfileId = objTwitterAccount.TwitterUserId;
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterFeed.MessageId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterFeed.FeedDate = Utility.ParseTwitterTime(item["created_at"].ToString().TrimStart('"').TrimEnd('"'));
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterFeed.InReplyToStatusUserId = item["in_reply_to_status_id_str"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterFeed.Id = Guid.NewGuid();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
<<<<<<< HEAD
                        try
                        {
                            objTwitterFeed.FromProfileUrl = item["user"]["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
                            objTwitterFeed.FromName = item["user"]["name"].ToString().TrimStart('"').TrimEnd('"');
=======
                        try
                        {
                            objTwitterFeed.FromProfileUrl = item["user"]["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
>>>>>>> e052534b7a2a3744cad9dddbc3c6acccf394ca7b
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
<<<<<<< HEAD
=======
                            objTwitterFeed.FromName = item["user"]["name"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        try
                        {
>>>>>>> e052534b7a2a3744cad9dddbc3c6acccf394ca7b
                            objTwitterFeed.FromId = item["user"]["id_str"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        objTwitterFeed.EntryDate = DateTime.Now;
                        try
                        {
                            objTwitterFeed.FromScreenName = item["user"]["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.StackTrace);
                        }
                        if (!objTwitterFeedRepository.checkTwitterFeedExists(objTwitterFeed.MessageId))
                        {
                            try
                            {
                                objTwitterFeedRepository.addTwitterFeed(objTwitterFeed);
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.Message);
                                Console.WriteLine(ex.StackTrace);
                            }
                        }
                        // Edited by Antima[20/12/2014]

                        SentimentalAnalysis _SentimentalAnalysis = new SentimentalAnalysis();
                        FeedSentimentalAnalysisRepository _FeedSentimentalAnalysisRepository = new FeedSentimentalAnalysisRepository();
                        try
                        {
                            if (_FeedSentimentalAnalysisRepository.checkFeedExists(objTwitterFeed.ProfileId.ToString(), Guid.Parse(UserId), objTwitterFeed.Id.ToString()))
                            {
                                if (!string.IsNullOrEmpty(objTwitterFeed.Feed))
                                {
                                    string Network = "twitter";
                                    _SentimentalAnalysis.GetPostSentimentsFromUclassify(Guid.Parse(UserId), objTwitterFeed.ProfileId, objTwitterFeed.MessageId, objTwitterFeed.Feed, Network);
                                }
                            }
                        }
                        catch (Exception)
                        {

                        }
                    }
                }
Пример #17
0
 public void UpdateTwitterMessage(TwitterMessage twitterMessage)
 {
     lock (_dbLock)
         _db.SaveChanges();
 }
 public void Add(TwitterMessage message)
 {
     _messages.Add(message);
 }
Пример #19
0
        private void getUserTweets(string UserId, oAuthTwitter OAuth)
        {
            #region Add User Tweets
            try
            {
                TwitterUser twtuser =new TwitterUser();
                JArray Timeline = twtuser.GetStatuses_User_Timeline(OAuth);
                TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository();
                TwitterMessage twtmsg = new TwitterMessage();
                foreach (var item in Timeline)
                {
                    objTwitterMessage.UserId = Guid.Parse(UserId);
                    objTwitterMessage.Type = "twt_usertweets";
                    try
                    {
                        objTwitterMessage.TwitterMsg = item["text"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterMessage.SourceUrl = item["source"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterMessage.ScreenName = objTwitterAccount.TwitterScreenName;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterMessage.ProfileId = objTwitterAccount.TwitterUserId;
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterMessage.MessageId = item["id_str"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterMessage.MessageDate = Utility.ParseTwitterTime(item["created_at"].ToString().TrimStart('"').TrimEnd('"'));
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterMessage.InReplyToStatusUserId = item["in_reply_to_status_id_str"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterMessage.Id = Guid.NewGuid();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterMessage.FromProfileUrl = item["user"]["profile_image_url"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterMessage.FromName = item["user"]["name"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    try
                    {
                        objTwitterMessage.FromId = item["user"]["id_str"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    objTwitterMessage.EntryDate = DateTime.Now;
                    try
                    {
                        objTwitterMessage.FromScreenName = item["user"]["screen_name"].ToString().TrimStart('"').TrimEnd('"');
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.StackTrace);
                    }
                    if (!objTwitterMessageRepository.checkTwitterMessageExists(objTwitterMessage.MessageId))
                    {
                        objTwitterMessageRepository.addTwitterMessage(objTwitterMessage);
                    }

                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                logger.Error("twtuser.GetStatuses_User_Timeline ex.StackTrace >> " + ex.StackTrace);
                logger.Error("twtuser.GetStatuses_User_Timeline ex.Message >> " + ex.Message);
            }
            #endregion
        }
 private void OnNewTweet(TwitterMessage tweet)
 {
     NotifyPropertyChanged(nameof(Tweets));
 }