Skip to content

Commit

Permalink
Socioboard3.0 Update
Browse files Browse the repository at this point in the history
Socioboard3.0 Update
  • Loading branch information
swetasb committed Nov 6, 2017
1 parent 615cf37 commit e14e5ec
Show file tree
Hide file tree
Showing 277 changed files with 411,413 additions and 634 deletions.
Binary file modified .vs/Socioboard/v14/.suo
Binary file not shown.
26 changes: 25 additions & 1 deletion src/Api.Socioboard/Controllers/ContentStudioController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public IActionResult GetYTAdvanceSearchData(Domain.Socioboard.Enum.NetworkType n
}


[HttpGet("GetAdvanceSearchFlickerData")]
[HttpGet("GetAdvanceSearchFlickerData")]
public IActionResult GetAdvanceSearchFlickerData(Domain.Socioboard.Enum.NetworkType network, int skip, int count)
{
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
Expand All @@ -115,6 +115,30 @@ public IActionResult GetAdvanceSearchFlickerData(Domain.Socioboard.Enum.NetworkT
}
}

[HttpGet("GetAdvanceSerachInstagramData")]
public IActionResult GetAdvanceSerachInstagramData(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.InstagramAdvanceSerachData(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);
}
}


[HttpGet("GetSortByData")]
public IActionResult GetSortByData(string sortType, int skip, int count)
Expand Down
8 changes: 8 additions & 0 deletions src/Api.Socioboard/Controllers/TwitterController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -457,5 +457,13 @@ public IActionResult TwitterMentions(string profileId)
List<Domain.Socioboard.Models.TwitterMentionSugg> lstMentionSugg = Helper.TwitterHelper.TwitterMentionBased(profileId, dbr, _logger, _redisCache, _appSettings);
return Ok(lstMentionSugg);
}
[HttpGet("TwitterConversation")]
public IActionResult TwitterConversation(string profileId)
{
DatabaseRepository dbr = new Model.DatabaseRepository(_logger, _appEnv);
List<Domain.Socioboard.Models.TwitterMentionSugg> lstConveSugg = Helper.TwitterHelper.TwitterConversation(profileId, dbr, _logger, _redisCache, _appSettings);
return Ok(lstConveSugg);
}

}
}
5 changes: 3 additions & 2 deletions src/Api.Socioboard/Helper/ScheduleMessageHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ public static string ScheduleMessage(string profileId, string socialprofileName,
{


ScheduledMessage scheduledMessage = new ScheduledMessage();
scheduledMessage.calendertime = Convert.ToDateTime(localscheduletime);
ScheduledMessage scheduledMessage = new ScheduledMessage();
//scheduledMessage.calendertime = Convert.ToDateTime(localscheduletime); error coming so change
scheduledMessage.calendertime = DateTime.Today;
scheduledMessage.shareMessage = shareMessage;
string userlocalscheduletime = localscheduletime;
try
Expand Down
69 changes: 69 additions & 0 deletions src/Api.Socioboard/Helper/TwitterHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using Socioboard.Twitter.Twitter.Core.UserMethods;
using Socioboard.Twitter.Twitter.Core.FollowersMethods;
using Socioboard.Twitter.Twitter.Core.TimeLineMethods;
using Socioboard.Twitter.Twitter.Core.DirectMessageMethods;

namespace Api.Socioboard.Helper
{
Expand Down Expand Up @@ -876,6 +877,74 @@ public static Domain.Socioboard.Models.TwitterFriendRelation TwitterFrindsRelati
return null;
}
}
public static List<Domain.Socioboard.Models.TwitterMentionSugg> TwitterConversation(string profileId, Model.DatabaseRepository dbr, ILogger _logger, Helper.Cache _redisCache, Helper.AppSettings _appSettings)
{
List<Domain.Socioboard.Models.TwitterMentionSugg> lstConveUsers = new List<TwitterMentionSugg>();
Domain.Socioboard.Models.TwitterAccount twtacc = new Domain.Socioboard.Models.TwitterAccount();
Domain.Socioboard.Models.TwitterAccount imtwtacc = _redisCache.Get<Domain.Socioboard.Models.TwitterAccount>(Domain.Socioboard.Consatants.SocioboardConsts.CacheTwitterAccount + profileId);
if (imtwtacc == null)
{
twtacc = dbr.Find<Domain.Socioboard.Models.TwitterAccount>(t => t.twitterUserId.Equals(profileId)).FirstOrDefault();
if (twtacc != null)
{
_redisCache.Set(Domain.Socioboard.Consatants.SocioboardConsts.CacheTwitterAccount + profileId, twtacc);
}
}
else
{
twtacc = imtwtacc;
}
oAuthTwitter oAuth = new oAuthTwitter(_appSettings.twitterConsumerKey, _appSettings.twitterConsumerScreatKey, _appSettings.twitterRedirectionUrl);
oAuth.AccessToken = twtacc.oAuthToken;
oAuth.AccessTokenSecret = twtacc.oAuthSecret;
oAuth.TwitterScreenName = twtacc.twitterScreenName;
oAuth.TwitterUserId = twtacc.twitterUserId;
DirectMessage timeline_obj = new DirectMessage();
List<string> tempScreenNames = new List<string>();
try
{
JArray jMentionResp = timeline_obj.Get_Direct_Messages(oAuth, 100);
if (jMentionResp == null)
{
return null;
}
else
{
foreach (var items in jMentionResp)
{
Domain.Socioboard.Models.TwitterMentionSugg _objLstData = new Domain.Socioboard.Models.TwitterMentionSugg();

_objLstData.postId = items["id_str"].ToString();
_objLstData.textMsg = items["sender"]["description"].ToString();
_objLstData.fromName = items["sender"]["name"].ToString();
_objLstData.fromScreenName = items["sender"]["screen_name"].ToString();
_objLstData.fromLocation = items["sender"]["location"].ToString();
if (_objLstData.fromLocation == "")
{
_objLstData.fromLocation = "NA";
}
_objLstData.fromFollowers = items["sender"]["followers_count"].ToString();
_objLstData.fromFollowing = items["sender"]["friends_count"].ToString();
_objLstData.fromProfilePic = items["sender"]["profile_image_url_https"].ToString();
_objLstData.fromProfileLinkUrl = "https://twitter.com/" + _objLstData.fromScreenName;
_objLstData.postLinkUrl = "https://twitter.com/SB/status/" + _objLstData.postId;
if (!tempScreenNames.Contains(_objLstData.fromScreenName))
{
lstConveUsers.Add(_objLstData);
}
tempScreenNames.Add(_objLstData.fromScreenName);
}
}
return lstConveUsers.ToList();
}
catch (Exception ex)
{
_logger.LogError("error finding friendship relation" + ex.StackTrace);
_logger.LogError("error finding friendship relation" + ex.Message);
return null;
}
}


}
}
24 changes: 24 additions & 0 deletions src/Api.Socioboard/Repositories/ContentStudioRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,30 @@ public class ContentStudioRepository
return null;
}

