Skip to content

Commit

Permalink
Socioboard 3.0.51
Browse files Browse the repository at this point in the history
Socioboard 3.0.51
  • Loading branch information
RajGlobussoft committed Jul 27, 2018
1 parent 574d7d7 commit 67a3a4b
Show file tree
Hide file tree
Showing 31 changed files with 186 additions and 355 deletions.
2 changes: 1 addition & 1 deletion src/Api.Socioboard/Controllers/TwitterReportsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public IActionResult GettwtfollowfollowingGraph(long groupId)
List<Domain.Socioboard.Models.Groupprofiles> lstGrpProfiles = Repositories.GroupProfilesRepository.getAllGroupProfiles(groupId, _redisCache, dbr);
lstGrpProfiles = lstGrpProfiles.Where(t => t.profileType == Domain.Socioboard.Enum.SocialProfileType.Twitter).ToList();
string[] lstStr = lstGrpProfiles.Select(t => t.profileId).ToArray();
// string[] lstname= lstGrpProfiles.Select(t => t.profileName).ToArray();
// string[] lstname= lstGrpProfiles.Select(t => t.profileName).ToArray();
//List<Domain.Socioboard.Models.TwitterAccount> lstInsAcc = new List<Domain.Socioboard.Models.TwitterAccount>();
List<Domain.Socioboard.Models.Mongo.twtfollowfollowing> lstTwtreport = new List<Domain.Socioboard.Models.Mongo.twtfollowfollowing>();
lstTwtreport = Repositories.TwitterReportsRepository.gettwtfollofollowingReport(lstStr, 90, _redisCache, _appSettings,dbr);
Expand Down
251 changes: 0 additions & 251 deletions src/Api.Socioboard/Helper/LinkedInHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,128 +140,6 @@ public static string PostLinkedInMessage(string ImageUrl, long userid, string co
}


}

public static string UrlPostLinkedInMessage(string ImageUrl, long userid, string comment, string ProfileId, string imagepath, Domain.Socioboard.Enum.MediaType mediaType, string profileName, Helper.Cache _redisCache, Helper.AppSettings _appSettings, Model.DatabaseRepository dbr)
{
try
{

if (!ImageUrl.Contains("https://") && !ImageUrl.Contains("http://") && !string.IsNullOrEmpty(ImageUrl))
{
var client = new ImgurClient("5f1ad42ec5988b7", "f3294c8632ef8de6bfcbc46b37a23d18479159c5");
var endpoint = new ImageEndpoint(client);
IImage image;
using (var fs = new FileStream(imagepath, FileMode.Open))
{
image = endpoint.UploadImageStreamAsync(fs).GetAwaiter().GetResult();
}

var img = image.Link;
string json = "";
Domain.Socioboard.Models.LinkedInAccount _LinkedInAccount = Repositories.LinkedInAccountRepository.getLinkedInAccount(ProfileId, _redisCache, dbr);
oAuthLinkedIn _oauth = new oAuthLinkedIn();
_oauth.ConsumerKey = _appSettings.LinkedinApiKey;
_oauth.ConsumerSecret = _appSettings.LinkedinSecretKey;
_oauth.Token = _LinkedInAccount.OAuthToken;
string PostUrl = "https://api.linkedin.com/v1/people/~/shares?format=json";
if (string.IsNullOrEmpty(ImageUrl))
{
json = _oauth.LinkedProfilePostWebRequest("POST", PostUrl, comment);
}
else
{
json = _oauth.LinkedProfilePostWebRequestWithImage("POST", PostUrl, comment, img);
}

if (!string.IsNullOrEmpty(json))
{

ScheduledMessage scheduledMessage = new ScheduledMessage();
scheduledMessage.createTime = DateTime.UtcNow;
scheduledMessage.picUrl = _LinkedInAccount.ProfileImageUrl;
scheduledMessage.profileId = ProfileId;
scheduledMessage.profileType = Domain.Socioboard.Enum.SocialProfileType.LinkedIn;
scheduledMessage.scheduleTime = DateTime.UtcNow;
scheduledMessage.shareMessage = comment;
scheduledMessage.userId = userid;
scheduledMessage.status = Domain.Socioboard.Enum.ScheduleStatus.Compleated;
scheduledMessage.url = ImageUrl;
scheduledMessage.mediaType = mediaType;
scheduledMessage.socialprofileName = _LinkedInAccount.LinkedinUserName;
dbr.Add<ScheduledMessage>(scheduledMessage);

return "posted";
}
else
{
json = "Message not posted";
return json;
}
}
else
{
string json = "";
Domain.Socioboard.Models.LinkedInAccount _LinkedInAccount = Repositories.LinkedInAccountRepository.getLinkedInAccount(ProfileId, _redisCache, dbr);
oAuthLinkedIn _oauth = new oAuthLinkedIn();
_oauth.ConsumerKey = _appSettings.LinkedinApiKey;
_oauth.ConsumerSecret = _appSettings.LinkedinSecretKey;
_oauth.Token = _LinkedInAccount.OAuthToken;
string PostUrl = "https://api.linkedin.com/v1/people/~/shares?format=json";
if (string.IsNullOrEmpty(ImageUrl))
{
json = _oauth.LinkedProfilePostWebRequest("POST", PostUrl, comment);
}
else
{
var client = new ImgurClient("5f1ad42ec5988b7", "f3294c8632ef8de6bfcbc46b37a23d18479159c5");
var endpoint = new ImageEndpoint(client);
IImage image;
using (var fs = new FileStream(imagepath, FileMode.Open))
{
image = endpoint.UploadImageStreamAsync(fs).GetAwaiter().GetResult();
}

var img = image.Link;
json = _oauth.LinkedProfilePostWebRequestWithImage("POST", PostUrl, comment, img);
}

if (!string.IsNullOrEmpty(json))
{

ScheduledMessage scheduledMessage = new ScheduledMessage();
scheduledMessage.createTime = DateTime.UtcNow;
scheduledMessage.picUrl = _LinkedInAccount.ProfileImageUrl;
scheduledMessage.profileId = ProfileId;
scheduledMessage.profileType = Domain.Socioboard.Enum.SocialProfileType.LinkedIn;
scheduledMessage.scheduleTime = DateTime.UtcNow;
scheduledMessage.shareMessage = comment;
scheduledMessage.userId = userid;
scheduledMessage.status = Domain.Socioboard.Enum.ScheduleStatus.Compleated;
scheduledMessage.url = ImageUrl;
scheduledMessage.mediaType = mediaType;
scheduledMessage.socialprofileName = _LinkedInAccount.LinkedinUserName;
dbr.Add<ScheduledMessage>(scheduledMessage);

return "posted";
}
else
{
json = "Message not posted";
return json;
}
}

}


catch (Exception ex)
{

return "Message not posted";
}


}

