public string GetInstagramFeeds(string UserId, string InstagramId) { try { InstagramFeedRepository objInsFeedRepo = new InstagramFeedRepository(); List <InstagramFeed> lstInsFeed = objInsFeedRepo.getAllInstagramFeedsOfUser(Guid.Parse(UserId), InstagramId); return(new JavaScriptSerializer().Serialize(lstInsFeed)); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(null); } }
public string getIntagramImages(InstagramAccount objInsAccount) { InstagramAccountRepository objIns = new InstagramAccountRepository(); InstagramResponse <GlobusInstagramLib.App.Core.User[]> userinf = new InstagramResponse <GlobusInstagramLib.App.Core.User[]>(); InstagramResponse <GlobusInstagramLib.App.Core.User[]> userinf1 = new InstagramResponse <GlobusInstagramLib.App.Core.User[]>(); InstagramResponse <InstagramMedia[]> userinf2 = new InstagramResponse <InstagramMedia[]>(); InstagramResponse <Comment[]> usercmts = new InstagramResponse <Comment[]>(); MediaController objMedia = new MediaController(); CommentController objComment = new CommentController(); LikesController objLikes = new LikesController(); InstagramFeedRepository objInsFeedRepo = new InstagramFeedRepository(); InstagramFeed objFeed = new InstagramFeed(); InstagramComment objinsComment = new InstagramComment(); InstagramCommentRepository objInsRepo = new InstagramCommentRepository(); // ArrayList aslt = objIns.getAllInstagramAccountsOfUser(instaid); string html = string.Empty; int i = 0; // string[] allhtmls = new string[aslt.Count]; string[] allhtmls = new string[0]; int countofimages = 0; GlobusInstagramLib.Instagram.Core.UsersMethods.Users userInstagram = new GlobusInstagramLib.Instagram.Core.UsersMethods.Users(); try { userinf2 = userInstagram.UserRecentMedia(objInsAccount.InstagramId, string.Empty, string.Empty, "20", string.Empty, string.Empty, objInsAccount.AccessToken); } catch (Exception ex) { logger.Error(ex.StackTrace); } if (userinf2 != null) { for (int j = 0; j < userinf2.data.Count(); j++) { try { usercmts = objComment.GetComment(userinf2.data[j].id, objInsAccount.AccessToken); bool liked = false; try { liked = objLikes.LikeToggle(userinf2.data[j].id, objInsAccount.InstagramId, objInsAccount.AccessToken); } catch (Exception ex) { logger.Error(ex.StackTrace); } int n = usercmts.data.Count(); for (int cmt = usercmts.data.Count() - 1; cmt > usercmts.data.Count() - 3; cmt--) { try { objinsComment.Comment = usercmts.data[cmt].text; objinsComment.CommentDate = usercmts.data[cmt].created_time.ToString(); objinsComment.CommentId = usercmts.data[cmt].id; objinsComment.EntryDate = DateTime.Now.ToString(); objinsComment.FeedId = userinf2.data[j].id; objinsComment.Id = Guid.NewGuid(); objinsComment.InstagramId = objInsAccount.InstagramId; objinsComment.UserId = objInsAccount.UserId; objinsComment.FromName = usercmts.data[cmt].from.full_name; objinsComment.FromProfilePic = usercmts.data[cmt].from.profile_picture; if (!objInsRepo.checkInstagramCommentExists(usercmts.data[cmt].id, objInsAccount.UserId)) { objInsRepo.addInstagramComment(objinsComment); } } catch (Exception ex) { logger.Error(ex.StackTrace); Console.WriteLine(ex.StackTrace); } } objFeed.EntryDate = DateTime.Now; objFeed.FeedDate = userinf2.data[j].created_time.ToString(); objFeed.FeedId = userinf2.data[j].id; objFeed.FeedImageUrl = userinf2.data[j].images.low_resolution.url.ToString(); objFeed.InstagramId = objInsAccount.InstagramId; objFeed.LikeCount = userinf2.data[j].likes.count; objFeed.UserId = objInsAccount.UserId; if (!objInsFeedRepo.checkInstagramFeedExists(userinf2.data[j].id, objInsAccount.UserId)) { objInsFeedRepo.addInstagramFeed(objFeed); } } catch (Exception ex) { logger.Error(ex.StackTrace); } i++; } } i++; string totalhtml = string.Empty; try { for (int k = 0; k < countofimages; k++) { totalhtml = totalhtml + allhtmls[k]; } } catch (Exception ex) { logger.Error(ex.StackTrace); } Session["AllHtmls"] = allhtmls; return(totalhtml); }
public DataSet bindFeedsIntoDataTable(User user, string network) { Messages mstable = new Messages(); DataSet ds = DataTableGenerator.CreateDataSetForTable(mstable); if (!string.IsNullOrEmpty(network)) { /*Facebook region*/ if (network == "facebook") { FacebookAccountRepository fbaccount = new FacebookAccountRepository(); FacebookMessageRepository fbmsg = new FacebookMessageRepository(); ArrayList alstfbaccount = fbaccount.getAllFacebookAccountsOfUser(user.Id); foreach (FacebookAccount item in alstfbaccount) { List <FacebookMessage> lstfbmsg = fbmsg.getAllFacebookMessagesOfUser(user.Id, item.FbUserId); foreach (FacebookMessage facebookmsg in lstfbmsg) { 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); } } } else if (network == "twitter") { TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository(); TwitterFeedRepository twtfeedrepo = new TwitterFeedRepository(); ArrayList alsttwtaccount = twtaccountrepo.getAllTwitterAccountsOfUser(user.Id); foreach (TwitterAccount item in alsttwtaccount) { List <TwitterFeed> lsttwtmsg = twtfeedrepo.getAllTwitterFeedOfUsers(user.Id, item.TwitterUserId); foreach (TwitterFeed twtmsg in lsttwtmsg) { ds.Tables[0].Rows.Add(twtmsg.ProfileId, "twitter", twtmsg.FromId, twtmsg.FromScreenName, twtmsg.FromProfileUrl, twtmsg.FeedDate, twtmsg.Feed, "", "", twtmsg.MessageId, twtmsg.Type); } } } else if (network == "linkedin") { LinkedInAccountRepository liaccountrepo = new LinkedInAccountRepository(); LinkedInFeedRepository lifeedrepo = new LinkedInFeedRepository(); ArrayList alstliaccount = liaccountrepo.getAllLinkedinAccountsOfUser(user.Id); foreach (LinkedInAccount item in alstliaccount) { List <LinkedInFeed> lsttwtmsg = lifeedrepo.getAllLinkedInFeedsOfUser(user.Id, item.LinkedinUserId); foreach (LinkedInFeed limsg in lsttwtmsg) { ds.Tables[0].Rows.Add(limsg.ProfileId, "linkedin", limsg.FromId, limsg.FromName, limsg.FromPicUrl, limsg.FeedsDate, limsg.Feeds, "", "", "", limsg.Type); } } } else if (network == "instagram") { InstagramAccountRepository insAccRepo = new InstagramAccountRepository(); InstagramFeedRepository insFeedRepo = new InstagramFeedRepository(); ArrayList alstlistaccount = insAccRepo.getAllInstagramAccountsOfUser(user.Id); foreach (InstagramAccount item in alstlistaccount) { List <InstagramFeed> lstFeeed = insFeedRepo.getAllInstagramFeedsOfUser(user.Id, item.InstagramId); foreach (InstagramFeed insFeed in lstFeeed) { ds.Tables[0].Rows.Add(insFeed.InstagramId, "instagram", "", "", "", insFeed.FeedDate, insFeed.FeedImageUrl, "", "", insFeed.FeedId, ""); } } } } return(ds); }
public void getIntagramImages(object instaId) { Guid instaid = (Guid)instaId; InstagramAccountRepository objIns = new InstagramAccountRepository(); InstagramResponse <GlobusInstagramLib.App.Core.User[]> userinf = new InstagramResponse <GlobusInstagramLib.App.Core.User[]>(); InstagramResponse <GlobusInstagramLib.App.Core.User[]> userinf1 = new InstagramResponse <GlobusInstagramLib.App.Core.User[]>(); InstagramResponse <InstagramMedia[]> userinf2 = new InstagramResponse <InstagramMedia[]>(); InstagramResponse <Comment[]> usercmts = new InstagramResponse <Comment[]>(); MediaController objMedia = new MediaController(); CommentController objComment = new CommentController(); LikesController objLikes = new LikesController(); InstagramFeedRepository objInsFeedRepo = new InstagramFeedRepository(); InstagramFeed objFeed = new InstagramFeed(); InstagramComment objinsComment = new InstagramComment(); InstagramCommentRepository objInsRepo = new InstagramCommentRepository(); GlobusInstagramLib.Authentication.ConfigurationIns configi = new GlobusInstagramLib.Authentication.ConfigurationIns("https://api.instagram.com/oauth/authorize/", ConfigurationManager.AppSettings["InstagramClientKey"].ToString(), ConfigurationManager.AppSettings["InstagramClientSec"].ToString(), ConfigurationManager.AppSettings["InstagramCallBackURL"].ToString(), "http://api.instagram.com/oauth/access_token", "https://api.instagram.com/v1/", ""); oAuthInstagram _api = oAuthInstagram.GetInstance(configi); ArrayList aslt = objIns.getAllInstagramAccountsOfUser(instaid); string html = string.Empty; int i = 0; // string[] allhtmls = new string[aslt.Count]; string[] allhtmls = new string[0]; int countofimages = 0; foreach (InstagramAccount item in aslt) { try { GlobusInstagramLib.Instagram.Core.UsersMethods.Users userInstagram = new GlobusInstagramLib.Instagram.Core.UsersMethods.Users(); try { userinf2 = userInstagram.UserRecentMedia(item.InstagramId, string.Empty, string.Empty, "20", string.Empty, string.Empty, item.AccessToken); } catch { } } catch { } if (userinf2 != null) { for (int j = 0; j < userinf2.data.Count(); j++) { try { usercmts = objComment.GetComment(userinf2.data[j].id, item.AccessToken); bool liked = false; try { liked = objLikes.LikeToggle(userinf2.data[j].id, item.InstagramId, item.AccessToken); } catch { } int n = usercmts.data.Count(); for (int cmt = 0; cmt < usercmts.data.Count(); cmt++) { objinsComment.Comment = usercmts.data[cmt].text; objinsComment.CommentDate = usercmts.data[cmt].created_time.ToString(); objinsComment.CommentId = usercmts.data[cmt].id; objinsComment.EntryDate = DateTime.Now.ToString(); objinsComment.FeedId = userinf2.data[j].id; objinsComment.Id = Guid.NewGuid(); objinsComment.InstagramId = item.InstagramId; objinsComment.UserId = item.UserId; objinsComment.FromName = usercmts.data[cmt].from.full_name; objinsComment.FromProfilePic = usercmts.data[cmt].from.profile_picture; if (!objInsRepo.checkInstagramCommentExists(usercmts.data[cmt].id, item.UserId)) { objInsRepo.addInstagramComment(objinsComment); } } objFeed.EntryDate = DateTime.Now; objFeed.FeedDate = userinf2.data[j].created_time.ToString(); objFeed.FeedId = userinf2.data[j].id; objFeed.FeedImageUrl = userinf2.data[j].images.low_resolution.url.ToString(); objFeed.InstagramId = item.InstagramId; objFeed.LikeCount = userinf2.data[j].likes.count; objFeed.UserId = item.UserId; if (!objInsFeedRepo.checkInstagramFeedExists(userinf2.data[j].id, item.UserId)) { objInsFeedRepo.addInstagramFeed(objFeed); } } catch { } i++; } } i++; // allhtmls[countofimages] = html; html = string.Empty; countofimages++; break; } string totalhtml = string.Empty; try { for (int k = 0; k < countofimages; k++) { totalhtml = totalhtml + allhtmls[k]; } } catch { } }
public string DeleteAllUsersByCreateDate(string date) { int i = 0; int count = 0; UserRepository objUserRepository = new UserRepository(); List <User> lstuser = objUserRepository.GetAllUsersByCreateDate(date); ArchiveMessageRepository objArchiveMessageRepository = new ArchiveMessageRepository(); DiscoverySearchRepository objDiscoverySearchRepository = new DiscoverySearchRepository(); DraftsRepository objDraftsRepository = new DraftsRepository(); FacebookAccountRepository objFacebookAccountRepository = new FacebookAccountRepository(); FacebookFeedRepository objFacebookFeedRepository = new FacebookFeedRepository(); FacebookInsightPostStatsRepository objFacebookInsightPostStatsRepository = new FacebookInsightPostStatsRepository(); FacebookInsightStatsRepository objFacebookInsightStatsRepository = new FacebookInsightStatsRepository(); FacebookMessageRepository objFacebookMessageRepository = new FacebookMessageRepository(); FacebookStatsRepository objFacebookStatsRepository = new FacebookStatsRepository(); GoogleAnalyticsAccountRepository objGoogleAnalyticsAccountRepository = new GoogleAnalyticsAccountRepository(); GoogleAnalyticsStatsRepository objGoogleAnalyticsStatsRepository = new GoogleAnalyticsStatsRepository(); GooglePlusAccountRepository objGooglePlusAccountRepository = new GooglePlusAccountRepository(); GooglePlusActivitiesRepository objGooglePlusActivitiesRepository = new GooglePlusActivitiesRepository(); GroupProfileRepository objGroupProfileRepository = new GroupProfileRepository(); GroupRepository objGroupRepository = new GroupRepository(); InstagramAccountRepository objInstagramAccountRepository = new InstagramAccountRepository(); InstagramCommentRepository objInstagramCommentRepository = new InstagramCommentRepository(); InstagramFeedRepository objInstagramFeedRepository = new InstagramFeedRepository(); LinkedInAccountRepository objLinkedInAccountRepository = new LinkedInAccountRepository(); LinkedInFeedRepository objLinkedInFeedRepository = new LinkedInFeedRepository(); LogRepository objLogRepository = new LogRepository(); RssFeedsRepository objRssFeedsRepository = new RssFeedsRepository(); RssReaderRepository objRssReaderRepository = new RssReaderRepository(); ScheduledMessageRepository objScheduledMessageRepository = new ScheduledMessageRepository(); SocialProfilesRepository objSocialProfilesRepository = new SocialProfilesRepository(); TaskCommentRepository objTaskCommentRepository = new TaskCommentRepository(); TaskRepository objTaskRepository = new TaskRepository(); TeamRepository objTeamRepository = new TeamRepository(); TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository(); TwitterAccountRepository objTwitterAccountRepository = new TwitterAccountRepository(); TwitterDirectMessageRepository objTwitterDirectMessageRepository = new TwitterDirectMessageRepository(); TwitterFeedRepository objTwitterFeedRepository = new TwitterFeedRepository(); TwitterMessageRepository objTwitterMessageRepository = new TwitterMessageRepository(); TwitterStatsRepository objTwitterStatsRepository = new TwitterStatsRepository(); UserActivationRepository objUserActivationRepository = new UserActivationRepository(); UserPackageRelationRepository objUserPackageRelationRepository = new UserPackageRelationRepository(); count = lstuser.Count(); foreach (var item in lstuser) { i++; try { if (item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**") { } else { objArchiveMessageRepository.DeleteArchiveMessageByUserid(item.Id); objDiscoverySearchRepository.DeleteDiscoverySearchByUserid(item.Id); objDraftsRepository.DeleteDraftsByUserid(item.Id); objFacebookAccountRepository.DeleteFacebookAccountByUserid(item.Id); objFacebookFeedRepository.DeleteFacebookFeedByUserid(item.Id); objFacebookInsightPostStatsRepository.DeleteFacebookInsightPostStatsByUserid(item.Id); objFacebookInsightStatsRepository.DeleteFacebookInsightStatsByUserid(item.Id); objFacebookMessageRepository.DeleteFacebookMessageByUserid(item.Id); objFacebookStatsRepository.DeleteFacebookStatsByUserid(item.Id); objGoogleAnalyticsAccountRepository.DeleteGoogleAnalyticsAccountByUserid(item.Id); objGoogleAnalyticsStatsRepository.DeleteGoogleAnalyticsStatsByUserid(item.Id); objGooglePlusAccountRepository.DeleteGooglePlusAccountByUserid(item.Id); objGooglePlusActivitiesRepository.DeleteGooglePlusActivitiesByUserid(item.Id); objGroupProfileRepository.DeleteGroupProfileByUserid(item.Id); objGroupRepository.DeleteGroupsByUserid(item.Id); objInstagramAccountRepository.DeleteInstagramAccountByUserid(item.Id); objInstagramCommentRepository.DeleteInstagramCommentByUserid(item.Id); objInstagramFeedRepository.DeleteInstagramFeedByUserid(item.Id); objLinkedInAccountRepository.DeleteLinkedInAccountByUserid(item.Id); objLinkedInFeedRepository.DeleteLinkedInFeedByUserid(item.Id); objLogRepository.DeleteLogByUserid(item.Id); objRssFeedsRepository.DeleteRssFeedsByUserid(item.Id); objRssReaderRepository.DeleteRssReaderByUserid(item.Id); objScheduledMessageRepository.DeleteScheduledMessageByUserid(item.Id); objSocialProfilesRepository.DeleteSocialProfileByUserid(item.Id); objTaskCommentRepository.DeleteTaskCommentByUserid(item.Id); objTaskRepository.DeleteTasksByUserid(item.Id); objTeamRepository.DeleteTeamByUserid(item.Id); objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(item.Id); objTwitterAccountRepository.DeleteTwitterAccountByUserid(item.Id); objTwitterDirectMessageRepository.DeleteTwitterDirectMessagesByUserid(item.Id); objTwitterFeedRepository.DeleteTwitterFeedByUserid(item.Id); objTwitterMessageRepository.DeleteTwitterMessageByUserid(item.Id); objTwitterStatsRepository.DeleteTwitterStatsByUserid(item.Id); objUserActivationRepository.DeleteUserActivationByUserid(item.Id); objUserPackageRelationRepository.DeleteuserPackageRelationByUserid(item.Id); objUserRepository.DeleteUserByUserid(item.Id); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } return(i + " " + count); }