public static List<Domain.Socioboard.Models.Mongo.AdvanceSerachData> InstagramAdvanceSerachData(Domain.Socioboard.Enum.NetworkType networkType, Helper.Cache _redisCache, Helper.AppSettings settings)
{

MongoRepository _RssRepository = new MongoRepository("AdvanceSerachData", settings);
var builder = Builders<AdvanceSerachData>.Sort;
var sort = builder.Descending(t => t.postedTime);
var result = _RssRepository.FindWithRange<AdvanceSerachData>(t => t.networkType == networkType, sort, 0, 200);
var task = Task.Run(async () =>
{
return await result;
});

IList<AdvanceSerachData> lstflicker = task.Result.ToList();
lstflicker = lstflicker.OrderByDescending(kt => kt.postedTime).ToList();

if (lstflicker != null)
{
//_redisCache.Set(Domain.Socioboard.Consatants.SocioboardConsts.CacheTwitterRecent100Feeds + profileId, lstFbFeeds.ToList());

return lstflicker.ToList();
}
return null;
}

public static List<Domain.Socioboard.Models.Mongo.AdvanceSerachData> FlickerAdvanceSerachData(Domain.Socioboard.Enum.NetworkType networkType, Helper.Cache _redisCache, Helper.AppSettings settings)
{

Expand Down
37 changes: 19 additions & 18 deletions src/Api.Socioboard/Repositories/FacebookRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1672,27 +1672,28 @@ public static List<MongoFbPostComment> FbPostComments(string postid, string Acce
return await result;
});
IList<Domain.Socioboard.Models.Mongo.MongoFacebookFeed> lstFbFeeds = task.Result;
var sortt = lstFbFeeds.OrderByDescending(t => Convert.ToDateTime(t.EntryDate));
foreach (var item in sortt.ToList())
//var sortt = lstFbFeeds.OrderByDescending(t => Convert.ToDateTime(t.EntryDate));
foreach (var item in lstFbFeeds)//sortt.ToList())
{
Domain.Socioboard.Models.Mongo.facebookfeed _intafeed = new Domain.Socioboard.Models.Mongo.facebookfeed();
MongoRepository mongorepocomment = new MongoRepository("MongoFbPostComment", settings);
var buildecommentr = Builders<Domain.Socioboard.Models.Mongo.MongoFbPostComment>.Sort;
var sortcomment = buildecommentr.Descending(t => t.Likes);
var resultcomment = mongorepocomment.FindWithRange<Domain.Socioboard.Models.Mongo.MongoFbPostComment>(t => t.PostId == item.FeedId && (!t.CommentId.Contains("{")), sortcomment, 0, 50);
var taskcomment = Task.Run(async () =>
{
return await resultcomment;
});
IList<Domain.Socioboard.Models.Mongo.MongoFbPostComment> lstFbPostComment = taskcomment.Result;
lstFbPostComment = lstFbPostComment.OrderByDescending(t => t.Commentdate).ToList();
item.Commentcount = lstFbPostComment.Count.ToString();
foreach(var commentItems in lstFbPostComment)
{
commentItems.Commentdate = Convert.ToDateTime(commentItems.Commentdate).AddMinutes(330).ToString();
}
//MongoRepository mongorepocomment = new MongoRepository("MongoFbPostComment", settings);
//var buildecommentr = Builders<Domain.Socioboard.Models.Mongo.MongoFbPostComment>.Sort;
//var sortcomment = buildecommentr.Descending(t => t.Likes);
//var resultcomment = mongorepocomment.FindWithRange<Domain.Socioboard.Models.Mongo.MongoFbPostComment>(t => t.PostId == item.FeedId && (!t.CommentId.Contains("{")), sortcomment, 0, 50);
//var taskcomment = Task.Run(async () =>
//{
// return await resultcomment;
//});
//IList<Domain.Socioboard.Models.Mongo.MongoFbPostComment> lstFbPostComment = taskcomment.Result;
//lstFbPostComment = lstFbPostComment.OrderByDescending(t => t.Commentdate).ToList();
//item.Commentcount = lstFbPostComment.Count.ToString();
//foreach(var commentItems in lstFbPostComment)
//{
// commentItems.Commentdate = Convert.ToDateTime(commentItems.Commentdate).AddMinutes(330).ToString();
//}

_intafeed._facebookFeed = item;
_intafeed._facebookComment = lstFbPostComment.ToList();
// _intafeed._facebookComment = lstFbPostComment.ToList();
lstfacebookfeed.Add(_intafeed);
}
return lstfacebookfeed;
Expand Down
1 change: 1 addition & 0 deletions src/Api.Socioboard/Repositories/ShareathonRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ public static string AddFacebookFeedShareDetail(long userId, string socialProfil
_facebookfeedsShare.pageId = FacebookPageId;
_facebookfeedsShare.socialProfiles = socialProfile;
_facebookfeedsShare.socialmedia = socialmedia;
_facebookfeedsShare.scheduleTime = DateTime.UtcNow;
var ret = _fbFeedShareRepository.Find<Domain.Socioboard.Models.Mongo.FacebookPageFeedShare>(t => t.pageId == FacebookPageId && t.socialProfiles == socialProfile);
var task = Task.Run(async () =>
{
Expand Down
2 changes: 1 addition & 1 deletion src/Api.Socioboard/Repositories/TwitterRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ public static string DeleteProfile(Model.DatabaseRepository dbr, string profileI
{
MongoRepository mongorepo = new MongoRepository("MongoTwitterFeed", settings);
var builder = Builders<MongoTwitterFeed>.Sort;
var sort = builder.Descending(t => t.feedDate);
var sort = builder.Descending(t => t.feedTimeStamp);
var result = mongorepo.FindWithRange<MongoTwitterFeed>(t => t.profileId.Equals(profileId), sort, 0, 100);
var task = Task.Run(async () =>
{
Expand Down
Binary file modified src/Api.Socioboard/bin/Debug/net451/Api.Socioboard.exe
Binary file not shown.
Binary file modified src/Api.Socioboard/bin/Debug/net451/Api.Socioboard.pdb
Binary file not shown.
Loading

0 comments on commit e14e5ec

Please sign in to comment.