Skip to content

Commit

Permalink
socioboard 3.0 update
Browse files Browse the repository at this point in the history
socioboard 3.0 update
  • Loading branch information
swetasb committed Jan 3, 2018
1 parent 6623fe0 commit c37fde4
Show file tree
Hide file tree
Showing 12 changed files with 252 additions and 105 deletions.
Binary file modified .vs/Socioboard/v14/.suo
Binary file not shown.
28 changes: 28 additions & 0 deletions src/Api.Socioboard/Controllers/FacebookController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Socioboard.Facebook.Data;
using Microsoft.AspNetCore.Cors;
using Domain.Socioboard.Models.Mongo;
using MongoDB.Bson;

// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860

Expand Down Expand Up @@ -133,7 +134,34 @@ public IActionResult ReconnectFbAccount(string accessToken, long groupId, long u
int res = Api.Socioboard.Repositories.FacebookRepository.ReFacebookAccount(profile, FbUser.getFbFriends(accessToken), dbr, userId, ngrp.id, Domain.Socioboard.Enum.FbProfileType.FacebookProfile, accessToken, reconnect, _redisCache, _appSettings, _logger);
if (res == 1)
{

MongoRepository repofb = new MongoRepository("FacebookPasswordChangeUserDetail", _appSettings);
try
{
var result = repofb.Find<Domain.Socioboard.Models.Mongo.FacebookPasswordChangeUserDetail>(t => t.profileId == fbacc.FbUserId );
var task = Task.Run(async () =>
{
return await result;
});
int count = task.Result.Count;

IList<Domain.Socioboard.Models.Mongo.FacebookPasswordChangeUserDetail> lstFbFeeds = task.Result;
if(count>0)
{
FilterDefinition<BsonDocument> filter = new BsonDocument("profileId", lstFbFeeds.FirstOrDefault().profileId);
var update = Builders<BsonDocument>.Update.Set("status", true);
repofb.Update<Domain.Socioboard.Models.Mongo.FacebookPasswordChangeUserDetail>(update, filter);

}
}
catch (Exception ex)
{

}

return Ok("Facebook account Reconnect Successfully");


}
else
{
Expand Down
60 changes: 59 additions & 1 deletion src/Api.Socioboard/Controllers/NotificationsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,64 @@ public IActionResult UpdateNotifications(long userId)
}



[HttpGet("ChangePasswordDetail")]
public IActionResult ChangePasswordDetail(long userId)
{
try
{

MongoRepository mongorepo = new MongoRepository("FacebookPasswordChangeUserDetail", _appSettings);
DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
List<Domain.Socioboard.Models.Facebookaccounts> datalst = dbr.Find<Facebookaccounts>(t => t.UserId == userId).ToList();
Domain.Socioboard.Models.User userDet = dbr.FindSingle<User>(t => t.Id == userId);
var result = mongorepo.Find<Domain.Socioboard.Models.Mongo.FacebookPasswordChangeUserDetail>(t => t.userId == userId && t.status==false);
var task = Task.Run(async () =>
{
return await result;
});
int count = task.Result.Count;
IList<Domain.Socioboard.Models.Mongo.FacebookPasswordChangeUserDetail> lstfbpasschange = task.Result;


if (count>0)
{
return Ok(userDet);
}
else
{
return NotFound();
}
}
catch (Exception ex)
{
return NotFound();
}


}

[HttpGet("getfbchangeprofile")]
public IActionResult getfbchangeprofile(long userId)
{
MongoRepository mongorepo = new MongoRepository("FacebookPasswordChangeUserDetail", _appSettings);
DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
List<Domain.Socioboard.Models.Facebookaccounts> datalst = dbr.Find<Facebookaccounts>(t => t.UserId == userId).ToList();
Domain.Socioboard.Models.User userDet = dbr.FindSingle<User>(t => t.Id == userId);
var result = mongorepo.Find<Domain.Socioboard.Models.Mongo.FacebookPasswordChangeUserDetail>(t => t.userId == userId && t.status==false);
var task = Task.Run(async () =>
{
return await result;
});
int count = task.Result.Count;
IList<Domain.Socioboard.Models.Mongo.FacebookPasswordChangeUserDetail> lstfbpasschange = task.Result;
if (count>0)
{
return Ok(lstfbpasschange.FirstOrDefault().profileId);
}
else
{
return NotFound();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -217,20 +217,14 @@ SocioboardApp.controller('FacebookFeedsController', function ($rootScope, $scope
$scope.reconnect(value.fbProfileType);
ac = true;
}

});

if (!ac) {
$scope.reconnect(null);
}

}


}, function (reason) {
$scope.error = reason.data;
});

};

