public void getUserFollowersData(oAuthTwitter OAuth, string screeenName, string TwitterUserId, Guid userId) { try { TimeLine _TimeLine = new TimeLine(); JArray jdata = _TimeLine.Get_User_Followers(OAuth); JArray user_data = JArray.Parse(jdata[0]["users"].ToString()); Domain.Socioboard.Domain.InboxMessages _InboxMessages; foreach (var item in user_data) { try { _InboxMessages = new Domain.Socioboard.Domain.InboxMessages(); _InboxMessages.Id = Guid.NewGuid(); _InboxMessages.UserId = userId; _InboxMessages.ProfileId = TwitterUserId; _InboxMessages.ProfileType = "twt"; _InboxMessages.MessageType = "twt_followers"; _InboxMessages.EntryTime = DateTime.Now; _InboxMessages.MessageId = ""; _InboxMessages.Status = 0; try { _InboxMessages.Message = item["description"].ToString(); } catch (Exception ex) { logger.Error("Twitter.asmx => getUserFollowers => " + ex.Message); } try { _InboxMessages.FromId = item["id_str"].ToString(); } catch (Exception ex) { _InboxMessages.FromId = item["id"].ToString(); } try { _InboxMessages.FromName = item["screen_name"].ToString(); } catch (Exception ex) { logger.Error("Twitter.asmx => getUserFollowers => " + ex.Message); } try { _InboxMessages.FollowerCount = item["followers_count"].ToString(); } catch (Exception ex) { logger.Error("Twitter.asmx => getUserFollowers => " + ex.Message); } try { _InboxMessages.FollowingCount = item["friends_count"].ToString(); } catch (Exception ex) { logger.Error("Twitter.asmx => getUserFollowers => " + ex.Message); } try { _InboxMessages.FromImageUrl = item["profile_image_url"].ToString(); } catch (Exception ex) { _InboxMessages.FromImageUrl = item["profile_image_url_https"].ToString(); } try { _InboxMessages.CreatedTime = DateTime.Now; } catch (Exception ex) { logger.Error("Twitter.asmx => getUserFollowers => " + ex.Message); } _InboxMessages.RecipientId = TwitterUserId; _InboxMessages.RecipientName = screeenName; if (!objInboxMessagesRepository.checkInboxMessageFriendExists(userId, _InboxMessages.FromId, _InboxMessages.RecipientId, _InboxMessages.MessageType)) { objInboxMessagesRepository.AddInboxMessages(_InboxMessages); } } catch (Exception ex) { logger.Error("Twitter.asmx => getUserFollowers => " + ex.Message); } } } catch (Exception ex) { logger.Error("Twitter.asmx => getUserFollowers => " + ex.Message); } }
public void getTwitterFollowerData(oAuthTwitter OAuth, string TwitterUserId) { try { TimeLine _TimeLine = new TimeLine(); JArray jdata = _TimeLine.Get_User_Followers(OAuth); JArray user_data = JArray.Parse(jdata[0]["users"].ToString()); Domain.Socioboard.Domain.TwitterFollowerNames _TwitterFollowerNames; TwitterFollowerNamesRepository objTwitterFollowerNamesRepository = new TwitterFollowerNamesRepository(); foreach (var item in user_data) { try { _TwitterFollowerNames = new Domain.Socioboard.Domain.TwitterFollowerNames(); _TwitterFollowerNames.Id = Guid.NewGuid(); _TwitterFollowerNames.TwitterProfileId = TwitterUserId; try { _TwitterFollowerNames.FollowerId = item["id_str"].ToString(); } catch (Exception ex) { _TwitterFollowerNames.FollowerId = item["id"].ToString(); } try { _TwitterFollowerNames.Followerscrname = item["screen_name"].ToString(); } catch (Exception ex) { Console.WriteLine(ex.Message); } try { _TwitterFollowerNames.Name = item["name"].ToString(); } catch (Exception ex) { Console.WriteLine(ex.Message); } if (!objTwitterFollowerNamesRepository.IsFollowerExist(_TwitterFollowerNames.TwitterProfileId, _TwitterFollowerNames.FollowerId)) { objTwitterFollowerNamesRepository.addTwitterAccountFollower(_TwitterFollowerNames); } } catch (Exception ex) { logger.Error("Twitter.asmx => getTwitterFollowerData => " + ex.Message); } } } catch (Exception ex) { logger.Error("Twitter.asmx => getTwitterFollowerData => " + ex.Message); } }