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 getTwitterMessages(string UserId, oAuthTwitter OAuth) { TwitterUser twtuser; #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 }
void ProcessRequest() { if (!string.IsNullOrEmpty(Request.QueryString["op"])) { if (Request.QueryString["op"] == "removedata") { string network = Request.QueryString["network"]; string message = string.Empty; var users = Request.QueryString["data[]"]; Messages mstable = new Messages(); DataSet ds = DataTableGenerator.CreateDataSetForTable(mstable); DataTable dtt = ds.Tables[0]; string page = Request.QueryString["page"]; if (page == "feed") { AjaxFeed ajxfed = new AjaxFeed(); DataTable dt = null; if (network == "facebook") { dt = (DataTable)Session["FacebookFeedDataTable"]; } else if (network == "twitter") { dt = (DataTable)Session["TwitterFeedDataTable"]; } else if (network == "linkedin") { dt = (DataTable)Session["LinkedInFeedDataTable"]; } foreach (var parent in users) { DataView dv = new DataView(dtt); DataRow[] foundRows = dt.Select("ProfileId = '" + parent + "'"); foreach (var child in foundRows) { dtt.ImportRow(child); } } message = ajxfed.BindData(dtt); } else if (page == "message") { WooSuite.Message.AjaxMessage ajxmes = new WooSuite.Message.AjaxMessage(); DataSet dss = (DataSet)Session["MessageDataTable"]; //foreach (var parent in users) //{ DataView dv = new DataView(dtt); DataRow[] foundRows = dss.Tables[0].Select("ProfileId = '" + users + "'"); foreach (var child in foundRows) { dtt.ImportRow(child); } //} message = ajxmes.BindData(dtt); } Response.Write(message); } else if (Request.QueryString["op"] == "upgradeplan") { User user = (User)Session["LoggedUser"]; UserRepository userRepo = new UserRepository(); string accounttype = Request.QueryString["planid"]; if (accounttype == AccountType.Deluxe.ToString().ToLower()) { userRepo.UpdateAccountType(user.Id, AccountType.Deluxe.ToString()); user.AccountType = AccountType.Deluxe.ToString(); } else if (accounttype == AccountType.Standard.ToString().ToLower()) { userRepo.UpdateAccountType(user.Id, AccountType.Standard.ToString()); user.AccountType = AccountType.Standard.ToString(); } else if (accounttype == AccountType.Premium.ToString().ToLower()) { userRepo.UpdateAccountType(user.Id, AccountType.Premium.ToString()); user.AccountType = AccountType.Premium.ToString(); } Session["LoggedUser"] = user; } else if (Request.QueryString["op"] == "bindrssActive") { User user = (User)Session["LoggedUser"]; RssFeedsRepository rssFeedsRepo = new RssFeedsRepository(); List<RssFeeds> lstrssfeeds = rssFeedsRepo.getAllActiveRssFeeds(user.Id); TwitterAccountRepository twtAccountRepo = new TwitterAccountRepository(); if (lstrssfeeds != null) { if (lstrssfeeds.Count != 0) { int rssCount = 0; string rssData = string.Empty; rssData += "<h2 class=\"league section-ttl rss_header\">Active RSS Feeds</h2>"; foreach (RssFeeds item in lstrssfeeds) { TwitterAccount twtAccount = twtAccountRepo.getUserInformation(item.ProfileScreenName, user.Id); string picurl = string.Empty; if (string.IsNullOrEmpty(twtAccount.ProfileUrl)) { picurl = "../Contents/img/blank_img.png"; } else { picurl = twtAccount.ProfileUrl; } rssData += " <section id=\"" + item.Id + "\" class=\"publishing\">" + "<section class=\"twothird\">" + "<article class=\"quarter\">" + "<div href=\"#\" class=\"avatar_link view_profile\" title=\"\">" + "<img title=\"" + item.ProfileScreenName + "\" src=\"" + picurl + "\" data-src=\"\" class=\"avatar sm\">" + "<article class=\"rss_ava_icon\"><span title=\"Twitter\" class=\"icon twitter_16\"></span></article>" + "</div>" + "</article>" + "<article class=\"threefourth\">" + "<ul>" + "<li>" + item.FeedUrl + "</li>" + "<li>Prefix: </li>" + "<li class=\"freq\" title=\"New items from this feed will be posted at most once every hour\">Max Frequency: " + item.Duration + "</li>" + "</ul>" + "</article>" + "</section>" + "<section class=\"third\">" + "<ul class=\"rss_action_buttons\">" + "<li onclick=\"pauseFunction('" + item.Id + "');\" class=\"\"><a id=\"pause_" + item.Id + "\" href=\"#\" title=\"Pause\" class=\"small_pause icon pause\"></a></li>" + "<li onclick=\"deleteRssFunction('" + item.Id + "');\" class=\"show-on-hover\"><a id=\"delete_" + item.Id + "\" href=\"#\" title=\"Delete\" class=\"small_remove icon delete\"></a></li>" + "</ul>" + "</section>" + "</section>"; } Response.Write(rssData); } } } else if (Request.QueryString["op"] == "savedrafts") { Guid Id = Guid.Parse(Request.QueryString["id"]); string newstr = Request.QueryString["newstr"]; DraftsRepository draftsRepo = new DraftsRepository(); draftsRepo.UpdateDrafts(Id, newstr); } else if (Request.QueryString["op"] == "getTwitterUserTweets") { UrlExtractor urlext = new UrlExtractor(); User user = (User)Session["LoggedUser"]; string userid = Request.QueryString["profileid"]; TwitterAccountRepository twtAccountRepo = new TwitterAccountRepository(); ArrayList alst = twtAccountRepo.getAllTwitterAccountsOfUser(user.Id); oAuthTwitter oauth = new oAuthTwitter(); foreach (TwitterAccount childnoe in alst) { oauth.AccessToken = childnoe.OAuthToken; oauth.AccessTokenSecret = childnoe.OAuthSecret; oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"]; oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"]; oauth.TwitterUserId = childnoe.TwitterUserId; oauth.TwitterScreenName = childnoe.TwitterScreenName; break; } TimeLine timeLine = new TimeLine(); //need to be implement waiting for design string mes = string.Empty; JArray userlookup = timeLine.Get_Statuses_User_Timeline(oauth,userid); string jstring = string.Empty; int i = 0; foreach (var item in userlookup) { if (i < 2) { string[] str = urlext.splitUrlFromString(item["text"].ToString()); mes += "<li class=\"\">" + "<div class=\"twtcommands\">" + "<a class=\"account-group\">" + "<img class=\"avatar\" alt=\"\" src=\"" + item["user"]["profile_image_url"] + "\" alt=\"\" />" + "</a>" + "<div class=\"stream-item-header\">" + "<div class=\"user-details\">" + "<strong class=\"fullname\">" + item["user"]["name"] + "</strong>" + "<span class=\"username\">" + "<s>@</s>" + "<b>" + item["screen_name"] + "</b>" + "</span>" + "<small class=\"time\"></small>" + "</div><p class=\"tweet-text\">"; foreach (string substritem in str) { if (!string.IsNullOrEmpty(substritem)) { if (substritem.Contains("http")) { mes += "<a target=\"_blank\" href=\"" + substritem + "\">" + substritem + "</a>"; } else { mes += substritem; } } } //item["text"] " + //"<a target=\"_blank\" class=\"twitter-timeline-link\" href=\"#\" f69e857af67d2c=\"true\">" + // "<span class=\"tco-ellipsis\"></span>" + // "<span class=\"invisible\">http://</span>" + // "<span class=\"js-display-url\">ow.ly/o4o7l</span>" + // "<span class=\"invisible\"></span>" + // "<span class=\"tco-ellipsis\"><span class=\"invisible\"> </span></span>" + //"</a> mes += "</p>" + "<div class=\"details\">" + "<a class=\"stream_details\"></a>" + "</div>" + "</div>" + "</div>" + "</li>"; i++; } else { break; } } Response.Write(mes); } else if (Request.QueryString["op"] == "saveWooQueue") { Guid Id = Guid.Parse(Request.QueryString["id"]); string profileid = Request.QueryString["profid"]; string message = Request.QueryString["message"]; string network = Request.QueryString["network"]; string net = string.Empty; if (network == "fb") { net = "facebook"; } else if (network == "twt") { net = "twitter"; } else if (network == "lin") { net = "linkedin"; } ScheduledMessageRepository schmsgRepo = new ScheduledMessageRepository(); schmsgRepo.UpdateProfileScheduleMessage(Id, profileid, message, net); } else if (Request.QueryString["op"] == "saveRss") { try { User user = (User)Session["LoggedUser"]; RssFeedsRepository objRssFeedRepo = new RssFeedsRepository(); RssFeeds objRssFeeds = new RssFeeds(); objRssFeeds.ProfileScreenName = Request.QueryString["user"]; objRssFeeds.FeedUrl = Request.QueryString["feedsurl"]; objRssFeeds.UserId = user.Id; objRssFeeds.Status = false; objRssFeeds.Message = Request.QueryString["message"]; objRssFeeds.Duration = Request.QueryString["duration"]; objRssFeeds.CreatedDate = DateTime.Now; objRssFeedRepo.AddRssFeed(objRssFeeds); } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } else if (Request.QueryString["op"] == "deletewooqueuemessage") { try { Guid id = Guid.Parse(Request.QueryString["id"]); ScheduledMessageRepository schmsgRepo = new ScheduledMessageRepository(); schmsgRepo.deleteMessage(id); } catch (Exception ex) { logger.Error(ex.Message); } } else if (Request.QueryString["op"] == "chkrssurl") { try { string url = Request.QueryString["url"]; var facerequest = (HttpWebRequest)WebRequest.Create(url); facerequest.Method = "GET"; string outputface = string.Empty; using (var response = facerequest.GetResponse()) { using (var stream = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(1252))) { outputface = stream.ReadToEnd(); if (outputface.Contains("<rss version=\"2.0\"")) { Response.Write("true"); } } } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); Response.Write("Error"); } } else if (Request.QueryString["op"] == "rssusers") { try { User user = (User)Session["LoggedUser"]; TwitterAccountRepository twtAccRepo = new TwitterAccountRepository(); ArrayList alst = twtAccRepo.getAllTwitterAccountsOfUser(user.Id); string message = string.Empty; foreach (TwitterAccount item in alst) { message += "<option value=\"" + item.TwitterScreenName + "\">@" + item.TwitterScreenName + "</option>"; } Response.Write(message); } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } else if (Request.QueryString["op"] == "searchkeyword") { User user = (User)Session["LoggedUser"]; DiscoverySearchRepository disrepo = new DiscoverySearchRepository(); List<string> alst = disrepo.getAllSearchKeywords(user.Id); string message = string.Empty; foreach (var item in alst) { message += "<li onclick=\"getSearchResults('" + item + "');\"><a href=\"#\"><i class=\"show icon-caret-right\" style=\"visibility:visible;margin-right:5px\"></i>" + item + "</a></li>"; } Response.Write(message); } else if (Request.QueryString["op"] == "getResults") { string type = Request.QueryString["type"]; string key = Request.QueryString["keyword"]; Discovery discoverypage = new Discovery(); string search = discoverypage.getresults(key); string message = "<ul id=\"message-list\">" + search + "</ul>"; Response.Write(message); } else if (Request.QueryString["op"] == "getFollowers") { User user = (User)Session["LoggedUser"]; Users twtUser = new Users(); oAuthTwitter oauth = new oAuthTwitter(); TwitterAccountRepository TwtAccRepo = new TwitterAccountRepository(); TwitterAccount TwtAccount = TwtAccRepo.getUserInformation(user.Id, Request.QueryString["id"]); oauth.AccessToken = TwtAccount.OAuthToken; oauth.AccessTokenSecret = TwtAccount.OAuthSecret; oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"]; oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"]; oauth.TwitterScreenName = TwtAccount.TwitterScreenName; oauth.TwitterUserId = TwtAccount.TwitterUserId; JArray response = twtUser.Get_Followers_ById(oauth, Request.QueryString["id"]); string jquery = string.Empty; foreach (var item in response) { if (item["ids"] != null) { foreach (var child in item["ids"]) { JArray userprofile = twtUser.Get_Users_LookUp(oauth, child.ToString()); foreach (var items in userprofile) { try { jquery += "<li class=\"shadower\">" + "<div class=\"disco-feeds\">" + "<div class=\"star-ribbon\"></div>" + "<div class=\"disco-feeds-img\">" + "<img alt=\"\" src=\"" + items["profile_image_url"] + "\" style=\"height: 100px; width: 100px;\" class=\"pull-left\">" + "</div>" + "<div class=\"disco-feeds-content\">" + "<div class=\"disco-feeds-title\">" + "<h3 class=\"no-margin\">" + items["name"] + "</h3>" + "<span>@" + items["screen_name"] + "</span>" + "</div>" + "<p>"; try { jquery += items["status"]["text"]; } catch (Exception ex) { logger.Error(ex.Message); } jquery += "</p>" + //"<a href=\"#\" class=\"btn\">Hide</a>" + "<a href=\"#\" onclick=\"detailsprofile('" + items["id_str"] + "')\" class=\"btn\">Full Profile <i class=\"icon-caret-right\"></i> </a><div class=\"scl\">" + "<a href=\"#\"><img alt=\"\" src=\"../Contents/img/admin/usergrey.png\"></a>" + "<a href=\"#\"><img alt=\"\" src=\"../Contents/img/admin/goto.png\"></a>" + "<a href=\"#\"><img alt=\"\" src=\"../Contents/img/admin/setting.png\"></a>" + "</div></div></div>" + "<div class=\"disco-feeds-info\">" + "<ul class=\"no-margin\">" + "<li><a href=\"#\"><img src=\"../Contents/img/admin/markerbtn2.png\" alt=\"\">"; if (!string.IsNullOrEmpty(items["time_zone"].ToString())) { jquery += items["time_zone"]; } else { jquery += "Not Specific"; } jquery += "</a></li>"; if (string.IsNullOrEmpty(items["url"].ToString())) { jquery += "<li><a href=\"#\"><img src=\"../Contents/img/admin/url.png\" alt=\"\">"; jquery += "Not Specific"; } else { jquery += "<li><a target=\"_blank\" href=\"" + items["url"] + "\"><img src=\"../Contents/img/admin/url.png\" alt=\"\">"; jquery += items["url"]; } jquery += "</a></li></ul>" + "<ul class=\"no-margin\" style=\"margin-top:20px\">" + "<li><a href=\"#\"><img src=\"../Contents/img/admin/twittericon-white.png\" alt=\"\">Followers <big><b>" + items["followers_count"] + "</b></big></a></li>" + "<li><a href=\"#\"><img src=\"../Contents/img/admin/twitter-white.png\" alt=\"\">Following <big><b>" + items["friends_count"] + "</b></big></a></li>" + "</ul>" + "</div>" + "</li>"; #region old // jquery += "<div class=\"wentbg\">" + // "<div class=\"over\">" + // "<div class=\"topicon\">" + // //"<a href=\"#\"><img border=\"none\" alt=\"\" src=\"../Contents/img/manplus.png\"></a>" + // //"<a href=\"#\"><img border=\"none\" alt=\"\" src=\"../Contents/img/replay.png\"></a>" + // //"<a href=\"#\"><img border=\"none\" alt=\"\" src=\"../Contents/img/setting.png\"></a>" + // "</div>" + // "<div class=\"botombtn\">" + // "<div class=\"clickbtn\"><a href=\"#\"><img border=\"none\" alt=\"\" src=\"../Contents/img/full_profile.png\" onclick=\"detailsprofile('" + items["id_str"] + "')\"></a></div>" + // "</div>" + // "</div>" + // "<div class=\"wentbgf\"><img alt=\"\" src=\"" + items["profile_image_url"] + "\"></div>" + // "<div class=\"wentbgtext\">" + //"<span class=\"heading\">\"" + items["name"] + "\"</span> <span>@\"" + items["screen_name"] + "\"</span>" + //"<div class=\"viegil\">\"" + items["status"]["text"] + "\"</div>" + // "<div class=\"avenue\">" + // "<img alt=\"\" src=\"../Contents/img/avenue.png\">" + // "<div class=\"avenuetext\">\"" + items["time_zone"] + "\"</div>" + // "<img class=\"link\" alt=\"\" src=\"../Contents/img/url.png\">" + // "<div class=\"nourl\">No URL</div>" + // "</div>"; // jquery += "<div class=\"followerbg\">" + // "<div class=\"follower\">Followers <span>\"" + items["followers_count"] + "\"</span></div>" + // "<div class=\"following\">Friends <span>\"" + items["friends_count"] + "\"</span></div>" + // "</div>" + // "</div>" + // "</div>"; #endregion } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } } } else { jquery += "None of the User Is Following"; } } Response.Write(jquery); } else if (Request.QueryString["op"] == "deletedrafts") { Guid id = Guid.Parse(Request.QueryString["id"]); DraftsRepository draftsRepo = new DraftsRepository(); draftsRepo.DeleteDrafts(id); } else if (Request.QueryString["op"] == "usersearchresults") { ArrayList alstallusers = null; if (Session["AllUserList"] == null) { User user = (User)Session["LoggedUser"]; alstallusers = new ArrayList(); /*facebook*/ try { FacebookAccountRepository faceaccount = new FacebookAccountRepository(); ArrayList lstfacebookaccount = faceaccount.getAllFacebookAccountsOfUser(user.Id); foreach (FacebookAccount item in lstfacebookaccount) { alstallusers.Add(item.FbUserName + "_fb_" + item.FbUserId); } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } /*twitter*/ try { TwitterAccountRepository twtAccountrepo = new TwitterAccountRepository(); ArrayList lsttwitteraccount = twtAccountrepo.getAllTwitterAccountsOfUser(user.Id); foreach (TwitterAccount item in lsttwitteraccount) { alstallusers.Add(item.TwitterScreenName + "_twt_" + item.TwitterUserId); } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } /*linkedin*/ try { LinkedInAccountRepository linkedinaccountrepo = new LinkedInAccountRepository(); ArrayList lstaccount = linkedinaccountrepo.getAllLinkedinAccountsOfUser(user.Id); foreach (LinkedInAccount item in lstaccount) { alstallusers.Add(item.LinkedinUserName + "_lin_" + item.LinkedinUserId); } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } /*instagram*/ try { InstagramAccountRepository instaaccrepo = new InstagramAccountRepository(); ArrayList lstinstagramaccount = instaaccrepo.getAllInstagramAccountsOfUser(user.Id); foreach (InstagramAccount item in lstinstagramaccount) { alstallusers.Add(item.InsUserName + "_ins_" + item.InstagramId); } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } ///*googleplus*/ try { GooglePlusAccountRepository gpaccountrepo = new GooglePlusAccountRepository(); ArrayList lstgpaccount = gpaccountrepo.getAllGooglePlusAccountsOfUser(user.Id); foreach (GooglePlusAccount item in lstgpaccount) { alstallusers.Add(item.GpUserName + "_gp_" + item.GpUserId); } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } Session["AllUserList"] = alstallusers; } else { alstallusers = (ArrayList)Session["AllUserList"]; } } else if (Request.QueryString["op"] == "searchingresults") { string txtvalue = Request.QueryString["txtvalue"]; string message = string.Empty; if (!string.IsNullOrEmpty(txtvalue)) { ArrayList alstall = (ArrayList)Session["AllUserList"]; if (alstall.Count != 0) { foreach (string item in alstall) { if (item.ToLower().StartsWith(txtvalue)) { string[] nametype = item.Split('_'); if (nametype[1] == "fb") { message += "<div class=\"btn srcbtn\">" + "<img width=\"15\" src=\"../Contents/img/facebook.png\" alt=\"\">" + "<span onclick=\"getFacebookProfiles('" + nametype[2] + "')\">" + nametype[0] + "</span>" + "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" + "</div>"; } else if (nametype[1] == "twt" || item.Contains("_twt_")) { if (nametype.Count() < 4) { message += "<div class=\"btn srcbtn\">" + "<img width=\"15\" src=\"../Contents/img/twticon.png\" alt=\"\">" + " <span onclick=\"detailsprofile('" + nametype[0] + "');\">" + nametype[0] + "</span>" + "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" + "</div>"; } else { string[] containstwitter = item.Split(new string[] { "_twt_" }, StringSplitOptions.None); message += "<div class=\"btn srcbtn\">" + "<img width=\"15\" src=\"../Contents/img/twticon.png\" alt=\"\">" + "<span onclick=\"detailsprofile('" + containstwitter[0] + "');\"> " + containstwitter[0] + "</span>" + "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" + "</div>"; } } else if (nametype[1] == "ins") { message += "<div class=\"btn srcbtn\">" + "<img width=\"15\" src=\"../Contents/img/instagram_24X24.png\" alt=\"\">" + nametype[0] + "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" + "</div>"; } else if (nametype[1] == "lin") { message += "<div class=\"btn srcbtn\">" + "<img width=\"15\" src=\"../Contents/img/link_icon.png\" alt=\"\">" + nametype[0] + "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" + "</div>"; } else if (nametype[1] == "gp") { message += "<div class=\"btn srcbtn\">" + "<img width=\"15\" src=\"../Contents/img/google_plus.png\" alt=\"\">" + nametype[0] + "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" + "</div>"; } } } } else { message += "<div class=\"btn srcbtn\">" + "<img width=\"15\" src=\"../Contents/img/norecord.png\" alt=\"\">" + "No Records Found" + "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" + "</div>"; } message += "<div class=\"socailtile\">Twitter</div>"; /*twitter contact search */ #region twitter contact search try { User user = (User)Session["LoggedUser"]; Users twtUser = new Users(); oAuthTwitter oAuthTwt = new oAuthTwitter(); if (Session["oAuthUserSearch"] == null) { oAuthTwitter oauth = new oAuthTwitter(); oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"].ToString(); oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"].ToString(); oauth.CallBackUrl = ConfigurationManager.AppSettings["callbackurl"].ToString(); TwitterAccountRepository twtAccRepo = new TwitterAccountRepository(); ArrayList alst = twtAccRepo.getAllTwitterAccountsOfUser(user.Id); foreach (TwitterAccount item in alst) { oauth.AccessToken = item.OAuthToken; oauth.AccessTokenSecret = item.OAuthSecret; oauth.TwitterUserId = item.TwitterUserId; oauth.TwitterScreenName = item.TwitterScreenName; break; } Session["oAuthUserSearch"] = oauth; oAuthTwt = oauth; } else { oAuthTwitter oauth = (oAuthTwitter)Session["oAuthUserSearch"]; oAuthTwt = oauth; } JArray twtuserjson = twtUser.Get_Users_Search(oAuthTwt, txtvalue, "5"); foreach (var item in twtuserjson) { message += "<div class=\"btn srcbtn\">" + "<img width=\"15\" src=\"../Contents/img/twticon.png\" alt=\"\">" + " <span> " + item["screen_name"].ToString().TrimStart('"').TrimEnd('"') + "</span>" + "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" + "</div>"; } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } #endregion message += "<div class=\"socailtile\">Facebook</div>"; #region Facebook Contact search try { string accesstoken = string.Empty; FacebookAccountRepository facebookaccrepo = new FacebookAccountRepository(); ArrayList alstfacbookusers = facebookaccrepo.getAllFacebookAccounts(); foreach (FacebookAccount item in alstfacbookusers) { accesstoken = item.AccessToken; break; } string facebookSearchUrl = "https://graph.facebook.com/search?q=" + txtvalue + " &limit=5&type=user&access_token=" + accesstoken; var facerequest = (HttpWebRequest)WebRequest.Create(facebookSearchUrl); facerequest.Method = "GET"; string outputface = string.Empty; using (var response = facerequest.GetResponse()) { using (var stream = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(1252))) { outputface = stream.ReadToEnd(); } } if (!outputface.StartsWith("[")) outputface = "[" + outputface + "]"; JArray facebookSearchResult = JArray.Parse(outputface); foreach (var item in facebookSearchResult) { var data = item["data"]; foreach (var chlid in data) { message += "<div class=\"btn srcbtn\">" + "<img width=\"15\" src=\"../Contents/img/facebook.png\" alt=\"\">" + "<span >" + chlid["name"] + "</span>" + "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" + "</div>"; } } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } #endregion Response.Write(message); } } else if (Request.QueryString["op"] == "getTwitterUserDetails") { User user = (User)Session["LoggedUser"]; string userid = Request.QueryString["profileid"]; TwitterAccountRepository twtAccountRepo = new TwitterAccountRepository(); ArrayList alst = twtAccountRepo.getAllTwitterAccountsOfUser(user.Id); oAuthTwitter oauth = new oAuthTwitter(); foreach (TwitterAccount childnoe in alst) { oauth.AccessToken = childnoe.OAuthToken; oauth.AccessTokenSecret = childnoe.OAuthSecret; oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"]; oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"]; oauth.TwitterUserId = childnoe.TwitterUserId; oauth.TwitterScreenName = childnoe.TwitterScreenName; break; } Users userinfo = new Users(); //JArray foll = userinfo.Get_Followers_ById(oauth, userid); JArray userlookup = userinfo.Get_Users_LookUp(oauth, userid); string jstring = string.Empty; foreach (var item in userlookup) { jstring += "<div class=\"modal-small draggable\">"; jstring += "<div class=\"modal-content\">"; jstring += "<button class=\"modal-btn button b-close\" type=\"button\">"; jstring += "<span class=\"icon close-medium\"><span class=\"visuallyhidden\">X</span></span></button>"; jstring += "<div class=\"modal-header\"><h3 class=\"modal-title\">Profile summary</h3></div>"; jstring += "<div class=\"modal-body profile-modal\">"; jstring += "<div class=\"module profile-card component profile-header\">"; jstring += "<div class=\"profile-header-inner flex-module clearfix\" style=\"background-image: url('" + item["profile_banner_url"] + "');\">"; jstring += "<div class=\"profile-header-inner-overlay\"></div>"; jstring += "<a class=\"profile-picture media-thumbnail js-nav\" href=\"#\"><img class=\"avatar size73\" alt=\"" + item["name"] + "\" src=\"" + item["profile_image_url"] + "\" /></a>"; jstring += "<div class=\"profile-card-inner\">"; jstring += "<h1 class=\"fullname editable-group\">"; jstring += "<a href=\"#\" class=\"js-nav\">" + item["name"] + "</a>"; jstring += "<a class=\"verified-link js-tooltip\" href=\"#\"><span class=\"icon verified verified-large-border\"><span class=\"visuallyhidden\"></span> </span></a>"; jstring += "</h1>"; jstring += "<h2 class=\"username\"><a href=\"#\" class=\"pretty-link js-nav\"><span class=\"screen-name\"><s>@</s>" + item["screen_name"] + "</span> </a></h2>"; jstring += "<div class=\"bio-container editable-group\"><p class=\"bio profile-field\">"; try { jstring += item["status"]["text"]; } catch (Exception ex) { logger.Error(ex.Message); } jstring += "</p></div>"; jstring += "<p class=\"location-and-url\">"; jstring += "<span class=\"location-container editable-group\"><span class=\"location profile-field\"></span></span>"; jstring += "<span class=\"divider hidden\"></span> "; jstring += "<span class=\"url editable-group\"> <span class=\"profile-field\"><a title=\"#\" href=\"" + item["url"] + "\" rel=\"me nofollow\" target=\"_blank\">" + item["url"] + " </a>"; jstring += "<div style=\"cursor: pointer; width: 16px; height: 16px; display: inline-block;\"> </div>"; jstring += "</span></span></p></div></div>"; jstring += "<div class=\"clearfix\">"; jstring += "<div class=\"default-footer\">"; jstring += "<ul class=\"stats js-mini-profile-stats\">" + //"<li><a href=\"#\" class=\"js-nav\"><strong> 6,274</strong> Tweets </a></li>" + "<li><a href=\"#\" class=\"js-nav\"><strong>" + item["friends_count"] + "</strong> Following </a></li>" + "<li><a href=\"#\" class=\"js-nav\"><strong>" + item["followers_count"] + "</strong> Followers </a></li>"; jstring += "</ul>"; jstring += "<div class=\"btn-group\">" + "<div class=\"follow_button\">"; //"<span class=\"button-text follow-text\">Follow</span> " + //foreach (var child in foll) //{ // foreach (var childItem in child["ids"]) // { // string pl = childItem.ToString(); // } //} //jstring += "<span class=\"button-text follow-text\">Following</span>"; //jstring += "<span class=\"button-text unfollow-text\">Unfollow</span>"; jstring += "</div>" + "</div>"; jstring += "</div></div>"; jstring += "<div class=\"profile-social-proof\"><div class=\"follow-bar\"></div></div></div>"; jstring += "<ol id=\"twitterUserTweets\" class=\"recent-tweets\">" + "</ol>" + "<div class=\"go_to_profile\">" + "<small><a href=\"https://twitter.com/" + item["screen_name"] + "\" target=\"_blank\" class=\"view_profile\">Go to full profile →</a></small>" + "</div>" + "</div>" + "<div class=\"loading\">" + "<span class=\"spinner-bigger\"></span>" + "</div>" + "</div>"; jstring += "</div>"; } Response.Write(jstring); } else if (Request.QueryString["op"] == "pauseRssMessage") { Guid ID = Guid.Parse(Request.QueryString["id"]); RssFeedsRepository rssRepo = new RssFeedsRepository(); rssRepo.updateFeedStatus("pause", ID); } else if (Request.QueryString["op"] == "deleteRssMessage") { Guid ID = Guid.Parse(Request.QueryString["id"]); RssFeedsRepository rssRepo = new RssFeedsRepository(); rssRepo.DeleteRssMessage(ID); } else if (Request.QueryString["op"] == "playRssMessage") { Guid ID = Guid.Parse(Request.QueryString["id"]); RssFeedsRepository rssRepo = new RssFeedsRepository(); rssRepo.updateFeedStatus("play", ID); } else if (Request.QueryString["op"] == "facebookProfileDetails") { User user = (User)Session["LoggedUser"]; string userid = Request.QueryString["profileid"]; FacebookAccountRepository fbRepo = new FacebookAccountRepository(); ArrayList alst = fbRepo.getAllFacebookAccountsOfUser(user.Id); string accesstoken = string.Empty; foreach (FacebookAccount childnoe in alst) { accesstoken = childnoe.AccessToken; break; } FacebookClient fbclient = new FacebookClient(accesstoken); string jstring = string.Empty; dynamic item = fbclient.Get(userid); jstring += "<div class=\"modal-small draggable\">"; jstring += "<div class=\"modal-content\">"; jstring += "<button class=\"modal-btn button b-close\" type=\"button\">"; jstring += "<span class=\"icon close-medium\"><span class=\"visuallyhidden\">X</span></span></button>"; jstring += "<div class=\"modal-header\"><h3 class=\"modal-title\">Profile summary</h3></div>"; jstring += "<div class=\"modal-body profile-modal\">"; jstring += "<div class=\"module profile-card component profile-header\">"; try { jstring += "<div class=\"profile-header-inner flex-module clearfix\" style=\"background-image: url('" + item["cover"]["source"] + "');\">"; } catch (Exception ex) { Console.WriteLine(ex.Message); jstring += "<div class=\"profile-header-inner flex-module clearfix\" style=\"background-image: url('https://pbs.twimg.com/profile_banners/215936249/1371721359');\">"; } jstring += "<div class=\"profile-header-inner-overlay\"></div>"; jstring += "<a class=\"profile-picture media-thumbnail js-nav\" href=\"#\"><img class=\"avatar size73\" alt=\"" + item["name"] + "\" src=\"http://graph.facebook.com/" + item["id"] + "/picture?type=small\" /></a>"; jstring += "<div class=\"profile-card-inner\">"; jstring += "<h1 class=\"fullname editable-group\">"; try { jstring += "<a href=\"#\" class=\"js-nav\">" + item["name"] + "</a>"; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } jstring += "<a class=\"verified-link js-tooltip\" href=\"#\"><span class=\"icon verified verified-large-border\"><span class=\"visuallyhidden\"></span> </span></a>"; jstring += "</h1>"; try { jstring += "<h2 class=\"username\"><a href=\"#\" class=\"pretty-link js-nav\"><span class=\"screen-name\"><s>@</s>" + item["username"] + "</span> </a></h2>"; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } jstring += "<div class=\"bio-container editable-group\"><p class=\"bio profile-field\">"; try { jstring += item["about"]; } catch (Exception ex) { logger.Error(ex.Message); } jstring += "</p></div>"; jstring += "<p class=\"location-and-url\">"; jstring += "<span class=\"location-container editable-group\"><span class=\"location profile-field\"></span></span>"; jstring += "<span class=\"divider hidden\"></span> "; jstring += "<span class=\"url editable-group\"> <span class=\"profile-field\"><a title=\"#\" href=\"http://facebook.com/" + item["id"] + "\" rel=\"me nofollow\" target=\"_blank\">" + item["link"] + " </a>"; jstring += "<div style=\"cursor: pointer; width: 16px; height: 16px; display: inline-block;\"> </div>"; jstring += "</span></span></p></div></div>"; jstring += "<div class=\"clearfix\">"; jstring += "<div class=\"default-footer\">"; jstring += "<div class=\"btn-group\">" + "<div class=\"follow_button\">" + //"<span class=\"button-text following-text\">Following</span>" + //"<span class=\"button-text unfollow-text\">Unfollow</span>" + "</div>" + "</div>"; jstring += "</div></div>"; jstring += "<div class=\"profile-social-proof\"><div class=\"follow-bar\"></div></div></div>"; jstring += "<ol class=\"recent-tweets\">" + "<li class=\"\">" + "<div>" + "<i class=\"dogear\"></i>" + "</div>" + "</li>" + "</ol>" + "<div class=\"go_to_profile\">" + "<small><a href=\"http://facebook.com/" + item["id"] + "\" target=\"_blank\" class=\"view_profile\">Go to full profile →</a></small>" + "</div>" + "</div>" + "<div class=\"loading\">" + "<span class=\"spinner-bigger\"></span>" + "</div>" + "</div>"; jstring += "</div>"; Response.Write(jstring); } } }
public void getUserRetweet(oAuthTwitter OAuth, string TwitterUserId, Guid userId) { try { TimeLine _TimeLine = new TimeLine(); JArray jdata = _TimeLine.Get_Statuses_Retweet_Of_Me(OAuth); Domain.Socioboard.Domain.InboxMessages _InboxMessages; foreach (var item in jdata) { try { _InboxMessages = new Domain.Socioboard.Domain.InboxMessages(); _InboxMessages.UserId = userId; _InboxMessages.ProfileId = TwitterUserId; _InboxMessages.ProfileType = "twt"; _InboxMessages.MessageType = "twt_retweet"; _InboxMessages.EntryTime = DateTime.Now; try { _InboxMessages.MessageId = item["id_str"].ToString(); } catch (Exception ex) { _InboxMessages.MessageId = item["id"].ToString(); } try { _InboxMessages.Message = item["text"].ToString(); } catch (Exception ex) { logger.Error("Twitter.asmx => getUserRetweets => " + ex.Message); } try { _InboxMessages.RecipientId = item["user"]["id_str"].ToString(); } catch (Exception ex) { logger.Error("Twitter.asmx => getUserRetweets => " + ex.Message); } try { _InboxMessages.RecipientName = item["user"]["screen_name"].ToString(); } catch (Exception ex) { logger.Error("Twitter.asmx => getUserRetweets => " + ex.Message); } try { _InboxMessages.RecipientImageUrl = item["user"]["profile_image_url"].ToString(); } catch (Exception ex) { _InboxMessages.RecipientImageUrl = item["user"]["profile_image_url_https"].ToString(); } Tweet _tweet = new Tweet(); JArray retweet_data = _tweet.Get_Statuses_RetweetsById(OAuth, _InboxMessages.MessageId); foreach (var item_retweet in retweet_data) { _InboxMessages.Id = Guid.NewGuid(); try { _InboxMessages.CreatedTime = Utility.ParseTwitterTime(item_retweet["created_at"].ToString()); } catch (Exception ex) { logger.Error("Twitter.asmx => getUserRetweets => " + ex.Message); } try { _InboxMessages.FromId = item_retweet["user"]["id_str"].ToString(); } catch (Exception ex) { _InboxMessages.FromId = item_retweet["user"]["id"].ToString(); } try { _InboxMessages.FromName = item_retweet["user"]["screen_name"].ToString(); } catch (Exception ex) { logger.Error("Twitter.asmx => getUserRetweets => " + ex.Message); } try { _InboxMessages.FromImageUrl = item_retweet["user"]["profile_image_url"].ToString(); } catch (Exception ex) { _InboxMessages.FromImageUrl = item_retweet["user"]["profile_image_url_https"].ToString(); } if (!objInboxMessagesRepository.checkInboxMessageRetweetExists(userId, _InboxMessages.MessageId, _InboxMessages.FromId, _InboxMessages.RecipientId, _InboxMessages.MessageType)) { objInboxMessagesRepository.AddInboxMessages(_InboxMessages); } } } catch (Exception ex) { logger.Error("Twitter.asmx => getUserRetweets => " + ex.Message); } } } catch (Exception ex) { logger.Error("Twitter.asmx => getUserRetweets => " + ex.Message); } }
/// <summary> /// Returns the most recent tweets authored by the authenticating user that have been retweeted by others. /// </summary> /// <param name="oAuth"></param> /// <returns></returns> public JArray GetStatuses_Retweet_Of_Me(oAuthTwitter oAuth) { TimeLine objTimeLine = new TimeLine(); JArray jobjRetweet = new JArray(); jobjRetweet = objTimeLine.Get_Statuses_Retweet_Of_Me(oAuth); return jobjRetweet; }
public void getMentions(oAuthTwitter oauth,TwitterAccount twitterAccount,Guid userid) { TwitterUser twtuser = new TwitterUser(); TimeLine tl = new TimeLine(); JArray data = tl.Get_Statuses_Mentions_Timeline(oauth); TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository(); TwitterMessage twtmsg = new TwitterMessage(); foreach (var item in data) { twtmsg.UserId = userid; twtmsg.Type = "twt_mentions"; twtmsg.Id = Guid.NewGuid(); 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.TwitterMsg = item["text"].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); } try { twtmsg.FromScreenName = item["user"]["screen_name"].ToString().TrimStart('"').TrimEnd('"'); } 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.InReplyToStatusUserId = item["in_reply_to_status_id_str"].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.ProfileId = twitterAccount.TwitterUserId; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } try { twtmsg.ScreenName = item["user"]["screen_name"].ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } try { twtmsg.EntryDate = DateTime.Now; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } if (!twtmsgrepo.checkTwitterMessageExists(twtmsg.MessageId)) { twtmsgrepo.addTwitterMessage(twtmsg); } } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Returns the 20 most recent mentions (tweets containing a users's @screen_name) for the authenticating user. /// </summary> /// <param name="oAuth"></param> /// <returns></returns> public JArray GetStatuses_Mentions_Timeline(oAuthTwitter oAuth) { TimeLine objTimeLine = new TimeLine(); JArray jobjMentions = new JArray(); jobjMentions = objTimeLine.Get_Statuses_Mentions_Timeline(oAuth); return jobjMentions; }
/// <summary> /// Returns a collection of the most recent Tweets and retweets posted by the authenticating user and the users they follow. /// </summary> /// <param name="oAuth"></param> /// <returns></returns> public JArray GetStatuses_Home_Timeline(oAuthTwitter oAuth) { TimeLine objTimeLine = new TimeLine(); JArray jobjHomeTimeline = new JArray(); jobjHomeTimeline = objTimeLine.Get_Statuses_Home_Timeline(oAuth); return jobjHomeTimeline; }
/// <summary> /// This Method is Depricated. Please use the "GetStatuses_Mentions_Timeline(oAuth)" method instead. /// Get All ReTweets Sent By User /// </summary> /// <param name="OAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param> /// <param name="Count">Number Of ReTweets</param> /// <returns>Return List Of ReTweets</returns> public List<status> GetStatuses_MentionsTimeLine(oAuthTwitter OAuth, string Count) { status objStatus = new status(); Twitter.Core.TimeLineMethods.TimeLine timeline = new Twitter.Core.TimeLineMethods.TimeLine(); xmlResult = timeline.Status_Mentions(OAuth, Count); XmlNodeList xmlNodeList = xmlResult.GetElementsByTagName("status"); foreach (XmlNode xn in xmlNodeList) { XmlElement created_atElement = (XmlElement)xn; objStatus.created_at = created_atElement.GetElementsByTagName("created_at")[0].InnerText; XmlElement textElement = (XmlElement)xn; objStatus.Description = textElement.GetElementsByTagName("text")[0].InnerText; XmlElement screenNameElement = (XmlElement)xn; objStatus.userObject.ScreenName = screenNameElement.GetElementsByTagName("screen_name")[0].InnerText; XmlElement imageUrlElement = (XmlElement)xn; objStatus.userObject.ProfileImageUrl = new Uri(imageUrlElement.GetElementsByTagName("profile_image_url")[0].InnerText); XmlElement followersCountElement = (XmlElement)xn; objStatus.userObject.FollowersCount = int.Parse(followersCountElement.GetElementsByTagName("followers_count")[0].InnerText); XmlElement friendCountElement = (XmlElement)xn; objStatus.userObject.FriendsCount = int.Parse(friendCountElement.GetElementsByTagName("friends_count")[0].InnerText); XmlElement statusElement = (XmlElement)xn; objStatus.userObject.StatusesCount = int.Parse(statusElement.GetElementsByTagName("statuses_count")[0].InnerText); StatusTimeLine.Add(objStatus); } return StatusTimeLine; }
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); } }
public void getTwitterMessages(string UserId, oAuthTwitter OAuth) { int I = 0; TwitterUser twtuser; #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.MongoDomain.TwitterMessage(); foreach (var item in data) { //objTwitterMessage.UserId = Guid.Parse(UserId); objTwitterMessage.Type = "twt_mentions"; objTwitterMessage.Id = ObjectId.GenerateNewId(); 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('"')).ToString("yyyy/MM/dd HH:mm:ss"); } 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); } var ret = twitterMessageRepo.Find<Domain.Socioboard.MongoDomain.TwitterMessage>(t => t.MessageId.Equals(objTwitterMessage.MessageId)); var task = Task.Run(async () => { return await ret; }); int count = task.Result.Count; if (count < 1) { twitterMessageRepo.Add(objTwitterMessage); } //if (!objTwitterMessageRepository.checkTwitterMessageExists(objTwitterMessage.MessageId)) //{ // I++; // objTwitterMessageRepository.addTwitterMessage(objTwitterMessage); // logger.Error("getTwitterMessagesCount>>>"+I); //} } } 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 }
public void getUserMentions(oAuthTwitter OAuth, string TwitterUserId, Guid userId) { try { TimeLine _TimeLine = new TimeLine(); JArray jdata = _TimeLine.Get_Statuses_Mentions_Timeline(OAuth); Domain.Myfashion.Domain.InboxMessages _InboxMessages; foreach (var item in jdata) { try { _InboxMessages = new Domain.Myfashion.Domain.InboxMessages(); _InboxMessages.Id = Guid.NewGuid(); _InboxMessages.UserId = userId; _InboxMessages.ProfileId = TwitterUserId; _InboxMessages.ProfileType = "twt"; _InboxMessages.MessageType = "twt_mention"; _InboxMessages.EntryTime = DateTime.Now; try { _InboxMessages.Message = item["text"].ToString(); } catch (Exception ex) { logger.Error("Twitter.asmx => getUserMentions => " + ex.Message); } try { _InboxMessages.MessageId = item["id_str"].ToString(); } catch (Exception ex) { logger.Error("Twitter.asmx => getUserMentions => " + ex.Message); } try { _InboxMessages.FromId = item["user"]["id_str"].ToString(); } catch (Exception ex) { _InboxMessages.FromId = item["user"]["id"].ToString(); } try { _InboxMessages.FromName = item["user"]["screen_name"].ToString(); } catch (Exception ex) { logger.Error("Twitter.asmx => getUserMentions => " + ex.Message); } try { _InboxMessages.FromImageUrl = item["user"]["profile_image_url"].ToString(); } catch (Exception ex) { _InboxMessages.FromImageUrl = item["user"]["profile_background_image_url_https"].ToString(); } try { _InboxMessages.CreatedTime = Utility.ParseTwitterTime(item["created_at"].ToString()); } catch (Exception ex) { logger.Error("Twitter.asmx => getUserMentions => " + ex.Message); } try { _InboxMessages.RecipientId = item["entities"]["user_mentions"][0]["id_str"].ToString(); } catch (Exception ex) { _InboxMessages.RecipientId = item["entities"]["user_mentions"][0]["id"].ToString(); } try { _InboxMessages.RecipientName = item["entities"]["user_mentions"][0]["screen_name"].ToString(); } catch (Exception ex) { logger.Error("Twitter.asmx => getUserMentions => " + ex.Message); } if (!objInboxMessagesRepository.checkInboxMessageExists(userId, _InboxMessages.MessageId, _InboxMessages.MessageType)) { objInboxMessagesRepository.AddInboxMessages(_InboxMessages); } } catch (Exception ex) { logger.Error("Twitter.asmx => getUserMentions => " + ex.Message); } } } catch (Exception ex) { logger.Error("Twitter.asmx => getUserMentions => " + ex.Message); } }
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) { } } }