$scope.confirmation = function () {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

SocioboardApp.controller('FacebookreportController', function ($rootScope, $scope, $http, $timeout, apiDomain,domain) {
SocioboardApp.controller('FacebookreportController', function ($rootScope, $scope, $http, $timeout, apiDomain) {
//alert('helo');
$scope.$on('$viewContentLoaded', function () {
$('#Fbfeedsdetails').DataTable({
Expand Down Expand Up @@ -71,46 +71,9 @@ SocioboardApp.controller('FacebookreportController', function ($rootScope, $scop
}
//addaed by me end for total fans

$scope.reconnect = function (xyz) {
$http.get(domain + '/socioboard/recfbcont?id=' + $scope.selectedProfile + '&fbprofileType=' + xyz)
.then(function (response) {
window.location.href = response.data;

}, function (reason) {
$scope.error = reason.data;
});

};

$scope.fbprofiles = function () {

console.log($scope.selectedProfile);
$http.get(apiDomain + '/api/Facebook/GetFacebookProfilesOnlyforReconn?groupId=' + $rootScope.groupId)
.then(function (response) {
console.log(response.data)
if (response.data != null) {
var ac = false;
$scope.profiledet = response.data;
angular.forEach($scope.profiledet, function (value, key) {
if (value.fbUserId == $scope.selectedProfile) {
$scope.reconnect(value.fbProfileType);
ac = true;
}

});

if (!ac) {
$scope.reconnect(null);
}

}


}, function (reason) {
$scope.error = reason.data;
});


};



$scope.getData = function (profileId, days) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,45 +95,45 @@ SocioboardApp.controller('FbpagedetreportController', function ($rootScope, $sco
}
//for fbpage daily report details-------end

$scope.reconnect = function (xyz) {
$http.get(domain + '/socioboard/recfbcont?id=' + $stateParams.profileId + '&fbprofileType=' + xyz)
.then(function (response) {
window.location.href = response.data;
// $scope.reconnect = function (xyz) {
// $http.get(domain + '/socioboard/recfbcont?id=' + $stateParams.profileId + '&fbprofileType=' + xyz)
// .then(function (response) {
// window.location.href = response.data;

}, function (reason) {
$scope.error = reason.data;
});
// }, function (reason) {
// $scope.error = reason.data;
// });

};
//};

$scope.fbprofiles = function () {
//$scope.fbprofiles = function () {

$http.get(apiDomain + '/api/Facebook/GetFacebookProfilesOnlyforReconn?groupId=' + $rootScope.groupId)
.then(function (response) {
console.log(response.data)
if (response.data != null) {
var ac = false;
$scope.profiledet = response.data;
angular.forEach($scope.profiledet, function (value, key) {
if (value.fbUserId == $stateParams.profileId) {
$scope.reconnect(value.fbProfileType);
ac = true;
}
// $http.get(apiDomain + '/api/Facebook/GetFacebookProfilesOnlyforReconn?groupId=' + $rootScope.groupId)
// .then(function (response) {
// console.log(response.data)
// if (response.data != null) {
// var ac = false;
// $scope.profiledet = response.data;
// angular.forEach($scope.profiledet, function (value, key) {
// if (value.fbUserId == $stateParams.profileId) {
// $scope.reconnect(value.fbProfileType);
// ac = true;
// }

});
// });

if (!ac) {
$scope.reconnect(null);
}
// if (!ac) {
// $scope.reconnect(null);
// }

}
// }


}, function (reason) {
$scope.error = reason.data;
});
// }, function (reason) {
// $scope.error = reason.data;
// });

};
//};



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ SocioboardApp.controller('NotificationAllController', function ($rootScope, $sco

$scope.changepass = function () {

$http.get(apiDomain + '/api/Notifications/ChangePasswordDetail?userId=' + $rootScope.user.Id )
$http.get(apiDomain + '/api/Notifications/ChangePasswordDetail?userId=' + $rootScope.user.Id+'&user' )
.then(function (response) {
$scope.lstChangePass = response.data;
console.log($scope.lstChangePass);
Expand All @@ -44,6 +44,39 @@ SocioboardApp.controller('NotificationAllController', function ($rootScope, $sco
$scope.changepass();



$scope.getfbprofileId = function () {

$http.get(apiDomain + '/api/Notifications/getfbchangeprofile?userId=' + $rootScope.user.Id)
.then(function (response) {
$scope.lstfbprofile = response.data;
// console.log($scope.lstfbprofile);
//var abc = $scope.lstfbprofile;

//$scope.notifycount = $scope.notifycount + 10;

}, function (reason) {
$scope.error = reason.data;
});
// end codes to load recent Feeds
}
$scope.getfbprofileId();

$scope.reconnect = function () {
var facebookid = $scope.lstfbprofile;
console.log($scope.lstfbprofile);
// console.log("abcd", $scope.lstfbprofile.userPrimaryEmail);
$http.get(domain + '/socioboard/recfbcont?id=' + facebookid + '&fbprofileType=' + 0)
.then(function (response) {
window.location.href = response.data;

}, function (reason) {
$scope.error = reason.data;
});

};


// start codes to load recent Feeds
$scope.loadmore = function () {
$("#load_more_toggle").addClass("hide");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@


<h4 class="pull-left">
<span class="grey-text text-darken-1">Showing last 90 days report ({{fromDate | date}} - {{toDate | date}})</span>
<a class='right white-text btn green accent-4' href="javascript:void(0)" ng-click="fbprofiles()" style="font-size: 14px !important;padding: 0px 5px 0px 5px !important;height: 28px;line-height: 15px;border-radius: 4px;">
<span class="white-text text-darken-4"><i class="fa fa-refresh fa-fw"></i><strong>Reconnect</strong></span>&nbsp;&nbsp;&nbsp;
</a>

<span class="grey-text text-darken-1">Showing last 90 days report ({{fromDate | date}} - {{toDate | date}})</span>
</h4>

<div class="row" ng-class="fetchdatacomplete">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ <h6 class="pull-right margin-top-20" ng-if="user.TrailStatus!=2">
<a ng-click="getData(15)" class="btn" title="Last 15 days report">15</a>
<a ng-click="getData(30)" class="btn" title="Last 30 days report">30</a>
<a ng-click="getData(60)" class="btn" title="Last 60 days report">60</a>
<a ng-click="getData(90)" class="btn" title="Last 90 days report">90</a>
<a ng-click="reconnect()" class="white-text text-darken-4">Reconnect</a>

<a ng-click="getData(90)" class="btn" title="Last 90 days report">90</a>
</h6>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,12 @@ <h6 class="pull-right margin-top-20" ng-if="user.TrailStatus!=2">
<a ng-click="getData(selectedProfile,15)" class="btn" title="Last 15 days report">15</a>
<a ng-click="getData(selectedProfile,30)" class="btn" title="Last 30 days report">30</a>
<a ng-click="getData(selectedProfile,60)" class="btn" title="Last 60 days report">60</a>
<a ng-click="getData(selectedProfile,90)" class="btn" title="Last 90 days report">90</a>
<a class='right white-text btn green accent-4' href="javascript:void(0)" ng-click="fbprofiles()" style="font-size: 14px !important;padding: 0px 5px 0px 5px !important;height: 28px;line-height: 15px;border-radius: 4px;">
<span class="white-text text-darken-4"><i class="fa fa-refresh fa-fw"></i><strong>Reconnect</strong></span>&nbsp;&nbsp;&nbsp;
</a>
<a ng-click="getData(selectedProfile,90)" class="btn" title="Last 90 days report">90</a>
</h6>
</div>
</div>

<div class="row" ng-class="fetchdatacomplete">

<!-- FACEBOOK STATS -->
<div class="col s12 m12 l12">
<div class="card" id="feeds">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,19 @@
<div class="card" id="feeds">
<h5 class="feeds_title blue darken-4 white-text">Your notifications</h5>
<ul class="collection facebookfeeds">
<li class="card">
<li class="card" >
<a ng-href="#/notification_all" terget="_blank" class="recent-activity-list chat-out-list row no-space" style="height:auto;">

<div ng-if="lstChangePass.userId!=''" class="col s9 recent-activity-list-text margin-top-10">

<span ng-if="lstChangePass.userId!=''" class="">For {{lstChangePass.userPrimaryEmail}} account password has change , please reconnect your account !!</span>
</div>
<div class="col s12">
<h6 ng-if="lstChangePass.userId !=''" class="center error_box">Reconnect</h6>
<div ng-show="lstChangePass.id" class="col s9 recent-activity-list-text margin-top-10">
<span class="" style="color:red">'{{lstChangePass.emailId}}' facebook account password has change , please reconnect your account !!</span>
</div>

</a>

<div ng-show="lstChangePass.id" class="load_more" style="height:auto;">
<a ng-click="reconnect()" class="center">Reconnect</a>
</div>

</li>
<li class="collection-item avatar" ng-repeat="notify in lstnotifications">
<img src="{{notify.picUrl}}" alt="{{notify.socialprofileName}}" class="circle">
Expand Down
Loading

0 comments on commit c37fde4

Please sign in to comment.