// Commented By Antima //public ActionResult AjaxFeeds(string profileid) //{ // List<object> lstobject = new List<object>(); // Dictionary<string, List<object>> dictwallposts = new Dictionary<string, List<object>>(); // Api.Groups.Groups ApiobjGroups = new Api.Groups.Groups(); // Domain.Socioboard.Domain.Groups objGroups = (Domain.Socioboard.Domain.Groups)(new JavaScriptSerializer().Deserialize(ApiobjGroups.GetGroupDetailsByGroupId(Session["group"].ToString()), typeof(Domain.Socioboard.Domain.Groups))); // Api.FacebookFeed.FacebookFeed ApiobjFacebookFeed = new Api.FacebookFeed.FacebookFeed(); // List<FacebookFeed> lstFacebookFeed = (List<FacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileId(objGroups.UserId.ToString(), profileid), typeof(List<FacebookFeed>))); // foreach (var twittermsg in lstFacebookFeed) // { // lstobject.Add(twittermsg); // } // dictwallposts.Add("facebook", lstobject); // return PartialView("_Panel2Partial", dictwallposts); //} public ActionResult AjaxFeeds(string profileid, string load) { List <object> lstobject = new List <object>(); if (load == "first") { Session["FacebookProfileIdForFeeds"] = profileid; facebookfeedcount = 0; } else { profileid = (string)Session["FacebookProfileIdForFeeds"]; facebookfeedcount = facebookfeedcount + 10; } Dictionary <string, List <object> > dictwallposts = new Dictionary <string, List <object> >(); Api.Groups.Groups ApiobjGroups = new Api.Groups.Groups(); Domain.Socioboard.Domain.Groups objGroups = (Domain.Socioboard.Domain.Groups)(new JavaScriptSerializer().Deserialize(ApiobjGroups.GetGroupDetailsByGroupId(Session["group"].ToString()), typeof(Domain.Socioboard.Domain.Groups))); Api.FacebookFeed.FacebookFeed ApiobjFacebookFeed = new Api.FacebookFeed.FacebookFeed(); List <FacebookFeed> lstFacebookFeed = (List <FacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileId1(objGroups.UserId.ToString(), profileid, facebookfeedcount), typeof(List <FacebookFeed>))); foreach (var twittermsg in lstFacebookFeed) { lstobject.Add(twittermsg); } dictwallposts.Add("facebook", lstobject); return(PartialView("_Panel2Partial", dictwallposts)); }
public async Task <ActionResult> BindFacebookMessage(string load, string arrid) { string FacebooProfiles = string.Empty; Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; if (load == "first") { //Dictionary<Domain.Socioboard.Domain.TeamMemberProfile, object> allprofileofuser = await SBUtils.GetUserProfilesccordingToGroup(); Dictionary <Domain.Socioboard.Domain.GroupProfile, object> allprofileofuser = await SBHelper.GetGroupProfiles(); foreach (var item in allprofileofuser) { try { if (item.Key.ProfileType == "facebook") { FacebooProfiles += item.Key.ProfileId + ','; } } catch (Exception Err) { Console.Write(Err.StackTrace); } } try { FacebooProfiles = FacebooProfiles.Substring(0, (FacebooProfiles.Length - 1)); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } facebookMessageCount = 0; } else if (load == "filter") { facebookMessageCount = 0; FacebooProfiles = arrid; } else if (load == "scroll") { facebookMessageCount = facebookMessageCount + 10; FacebooProfiles = arrid; } //Api.InboxMessages.InboxMessages ApiInboxMessages = new Api.InboxMessages.InboxMessages(); Api.FacebookFeed.FacebookFeed ApiFacebookFeed = new Api.FacebookFeed.FacebookFeed(); List <Domain.Socioboard.Domain.MongoFacebookFeed> _FacebookFeed = (List <Domain.Socioboard.Domain.MongoFacebookFeed>) new JavaScriptSerializer().Deserialize(ApiFacebookFeed.GetFacebookFeedWithSentiments(objUser.Id.ToString(), FacebooProfiles, facebookMessageCount.ToString(), "10"), typeof(List <Domain.Socioboard.Domain.MongoFacebookFeed>)); if (_FacebookFeed.Count > 0) { return(PartialView("_FacebookWallPartial", _FacebookFeed)); } else { return(Content("no_data")); } }
// Edited by Antima[20/12/2014] public DataSet bindMyTickets(Guid UserId) { Messages mstable = new Messages(); DataSet ds = DataTableGenerator.CreateDataSetForTable(mstable); Api.SentimentalAnalysis.SentimentalAnalysis ApiobjSentimentalAnalysis = new Api.SentimentalAnalysis.SentimentalAnalysis(); List <Domain.Myfashion.Domain.FeedSentimentalAnalysis> lstNegativeFeedsOfUser = new List <Domain.Myfashion.Domain.FeedSentimentalAnalysis>(); lstNegativeFeedsOfUser = (List <Domain.Myfashion.Domain.FeedSentimentalAnalysis>)(new JavaScriptSerializer().Deserialize(ApiobjSentimentalAnalysis.getNegativeFeedsOfUser(UserId.ToString()), typeof(List <Domain.Myfashion.Domain.FeedSentimentalAnalysis>))); if (lstNegativeFeedsOfUser != null) { foreach (var item in lstNegativeFeedsOfUser) { string Network = item.Network; if (Network == "facebook") { Api.FacebookFeed.FacebookFeed ApiobjFacebookFeed = new Api.FacebookFeed.FacebookFeed(); Domain.Myfashion.Domain.FacebookFeed facebookfeed = (Domain.Myfashion.Domain.FacebookFeed)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getFacebookFeedByProfileId(item.ProfileId, item.FeedId), typeof(Domain.Myfashion.Domain.FacebookFeed))); if (facebookfeed != null) { ds.Tables[0].Rows.Add(facebookfeed.ProfileId, "facebook", facebookfeed.FromId, facebookfeed.FromName, facebookfeed.FromProfileUrl, facebookfeed.FeedDate, facebookfeed.FeedDescription, facebookfeed.FbComment, facebookfeed.FbLike, facebookfeed.FeedId, facebookfeed.Type, ""); } } if (Network == "twitter") { Api.TwitterFeed.TwitterFeed ApiobjTwitterFeed = new Api.TwitterFeed.TwitterFeed(); Domain.Myfashion.Domain.TwitterFeed twtfeed = (Domain.Myfashion.Domain.TwitterFeed)(new JavaScriptSerializer().Deserialize(ApiobjTwitterFeed.getTwitterFeedByProfileId(item.ProfileId, item.FeedId), typeof(Domain.Myfashion.Domain.TwitterFeed))); if (twtfeed != null) { ds.Tables[0].Rows.Add(twtfeed.ProfileId, item.Network, twtfeed.FromId, twtfeed.FromScreenName, twtfeed.FromProfileUrl, twtfeed.FeedDate, twtfeed.Feed, "", "", twtfeed.MessageId, twtfeed.Type, ""); } } } } return(ds); }
//[OutputCache(Duration = 45, Location = OutputCacheLocation.Client, NoStore = true)] public ActionResult SearchFacebookFeeds(string keyword) { List<Domain.Socioboard.Domain.MongoFacebookFeed> lstFacebookFeedsSearch = new List<Domain.Socioboard.Domain.MongoFacebookFeed>(); try { Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; Api.FacebookFeed.FacebookFeed ApiobjDiscoverySearch = new Api.FacebookFeed.FacebookFeed(); int noOfDataToSkip = 0; lstFacebookFeedsSearch = (List<Domain.Socioboard.Domain.MongoFacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjDiscoverySearch.getAllFacebookFeedsByUserIdWithRange(objUser.Id.ToString(), keyword, noOfDataToSkip.ToString()), typeof(List<Domain.Socioboard.Domain.MongoFacebookFeed>))); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } return PartialView("_FacebookContactPartial", lstFacebookFeedsSearch); }
public ActionResult AjaxFeeds(string profileid, string load) { string datetime = Helper.Extensions.ToClientTime(DateTime.UtcNow); //string datetime = Request.Form["localtime"].ToString(); ViewBag.datetime = datetime; List<object> lstobject = new List<object>(); if (load == "first") { Session["FacebookProfileIdForFeeds"] = profileid; facebookfeedcount = 0; } else { profileid = (string)Session["FacebookProfileIdForFeeds"]; facebookfeedcount = facebookfeedcount + 10; } Dictionary<string, List<object>> dictwallposts = new Dictionary<string, List<object>>(); Api.Groups.Groups ApiobjGroups = new Api.Groups.Groups(); Domain.Socioboard.Domain.Groups objGroups = (Domain.Socioboard.Domain.Groups)(new JavaScriptSerializer().Deserialize(ApiobjGroups.GetGroupDetailsByGroupId(Session["group"].ToString()), typeof(Domain.Socioboard.Domain.Groups))); Api.FacebookFeed.FacebookFeed ApiobjFacebookFeed = new Api.FacebookFeed.FacebookFeed(); List<MongoFacebookFeed> lstFacebookFeed = (List<MongoFacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileId1(objGroups.UserId.ToString(), profileid, facebookfeedcount), typeof(List<MongoFacebookFeed>))); foreach (var twittermsg in lstFacebookFeed) { lstobject.Add(twittermsg); } dictwallposts.Add("facebook", lstobject); if (lstFacebookFeed.Count > 0) { return PartialView("_Panel2Partial", dictwallposts); } else { return Content("no_data"); } }
//Added by Sumit Gupta[15-02-2015] //[OutputCache(Duration = 45, Location = OutputCacheLocation.Client, NoStore = true)] public ActionResult AddLoadNewFacebookNewsFeeds(string profileid) { string datetime = Helper.Extensions.ToClientTime(DateTime.UtcNow); //string datetime = Request.Form["localtime"].ToString(); ViewBag.datetime = datetime; List<object> lstobject = new List<object>(); Dictionary<string, List<object>> dictFeeds = new Dictionary<string, List<object>>(); Api.Groups.Groups ApiobjGroups = new Api.Groups.Groups(); Dictionary<string, List<object>> dictwallposts = new Dictionary<string, List<object>>(); Domain.Socioboard.Domain.Groups objGroups = (Domain.Socioboard.Domain.Groups)(new JavaScriptSerializer().Deserialize(ApiobjGroups.GetGroupDetailsByGroupId(Session["group"].ToString()), typeof(Domain.Socioboard.Domain.Groups))); Api.FacebookFeed.FacebookFeed ApiobjFacebookFeed = new Api.FacebookFeed.FacebookFeed(); Api.Facebook.Facebook ApiobjFacebook = new Api.Facebook.Facebook(); List<MongoFacebookFeed> lstFacebookFeed = new List<MongoFacebookFeed>(); try { lstFacebookFeed = (List<MongoFacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebook.AddNewFacebookFeeds(profileid, objGroups.UserId.ToString()), typeof(List<MongoFacebookFeed>))); } catch (Exception ex) { lstFacebookFeed = null; } if (lstFacebookFeed == null) { lstFacebookFeed = new List<MongoFacebookFeed>(); } foreach (var FacebookFeed in lstFacebookFeed) { lstobject.Add(FacebookFeed); } dictwallposts.Add("facebook", lstobject); return PartialView("_Panel2Partial", dictwallposts); }
public async Task<ActionResult> BindFacebookMessage(string load, string arrid) { string FacebooProfiles = string.Empty; Domain.Socioboard.Domain.User objUser = (Domain.Socioboard.Domain.User)Session["User"]; if (load == "first") { //Dictionary<Domain.Socioboard.Domain.TeamMemberProfile, object> allprofileofuser = await SBUtils.GetUserProfilesccordingToGroup(); Dictionary<Domain.Socioboard.Domain.GroupProfile, object> allprofileofuser = await SBHelper.GetGroupProfiles(); foreach (var item in allprofileofuser) { try { if (item.Key.ProfileType == "facebook") { FacebooProfiles += item.Key.ProfileId + ','; } } catch (Exception Err) { Console.Write(Err.StackTrace); } } try { FacebooProfiles = FacebooProfiles.Substring(0, (FacebooProfiles.Length - 1)); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } facebookMessageCount = 0; } else if (load == "filter") { facebookMessageCount = 0; FacebooProfiles = arrid; } else if (load == "scroll") { facebookMessageCount = facebookMessageCount + 10; FacebooProfiles = arrid; } //Api.InboxMessages.InboxMessages ApiInboxMessages = new Api.InboxMessages.InboxMessages(); Api.FacebookFeed.FacebookFeed ApiFacebookFeed = new Api.FacebookFeed.FacebookFeed(); List<Domain.Socioboard.Domain.MongoFacebookFeed> _FacebookFeed = (List<Domain.Socioboard.Domain.MongoFacebookFeed>)new JavaScriptSerializer().Deserialize(ApiFacebookFeed.GetFacebookFeedWithSentiments(objUser.Id.ToString(), FacebooProfiles, facebookMessageCount.ToString(), "10"), typeof(List<Domain.Socioboard.Domain.MongoFacebookFeed>)); if (_FacebookFeed.Count > 0) { return PartialView("_FacebookWallPartial", _FacebookFeed); } else { return Content("no_data"); } }
public ActionResult DisplayCount() { string AllProfileId = string.Empty; string FbProfileId = string.Empty; string TwtProfileId = string.Empty; int fbmsgcount = 0; int twtmsgcount = 0; int allsentmsgcount = 0; User objUser = (User)Session["User"]; Dictionary<Domain.Socioboard.Domain.TeamMemberProfile, object> allprofileofuser = SBUtils.GetUserProfilesccordingToGroup(); foreach (var item in allprofileofuser) { try { //Domain.Socioboard.Domain.TeamMemberProfile item = (Domain.Socioboard.Domain.TeamMemberProfile)(profile.Value); if (item.Key.ProfileType == "facebook" || item.Key.ProfileType == "facebook_page") { FbProfileId += item.Key.ProfileId + ','; } else if (item.Key.ProfileType == "twitter") { TwtProfileId += item.Key.ProfileId + ','; } AllProfileId += item.Key.ProfileId + ','; } catch (Exception Err) { Console.Write(Err.StackTrace); } } try { FbProfileId = FbProfileId.Substring(0, FbProfileId.Length - 1); } catch (Exception Err) { Console.Write(Err.StackTrace); } try { TwtProfileId = TwtProfileId.Substring(0, TwtProfileId.Length - 1); } catch (Exception Err) { Console.Write(Err.StackTrace); } try { AllProfileId = AllProfileId.Substring(0, AllProfileId.Length - 1); } catch (Exception Err) { Console.Write(Err.StackTrace); } try { Api.FacebookFeed.FacebookFeed objFacebookFeed = new Api.FacebookFeed.FacebookFeed(); objFacebookFeed.Timeout = 300000; //fbmsgcount = ((List<FacebookFeed>)(new JavaScriptSerializer().Deserialize(objFacebookFeed.getAllFeedDetail1(FbProfileId, objUser.Id.ToString()), typeof(List<FacebookFeed>)))).Count; fbmsgcount = objFacebookFeed.GetFeedCountByProfileIdAndUserId(objUser.Id.ToString(), FbProfileId); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } try { Api.TwitterMessage.TwitterMessage objTwitterMessage = new Api.TwitterMessage.TwitterMessage(); objTwitterMessage.Timeout = 300000; //twtmsgcount = ((List<TwitterMessage>)(new JavaScriptSerializer().Deserialize(objTwitterMessage.getAlltwtMessages1(TwtProfileId, objUser.Id.ToString()), typeof(List<TwitterMessage>)))).Count; twtmsgcount = objTwitterMessage.GetFeedCountByProfileIdAndUserId(objUser.Id.ToString(), FbProfileId); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } try { Api.ScheduledMessage.ScheduledMessage objScheduledMessage = new Api.ScheduledMessage.ScheduledMessage(); objScheduledMessage.Timeout = 300000; //allsentmsgcount = ((List<ScheduledMessage>)(new JavaScriptSerializer().Deserialize(objScheduledMessage.getAllSentMessageDetails(AllProfileId, objUser.Id.ToString()), typeof(List<ScheduledMessage>)))).Count; allsentmsgcount = objScheduledMessage.GetSentMessageCountByProfileIdAndUserId(objUser.Id.ToString(), FbProfileId); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } string _totalIncomingMessage = "0"; string _totalSentMessage = "0"; string _totalTwitterFollowers = "0"; string _totalFacebookFan = "0"; try { _totalIncomingMessage = (fbmsgcount + twtmsgcount).ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } try { _totalSentMessage = allsentmsgcount.ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } try { _totalTwitterFollowers = SBUtils.GetAllTwitterFollowersCountofUser(TwtProfileId, objUser.Id.ToString()); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } try { _totalFacebookFan = SBUtils.GetAllFacebookFancountofUser(FbProfileId, objUser.Id.ToString()); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } ViewBag._totalIncomingMessage = _totalIncomingMessage; ViewBag._totalSentMessage = _totalSentMessage; ViewBag._totalTwitterFollowers = _totalTwitterFollowers; ViewBag._totalFacebookFan = _totalFacebookFan; return PartialView("_HomeUserActivityPartial"); }
// Edited by Antima[20/12/2014] public DataSet bindMyTickets(Guid UserId) { Messages mstable = new Messages(); DataSet ds = DataTableGenerator.CreateDataSetForTable(mstable); Api.SentimentalAnalysis.SentimentalAnalysis ApiobjSentimentalAnalysis = new Api.SentimentalAnalysis.SentimentalAnalysis(); List<Domain.Myfashion.Domain.FeedSentimentalAnalysis> lstNegativeFeedsOfUser = new List<Domain.Myfashion.Domain.FeedSentimentalAnalysis>(); lstNegativeFeedsOfUser = (List<Domain.Myfashion.Domain.FeedSentimentalAnalysis>)(new JavaScriptSerializer().Deserialize(ApiobjSentimentalAnalysis.getNegativeFeedsOfUser(UserId.ToString()), typeof(List<Domain.Myfashion.Domain.FeedSentimentalAnalysis>))); if (lstNegativeFeedsOfUser != null) { foreach (var item in lstNegativeFeedsOfUser) { string Network = item.Network; if (Network == "facebook") { Api.FacebookFeed.FacebookFeed ApiobjFacebookFeed = new Api.FacebookFeed.FacebookFeed(); Domain.Myfashion.Domain.FacebookFeed facebookfeed = (Domain.Myfashion.Domain.FacebookFeed)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getFacebookFeedByProfileId(item.ProfileId, item.FeedId), typeof(Domain.Myfashion.Domain.FacebookFeed))); if (facebookfeed != null) { ds.Tables[0].Rows.Add(facebookfeed.ProfileId, "facebook", facebookfeed.FromId, facebookfeed.FromName, facebookfeed.FromProfileUrl, facebookfeed.FeedDate, facebookfeed.FeedDescription, facebookfeed.FbComment, facebookfeed.FbLike, facebookfeed.FeedId, facebookfeed.Type, ""); } } if (Network == "twitter") { Api.TwitterFeed.TwitterFeed ApiobjTwitterFeed = new Api.TwitterFeed.TwitterFeed(); Domain.Myfashion.Domain.TwitterFeed twtfeed = (Domain.Myfashion.Domain.TwitterFeed)(new JavaScriptSerializer().Deserialize(ApiobjTwitterFeed.getTwitterFeedByProfileId(item.ProfileId, item.FeedId), typeof(Domain.Myfashion.Domain.TwitterFeed))); if (twtfeed != null) { ds.Tables[0].Rows.Add(twtfeed.ProfileId, item.Network, twtfeed.FromId, twtfeed.FromScreenName, twtfeed.FromProfileUrl, twtfeed.FeedDate, twtfeed.Feed, "", "", twtfeed.MessageId, twtfeed.Type, ""); } } } } return ds; }
public DataSet bindMessagesIntoDataTable(Guid id) { //SocialProfilesRepository socioprofrepo = new SocialProfilesRepository(); //List<SocialProfile> alstprofiles = socioprofrepo.getAllSocialProfilesOfUser(user.Id); //TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository(); //List<TeamMemberProfile> alstprofiles = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(id); Api.TeamMemberProfile.TeamMemberProfile objTeamMemberProfileRepository = new Api.TeamMemberProfile.TeamMemberProfile(); List <TeamMemberProfile> alstprofiles = (List <Domain.Socioboard.Domain.TeamMemberProfile>) new JavaScriptSerializer().Deserialize(objTeamMemberProfileRepository.GetTeamMemberProfilesByTeamId(id.ToString()), typeof(List <Domain.Socioboard.Domain.TeamMemberProfile>)); Api.FacebookFeed.FacebookFeed objApiFacebookFeed = new Api.FacebookFeed.FacebookFeed(); Api.TwitterMessage.TwitterMessage objApiTwitterMessage = new Api.TwitterMessage.TwitterMessage(); // DataTableGenerator datatablegenerepo = new DataTableGenerator(); Messages mstable = new Messages(); DataSet ds = DataTableGenerator.CreateDataSetForTable(mstable); // DataSet ds = datatablegenerepo.CreateDataSetForTable(mstable); foreach (TeamMemberProfile item in alstprofiles) { if (item.ProfileType == "facebook") { ////FacebookFeedRepository fbfeedRepo = new FacebookFeedRepository(); //Api.FacebookFeed.FacebookFeed objApiFacebookFeed = new Api.FacebookFeed.FacebookFeed(); //List<FacebookFeed> alstfeedfb = fbfeedRepo.getUnreadMessages(item.ProfileId); List <Domain.Socioboard.Domain.FacebookFeed> alstfeedfb = (List <Domain.Socioboard.Domain.FacebookFeed>) new JavaScriptSerializer().Deserialize(objApiFacebookFeed.getUnreadMessages(item.ProfileId), typeof(List <Domain.Socioboard.Domain.FacebookFeed>));; foreach (FacebookFeed facebookmsg in alstfeedfb) { ds.Tables[0].Rows.Add(facebookmsg.ProfileId, "facebook", facebookmsg.FromId, facebookmsg.FromName, facebookmsg.FromProfileUrl, facebookmsg.FeedDate, facebookmsg.FeedDescription, facebookmsg.FbComment, facebookmsg.FbLike, facebookmsg.FeedId, facebookmsg.Type, facebookmsg.ReadStatus); } } else if (item.ProfileType == "twitter") { ////TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository(); //Api.TwitterMessage.TwitterMessage objApiTwitterMessage = new Api.TwitterMessage.TwitterMessage(); List <Domain.Socioboard.Domain.TwitterMessage> lstmsgtwtuser = (List <TwitterMessage>) new JavaScriptSerializer().Deserialize(objApiTwitterMessage.getUnreadMessages(item.ProfileId), typeof(List <Domain.Socioboard.Domain.TwitterMessage>)); foreach (TwitterMessage lst in lstmsgtwtuser) { ds.Tables[0].Rows.Add(lst.ProfileId, "twitter", lst.FromId, lst.FromScreenName, lst.FromProfileUrl, lst.MessageDate, lst.TwitterMsg, "", "", lst.MessageId, lst.Type, lst.ReadStatus); } } else if (item.ProfileType == "googleplus") { } } foreach (TeamMemberProfile item in alstprofiles) { if (item.ProfileType == "facebook") { try { //FacebookFeedRepository fbfeedrepo = new FacebookFeedRepository(); //List<FacebookFeed> alstfbmsgs = fbfeedrepo.getAllReadFacebookFeeds(user.Id, item.ProfileId); //foreach (FacebookFeed facebookmsg in alstfbmsgs) //{ // ds.Tables[0].Rows.Add(facebookmsg.ProfileId, "facebook", facebookmsg.FromId, facebookmsg.FromName, facebookmsg.FromProfileUrl, facebookmsg.FeedDate, facebookmsg.FeedDescription, facebookmsg.FbComment, facebookmsg.FbLike, facebookmsg.FeedId, facebookmsg.Type,facebookmsg.ReadStatus); //} facebookid += item.ProfileId + ","; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (item.ProfileType == "twitter") { try { //TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository(); //List<TwitterMessage> lstmsgtwtuser = twtmsgrepo.getAllReadMessagesOfUser(user.Id, item.ProfileId); //foreach (TwitterMessage lst in lstmsgtwtuser) //{ // ds.Tables[0].Rows.Add(lst.ProfileId, "twitter", lst.FromId, lst.FromScreenName, lst.FromProfileUrl, lst.MessageDate, lst.TwitterMsg, "", "", lst.MessageId, lst.Type,lst.ReadStatus); //} twitterid += item.ProfileId + ","; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (item.ProfileType == "googleplus") { try { //GooglePlusActivitiesRepository objActRepo = new GooglePlusActivitiesRepository(); //List<GooglePlusActivities> lstmsggauser = objActRepo.getAllgoogleplusActivityOfUser(user.Id, item.ProfileId); //foreach (GooglePlusActivities lst in lstmsggauser) //{ // ds.Tables[0].Rows.Add(lst.GpUserId, "googleplus", lst.FromId, lst.FromUserName, lst.FromProfileImage, lst.PublishedDate, lst.Content, "", "", lst.ActivityId, "activities"); //} googleplusid += item.ProfileId + ","; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } if (facebookid != "") { facebookid = facebookid.Substring(0, facebookid.Length - 1); } if (twitterid != "") { twitterid = twitterid.Substring(0, twitterid.Length - 1); } if (googleplusid != "") { googleplusid = googleplusid.Substring(0, googleplusid.Length - 1); } //FacebookFeedRepository fbfeedRepository = new FacebookFeedRepository(); //List<FacebookFeed> alstfbmsgs = fbfeedRepository.getAllReadFbFeeds(facebookid); List <FacebookFeed> alstfbmsgs = (List <FacebookFeed>) new JavaScriptSerializer().Deserialize(objApiFacebookFeed.getAllReadFbFeeds(facebookid), typeof(List <FacebookFeed>)); try { foreach (FacebookFeed facebookmsg in alstfbmsgs) { try { ds.Tables[0].Rows.Add(facebookmsg.ProfileId, "facebook", facebookmsg.FromId, facebookmsg.FromName, facebookmsg.FromProfileUrl, facebookmsg.FeedDate, facebookmsg.FeedDescription, facebookmsg.FbComment, facebookmsg.FbLike, facebookmsg.FeedId, facebookmsg.Type, facebookmsg.ReadStatus); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } //TwitterMessageRepository twtmsgRepository = new TwitterMessageRepository(); //List<TwitterMessage> lstmsgtwt = twtmsgRepository.getAlltwtMessagesOfUser(twitterid); List <TwitterMessage> lstmsgtwt = (List <TwitterMessage>) new JavaScriptSerializer().Deserialize(objApiTwitterMessage.getAlltwtMessagesOfUser(twitterid), typeof(List <TwitterMessage>)); try { foreach (TwitterMessage lst in lstmsgtwt) { try { ds.Tables[0].Rows.Add(lst.ProfileId, "twitter", lst.FromId, lst.FromScreenName, lst.FromProfileUrl, lst.MessageDate, lst.TwitterMsg, "", "", lst.MessageId, lst.Type, lst.ReadStatus); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } #region Commented G+ code, to be used later //GooglePlusActivitiesRepository objActRepository = new GooglePlusActivitiesRepository(); //List<GooglePlusActivities> lstmsggpl = objActRepository.getAllgplusOfUser(googleplusid); //try //{ // foreach (GooglePlusActivities lst in lstmsggpl) // { // try // { // ds.Tables[0].Rows.Add(lst.GpUserId, "googleplus", lst.FromId, lst.FromUserName, lst.FromProfileImage, lst.PublishedDate, lst.Content, "", "", lst.ActivityId, "activities"); // } // catch (Exception ex) // { // Console.WriteLine(ex.StackTrace); // } // } //} //catch (Exception ex) //{ // Console.WriteLine(ex.StackTrace); //} #endregion return(ds); }
public ActionResult AjaxFeeds_FeedsSearch_Twitter(string profileid, string load, string keyword) { List<object> lstobject = new List<object>(); if (load == "first") { Session["FacebookProfileIdForFeeds"] = profileid; facebookfeedcount = 0; } else { profileid = (string)Session["FacebookProfileIdForFeeds"]; facebookfeedcount = facebookfeedcount + 10; } Dictionary<string, List<object>> dictwallposts = new Dictionary<string, List<object>>(); Api.Groups.Groups ApiobjGroups = new Api.Groups.Groups(); Domain.Socioboard.Domain.Groups objGroups = (Domain.Socioboard.Domain.Groups)(new JavaScriptSerializer().Deserialize(ApiobjGroups.GetGroupDetailsByGroupId(Session["group"].ToString()), typeof(Domain.Socioboard.Domain.Groups))); Api.FacebookFeed.FacebookFeed ApiobjFacebookFeed = new Api.FacebookFeed.FacebookFeed(); List<FacebookFeed> lstFacebookFeed = new List<FacebookFeed>(); lstFacebookFeed = (List<FacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileId1WithRange(objGroups.UserId.ToString(), keyword, profileid, facebookfeedcount.ToString()), typeof(List<FacebookFeed>))); if (lstFacebookFeed == null) { lstFacebookFeed = new List<FacebookFeed>(); } foreach (var twittermsg in lstFacebookFeed) { lstobject.Add(twittermsg); } dictwallposts.Add("facebook", lstobject); return PartialView("_Panel2Partial", dictwallposts); }
//Added by Sumit Gupta[15-02-2015] public ActionResult AddLoadNewFacebookNewsFeeds(string profileid) { List<object> lstobject = new List<object>(); Dictionary<string, List<object>> dictFeeds = new Dictionary<string, List<object>>(); Api.Groups.Groups ApiobjGroups = new Api.Groups.Groups(); Dictionary<string, List<object>> dictwallposts = new Dictionary<string, List<object>>(); Domain.Socioboard.Domain.Groups objGroups = (Domain.Socioboard.Domain.Groups)(new JavaScriptSerializer().Deserialize(ApiobjGroups.GetGroupDetailsByGroupId(Session["group"].ToString()), typeof(Domain.Socioboard.Domain.Groups))); Api.FacebookFeed.FacebookFeed ApiobjFacebookFeed = new Api.FacebookFeed.FacebookFeed(); Api.Facebook.Facebook ApiobjFacebook = new Api.Facebook.Facebook(); List<FacebookFeed> lstFacebookFeed = new List<FacebookFeed>(); lstFacebookFeed = (List<FacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebook.AddNewFacebookFeeds(profileid, objGroups.UserId.ToString()), typeof(List<FacebookFeed>))); if (lstFacebookFeed == null) { lstFacebookFeed = new List<FacebookFeed>(); } foreach (var FacebookFeed in lstFacebookFeed) { lstobject.Add(FacebookFeed); } dictwallposts.Add("facebook", lstobject); return PartialView("_Panel2Partial", dictwallposts); }
public static Dictionary <Domain.Socioboard.Domain.GroupProfile, Dictionary <object, List <object> > > GetUserProfilesSnapsAccordingToGroup(List <Domain.Socioboard.Domain.GroupProfile> groupProfile, User objUser, int CountProfileSnapshot = 0) { // User objUser = (User)System.Web.HttpContext.Current.Session["User"]; Dictionary <Domain.Socioboard.Domain.GroupProfile, Dictionary <object, List <object> > > dic_profilessnap = new Dictionary <Domain.Socioboard.Domain.GroupProfile, Dictionary <object, List <object> > >(); var dicprofilefeeds = new Dictionary <object, List <object> >(); List <GroupProfile> lstprofile = groupProfile.Where(t => t.ProfileType != "linkedin").ToList(); int tempCount = 0; foreach (Domain.Socioboard.Domain.GroupProfile item in lstprofile) { tempCount++; if (tempCount <= CountProfileSnapshot) { continue; } //to load only 3 profiles on home page load to speed up page loading if (dic_profilessnap.Count >= 3) { break; } List <object> feeds = null; if (item.ProfileType == "facebook" || item.ProfileType == "facebook_page") { try { feeds = new List <object>(); Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); ApiobjFacebookAccount.Timeout = 300000; FacebookAccount objFacebookAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getFacebookAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(FacebookAccount))); Api.FacebookFeed.FacebookFeed ApiobjFacebookFeed = new Api.FacebookFeed.FacebookFeed(); ApiobjFacebookFeed.Timeout = 300000; //List<FacebookFeed> lstFacebookFeed = (List<FacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<FacebookFeed>))); List <MongoFacebookFeed> lstFacebookFeed = (List <MongoFacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileIdUsingLimit(objUser.Id.ToString(), item.ProfileId.ToString(), "0", "10"), typeof(List <MongoFacebookFeed>))); foreach (var facebookfeed in lstFacebookFeed) { feeds.Add(facebookfeed); } dicprofilefeeds.Add(objFacebookAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } catch (Exception ex) { Console.WriteLine(ex.Message); } } if (item.ProfileType == "twitter") { try { feeds = new List <object>(); Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount(); TwitterAccount objTwitterAccount = (TwitterAccount)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetTwitterAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(TwitterAccount))); Api.TwitterFeed.TwitterFeed ApiobjTwitterFeed = new Api.TwitterFeed.TwitterFeed(); ApiobjTwitterFeed.Timeout = 300000; //List<TwitterFeed> lstTwitterFeed = (List<TwitterFeed>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterFeed.GetAllTwitterFeedsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<TwitterFeed>))); List <Domain.Socioboard.MongoDomain.TwitterFeed> lstTwitterFeed = (List <Domain.Socioboard.MongoDomain.TwitterFeed>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterFeed.getAllFeedsByUserIdAndProfileIdUsingLimit(objUser.Id.ToString(), item.ProfileId.ToString(), "0", "10"), typeof(List <Domain.Socioboard.MongoDomain.TwitterFeed>))); foreach (var twitterfeed in lstTwitterFeed) { feeds.Add(twitterfeed); } dicprofilefeeds.Add(objTwitterAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } catch (Exception ex) { Console.WriteLine(ex.Message); } } if (item.ProfileType == "linkedin") { try { feeds = new List <object>(); Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount(); ApiobjLinkedinAccount.Timeout = 300000; LinkedInAccount objLinkedInAccount = (LinkedInAccount)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetLinkedinAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(LinkedInAccount))); Api.LinkedInFeed.LinkedInFeed ApiobjLinkedInFeed = new Api.LinkedInFeed.LinkedInFeed(); ApiobjLinkedInFeed.Timeout = 300000; //List<LinkedInFeed> lstLinkedInFeed = (List<LinkedInFeed>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedInFeed.GetLinkedInFeeds(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<LinkedInFeed>))); List <LinkedInFeed> lstLinkedInFeed = (List <LinkedInFeed>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedInFeed.GetLinkedInFeedsByUserIdAndProfileIdUsingLimit(objUser.Id.ToString(), item.ProfileId.ToString(), "0", "10"), typeof(List <LinkedInFeed>))); foreach (var LinkedInFeed in lstLinkedInFeed) { feeds.Add(LinkedInFeed); } dicprofilefeeds.Add(objLinkedInAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } catch (Exception ex) { Console.WriteLine(ex.Message); } } if (item.ProfileType == "instagram") { try { feeds = new List <object>(); Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount(); ApiobjInstagramAccount.Timeout = 300000; InstagramAccount objInstagramAccount = (InstagramAccount)(new JavaScriptSerializer().Deserialize(ApiobjInstagramAccount.UserInformation(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(InstagramAccount))); dicprofilefeeds.Add(objInstagramAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } catch (Exception ex) { Console.WriteLine(ex.Message); } } if (item.ProfileType == "tumblr") { try { feeds = new List <object>(); Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount(); ApiobjTumblrAccount.Timeout = 300000; TumblrAccount objTumblrAccount = (TumblrAccount)(new JavaScriptSerializer().Deserialize(ApiobjTumblrAccount.GetTumblrAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(TumblrAccount))); dicprofilefeeds.Add(objTumblrAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } catch (Exception ex) { Console.WriteLine(ex.Message); } } if (item.ProfileType == "youtube") { try { feeds = new List <object>(); Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount(); ApiobjYoutubeAccount.Timeout = 300000; YoutubeAccount objYoutubeAccount = (YoutubeAccount)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeAccount.GetYoutubeAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(YoutubeAccount))); Api.YoutubeChannel.YoutubeChannel ApiobjYoutubeChannel = new Api.YoutubeChannel.YoutubeChannel(); ApiobjYoutubeChannel.Timeout = 300000; List <YoutubeChannel> lstYoutubeChannel = (List <YoutubeChannel>)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeChannel.GetAllYoutubeChannelByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List <YoutubeChannel>))); //List<YoutubeChannel> lstYoutubeChannel = new List<YoutubeChannel>(); //lstYoutubeChannel.Add(objYoutubeChannel); foreach (var youtubechannel in lstYoutubeChannel) { feeds.Add(youtubechannel); } dicprofilefeeds.Add(objYoutubeAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } catch (Exception ex) { Console.WriteLine(ex.Message); } } if (item.ProfileType == "linkedincompanypage") { try { feeds = new List <object>(); Api.LinkedinCompanyPage.LinkedinCompanyPage ApiobjLinkedinCompanyPage = new Api.LinkedinCompanyPage.LinkedinCompanyPage(); ApiobjLinkedinCompanyPage.Timeout = 300000; LinkedinCompanyPage objLinkedinCompanypage = (LinkedinCompanyPage)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinCompanyPage.GetLinkedinCompanyPageDetailsByUserIdAndPageId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(LinkedinCompanyPage))); Api.LinkedinCompanyPage.LinkedinCompanyPage ApiobjLinkedinCompanyPagePost = new Api.LinkedinCompanyPage.LinkedinCompanyPage(); ApiobjLinkedinCompanyPage.Timeout = 300000; List <LinkedinCompanyPagePosts> lstlipagepost = (List <LinkedinCompanyPagePosts>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinCompanyPagePost.GetAllLinkedinCompanyPagePostsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List <LinkedinCompanyPagePosts>))); foreach (var lipagepost in lstlipagepost) { feeds.Add(lipagepost); } dicprofilefeeds.Add(objLinkedinCompanypage, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } catch (Exception ex) { Console.WriteLine(ex.Message); } } if (item.ProfileType == "gplus") { try { feeds = new List <object>(); Api.GooglePlusAccount.GooglePlusAccount ApiobjGooglePlusAccount = new Api.GooglePlusAccount.GooglePlusAccount(); ApiobjGooglePlusAccount.Timeout = 300000; Domain.Socioboard.Domain.GooglePlusAccount _GooglePlusAccount = (GooglePlusAccount) new JavaScriptSerializer().Deserialize(ApiobjGooglePlusAccount.GetGooglePlusAccountDetailsById(objUser.Id.ToString(), item.ProfileId), typeof(GooglePlusAccount)); dicprofilefeeds.Add(_GooglePlusAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } catch (Exception ex) { Console.WriteLine(ex.Message); } } if (item.ProfileType == "googleanalytics") { try { feeds = new List <object>(); Api.GoogleAnalyticsAccount.GoogleAnalyticsAccount ApiobjGoogleAnalyticsAccount = new Api.GoogleAnalyticsAccount.GoogleAnalyticsAccount(); ApiobjGoogleAnalyticsAccount.Timeout = 300000; Domain.Socioboard.Domain.GoogleAnalyticsAccount _GoogleAnalyticsAccount = (GoogleAnalyticsAccount) new JavaScriptSerializer().Deserialize(ApiobjGoogleAnalyticsAccount.GetGooglePlusAccountDetailsById(objUser.Id.ToString(), item.ProfileId), typeof(GoogleAnalyticsAccount)); dicprofilefeeds.Add(_GoogleAnalyticsAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } catch (Exception ex) { Console.WriteLine(ex.Message); } } } return(dic_profilessnap); }
public void getFacebookUserProfile(dynamic data, string accesstoken, long friends, Guid user) { SocialProfile socioprofile = new SocialProfile(); //SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository(); Api.SocialProfile.SocialProfile ApiObjSocialProfile = new Api.SocialProfile.SocialProfile(); FacebookAccount fbAccount = new FacebookAccount(); //FacebookAccountRepository fbrepo = new FacebookAccountRepository(); Api.FacebookFeed.FacebookFeed ApiObjFacebookFeed = new Api.FacebookFeed.FacebookFeed(); try { try { fbAccount.AccessToken = accesstoken; } catch { } try { fbAccount.EmailId = data["email"].ToString(); } catch { } try { fbAccount.FbUserId = data["id"].ToString(); } catch { } try { fbAccount.ProfileUrl = data["link"].ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } try { fbAccount.FbUserName = data["name"].ToString(); } catch { } try { fbAccount.Friends = Convert.ToInt32(friends); } catch { } try { fbAccount.Id = Guid.NewGuid(); } catch { } fbAccount.IsActive = 1; try { if (HttpContext.Current.Session["fbSocial"] != null) { if (HttpContext.Current.Session["fbSocial"] == "p") { //FacebookClient fbClient = new FacebookClient(accesstoken); //int fancountPage = 0; //dynamic fancount = fbClient.Get("fql", new { q = " SELECT fan_count FROM page WHERE page_id =" + fbAccount.FbUserId }); //foreach (var friend in fancount.data) //{ // fancountPage = friend.fan_count; //} //fbAccount.Friends = Convert.ToInt32(fancountPage); fbAccount.Type = "page"; } else { fbAccount.Type = "account"; } fbAccount.UserId = user; } if (HttpContext.Current.Session["UserAndGroupsForFacebook"] != null) { try { fbAccount.UserId = user; fbAccount.Type = "account"; } catch (Exception ex) { } } } catch { } #region unused //if (HttpContext.Current.Session["login"] != null) //{ // if (HttpContext.Current.Session["login"].ToString().Equals("facebook")) // { // User usr = new User(); // UserRepository userrepo = new UserRepository(); // Registration regObject = new Registration(); // usr.AccountType = "free"; // usr.CreateDate = DateTime.Now; // usr.ExpiryDate = DateTime.Now.AddMonths(1); // usr.Id = Guid.NewGuid(); // usr.UserName = data["name"].ToString(); // usr.Password = regObject.MD5Hash(data["name"].ToString()); // usr.EmailId = data["email"].ToString(); // usr.UserStatus = 1; // if (!userrepo.IsUserExist(data["email"].ToString())) // { // UserRepository.Add(usr); // } // } //} #endregion try { socioprofile.UserId = user; } catch { } try { socioprofile.ProfileType = "facebook"; } catch { } try { socioprofile.ProfileId = data["id"].ToString(); } catch { } try { socioprofile.ProfileStatus = 1; } catch { } try { socioprofile.ProfileDate = DateTime.Now; } catch { } try { socioprofile.Id = Guid.NewGuid(); } catch { } if (HttpContext.Current.Session["fbSocial"] != null) { if (HttpContext.Current.Session["fbSocial"] == "p") { HttpContext.Current.Session["fbpagedetail"] = fbAccount; } else { if (!fbrepo.checkFacebookUserExists(fbAccount.FbUserId, user)) { fbrepo.addFacebookUser(fbAccount); if (!socioprofilerepo.checkUserProfileExist(socioprofile)) { socioprofilerepo.addNewProfileForUser(socioprofile); GroupRepository objGroupRepository = new GroupRepository(); SocioBoard.Domain.Team team = (SocioBoard.Domain.Team)HttpContext.Current.Session["GroupName"]; Groups lstDetails = objGroupRepository.getGroupName(team.GroupId); if (lstDetails.GroupName == "Socioboard") { TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository(); TeamMemberProfile teammemberprofile = new TeamMemberProfile(); teammemberprofile.Id = Guid.NewGuid(); teammemberprofile.TeamId = team.Id; teammemberprofile.ProfileId = fbAccount.FbUserId; teammemberprofile.ProfileType = "facebook"; teammemberprofile.StatusUpdateDate = DateTime.Now; objTeamMemberProfileRepository.addNewTeamMember(teammemberprofile); } } else { socioprofilerepo.updateSocialProfile(socioprofile); } } else { HttpContext.Current.Session["alreadyexist"] = fbAccount; fbrepo.updateFacebookUser(fbAccount); if (!socioprofilerepo.checkUserProfileExist(socioprofile)) { socioprofilerepo.addNewProfileForUser(socioprofile); } else { socioprofilerepo.updateSocialProfile(socioprofile); } } } } if (HttpContext.Current.Session["UserAndGroupsForFacebook"] != null) { if (HttpContext.Current.Session["UserAndGroupsForFacebook"].ToString() == "facebook") { try { if (!fbrepo.checkFacebookUserExists(fbAccount.FbUserId, user)) { fbrepo.addFacebookUser(fbAccount); if (!socioprofilerepo.checkUserProfileExist(socioprofile)) { socioprofilerepo.addNewProfileForUser(socioprofile); } else { socioprofilerepo.updateSocialProfile(socioprofile); } } else { fbrepo.updateFacebookUser(fbAccount); if (!socioprofilerepo.checkUserProfileExist(socioprofile)) { socioprofilerepo.addNewProfileForUser(socioprofile); } else { socioprofilerepo.updateSocialProfile(socioprofile); } } if (HttpContext.Current.Session["GroupName"] != null) { GroupProfile groupprofile = new GroupProfile(); GroupProfileRepository groupprofilerepo = new GroupProfileRepository(); Groups group = (Groups)HttpContext.Current.Session["GroupName"]; groupprofile.Id = Guid.NewGuid(); groupprofile.GroupOwnerId = user; groupprofile.ProfileId = socioprofile.ProfileId; groupprofile.ProfileType = "facebook"; groupprofile.GroupId = group.Id; groupprofile.EntryDate = DateTime.Now; if (!groupprofilerepo.checkGroupProfileExists(user, group.Id, groupprofile.ProfileId)) { groupprofilerepo.AddGroupProfile(groupprofile); } } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } }
public DataSet bindMessagesIntoDataTable(Guid id, int noOfDataToSkip, Guid UserId) { Api.TeamMemberProfile.TeamMemberProfile objTeamMemberProfileRepository = new Api.TeamMemberProfile.TeamMemberProfile(); List <TeamMemberProfile> alstprofiles = (List <Domain.Myfashion.Domain.TeamMemberProfile>) new JavaScriptSerializer().Deserialize(objTeamMemberProfileRepository.GetTeamMemberProfilesByTeamId(id.ToString()), typeof(List <Domain.Myfashion.Domain.TeamMemberProfile>)); Api.FacebookFeed.FacebookFeed objApiFacebookFeed = new Api.FacebookFeed.FacebookFeed(); Api.TwitterMessage.TwitterMessage objApiTwitterMessage = new Api.TwitterMessage.TwitterMessage(); Messages mstable = new Messages(); DataSet ds = DataTableGenerator.CreateDataSetForTable(mstable); foreach (TeamMemberProfile item in alstprofiles) { try { if (item.ProfileType == "facebook") { //List<Domain.Myfashion.Domain.FacebookFeed> alstfeedfb = (List<Domain.Myfashion.Domain.FacebookFeed>)new JavaScriptSerializer().Deserialize(objApiFacebookFeed.getUnreadMessages(item.ProfileId), typeof(List<Domain.Myfashion.Domain.FacebookFeed>)); ; //foreach (FacebookFeed facebookmsg in alstfeedfb) //{ // ds.Tables[0].Rows.Add(facebookmsg.ProfileId, "facebook", facebookmsg.FromId, facebookmsg.FromName, facebookmsg.FromProfileUrl, facebookmsg.FeedDate, facebookmsg.FeedDescription, facebookmsg.FbComment, facebookmsg.FbLike, facebookmsg.FeedId, facebookmsg.Type, facebookmsg.ReadStatus); //} //Updated by SumitGupta [09-02-2015] //List<FacebookMessage> lstfbmsg = (List<FacebookMessage>)new JavaScriptSerializer().Deserialize(objApiFacebookMessage.getAllFacebookMessagesOfUserByProfileId(item.ProfileId), typeof(List<FacebookMessage>)); List <FacebookMessage> lstfbmsg = (List <FacebookMessage>) new JavaScriptSerializer().Deserialize(objApiFacebookMessage.getAllFacebookMessagesOfUserByProfileIdWithRange(item.ProfileId, noOfDataToSkip.ToString(), UserId.ToString()), typeof(List <FacebookMessage>)); foreach (FacebookMessage facebookmsg in lstfbmsg) { try { ds.Tables[0].Rows.Add(facebookmsg.ProfileId, "facebook", facebookmsg.FromId, facebookmsg.FromName, facebookmsg.FromProfileUrl, facebookmsg.MessageDate, facebookmsg.Message, facebookmsg.FbComment, facebookmsg.FbLike, facebookmsg.MessageId, facebookmsg.Type, 1); } catch (Exception ex) { logger.Error("Exception Message : " + ex.Message); logger.Error("Exception Message : " + ex.StackTrace); } } } else if (item.ProfileType == "twitter") { //List<Domain.Myfashion.Domain.TwitterMessage> lstmsgtwtuser = (List<TwitterMessage>)new JavaScriptSerializer().Deserialize(objApiTwitterMessage.getUnreadMessages(item.ProfileId), typeof(List<Domain.Myfashion.Domain.TwitterMessage>)); //List<Domain.Myfashion.Domain.TwitterMessage> lstmsgtwtuser = (List<TwitterMessage>)new JavaScriptSerializer().Deserialize(objApiTwitterMessage.GetTwitterMessages(item.ProfileId, UserId.ToString()), typeof(List<Domain.Myfashion.Domain.TwitterMessage>)); List <Domain.Myfashion.Domain.TwitterMessage> lstmsgtwtuser = (List <TwitterMessage>) new JavaScriptSerializer().Deserialize(objApiTwitterMessage.getAllTwitterkMessagesOfUserByProfileIdWithRange(UserId.ToString(), item.ProfileId, noOfDataToSkip.ToString()), typeof(List <Domain.Myfashion.Domain.TwitterMessage>)); foreach (TwitterMessage lst in lstmsgtwtuser) { try { ds.Tables[0].Rows.Add(lst.ProfileId, "twitter", lst.FromId, lst.FromScreenName, lst.FromProfileUrl, lst.MessageDate, lst.TwitterMsg, "", "", lst.MessageId, lst.Type, lst.ReadStatus); } catch (Exception ex) { logger.Error("Exception Message : " + ex.Message); logger.Error("Exception Message : " + ex.StackTrace); } } } else if (item.ProfileType == "googleplus") { } } catch (Exception ex) { logger.Error("Exception Message : " + ex.Message); logger.Error("Exception Message : " + ex.StackTrace); } } foreach (TeamMemberProfile item in alstprofiles) { if (item.ProfileType == "facebook") { try { facebookid += item.ProfileId + ","; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (item.ProfileType == "twitter") { try { twitterid += item.ProfileId + ","; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (item.ProfileType == "googleplus") { try { googleplusid += item.ProfileId + ","; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } if (facebookid != "") { facebookid = facebookid.Substring(0, facebookid.Length - 1); } if (twitterid != "") { twitterid = twitterid.Substring(0, twitterid.Length - 1); } if (googleplusid != "") { googleplusid = googleplusid.Substring(0, googleplusid.Length - 1); } // suraj=============================================================================== //List<FacebookFeed> alstfbmsgs = (List<FacebookFeed>)new JavaScriptSerializer().Deserialize(objApiFacebookFeed.getAllReadFbFeeds(facebookid), typeof(List<FacebookFeed>)); //try //{ // foreach (FacebookFeed facebookmsg in alstfbmsgs) // { // try // { // ds.Tables[0].Rows.Add(facebookmsg.ProfileId, "facebook", facebookmsg.FromId, facebookmsg.FromName, facebookmsg.FromProfileUrl, facebookmsg.FeedDate, facebookmsg.FeedDescription, facebookmsg.FbComment, facebookmsg.FbLike, facebookmsg.FeedId, facebookmsg.Type, facebookmsg.ReadStatus); // } // catch (Exception ex) // { // Console.WriteLine(ex.StackTrace); // } // } //} //catch (Exception ex) //{ // Console.WriteLine(ex.StackTrace); //} //=============================================================================== List <TwitterMessage> lstmsgtwt = (List <TwitterMessage>) new JavaScriptSerializer().Deserialize(objApiTwitterMessage.getAlltwtMessagesOfUser(twitterid), typeof(List <TwitterMessage>)); try { foreach (TwitterMessage lst in lstmsgtwt) { try { ds.Tables[0].Rows.Add(lst.ProfileId, "twitter", lst.FromId, lst.FromScreenName, lst.FromProfileUrl, lst.MessageDate, lst.TwitterMsg, "", "", lst.MessageId, lst.Type, lst.ReadStatus); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } #region Commented G+ code, to be used later //GooglePlusActivitiesRepository objActRepository = new GooglePlusActivitiesRepository(); //List<GooglePlusActivities> lstmsggpl = objActRepository.getAllgplusOfUser(googleplusid); //try //{ // foreach (GooglePlusActivities lst in lstmsggpl) // { // try // { // ds.Tables[0].Rows.Add(lst.GpUserId, "googleplus", lst.FromId, lst.FromUserName, lst.FromProfileImage, lst.PublishedDate, lst.Content, "", "", lst.ActivityId, "activities"); // } // catch (Exception ex) // { // Console.WriteLine(ex.StackTrace); // } // } //} //catch (Exception ex) //{ // Console.WriteLine(ex.StackTrace); //} #endregion return(ds); }
public static Dictionary<Domain.Socioboard.Domain.TeamMemberProfile, Dictionary<object, List<object>>> GetUserProfilesSnapsAccordingToGroup(List<Domain.Socioboard.Domain.TeamMemberProfile> TeamMemberProfile) { User objUser = (User)System.Web.HttpContext.Current.Session["User"]; Dictionary<Domain.Socioboard.Domain.TeamMemberProfile, Dictionary<object, List<object>>> dic_profilessnap = new Dictionary<Domain.Socioboard.Domain.TeamMemberProfile, Dictionary<object, List<object>>>(); var dicprofilefeeds = new Dictionary<object, List<object>>(); foreach (Domain.Socioboard.Domain.TeamMemberProfile item in TeamMemberProfile) { List<object> feeds = null; if (item.ProfileType == "facebook") { feeds = new List<object>(); Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); FacebookAccount objFacebookAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getFacebookAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(FacebookAccount))); Api.FacebookFeed.FacebookFeed ApiobjFacebookFeed = new Api.FacebookFeed.FacebookFeed(); List<FacebookFeed> lstFacebookFeed = (List<FacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<FacebookFeed>))); foreach (var facebookfeed in lstFacebookFeed) { feeds.Add(facebookfeed); } dicprofilefeeds.Add(objFacebookAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } if (item.ProfileType == "twitter") { feeds = new List<object>(); Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount(); TwitterAccount objTwitterAccount = (TwitterAccount)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetTwitterAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(TwitterAccount))); Api.TwitterFeed.TwitterFeed ApiobjTwitterFeed = new Api.TwitterFeed.TwitterFeed(); List<TwitterFeed> lstTwitterFeed = (List<TwitterFeed>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterFeed.GetAllTwitterFeedsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<TwitterFeed>))); foreach (var twitterfeed in lstTwitterFeed) { feeds.Add(twitterfeed); } dicprofilefeeds.Add(objTwitterAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } if (item.ProfileType == "linkedin") { feeds = new List<object>(); Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount(); LinkedInAccount objLinkedInAccount = (LinkedInAccount)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetLinkedinAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(LinkedInAccount))); Api.LinkedInFeed.LinkedInFeed ApiobjLinkedInFeed = new Api.LinkedInFeed.LinkedInFeed(); List<LinkedInFeed> lstLinkedInFeed = (List<LinkedInFeed>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedInFeed.GetLinkedInFeeds(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<LinkedInFeed>))); foreach (var LinkedInFeed in lstLinkedInFeed) { feeds.Add(LinkedInFeed); } dicprofilefeeds.Add(objLinkedInAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } if (item.ProfileType == "instagram") { feeds = new List<object>(); Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount(); InstagramAccount objInstagramAccount = (InstagramAccount)(new JavaScriptSerializer().Deserialize(ApiobjInstagramAccount.UserInformation(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(InstagramAccount))); dicprofilefeeds.Add(objInstagramAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } if (item.ProfileType == "tumblr") { feeds = new List<object>(); Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount(); TumblrAccount objTumblrAccount = (TumblrAccount)(new JavaScriptSerializer().Deserialize(ApiobjTumblrAccount.GetTumblrAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(TumblrAccount))); dicprofilefeeds.Add(objTumblrAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } if (item.ProfileType == "youtube") { feeds = new List<object>(); Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount(); YoutubeAccount objYoutubeAccount = (YoutubeAccount)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeAccount.GetYoutubeAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(YoutubeAccount))); Api.YoutubeChannel.YoutubeChannel ApiobjYoutubeChannel = new Api.YoutubeChannel.YoutubeChannel(); YoutubeChannel objYoutubeChannel = (YoutubeChannel)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeChannel.GetAllYoutubeChannelByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(YoutubeChannel))); List<YoutubeChannel> lstYoutubeChannel = new List<YoutubeChannel>(); lstYoutubeChannel.Add(objYoutubeChannel); foreach (var youtubechannel in lstYoutubeChannel) { feeds.Add(youtubechannel); } dicprofilefeeds.Add(objYoutubeAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } } return dic_profilessnap; }
public ActionResult DisplayCount() { string AllProfileId = string.Empty; string FbProfileId = string.Empty; string TwtProfileId = string.Empty; int fbmsgcount = 0; int twtmsgcount = 0; int allsentmsgcount = 0; User objUser = (User)Session["User"]; Dictionary <Domain.Socioboard.Domain.TeamMemberProfile, object> allprofileofuser = SBUtils.GetUserProfilesccordingToGroup(); foreach (var item in allprofileofuser) { try { //Domain.Socioboard.Domain.TeamMemberProfile item = (Domain.Socioboard.Domain.TeamMemberProfile)(profile.Value); if (item.Key.ProfileType == "facebook" || item.Key.ProfileType == "facebook_page") { FbProfileId += item.Key.ProfileId + ','; } else if (item.Key.ProfileType == "twitter") { TwtProfileId += item.Key.ProfileId + ','; } AllProfileId += item.Key.ProfileId + ','; } catch (Exception Err) { Console.Write(Err.StackTrace); } } try { FbProfileId = FbProfileId.Substring(0, FbProfileId.Length - 1); } catch (Exception Err) { Console.Write(Err.StackTrace); } try { TwtProfileId = TwtProfileId.Substring(0, TwtProfileId.Length - 1); } catch (Exception Err) { Console.Write(Err.StackTrace); } try { AllProfileId = AllProfileId.Substring(0, AllProfileId.Length - 1); } catch (Exception Err) { Console.Write(Err.StackTrace); } try { Api.FacebookFeed.FacebookFeed objFacebookFeed = new Api.FacebookFeed.FacebookFeed(); //fbmsgcount = ((List<FacebookFeed>)(new JavaScriptSerializer().Deserialize(objFacebookFeed.getAllFeedDetail1(FbProfileId, objUser.Id.ToString()), typeof(List<FacebookFeed>)))).Count; fbmsgcount = objFacebookFeed.GetFeedCountByProfileIdAndUserId(objUser.Id.ToString(), FbProfileId); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } try { Api.TwitterMessage.TwitterMessage objTwitterMessage = new Api.TwitterMessage.TwitterMessage(); //twtmsgcount = ((List<TwitterMessage>)(new JavaScriptSerializer().Deserialize(objTwitterMessage.getAlltwtMessages1(TwtProfileId, objUser.Id.ToString()), typeof(List<TwitterMessage>)))).Count; twtmsgcount = objTwitterMessage.GetFeedCountByProfileIdAndUserId(objUser.Id.ToString(), FbProfileId); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } try { Api.ScheduledMessage.ScheduledMessage objScheduledMessage = new Api.ScheduledMessage.ScheduledMessage(); //allsentmsgcount = ((List<ScheduledMessage>)(new JavaScriptSerializer().Deserialize(objScheduledMessage.getAllSentMessageDetails(AllProfileId, objUser.Id.ToString()), typeof(List<ScheduledMessage>)))).Count; allsentmsgcount = objScheduledMessage.GetSentMessageCountByProfileIdAndUserId(objUser.Id.ToString(), FbProfileId); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } string _totalIncomingMessage = (fbmsgcount + twtmsgcount).ToString(); string _totalSentMessage = allsentmsgcount.ToString(); string _totalTwitterFollowers = SBUtils.GetAllTwitterFollowersCountofUser(TwtProfileId, objUser.Id.ToString()); string _totalFacebookFan = SBUtils.GetAllFacebookFancountofUser(FbProfileId, objUser.Id.ToString()); ViewBag._totalIncomingMessage = _totalIncomingMessage; ViewBag._totalSentMessage = _totalSentMessage; ViewBag._totalTwitterFollowers = _totalTwitterFollowers; ViewBag._totalFacebookFan = _totalFacebookFan; return(PartialView("_HomeUserActivityPartial")); }
public DataSet bindMessagesIntoDataTable(Guid id, int noOfDataToSkip, Guid UserId) { Api.TeamMemberProfile.TeamMemberProfile objTeamMemberProfileRepository = new Api.TeamMemberProfile.TeamMemberProfile(); List<TeamMemberProfile> alstprofiles = (List<Domain.Myfashion.Domain.TeamMemberProfile>)new JavaScriptSerializer().Deserialize(objTeamMemberProfileRepository.GetTeamMemberProfilesByTeamId(id.ToString()), typeof(List<Domain.Myfashion.Domain.TeamMemberProfile>)); Api.FacebookFeed.FacebookFeed objApiFacebookFeed = new Api.FacebookFeed.FacebookFeed(); Api.TwitterMessage.TwitterMessage objApiTwitterMessage = new Api.TwitterMessage.TwitterMessage(); Messages mstable = new Messages(); DataSet ds = DataTableGenerator.CreateDataSetForTable(mstable); foreach (TeamMemberProfile item in alstprofiles) { try { if (item.ProfileType == "facebook") { //List<Domain.Myfashion.Domain.FacebookFeed> alstfeedfb = (List<Domain.Myfashion.Domain.FacebookFeed>)new JavaScriptSerializer().Deserialize(objApiFacebookFeed.getUnreadMessages(item.ProfileId), typeof(List<Domain.Myfashion.Domain.FacebookFeed>)); ; //foreach (FacebookFeed facebookmsg in alstfeedfb) //{ // ds.Tables[0].Rows.Add(facebookmsg.ProfileId, "facebook", facebookmsg.FromId, facebookmsg.FromName, facebookmsg.FromProfileUrl, facebookmsg.FeedDate, facebookmsg.FeedDescription, facebookmsg.FbComment, facebookmsg.FbLike, facebookmsg.FeedId, facebookmsg.Type, facebookmsg.ReadStatus); //} //Updated by SumitGupta [09-02-2015] //List<FacebookMessage> lstfbmsg = (List<FacebookMessage>)new JavaScriptSerializer().Deserialize(objApiFacebookMessage.getAllFacebookMessagesOfUserByProfileId(item.ProfileId), typeof(List<FacebookMessage>)); List<FacebookMessage> lstfbmsg = (List<FacebookMessage>)new JavaScriptSerializer().Deserialize(objApiFacebookMessage.getAllFacebookMessagesOfUserByProfileIdWithRange(item.ProfileId, noOfDataToSkip.ToString(), UserId.ToString()), typeof(List<FacebookMessage>)); foreach (FacebookMessage facebookmsg in lstfbmsg) { try { ds.Tables[0].Rows.Add(facebookmsg.ProfileId, "facebook", facebookmsg.FromId, facebookmsg.FromName, facebookmsg.FromProfileUrl, facebookmsg.MessageDate, facebookmsg.Message, facebookmsg.FbComment, facebookmsg.FbLike, facebookmsg.MessageId, facebookmsg.Type, 1); } catch (Exception ex) { logger.Error("Exception Message : " + ex.Message); logger.Error("Exception Message : " + ex.StackTrace); } } } else if (item.ProfileType == "twitter") { //List<Domain.Myfashion.Domain.TwitterMessage> lstmsgtwtuser = (List<TwitterMessage>)new JavaScriptSerializer().Deserialize(objApiTwitterMessage.getUnreadMessages(item.ProfileId), typeof(List<Domain.Myfashion.Domain.TwitterMessage>)); //List<Domain.Myfashion.Domain.TwitterMessage> lstmsgtwtuser = (List<TwitterMessage>)new JavaScriptSerializer().Deserialize(objApiTwitterMessage.GetTwitterMessages(item.ProfileId, UserId.ToString()), typeof(List<Domain.Myfashion.Domain.TwitterMessage>)); List<Domain.Myfashion.Domain.TwitterMessage> lstmsgtwtuser = (List<TwitterMessage>)new JavaScriptSerializer().Deserialize(objApiTwitterMessage.getAllTwitterkMessagesOfUserByProfileIdWithRange(UserId.ToString(), item.ProfileId, noOfDataToSkip.ToString()), typeof(List<Domain.Myfashion.Domain.TwitterMessage>)); foreach (TwitterMessage lst in lstmsgtwtuser) { try { ds.Tables[0].Rows.Add(lst.ProfileId, "twitter", lst.FromId, lst.FromScreenName, lst.FromProfileUrl, lst.MessageDate, lst.TwitterMsg, "", "", lst.MessageId, lst.Type, lst.ReadStatus); } catch (Exception ex) { logger.Error("Exception Message : " + ex.Message); logger.Error("Exception Message : " + ex.StackTrace); } } } else if (item.ProfileType == "googleplus") { } } catch (Exception ex) { logger.Error("Exception Message : " + ex.Message); logger.Error("Exception Message : " + ex.StackTrace); } } foreach (TeamMemberProfile item in alstprofiles) { if (item.ProfileType == "facebook") { try { facebookid += item.ProfileId + ","; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (item.ProfileType == "twitter") { try { twitterid += item.ProfileId + ","; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (item.ProfileType == "googleplus") { try { googleplusid += item.ProfileId + ","; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } if (facebookid != "") { facebookid = facebookid.Substring(0, facebookid.Length - 1); } if (twitterid != "") { twitterid = twitterid.Substring(0, twitterid.Length - 1); } if (googleplusid != "") { googleplusid = googleplusid.Substring(0, googleplusid.Length - 1); } // suraj=============================================================================== //List<FacebookFeed> alstfbmsgs = (List<FacebookFeed>)new JavaScriptSerializer().Deserialize(objApiFacebookFeed.getAllReadFbFeeds(facebookid), typeof(List<FacebookFeed>)); //try //{ // foreach (FacebookFeed facebookmsg in alstfbmsgs) // { // try // { // ds.Tables[0].Rows.Add(facebookmsg.ProfileId, "facebook", facebookmsg.FromId, facebookmsg.FromName, facebookmsg.FromProfileUrl, facebookmsg.FeedDate, facebookmsg.FeedDescription, facebookmsg.FbComment, facebookmsg.FbLike, facebookmsg.FeedId, facebookmsg.Type, facebookmsg.ReadStatus); // } // catch (Exception ex) // { // Console.WriteLine(ex.StackTrace); // } // } //} //catch (Exception ex) //{ // Console.WriteLine(ex.StackTrace); //} //=============================================================================== List<TwitterMessage> lstmsgtwt = (List<TwitterMessage>)new JavaScriptSerializer().Deserialize(objApiTwitterMessage.getAlltwtMessagesOfUser(twitterid), typeof(List<TwitterMessage>)); try { foreach (TwitterMessage lst in lstmsgtwt) { try { ds.Tables[0].Rows.Add(lst.ProfileId, "twitter", lst.FromId, lst.FromScreenName, lst.FromProfileUrl, lst.MessageDate, lst.TwitterMsg, "", "", lst.MessageId, lst.Type, lst.ReadStatus); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } #region Commented G+ code, to be used later //GooglePlusActivitiesRepository objActRepository = new GooglePlusActivitiesRepository(); //List<GooglePlusActivities> lstmsggpl = objActRepository.getAllgplusOfUser(googleplusid); //try //{ // foreach (GooglePlusActivities lst in lstmsggpl) // { // try // { // ds.Tables[0].Rows.Add(lst.GpUserId, "googleplus", lst.FromId, lst.FromUserName, lst.FromProfileImage, lst.PublishedDate, lst.Content, "", "", lst.ActivityId, "activities"); // } // catch (Exception ex) // { // Console.WriteLine(ex.StackTrace); // } // } //} //catch (Exception ex) //{ // Console.WriteLine(ex.StackTrace); //} #endregion return ds; }
public DataSet bindMessagesIntoDataTable(Guid id) { //SocialProfilesRepository socioprofrepo = new SocialProfilesRepository(); //List<SocialProfile> alstprofiles = socioprofrepo.getAllSocialProfilesOfUser(user.Id); //TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository(); //List<TeamMemberProfile> alstprofiles = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(id); Api.TeamMemberProfile.TeamMemberProfile objTeamMemberProfileRepository = new Api.TeamMemberProfile.TeamMemberProfile(); List<TeamMemberProfile> alstprofiles = (List<Domain.Socioboard.Domain.TeamMemberProfile>)new JavaScriptSerializer().Deserialize(objTeamMemberProfileRepository.GetTeamMemberProfilesByTeamId(id.ToString()), typeof(List<Domain.Socioboard.Domain.TeamMemberProfile>)); Api.FacebookFeed.FacebookFeed objApiFacebookFeed = new Api.FacebookFeed.FacebookFeed(); Api.TwitterMessage.TwitterMessage objApiTwitterMessage = new Api.TwitterMessage.TwitterMessage(); // DataTableGenerator datatablegenerepo = new DataTableGenerator(); Messages mstable = new Messages(); DataSet ds = DataTableGenerator.CreateDataSetForTable(mstable); // DataSet ds = datatablegenerepo.CreateDataSetForTable(mstable); foreach (TeamMemberProfile item in alstprofiles) { if (item.ProfileType == "facebook") { ////FacebookFeedRepository fbfeedRepo = new FacebookFeedRepository(); //Api.FacebookFeed.FacebookFeed objApiFacebookFeed = new Api.FacebookFeed.FacebookFeed(); //List<FacebookFeed> alstfeedfb = fbfeedRepo.getUnreadMessages(item.ProfileId); List<Domain.Socioboard.Domain.FacebookFeed> alstfeedfb = (List<Domain.Socioboard.Domain.FacebookFeed>)new JavaScriptSerializer().Deserialize(objApiFacebookFeed.getUnreadMessages(item.ProfileId), typeof(List<Domain.Socioboard.Domain.FacebookFeed>)); ; foreach (FacebookFeed facebookmsg in alstfeedfb) { ds.Tables[0].Rows.Add(facebookmsg.ProfileId, "facebook", facebookmsg.FromId, facebookmsg.FromName, facebookmsg.FromProfileUrl, facebookmsg.FeedDate, facebookmsg.FeedDescription, facebookmsg.FbComment, facebookmsg.FbLike, facebookmsg.FeedId, facebookmsg.Type, facebookmsg.ReadStatus); } } else if (item.ProfileType == "twitter") { ////TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository(); //Api.TwitterMessage.TwitterMessage objApiTwitterMessage = new Api.TwitterMessage.TwitterMessage(); List<Domain.Socioboard.Domain.TwitterMessage> lstmsgtwtuser = (List<TwitterMessage>)new JavaScriptSerializer().Deserialize(objApiTwitterMessage.getUnreadMessages(item.ProfileId), typeof(List<Domain.Socioboard.Domain.TwitterMessage>)); foreach (TwitterMessage lst in lstmsgtwtuser) { ds.Tables[0].Rows.Add(lst.ProfileId, "twitter", lst.FromId, lst.FromScreenName, lst.FromProfileUrl, lst.MessageDate, lst.TwitterMsg, "", "", lst.MessageId, lst.Type, lst.ReadStatus); } } else if (item.ProfileType == "googleplus") { } } foreach (TeamMemberProfile item in alstprofiles) { if (item.ProfileType == "facebook") { try { //FacebookFeedRepository fbfeedrepo = new FacebookFeedRepository(); //List<FacebookFeed> alstfbmsgs = fbfeedrepo.getAllReadFacebookFeeds(user.Id, item.ProfileId); //foreach (FacebookFeed facebookmsg in alstfbmsgs) //{ // ds.Tables[0].Rows.Add(facebookmsg.ProfileId, "facebook", facebookmsg.FromId, facebookmsg.FromName, facebookmsg.FromProfileUrl, facebookmsg.FeedDate, facebookmsg.FeedDescription, facebookmsg.FbComment, facebookmsg.FbLike, facebookmsg.FeedId, facebookmsg.Type,facebookmsg.ReadStatus); //} facebookid += item.ProfileId + ","; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (item.ProfileType == "twitter") { try { //TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository(); //List<TwitterMessage> lstmsgtwtuser = twtmsgrepo.getAllReadMessagesOfUser(user.Id, item.ProfileId); //foreach (TwitterMessage lst in lstmsgtwtuser) //{ // ds.Tables[0].Rows.Add(lst.ProfileId, "twitter", lst.FromId, lst.FromScreenName, lst.FromProfileUrl, lst.MessageDate, lst.TwitterMsg, "", "", lst.MessageId, lst.Type,lst.ReadStatus); //} twitterid += item.ProfileId + ","; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (item.ProfileType == "googleplus") { try { //GooglePlusActivitiesRepository objActRepo = new GooglePlusActivitiesRepository(); //List<GooglePlusActivities> lstmsggauser = objActRepo.getAllgoogleplusActivityOfUser(user.Id, item.ProfileId); //foreach (GooglePlusActivities lst in lstmsggauser) //{ // ds.Tables[0].Rows.Add(lst.GpUserId, "googleplus", lst.FromId, lst.FromUserName, lst.FromProfileImage, lst.PublishedDate, lst.Content, "", "", lst.ActivityId, "activities"); //} googleplusid += item.ProfileId + ","; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } if (facebookid != "") { facebookid = facebookid.Substring(0, facebookid.Length - 1); } if (twitterid != "") { twitterid = twitterid.Substring(0, twitterid.Length - 1); } if (googleplusid != "") { googleplusid = googleplusid.Substring(0, googleplusid.Length - 1); } //FacebookFeedRepository fbfeedRepository = new FacebookFeedRepository(); //List<FacebookFeed> alstfbmsgs = fbfeedRepository.getAllReadFbFeeds(facebookid); List<FacebookFeed> alstfbmsgs = (List<FacebookFeed>)new JavaScriptSerializer().Deserialize(objApiFacebookFeed.getAllReadFbFeeds(facebookid), typeof(List<FacebookFeed>)); try { foreach (FacebookFeed facebookmsg in alstfbmsgs) { try { ds.Tables[0].Rows.Add(facebookmsg.ProfileId, "facebook", facebookmsg.FromId, facebookmsg.FromName, facebookmsg.FromProfileUrl, facebookmsg.FeedDate, facebookmsg.FeedDescription, facebookmsg.FbComment, facebookmsg.FbLike, facebookmsg.FeedId, facebookmsg.Type, facebookmsg.ReadStatus); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } //TwitterMessageRepository twtmsgRepository = new TwitterMessageRepository(); //List<TwitterMessage> lstmsgtwt = twtmsgRepository.getAlltwtMessagesOfUser(twitterid); List<TwitterMessage> lstmsgtwt = (List<TwitterMessage>)new JavaScriptSerializer().Deserialize(objApiTwitterMessage.getAlltwtMessagesOfUser(twitterid), typeof(List<TwitterMessage>)); try { foreach (TwitterMessage lst in lstmsgtwt) { try { ds.Tables[0].Rows.Add(lst.ProfileId, "twitter", lst.FromId, lst.FromScreenName, lst.FromProfileUrl, lst.MessageDate, lst.TwitterMsg, "", "", lst.MessageId, lst.Type, lst.ReadStatus); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } #region Commented G+ code, to be used later //GooglePlusActivitiesRepository objActRepository = new GooglePlusActivitiesRepository(); //List<GooglePlusActivities> lstmsggpl = objActRepository.getAllgplusOfUser(googleplusid); //try //{ // foreach (GooglePlusActivities lst in lstmsggpl) // { // try // { // ds.Tables[0].Rows.Add(lst.GpUserId, "googleplus", lst.FromId, lst.FromUserName, lst.FromProfileImage, lst.PublishedDate, lst.Content, "", "", lst.ActivityId, "activities"); // } // catch (Exception ex) // { // Console.WriteLine(ex.StackTrace); // } // } //} //catch (Exception ex) //{ // Console.WriteLine(ex.StackTrace); //} #endregion return ds; }
public ActionResult DisplayCount() { string AllProfileId = string.Empty; string FbProfileId = string.Empty; string TwtProfileId = string.Empty; int fbmsgcount = 0; int twtmsgcount = 0; int allsentmsgcount = 0; User objUser = (User)Session["User"]; Dictionary <Domain.Myfashion.Domain.TeamMemberProfile, object> allprofileofuser = SBUtils.GetUserProfilesccordingToGroup(); foreach (var item in allprofileofuser) { try { if (item.Key.ProfileType == "facebook" || item.Key.ProfileType == "facebook_page") { FbProfileId += item.Key.ProfileId + ','; } else if (item.Key.ProfileType == "twitter") { TwtProfileId += item.Key.ProfileId + ','; } AllProfileId += item.Key.ProfileId + ','; } catch (Exception Err) { Console.Write(Err.StackTrace); } } try { FbProfileId = FbProfileId.Substring(0, FbProfileId.Length - 1); } catch (Exception Err) { Console.Write(Err.StackTrace); } try { TwtProfileId = TwtProfileId.Substring(0, TwtProfileId.Length - 1); } catch (Exception Err) { Console.Write(Err.StackTrace); } try { AllProfileId = AllProfileId.Substring(0, AllProfileId.Length - 1); } catch (Exception Err) { Console.Write(Err.StackTrace); } try { Api.FacebookFeed.FacebookFeed objFacebookFeed = new Api.FacebookFeed.FacebookFeed(); objFacebookFeed.Timeout = 300000; fbmsgcount = objFacebookFeed.GetFeedCountByProfileIdAndUserId(objUser.Id.ToString(), FbProfileId); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } try { Api.TwitterMessage.TwitterMessage objTwitterMessage = new Api.TwitterMessage.TwitterMessage(); objTwitterMessage.Timeout = 300000; twtmsgcount = objTwitterMessage.GetFeedCountByProfileIdAndUserId(objUser.Id.ToString(), FbProfileId); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } try { Api.ScheduledMessage.ScheduledMessage objScheduledMessage = new Api.ScheduledMessage.ScheduledMessage(); objScheduledMessage.Timeout = 300000; allsentmsgcount = objScheduledMessage.GetSentMessageCountByProfileIdAndUserId(objUser.Id.ToString(), FbProfileId); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } string _totalIncomingMessage = "0"; string _totalSentMessage = "0"; string _totalTwitterFollowers = "0"; string _totalFacebookFan = "0"; try { _totalIncomingMessage = (fbmsgcount + twtmsgcount).ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } try { _totalSentMessage = allsentmsgcount.ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } try { _totalTwitterFollowers = SBUtils.GetAllTwitterFollowersCountofUser(TwtProfileId, objUser.Id.ToString()); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } try { _totalFacebookFan = SBUtils.GetAllFacebookFancountofUser(FbProfileId, objUser.Id.ToString()); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } ViewBag._totalIncomingMessage = _totalIncomingMessage; ViewBag._totalSentMessage = _totalSentMessage; ViewBag._totalTwitterFollowers = _totalTwitterFollowers; ViewBag._totalFacebookFan = _totalFacebookFan; return(PartialView("_HomeUserActivityPartial")); }
public static Dictionary <Domain.Socioboard.Domain.TeamMemberProfile, Dictionary <object, List <object> > > GetUserProfilesSnapsAccordingToGroup(List <Domain.Socioboard.Domain.TeamMemberProfile> TeamMemberProfile) { User objUser = (User)System.Web.HttpContext.Current.Session["User"]; Dictionary <Domain.Socioboard.Domain.TeamMemberProfile, Dictionary <object, List <object> > > dic_profilessnap = new Dictionary <Domain.Socioboard.Domain.TeamMemberProfile, Dictionary <object, List <object> > >(); var dicprofilefeeds = new Dictionary <object, List <object> >(); foreach (Domain.Socioboard.Domain.TeamMemberProfile item in TeamMemberProfile) { List <object> feeds = null; if (item.ProfileType == "facebook") { feeds = new List <object>(); Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); FacebookAccount objFacebookAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getFacebookAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(FacebookAccount))); Api.FacebookFeed.FacebookFeed ApiobjFacebookFeed = new Api.FacebookFeed.FacebookFeed(); List <FacebookFeed> lstFacebookFeed = (List <FacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List <FacebookFeed>))); foreach (var facebookfeed in lstFacebookFeed) { feeds.Add(facebookfeed); } dicprofilefeeds.Add(objFacebookAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } if (item.ProfileType == "twitter") { feeds = new List <object>(); Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount(); TwitterAccount objTwitterAccount = (TwitterAccount)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetTwitterAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(TwitterAccount))); Api.TwitterFeed.TwitterFeed ApiobjTwitterFeed = new Api.TwitterFeed.TwitterFeed(); List <TwitterFeed> lstTwitterFeed = (List <TwitterFeed>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterFeed.GetAllTwitterFeedsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List <TwitterFeed>))); foreach (var twitterfeed in lstTwitterFeed) { feeds.Add(twitterfeed); } dicprofilefeeds.Add(objTwitterAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } if (item.ProfileType == "linkedin") { feeds = new List <object>(); Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount(); LinkedInAccount objLinkedInAccount = (LinkedInAccount)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetLinkedinAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(LinkedInAccount))); Api.LinkedInFeed.LinkedInFeed ApiobjLinkedInFeed = new Api.LinkedInFeed.LinkedInFeed(); List <LinkedInFeed> lstLinkedInFeed = (List <LinkedInFeed>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedInFeed.GetLinkedInFeeds(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List <LinkedInFeed>))); foreach (var LinkedInFeed in lstLinkedInFeed) { feeds.Add(LinkedInFeed); } dicprofilefeeds.Add(objLinkedInAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } if (item.ProfileType == "instagram") { feeds = new List <object>(); Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount(); InstagramAccount objInstagramAccount = (InstagramAccount)(new JavaScriptSerializer().Deserialize(ApiobjInstagramAccount.UserInformation(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(InstagramAccount))); dicprofilefeeds.Add(objInstagramAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } if (item.ProfileType == "tumblr") { feeds = new List <object>(); Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount(); TumblrAccount objTumblrAccount = (TumblrAccount)(new JavaScriptSerializer().Deserialize(ApiobjTumblrAccount.GetTumblrAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(TumblrAccount))); dicprofilefeeds.Add(objTumblrAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } if (item.ProfileType == "youtube") { feeds = new List <object>(); Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount(); YoutubeAccount objYoutubeAccount = (YoutubeAccount)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeAccount.GetYoutubeAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(YoutubeAccount))); Api.YoutubeChannel.YoutubeChannel ApiobjYoutubeChannel = new Api.YoutubeChannel.YoutubeChannel(); YoutubeChannel objYoutubeChannel = (YoutubeChannel)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeChannel.GetAllYoutubeChannelByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(YoutubeChannel))); List <YoutubeChannel> lstYoutubeChannel = new List <YoutubeChannel>(); lstYoutubeChannel.Add(objYoutubeChannel); foreach (var youtubechannel in lstYoutubeChannel) { feeds.Add(youtubechannel); } dicprofilefeeds.Add(objYoutubeAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } } return(dic_profilessnap); }
//public static Dictionary<Domain.Socioboard.Domain.TeamMemberProfile, Dictionary<object, List<object>>> GetUserProfilesSnapsAccordingToGroup(List<Domain.Socioboard.Domain.TeamMemberProfile> TeamMemberProfile) //{ // User objUser = (User)System.Web.HttpContext.Current.Session["User"]; // Dictionary<Domain.Socioboard.Domain.TeamMemberProfile, Dictionary<object, List<object>>> dic_profilessnap = new Dictionary<Domain.Socioboard.Domain.TeamMemberProfile, Dictionary<object, List<object>>>(); // var dicprofilefeeds = new Dictionary<object, List<object>>(); // foreach (Domain.Socioboard.Domain.TeamMemberProfile item in TeamMemberProfile) // { // List<object> feeds = null; // if (item.ProfileType == "facebook" || item.ProfileType == "facebook_page") // { // try // { // feeds = new List<object>(); // Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); // FacebookAccount objFacebookAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getFacebookAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(FacebookAccount))); // Api.FacebookFeed.FacebookFeed ApiobjFacebookFeed = new Api.FacebookFeed.FacebookFeed(); // //List<FacebookFeed> lstFacebookFeed = (List<FacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<FacebookFeed>))); // List<FacebookFeed> lstFacebookFeed = (List<FacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileIdUsingLimit(objUser.Id.ToString(), item.ProfileId.ToString(), "0", "10"), typeof(List<FacebookFeed>))); // foreach (var facebookfeed in lstFacebookFeed) // { // feeds.Add(facebookfeed); // } // dicprofilefeeds.Add(objFacebookAccount, feeds); // dic_profilessnap.Add(item, dicprofilefeeds); // } // catch (Exception ex) // { // Console.WriteLine(ex.Message); // } // } // if (item.ProfileType == "twitter") // { // try // { // feeds = new List<object>(); // Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount(); // TwitterAccount objTwitterAccount = (TwitterAccount)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetTwitterAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(TwitterAccount))); // Api.TwitterFeed.TwitterFeed ApiobjTwitterFeed = new Api.TwitterFeed.TwitterFeed(); // //List<TwitterFeed> lstTwitterFeed = (List<TwitterFeed>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterFeed.GetAllTwitterFeedsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<TwitterFeed>))); // List<TwitterFeed> lstTwitterFeed = (List<TwitterFeed>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterFeed.getAllFeedsByUserIdAndProfileIdUsingLimit(objUser.Id.ToString(), item.ProfileId.ToString(),"0","10"), typeof(List<TwitterFeed>))); // foreach (var twitterfeed in lstTwitterFeed) // { // feeds.Add(twitterfeed); // } // dicprofilefeeds.Add(objTwitterAccount, feeds); // dic_profilessnap.Add(item, dicprofilefeeds); // } // catch (Exception ex) // { // Console.WriteLine(ex.Message); // } // } // if (item.ProfileType == "linkedin") // { // try // { // feeds = new List<object>(); // Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount(); // LinkedInAccount objLinkedInAccount = (LinkedInAccount)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetLinkedinAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(LinkedInAccount))); // Api.LinkedInFeed.LinkedInFeed ApiobjLinkedInFeed = new Api.LinkedInFeed.LinkedInFeed(); // //List<LinkedInFeed> lstLinkedInFeed = (List<LinkedInFeed>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedInFeed.GetLinkedInFeeds(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<LinkedInFeed>))); // List<LinkedInFeed> lstLinkedInFeed = (List<LinkedInFeed>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedInFeed.GetLinkedInFeedsByUserIdAndProfileIdUsingLimit(objUser.Id.ToString(), item.ProfileId.ToString(), "0", "10"), typeof(List<LinkedInFeed>))); // foreach (var LinkedInFeed in lstLinkedInFeed) // { // feeds.Add(LinkedInFeed); // } // dicprofilefeeds.Add(objLinkedInAccount, feeds); // dic_profilessnap.Add(item, dicprofilefeeds); // } // catch (Exception ex) // { // Console.WriteLine(ex.Message); // } // } // if (item.ProfileType == "instagram") // { // try // { // feeds = new List<object>(); // Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount(); // InstagramAccount objInstagramAccount = (InstagramAccount)(new JavaScriptSerializer().Deserialize(ApiobjInstagramAccount.UserInformation(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(InstagramAccount))); // dicprofilefeeds.Add(objInstagramAccount, feeds); // dic_profilessnap.Add(item, dicprofilefeeds); // } // catch (Exception ex) // { // Console.WriteLine(ex.Message); // } // } // if (item.ProfileType == "tumblr") // { // try // { // feeds = new List<object>(); // Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount(); // TumblrAccount objTumblrAccount = (TumblrAccount)(new JavaScriptSerializer().Deserialize(ApiobjTumblrAccount.GetTumblrAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(TumblrAccount))); // dicprofilefeeds.Add(objTumblrAccount, feeds); // dic_profilessnap.Add(item, dicprofilefeeds); // } // catch (Exception ex) // { // Console.WriteLine(ex.Message); // } // } // if (item.ProfileType == "youtube") // { // try // { // feeds = new List<object>(); // Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount(); // YoutubeAccount objYoutubeAccount = (YoutubeAccount)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeAccount.GetYoutubeAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(YoutubeAccount))); // Api.YoutubeChannel.YoutubeChannel ApiobjYoutubeChannel = new Api.YoutubeChannel.YoutubeChannel(); // YoutubeChannel objYoutubeChannel = (YoutubeChannel)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeChannel.GetAllYoutubeChannelByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(YoutubeChannel))); // List<YoutubeChannel> lstYoutubeChannel = new List<YoutubeChannel>(); // lstYoutubeChannel.Add(objYoutubeChannel); // foreach (var youtubechannel in lstYoutubeChannel) // { // feeds.Add(youtubechannel); // } // dicprofilefeeds.Add(objYoutubeAccount, feeds); // dic_profilessnap.Add(item, dicprofilefeeds); // } // catch (Exception ex) // { // Console.WriteLine(ex.Message); // } // } // if (item.ProfileType == "linkedincompanypage") // { // try // { // feeds = new List<object>(); // Api.LinkedinCompanyPage.LinkedinCompanyPage ApiobjLinkedinCompanyPage = new Api.LinkedinCompanyPage.LinkedinCompanyPage(); // LinkedinCompanyPage objLinkedinCompanypage = (LinkedinCompanyPage)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinCompanyPage.GetLinkedinCompanyPageDetailsByUserIdAndPageId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(LinkedinCompanyPage))); // Api.LinkedinCompanyPage.LinkedinCompanyPage ApiobjLinkedinCompanyPagePost = new Api.LinkedinCompanyPage.LinkedinCompanyPage(); // List<LinkedinCompanyPagePosts> lstlipagepost = (List<LinkedinCompanyPagePosts>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinCompanyPagePost.GetAllLinkedinCompanyPagePostsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<LinkedinCompanyPagePosts>))); // foreach (var lipagepost in lstlipagepost) // { // feeds.Add(lipagepost); // } // dicprofilefeeds.Add(objLinkedinCompanypage, feeds); // dic_profilessnap.Add(item, dicprofilefeeds); // } // catch (Exception ex) // { // Console.WriteLine(ex.Message); // } // } // } // return dic_profilessnap; //} public static Dictionary<Domain.Socioboard.Domain.TeamMemberProfile, Dictionary<object, List<object>>> GetUserProfilesSnapsAccordingToGroup(List<Domain.Socioboard.Domain.TeamMemberProfile> TeamMemberProfile, int CountProfileSnapshot = 0) { User objUser = (User)System.Web.HttpContext.Current.Session["User"]; Dictionary<Domain.Socioboard.Domain.TeamMemberProfile, Dictionary<object, List<object>>> dic_profilessnap = new Dictionary<Domain.Socioboard.Domain.TeamMemberProfile, Dictionary<object, List<object>>>(); var dicprofilefeeds = new Dictionary<object, List<object>>(); int tempCount = 0; foreach (Domain.Socioboard.Domain.TeamMemberProfile item in TeamMemberProfile) { tempCount++; if (tempCount <= CountProfileSnapshot) { continue; } //to load only 3 profiles on home page load to speed up page loading if (dic_profilessnap.Count >= 3) { break; } List<object> feeds = null; if (item.ProfileType == "facebook" || item.ProfileType == "facebook_page") { try { feeds = new List<object>(); Api.FacebookAccount.FacebookAccount ApiobjFacebookAccount = new Api.FacebookAccount.FacebookAccount(); ApiobjFacebookAccount.Timeout = 300000; FacebookAccount objFacebookAccount = (FacebookAccount)(new JavaScriptSerializer().Deserialize(ApiobjFacebookAccount.getFacebookAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(FacebookAccount))); Api.FacebookFeed.FacebookFeed ApiobjFacebookFeed = new Api.FacebookFeed.FacebookFeed(); ApiobjFacebookFeed.Timeout = 300000; //List<FacebookFeed> lstFacebookFeed = (List<FacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<FacebookFeed>))); List<FacebookFeed> lstFacebookFeed = (List<FacebookFeed>)(new JavaScriptSerializer().Deserialize(ApiobjFacebookFeed.getAllFacebookFeedsByUserIdAndProfileIdUsingLimit(objUser.Id.ToString(), item.ProfileId.ToString(), "0", "10"), typeof(List<FacebookFeed>))); foreach (var facebookfeed in lstFacebookFeed) { feeds.Add(facebookfeed); } dicprofilefeeds.Add(objFacebookAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } catch (Exception ex) { Console.WriteLine(ex.Message); } } if (item.ProfileType == "twitter") { try { feeds = new List<object>(); Api.TwitterAccount.TwitterAccount ApiobjTwitterAccount = new Api.TwitterAccount.TwitterAccount(); TwitterAccount objTwitterAccount = (TwitterAccount)(new JavaScriptSerializer().Deserialize(ApiobjTwitterAccount.GetTwitterAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(TwitterAccount))); Api.TwitterFeed.TwitterFeed ApiobjTwitterFeed = new Api.TwitterFeed.TwitterFeed(); ApiobjTwitterFeed.Timeout = 300000; //List<TwitterFeed> lstTwitterFeed = (List<TwitterFeed>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterFeed.GetAllTwitterFeedsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<TwitterFeed>))); List<TwitterFeed> lstTwitterFeed = (List<TwitterFeed>)(new JavaScriptSerializer().Deserialize(ApiobjTwitterFeed.getAllFeedsByUserIdAndProfileIdUsingLimit(objUser.Id.ToString(), item.ProfileId.ToString(), "0", "10"), typeof(List<TwitterFeed>))); foreach (var twitterfeed in lstTwitterFeed) { feeds.Add(twitterfeed); } dicprofilefeeds.Add(objTwitterAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } catch (Exception ex) { Console.WriteLine(ex.Message); } } if (item.ProfileType == "linkedin") { try { feeds = new List<object>(); Api.LinkedinAccount.LinkedinAccount ApiobjLinkedinAccount = new Api.LinkedinAccount.LinkedinAccount(); ApiobjLinkedinAccount.Timeout = 300000; LinkedInAccount objLinkedInAccount = (LinkedInAccount)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinAccount.GetLinkedinAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(LinkedInAccount))); Api.LinkedInFeed.LinkedInFeed ApiobjLinkedInFeed = new Api.LinkedInFeed.LinkedInFeed(); ApiobjLinkedInFeed.Timeout = 300000; //List<LinkedInFeed> lstLinkedInFeed = (List<LinkedInFeed>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedInFeed.GetLinkedInFeeds(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<LinkedInFeed>))); List<LinkedInFeed> lstLinkedInFeed = (List<LinkedInFeed>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedInFeed.GetLinkedInFeedsByUserIdAndProfileIdUsingLimit(objUser.Id.ToString(), item.ProfileId.ToString(), "0", "10"), typeof(List<LinkedInFeed>))); foreach (var LinkedInFeed in lstLinkedInFeed) { feeds.Add(LinkedInFeed); } dicprofilefeeds.Add(objLinkedInAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } catch (Exception ex) { Console.WriteLine(ex.Message); } } if (item.ProfileType == "instagram") { try { feeds = new List<object>(); Api.InstagramAccount.InstagramAccount ApiobjInstagramAccount = new Api.InstagramAccount.InstagramAccount(); ApiobjInstagramAccount.Timeout = 300000; InstagramAccount objInstagramAccount = (InstagramAccount)(new JavaScriptSerializer().Deserialize(ApiobjInstagramAccount.UserInformation(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(InstagramAccount))); dicprofilefeeds.Add(objInstagramAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } catch (Exception ex) { Console.WriteLine(ex.Message); } } if (item.ProfileType == "tumblr") { try { feeds = new List<object>(); Api.TumblrAccount.TumblrAccount ApiobjTumblrAccount = new Api.TumblrAccount.TumblrAccount(); ApiobjTumblrAccount.Timeout = 300000; TumblrAccount objTumblrAccount = (TumblrAccount)(new JavaScriptSerializer().Deserialize(ApiobjTumblrAccount.GetTumblrAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(TumblrAccount))); dicprofilefeeds.Add(objTumblrAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } catch (Exception ex) { Console.WriteLine(ex.Message); } } if (item.ProfileType == "youtube") { try { feeds = new List<object>(); Api.YoutubeAccount.YoutubeAccount ApiobjYoutubeAccount = new Api.YoutubeAccount.YoutubeAccount(); ApiobjYoutubeAccount.Timeout = 300000; YoutubeAccount objYoutubeAccount = (YoutubeAccount)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeAccount.GetYoutubeAccountDetailsById(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(YoutubeAccount))); Api.YoutubeChannel.YoutubeChannel ApiobjYoutubeChannel = new Api.YoutubeChannel.YoutubeChannel(); ApiobjYoutubeChannel.Timeout = 300000; YoutubeChannel objYoutubeChannel = (YoutubeChannel)(new JavaScriptSerializer().Deserialize(ApiobjYoutubeChannel.GetAllYoutubeChannelByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(YoutubeChannel))); List<YoutubeChannel> lstYoutubeChannel = new List<YoutubeChannel>(); lstYoutubeChannel.Add(objYoutubeChannel); foreach (var youtubechannel in lstYoutubeChannel) { feeds.Add(youtubechannel); } dicprofilefeeds.Add(objYoutubeAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } catch (Exception ex) { Console.WriteLine(ex.Message); } } if (item.ProfileType == "linkedincompanypage") { try { feeds = new List<object>(); Api.LinkedinCompanyPage.LinkedinCompanyPage ApiobjLinkedinCompanyPage = new Api.LinkedinCompanyPage.LinkedinCompanyPage(); ApiobjLinkedinCompanyPage.Timeout = 300000; LinkedinCompanyPage objLinkedinCompanypage = (LinkedinCompanyPage)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinCompanyPage.GetLinkedinCompanyPageDetailsByUserIdAndPageId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(LinkedinCompanyPage))); Api.LinkedinCompanyPage.LinkedinCompanyPage ApiobjLinkedinCompanyPagePost = new Api.LinkedinCompanyPage.LinkedinCompanyPage(); ApiobjLinkedinCompanyPage.Timeout = 300000; List<LinkedinCompanyPagePosts> lstlipagepost = (List<LinkedinCompanyPagePosts>)(new JavaScriptSerializer().Deserialize(ApiobjLinkedinCompanyPagePost.GetAllLinkedinCompanyPagePostsByUserIdAndProfileId(objUser.Id.ToString(), item.ProfileId.ToString()), typeof(List<LinkedinCompanyPagePosts>))); foreach (var lipagepost in lstlipagepost) { feeds.Add(lipagepost); } dicprofilefeeds.Add(objLinkedinCompanypage, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } catch (Exception ex) { Console.WriteLine(ex.Message); } } if (item.ProfileType == "gplus") { try { feeds = new List<object>(); Api.GooglePlusAccount.GooglePlusAccount ApiobjGooglePlusAccount = new Api.GooglePlusAccount.GooglePlusAccount(); ApiobjGooglePlusAccount.Timeout = 300000; Domain.Socioboard.Domain.GooglePlusAccount _GooglePlusAccount = (GooglePlusAccount)new JavaScriptSerializer().Deserialize(ApiobjGooglePlusAccount.GetGooglePlusAccountDetailsById(objUser.Id.ToString(), item.ProfileId), typeof(GooglePlusAccount)); dicprofilefeeds.Add(_GooglePlusAccount, feeds); dic_profilessnap.Add(item, dicprofilefeeds); } catch (Exception ex) { Console.WriteLine(ex.Message); } } } return dic_profilessnap; }