public IActionResult GetLatestFeeds(string profileId, long userId, int skip, int count, string date) { DateTime lastfeeddate = Convert.ToDateTime(date); DateTime currentdate = DateTime.UtcNow; //Int32 unixTimestamp= Convert.ToInt32(date); List <Domain.Socioboard.Models.Mongo.facebookfeed> lstfacebookfeed = new List <Domain.Socioboard.Models.Mongo.facebookfeed>(); MongoRepository mongorepo = new MongoRepository("MongoFacebookFeed", _appSettings); var builder = Builders <Domain.Socioboard.Models.Mongo.MongoFacebookFeed> .Sort; var sort = builder.Descending(t => t.EntryDate); var result = mongorepo.FindWithRange <Domain.Socioboard.Models.Mongo.MongoFacebookFeed>(t => t.ProfileId.Equals(profileId), sort, skip, count); var task = Task.Run(async() => { return(await result); }); IList <Domain.Socioboard.Models.Mongo.MongoFacebookFeed> lstFbFeeds = task.Result; List <Domain.Socioboard.Models.Mongo.LatestFacebookFeed> lstlatestfeed = new List <Domain.Socioboard.Models.Mongo.LatestFacebookFeed>(); lstlatestfeed = lstFbFeeds.Select(x => new LatestFacebookFeed() { EntryDate = Convert.ToDateTime(x.EntryDate), FeedDescription = x.FeedDescription, FeedDate = x.FeedDate, ProfileId = x.ProfileId, FromId = x.FromId, FromName = x.FromName, FromProfileUrl = x.FromProfileUrl, Type = x.Type, FbComment = x.FbComment, FbLike = x.FbLike, FeedId = x.FeedId, ReadStatus = x.ReadStatus, Picture = x.Picture, Positive = x.Positive, Negative = x.Negative, Commentcount = x.Commentcount, Likecount = x.Likecount, postType = x.postType, postingFrom = x.postingFrom, _facebookComment = x._facebookComment }).ToList(); lstlatestfeed = lstlatestfeed.FindAll(t => t.EntryDate > lastfeeddate && t.EntryDate <= currentdate).ToList(); return(Ok(lstlatestfeed.ToList())); }
public IActionResult GetTopCompanyPagePosts(string pageId, long userId, int skip, int count) { if (skip + count < 100) { DatabaseRepository dbr = new DatabaseRepository(_logger, _env); return(Ok(Repositories.LinkedInAccountRepository.GetTopCompanyPagePosts(pageId, userId, _redisCache, _appSettings, dbr, skip, count))); } else { DatabaseRepository dbr = new DatabaseRepository(_logger, _env); MongoRepository _linkedincompanypagereppo = new MongoRepository("LinkedinCompanyPagePosts", _appSettings); var builder = Builders <Domain.Socioboard.Models.Mongo.LinkedinCompanyPagePosts> .Sort; var sort = builder.Descending(t => t.PostDate); var ret = _linkedincompanypagereppo.FindWithRange <Domain.Socioboard.Models.Mongo.LinkedinCompanyPagePosts>(t => t.PageId.Equals(pageId), sort, 0, 100); var task = Task.Run(async() => { return(await ret); }); List <Domain.Socioboard.Models.Mongo.LinkedinCompanyPagePosts> lstCompanyPagePosts = task.Result.ToList(); Domain.Socioboard.Models.LinkedInData _LinkedInData = new Domain.Socioboard.Models.LinkedInData(); _LinkedInData._LinkedinCompanyPage = Repositories.LinkedInAccountRepository.getLinkedinCompanyPage(pageId, _redisCache, dbr); _LinkedInData._LinkedinCompanyPagePosts = lstCompanyPagePosts; return(Ok(_LinkedInData)); } }
public IActionResult GetAdvanceSearchFlickerData(Domain.Socioboard.Enum.NetworkType network, int skip, int count) { DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv); skip = 0; MongoRepository mongorepo = new MongoRepository("AdvanceSerachData", _appSettings); if (skip + count < 100) { return(Ok(Repositories.ContentStudioRepository.FlickerAdvanceSerachData(network, _redisCache, _appSettings).Skip(skip).Take(count))); } else { var builder = Builders <Domain.Socioboard.Models.Mongo.AdvanceSerachData> .Sort; var sort = builder.Descending(t => t.totalShareCount); var result = mongorepo.FindWithRange <Domain.Socioboard.Models.Mongo.AdvanceSerachData>(t => t.networkType.Equals(network), sort, skip, count); var task = Task.Run(async() => { return(await result); }); IList <Domain.Socioboard.Models.Mongo.AdvanceSerachData> lstTwitterFeeds = task.Result; return(Ok(lstTwitterFeeds)); } }
public IActionResult getRssNewsFeedsPost(string userId, int skip, int count) { DatabaseRepository dbr = new DatabaseRepository(_logger, _env); if (count < 100) { return(Ok(Repositories.RssNewsContentsRepository.GetRssNewsPostedFeeds(userId, _redisCache, _appSettings).Skip(skip).Take(count))); } else { MongoRepository mongorepo = new MongoRepository("RssNewsContentsFeeds", _appSettings); var builder = Builders <Domain.Socioboard.Models.Mongo.RssNewsContentsFeeds> .Sort; var sort = builder.Descending(t => t.PublishingDate); var result = mongorepo.FindWithRange <Domain.Socioboard.Models.Mongo.RssNewsContentsFeeds>(t => t.UserId.Equals(userId), sort, skip, count); var task = Task.Run(async() => { return(await result); }); IList <Domain.Socioboard.Models.Mongo.RssNewsContentsFeeds> lstcontentFeeds = task.Result; return(Ok(lstcontentFeeds)); } // lstRss = lstRss.Where(t => !string.IsNullOrEmpty(t.Message)).ToList(); //return Ok(lstRss); }
public IActionResult Notifications(long groupId, long userId, int skip, int count) { DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv); List <int> alldata = new List <int>(); List <Domain.Socioboard.Models.Groupprofiles> lstGrpProfiles = Repositories.GroupProfilesRepository.getAllGroupProfiles(groupId, _redisCache, dbr); List <Domain.Socioboard.Models.Mongo.MongoTwitterMessage> lstTwtMessages = new List <Domain.Socioboard.Models.Mongo.MongoTwitterMessage>(); List <Domain.Socioboard.Models.Mongo.MongoTwitterMessage> TwtMessages = new List <Domain.Socioboard.Models.Mongo.MongoTwitterMessage>(); foreach (var item in lstGrpProfiles.Where(t => t.profileType == Domain.Socioboard.Enum.SocialProfileType.Twitter)) { MongoRepository mongorepo = new MongoRepository("MongoTwitterMessage", _appSettings); var builder = Builders <Domain.Socioboard.Models.Mongo.MongoTwitterMessage> .Sort; var sort = builder.Descending(t => t.messageDate); var result = mongorepo.FindWithRange <Domain.Socioboard.Models.Mongo.MongoTwitterMessage>(t => t.profileId.Equals(item.profileId) && (t.type == Domain.Socioboard.Enum.TwitterMessageType.TwitterMention || t.type == Domain.Socioboard.Enum.TwitterMessageType.TwitterRetweet || t.type == Domain.Socioboard.Enum.TwitterMessageType.TwitterFollower || t.type == Domain.Socioboard.Enum.TwitterMessageType.TwitterUsertweet), sort, skip, count); var task = Task.Run(async() => { return(await result); }); IList <Domain.Socioboard.Models.Mongo.MongoTwitterMessage> lstTwitterTweets = task.Result; TwtMessages = lstTwitterTweets.Where(t => t.type == Domain.Socioboard.Enum.TwitterMessageType.TwitterUsertweet).ToList(); if (lstTwitterTweets != null) { lstTwtMessages.AddRange(lstTwitterTweets); } var d = lstTwitterTweets.Count; } int posttext = TwtMessages.FindAll(t => t.twitterMsg != null && t.mediaUrl == null && !t.twitterMsg.Contains("http") || !t.twitterMsg.Contains("https") || !t.twitterMsg.Contains("www.") || !t.twitterMsg.Contains("http://") || !t.twitterMsg.Contains("https://") || !t.twitterMsg.Contains("www.")).Count; int mediapost = TwtMessages.FindAll(t => t.mediaUrl != null).Count; int linkpost = TwtMessages.FindAll(t => t.twitterMsg.Contains("http") || t.twitterMsg.Contains("https") || t.twitterMsg.Contains("www.") || t.twitterMsg.Contains("http://") || t.twitterMsg.Contains("https://") || t.twitterMsg.Contains("www.")).Count; int mentions = lstTwtMessages.FindAll(t => t.type == Domain.Socioboard.Enum.TwitterMessageType.TwitterMention).Count; int retweet = lstTwtMessages.FindAll(t => t.type == Domain.Socioboard.Enum.TwitterMessageType.TwitterRetweet).Count; // || t.twitterMsg.Contains("https") || t.twitterMsg.Contains("www.") || t.twitterMsg.Contains("http://") || t.twitterMsg.Contains("https://") || t.twitterMsg.Contains("www.") alldata.Add(mentions); alldata.Add(retweet); List <Domain.Socioboard.Models.Mongo.MongoTwitterDirectMessages> lstTwtMessagess = new List <Domain.Socioboard.Models.Mongo.MongoTwitterDirectMessages>(); foreach (var item in lstGrpProfiles.Where(t => t.profileType == Domain.Socioboard.Enum.SocialProfileType.Twitter)) { MongoRepository mongorepoDm = new MongoRepository("MongoTwitterDirectMessages", _appSettings); var builder = Builders <Domain.Socioboard.Models.Mongo.MongoTwitterDirectMessages> .Sort; var sort = builder.Descending(t => t.entryDate); var result = mongorepoDm.FindWithRange <Domain.Socioboard.Models.Mongo.MongoTwitterDirectMessages>(t => t.profileId.Equals(item.profileId) && (t.type == Domain.Socioboard.Enum.TwitterMessageType.TwitterDirectMessageReceived || t.type == Domain.Socioboard.Enum.TwitterMessageType.TwitterDirectMessageSent), sort, skip, count); var task = Task.Run(async() => { return(await result); }); IList <Domain.Socioboard.Models.Mongo.MongoTwitterDirectMessages> lstTwitterdm = task.Result; if (lstTwitterdm != null) { lstTwtMessagess.AddRange(lstTwitterdm); } } int dmrecived = lstTwtMessagess.FindAll(t => t.type == Domain.Socioboard.Enum.TwitterMessageType.TwitterDirectMessageReceived).Count; int dmsend = lstTwtMessagess.FindAll(t => t.type == Domain.Socioboard.Enum.TwitterMessageType.TwitterDirectMessageSent).Count; alldata.Add(dmrecived); alldata.Add(dmsend); alldata.Add(posttext); alldata.Add(mediapost); alldata.Add(linkpost); return(Ok(alldata)); }
public static List <Domain.Socioboard.Models.Listening.FaceBookGroupPost> GetFacebookGroupFeeds(string keyword, int skip, int count, Helper.Cache _redisCache, Helper.AppSettings _appSettings) { //List<Domain.Socioboard.Models.Listening.FacebookGroupPost> iMmemFacebookGroupPost = _redisCache.Get<List<Domain.Socioboard.Models.Listening.FacebookGroupPost>>(Domain.Socioboard.Consatants.SocioboardConsts.CacheDiscoveryFacebookGroupPost + keyword); //if (iMmemFacebookGroupPost != null && iMmemFacebookGroupPost.Count > 0) //{ // return iMmemFacebookGroupPost; //} //else //{ MongoRepository mongorepo = new MongoRepository("FaceBookGroupPost", _appSettings); MongoRepository mongoreppo = new MongoRepository("GroupPostKeyWords", _appSettings); var builder = Builders <Domain.Socioboard.Models.Listening.FaceBookGroupPost> .Sort; var sort = builder.Descending(t => t.DateTimeOfPost); var result = mongorepo.FindWithRange <Domain.Socioboard.Models.Listening.FaceBookGroupPost>(t => t.Message.Contains(keyword), sort, skip, count); //var result = mongorepo.FindAll<Domain.Socioboard.Models.Listening.FaceBookGroupPost>(); var task = Task.Run(async() => { return(await result); }); IList <Domain.Socioboard.Models.Listening.FaceBookGroupPost> lstFbFeeds = task.Result; for (int i = 0; i < lstFbFeeds.Count; i++) { // lstFbFeeds[i].Message = lstFbFeeds[i].Message.Replace("%20"," ").Replace("21%", " ").Replace("2%"," ").Replace("\n"," ").Replace("%3F"," ").Replace("% 21"," "); //lstFbFeeds[i].Message = Regex.Replace(lstFbFeeds[i].Message,"[%21%27%21%22]"," "); lstFbFeeds[i].Message = lstFbFeeds[i].Message.Replace("\\n", " ").Replace("\\r", " "); lstFbFeeds[i].Message = HttpUtility.UrlDecode(lstFbFeeds[i].Message); } //foreach(IList<Domain.Socioboard.Models.Listening.FaceBookGroupPost> lstFbFeedss in lstFbFeeds) // { // lstFbFeedss.First().Message= lstFbFeedss.First().Message.Replace("%", ""); // //lstFbFeeds.FirstOrDefault().Message = lstFbFeeds.FirstOrDefault().Message.Replace("%", ""); // } //lstFbFeeds.find.Message = lstFbFeeds.First().Message.Replace("%", ""); //lstFbFeeds.FirstOrDefault().Message= lstFbFeeds.FirstOrDefault().Message.Replace("%", ""); //for (int i = 0; i < lstFbFeeds.Count; i++) //{ // //string data = lstFbFeeds[i].Message; // lstFbFeeds.First().Message = lstFbFeeds.First().Message.Replace("%", ""); //} //foreach(IList<Domain.Socioboard.Models.Listening.FaceBookGroupPost> acc in lstFbFeeds) //{ // foreach(object mess in acc) // { // string message = mess.ToString(); // } //} //List<FacebookGroupPostRepository> lists = new List<FacebookGroupPostRepository>(); if (lstFbFeeds.Count > 0) { // _redisCache.Set(Domain.Socioboard.Consatants.SocioboardConsts.CacheDiscoveryFacebookGroupPost + keyword, lstFbFeeds.ToList()); } Domain.Socioboard.Models.Mongo.GroupPostKeyWords _GroupPostKeyWords = new Domain.Socioboard.Models.Mongo.GroupPostKeyWords(); _GroupPostKeyWords.id = ObjectId.GenerateNewId(); _GroupPostKeyWords.strId = ObjectId.GenerateNewId().ToString(); _GroupPostKeyWords.keyword = keyword; _GroupPostKeyWords.createdTime = Domain.Socioboard.Helpers.SBHelper.ConvertToUnixTimestamp(DateTime.UtcNow); var retkeyword = mongoreppo.Find <Domain.Socioboard.Models.Mongo.GroupPostKeyWords>(t => t.keyword.Contains(keyword)); var taskkeyword = Task.Run(async() => { return(await retkeyword); }); int countkeyword = taskkeyword.Result.Count; if (count < 1) { mongoreppo.Add <Domain.Socioboard.Models.Mongo.GroupPostKeyWords>(_GroupPostKeyWords); } lstFbFeeds.Select(s => { s.Message = WebUtility.HtmlDecode(s.Message); return(s); }).ToList(); return(lstFbFeeds.ToList()); //} }