public static string PostLinkedInCompanyPagePost(string upload,string ImageUrl, long userid, string comment, string LinkedinPageId, Domain.Socioboard.Enum.MediaType mediaType, string profileName, Helper.Cache _redisCache,Model.DatabaseRepository dbr,Helper.AppSettings _appSettings)
Expand Down Expand Up @@ -392,135 +270,6 @@ public static string PostLinkedInCompanyPagePost(string upload,string ImageUrl,

}

public static string UrlPostLinkedInCompanyPagePost(string upload, string ImageUrl, long userid, string comment, string LinkedinPageId, Domain.Socioboard.Enum.MediaType mediaType, string profileName, Helper.Cache _redisCache, Model.DatabaseRepository dbr, Helper.AppSettings _appSettings)
{
try
{
if (!ImageUrl.Contains("https://") && !ImageUrl.Contains("http://") && !string.IsNullOrEmpty(ImageUrl))
{
var client = new ImgurClient("5f1ad42ec5988b7", "f3294c8632ef8de6bfcbc46b37a23d18479159c5");
var endpoint = new ImageEndpoint(client);
IImage image;
using (var fs = new FileStream(ImageUrl, FileMode.Open))
{
image = endpoint.UploadImageStreamAsync(fs).GetAwaiter().GetResult();
}
var img = image.Link;
string json = "";
Domain.Socioboard.Models.LinkedinCompanyPage objlicompanypage = Repositories.LinkedInAccountRepository.getLinkedinCompanyPage(LinkedinPageId, _redisCache, dbr);
oAuthLinkedIn Linkedin_oauth = new oAuthLinkedIn();
Linkedin_oauth.ConsumerKey = _appSettings.LinkedinApiKey;
Linkedin_oauth.ConsumerSecret = _appSettings.LinkedinSecretKey;
Linkedin_oauth.Verifier = objlicompanypage.OAuthVerifier;
Linkedin_oauth.TokenSecret = objlicompanypage.OAuthSecret;
Linkedin_oauth.Token = objlicompanypage.OAuthToken;
Linkedin_oauth.Id = objlicompanypage.LinkedinPageId;
Linkedin_oauth.FirstName = objlicompanypage.LinkedinPageName;
Company company = new Company();
if (string.IsNullOrEmpty(ImageUrl))
{
json = company.SetPostOnPage(Linkedin_oauth, objlicompanypage.LinkedinPageId, comment);
}
else
{
json = company.SetPostOnPageWithImage(Linkedin_oauth, objlicompanypage.LinkedinPageId, img, comment);
}
if (!string.IsNullOrEmpty(json))
{

ScheduledMessage scheduledMessage = new ScheduledMessage();
scheduledMessage.createTime = DateTime.UtcNow;
scheduledMessage.picUrl = objlicompanypage.LogoUrl;
scheduledMessage.profileId = objlicompanypage.LinkedinPageId;
scheduledMessage.profileType = Domain.Socioboard.Enum.SocialProfileType.LinkedInComapanyPage;
scheduledMessage.scheduleTime = DateTime.UtcNow;
scheduledMessage.shareMessage = comment;
scheduledMessage.userId = userid;
scheduledMessage.status = Domain.Socioboard.Enum.ScheduleStatus.Compleated;
scheduledMessage.url = upload;
scheduledMessage.mediaType = mediaType;
scheduledMessage.socialprofileName = objlicompanypage.LinkedinPageName;
dbr.Add<ScheduledMessage>(scheduledMessage);

return "posted";
}
else
{
json = "Message not posted";
return json;
}
}
else
{
string json = "";
Domain.Socioboard.Models.LinkedinCompanyPage objlicompanypage = Repositories.LinkedInAccountRepository.getLinkedinCompanyPage(LinkedinPageId, _redisCache, dbr);
oAuthLinkedIn Linkedin_oauth = new oAuthLinkedIn();
Linkedin_oauth.ConsumerKey = _appSettings.LinkedinApiKey;
Linkedin_oauth.ConsumerSecret = _appSettings.LinkedinSecretKey;
Linkedin_oauth.Verifier = objlicompanypage.OAuthVerifier;
Linkedin_oauth.TokenSecret = objlicompanypage.OAuthSecret;
Linkedin_oauth.Token = objlicompanypage.OAuthToken;
Linkedin_oauth.Id = objlicompanypage.LinkedinPageId;
Linkedin_oauth.FirstName = objlicompanypage.LinkedinPageName;
Company company = new Company();
if (string.IsNullOrEmpty(ImageUrl))
{
json = company.SetPostOnPage(Linkedin_oauth, objlicompanypage.LinkedinPageId, comment);
}
else
{
var client = new ImgurClient("5f1ad42ec5988b7", "f3294c8632ef8de6bfcbc46b37a23d18479159c5");
var endpoint = new ImageEndpoint(client);
IImage image;
using (var fs = new FileStream(ImageUrl, FileMode.Open))
{
image = endpoint.UploadImageStreamAsync(fs).GetAwaiter().GetResult();
}
var img = image.Link;
json = company.SetPostOnPageWithImage(Linkedin_oauth, objlicompanypage.LinkedinPageId, img, comment);
}
if (!string.IsNullOrEmpty(json))
{

ScheduledMessage scheduledMessage = new ScheduledMessage();
scheduledMessage.createTime = DateTime.UtcNow;
scheduledMessage.picUrl = objlicompanypage.LogoUrl;
scheduledMessage.profileId = objlicompanypage.LinkedinPageId;
scheduledMessage.profileType = Domain.Socioboard.Enum.SocialProfileType.LinkedInComapanyPage;
scheduledMessage.scheduleTime = DateTime.UtcNow;
scheduledMessage.shareMessage = comment;
scheduledMessage.userId = userid;
scheduledMessage.status = Domain.Socioboard.Enum.ScheduleStatus.Compleated;
scheduledMessage.url = upload;
scheduledMessage.mediaType = mediaType;
scheduledMessage.socialprofileName = objlicompanypage.LinkedinPageName;
dbr.Add<ScheduledMessage>(scheduledMessage);

return "posted";
}
else
{
json = "Message not posted";
return json;
}
}


//}
//catch(Exception ex)
//{
// return "Message not posted";
//}

}
catch (Exception ex)
{
return "Message not posted";
}

}


