public void getFanPost(string pageId, Guid UserId, int days) { string strStories = "https://graph.facebook.com/" + pageId + "/feed"; FacebookClient fb = new FacebookClient(); FacebookAccountRepository fbAccRepo = new FacebookAccountRepository(); FacebookAccount acc = fbAccRepo.getUserDetails(pageId); fb.AccessToken = acc.AccessToken; JsonObject outputreg = (JsonObject)fb.Get(strStories); JArray data = (JArray)JsonConvert.DeserializeObject(outputreg["data"].ToString()); FacebookInsightPostStats objFbiPost = new FacebookInsightPostStats(); FacebookInsightPostStatsRepository objfbiPostRepo = new FacebookInsightPostStatsRepository(); foreach (var item in data) { try { objFbiPost.Id = Guid.NewGuid(); objFbiPost.EntryDate = DateTime.Now; objFbiPost.PageId = pageId; try { objFbiPost.PostMessage = item["story"].ToString(); } catch (Exception Err) { objFbiPost.PostMessage = item["message"].ToString(); } objFbiPost.PostDate = item["created_time"].ToString(); JArray arrComment = (JArray)item["comment"]; if (arrComment != null) objFbiPost.PostComments = arrComment.Count; else objFbiPost.PostComments = 0; objFbiPost.PostId = item["id"].ToString(); objFbiPost.UserId = UserId; if (!objfbiPostRepo.checkFacebookInsightPostStatsExists(pageId, item["id"].ToString(), UserId, item["created_time"].ToString())) objfbiPostRepo.addFacebookInsightPostStats(objFbiPost); else objfbiPostRepo.updateFacebookInsightPostStats(objFbiPost); } catch (Exception ex) { Console.WriteLine(ex.Message); } } }
public string getPostDetails(string fbUserId, Guid UserId, int days) { try { string strlocation = string.Empty; string strcount = string.Empty; string previousDate = string.Empty; FacebookInsightPostStatsRepository objfbiRepo = new FacebookInsightPostStatsRepository(); ArrayList arrList = objfbiRepo.getFacebookInsightPostStatsById(fbUserId, UserId, days); string fanpost = string.Empty; foreach (var item in arrList) { Array temp = (Array)item; fanpost = fanpost + "<div class=\"message-sent-table\" ><div class=\"labe-1\">" + temp.GetValue(3) + "</div>" + "<div class=\"labe-4\">" + temp.GetValue(4) + "</div><div class=\"labe-5\">" + temp.GetValue(5) + "</div><div class=\"labe-6\">" + temp.GetValue(6) + "</div><div class=\"labe-5\">" + temp.GetValue(5) + "</div></div>"; } return fanpost; } catch (Exception Err) { Console.Write(Err.StackTrace); return null; } }
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; }