public static string GetAccessToken(string Code, Helper.AppSettings _appSettings)
{
try
Expand Down
2 changes: 0 additions & 2 deletions src/Api.Socioboard/Repositories/DiscoveryRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,5 @@ public static void SetCofigDetailsForTwitter(oAuthTwitter OAuth, Helper.AppSetti

return lstdiscovery;
}


}
}
21 changes: 21 additions & 0 deletions src/Api.Socioboard/Repositories/FacebookRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ public static int AddFacebookAccount(dynamic profile, Int64 friends, Model.Datab
FacebookRepository.SaveFacebookFeeds(fbAcc.AccessToken, lstFbAcc.First().FbUserId, settings, _logger);
UpdatePageShareathon(fbAcc, userId, settings);
UpdateGroupShareathon(fbAcc, userId, settings);
// UpdateDeleteFacebookPassChange(fbAcc, userId, settings);
}).Start();
}
}
Expand Down Expand Up @@ -366,6 +367,7 @@ public static int AddFacebookPage(dynamic profile, Model.DatabaseRepository dbr,
UpdateGroupShareathonPage(fbAcc, userId, settings);
UpdatePageshareathonPage(fbAcc, userId, settings);
UpdateDeleteLinkShareathon(fbAcc.FbUserName, userId, settings);
// UpdateDeleteFacebookPassChange(fbAcc, userId, settings);
}).Start();


Expand Down Expand Up @@ -1982,6 +1984,8 @@ public static string DeleteProfile(Model.DatabaseRepository dbr, string profileI

DeleteLinkShareathon(fbAcc.FbUserName, userId,_appSettings);

DeleteFacebookPassChange(fbAcc.FbUserId, userId, _appSettings);

return "Deleted";
}
else
Expand Down Expand Up @@ -2258,6 +2262,23 @@ public static void UpdateDeleteLinkShareathon(string Facebookpageid, long userId
}
}

public static void DeleteFacebookPassChange(string profileId, long userId, Helper.AppSettings _appSettings)
{
MongoRepository _facebookPassChange = new MongoRepository("FacebookPasswordChangeUserDetail", _appSettings);
var ret = _facebookPassChange.Find<Domain.Socioboard.Models.Mongo.FacebookPasswordChangeUserDetail>(t => t.profileId.Equals(profileId) && t.userId == userId);
var task = Task.Run(async () =>
{
return await ret;
});
int count = task.Result.Count;
if (count > 0)
{
var builders = Builders<Domain.Socioboard.Models.Mongo.FacebookPasswordChangeUserDetail>.Filter;
FilterDefinition<Domain.Socioboard.Models.Mongo.FacebookPasswordChangeUserDetail> filter = builders.Eq("profileId", profileId);
_facebookPassChange.Delete<Domain.Socioboard.Models.Mongo.FacebookPasswordChangeUserDetail>(filter);

}
}


public static string CompareDateWithclient(string clientdate, string scheduletime)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ public static string CancelRecurringPayment(string ProfileID,long UserId,string
Dictionary<string, string> configurationMap = new Dictionary<string, string>();

configurationMap.Add("mode", "live");

// Signature Credential
configurationMap.Add("account1.apiUsername", paypalapiusername);
configurationMap.Add("account1.apiPassword", paypalpassword);
Expand Down
6 changes: 0 additions & 6 deletions src/Socioboard/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,6 @@ public async Task<IActionResult> Index()
ViewBag.profileCount = count;
ViewBag.MaxCount = MaxCount;
ViewBag.AccountType = user.AccountType;
//for primary account finding start
ViewBag.userPrimary = user;
// end
if (count > MaxCount)
{
ViewBag.downgrade = "true";
Expand Down Expand Up @@ -310,9 +307,6 @@ public async Task<IActionResult> Index()
int MaxCount = Domain.Socioboard.Helpers.SBHelper.GetMaxProfileCount(user.AccountType);
ViewBag.profileCount = count;
ViewBag.MaxCount = MaxCount;
//for primary account finding start
ViewBag.userPrimary = user;
// end
if (count > MaxCount)
{
ViewBag.downgrade = "true";
Expand Down
5 changes: 5 additions & 0 deletions src/Socioboard/Controllers/IndexController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,12 @@ public async Task<IActionResult> board(string boardName)
return View();
}

[Route("TermsConditions")]

public IActionResult Conditions()
{
return View();
}


}
Expand Down
Loading

0 comments on commit 67a3a4b

Please sign in to comment.