Skip to content

Commit

Permalink
Socioboard 3.0
Browse files Browse the repository at this point in the history
Github Commit
-------------------
1.added custom rss feeds.
2.added content feeds in rss.
3.solve bug repetition of message in schduled.
4.solve bug in compose for draft message.
5.solve the bug for posted rss feeds.
6.solved link expire issue for forget password
7.implemented social icons for compose message and sechdule message
8.solved scroll bar issue in dashboard
9.User Database modification
  • Loading branch information
socioboard committed Mar 21, 2017
1 parent 03bc1c3 commit 4052b85
Show file tree
Hide file tree
Showing 133 changed files with 2,005 additions and 50 deletions.
Binary file modified .vs/Socioboard/v14/.suo
Binary file not shown.
59 changes: 59 additions & 0 deletions src/Api.Socioboard/Controllers/GoogleController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -380,5 +380,64 @@ public IActionResult GetGAProfiles(long groupId)
}
return Ok(lstGoogleAnalyticsAccount);
}

[HttpPost("GetYoutubeAccount")]
public IActionResult GetYoutubeAccount(string code, long groupId, long userId)
{
try
{
List<Domain.Socioboard.ViewModels.YoutubeProfiles> lstYoutubeProfiles = new List<Domain.Socioboard.ViewModels.YoutubeProfiles>();
lstYoutubeProfiles = Helper.GoogleHelper.GetYoutubeAccount(code, _appSettings);
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
List<Domain.Socioboard.Models.Groupprofiles> lstGrpProfiles = Repositories.GroupProfilesRepository.getGroupProfiles(groupId, _redisCache, dbr);
lstGrpProfiles = lstGrpProfiles.Where(t => t.profileType == Domain.Socioboard.Enum.SocialProfileType.YouTube).ToList();
string[] lstStr = lstGrpProfiles.Select(t => t.profileId).ToArray();
if (lstStr.Length > 0)
{
lstYoutubeProfiles.Where(t => lstStr.Contains(t.YtChannelId)).Select(s => { s.connected = 1; return s; }).ToList();
}
return Ok(lstYoutubeProfiles);
}
catch (Exception ex)
{
_logger.LogError("GetGetYoutubeAccount" + ex.StackTrace);
_logger.LogError("GetGetYoutubeAccount" + ex.Message);
return Ok(new List<Domain.Socioboard.ViewModels.YoutubeProfiles>());
}
}


[HttpPost("AddYoutubeChannels")]
public IActionResult AddYoutubeChannels(long groupId, long userId)
{
string data = Request.Form["profileaccesstoken"];
DatabaseRepository dbr = new DatabaseRepository(_logger, _appEnv);
string[] profiledata = null;

profiledata = data.Split(',');
foreach (var item in profiledata)
{
int j = Repositories.GplusRepository.AddYoutubeChannels(item, userId, groupId, _redisCache, _appSettings, dbr, _appEnv);
}

return Ok("Added Successfully");
}

[HttpGet("GetYTChannelsSB")]
public IActionResult GetYTChannelsSB(long groupId)
{
DatabaseRepository dbr = new Model.DatabaseRepository(_logger, _appEnv);
List<Domain.Socioboard.Models.Groupprofiles> lstGroupprofiles = dbr.Find<Domain.Socioboard.Models.Groupprofiles>(t => t.groupId == groupId).Where(t => t.profileType == Domain.Socioboard.Enum.SocialProfileType.YouTube).ToList();
List<Domain.Socioboard.Models.YoutubeChannel> lstYoutubeChannel = new List<YoutubeChannel>();
foreach (var item in lstGroupprofiles)
{
Domain.Socioboard.Models.YoutubeChannel YTChnl = Repositories.GplusRepository.getYTChannel(item.profileId, _redisCache, dbr);
if (YTChnl != null)
{
lstYoutubeChannel.Add(YTChnl);
}
}
return Ok(lstYoutubeChannel);
}
}
}
40 changes: 40 additions & 0 deletions src/Api.Socioboard/Controllers/RssFeedController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Api.Socioboard.Model;
using Microsoft.AspNetCore.Cors;
using System.Xml;
using System.Text.RegularExpressions;

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

Expand Down Expand Up @@ -150,5 +151,44 @@ public IActionResult DeleteFeedUrl(string RssId)
string deletedata = Repositories.RssFeedRepository.DeleteFeedUrl(RssId, dbr, _appSettings);
return Ok(deletedata);
}


[HttpGet("RssNewsFeedsUrl")]
public IActionResult RssNewsFeedsUrl(long userId, string keyword )
{

string res = Repositories.RssNewsContentsRepository.AddRssContentsUrl(keyword, userId, _appSettings);
return Ok(res);


}


[HttpGet("getRssNewsFeedsContents")]
public IActionResult getRssNewsFeedsContents(string userId, string keyword)
{

DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
List<Domain.Socioboard.Models.Mongo.RssNewsContentsFeeds> lstRss = Repositories.RssNewsContentsRepository.GetRssNewsFeeds(userId,keyword, _appSettings);
// lstRss = lstRss.Where(t => !string.IsNullOrEmpty(t.Message)).ToList();
return Ok(lstRss);


}



[HttpGet("getRssNewsFeedsPost")]
public IActionResult getRssNewsFeedsPost(string userId)
{

DatabaseRepository dbr = new DatabaseRepository(_logger, _env);
List<Domain.Socioboard.Models.Mongo.RssNewsContentsFeeds> lstRss = Repositories.RssNewsContentsRepository.GetRssNewsPostedFeeds(userId, _appSettings);
// lstRss = lstRss.Where(t => !string.IsNullOrEmpty(t.Message)).ToList();
return Ok(lstRss);


}

}
}
1 change: 1 addition & 0 deletions src/Api.Socioboard/Controllers/UserController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public IActionResult SocioboardAccountCreation(User user)
user.EmailValidateToken = SBHelper.RandomString(20);
user.ValidateTokenExpireDate = DateTime.UtcNow.AddDays(1);
user.ActivationStatus = Domain.Socioboard.Enum.SBUserActivationStatus.Active;
user.dailyGrpReportsSummery = true;
user.Password = SBHelper.MD5Hash(user.Password);
user.UserName = "Socioboard";
user.UserType = "User";
Expand Down
84 changes: 84 additions & 0 deletions src/Api.Socioboard/Helper/GoogleHelper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Newtonsoft.Json.Linq;
using Socioboard.GoogleLib.Authentication;
using Socioboard.GoogleLib.GAnalytics.Core.Accounts;
using Socioboard.GoogleLib.Youtube.Core;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -86,5 +87,88 @@ public static class GoogleHelper
}
return lstGoogleAnalyticsProfiles;
}

public static List<Domain.Socioboard.ViewModels.YoutubeProfiles> GetYoutubeAccount(string code, Helper.AppSettings _appSettings)
{
Domain.Socioboard.ViewModels.YoutubeProfiles _YoutubeChannels;
List<Domain.Socioboard.ViewModels.YoutubeProfiles> lstYoutubeProfiles = new List<Domain.Socioboard.ViewModels.YoutubeProfiles>();
string access_token = string.Empty;
string refresh_token = string.Empty;
Channels _Channels = new Channels("575089347457-74q0u81gj88ve5bfdmbklcf2dnc0353q.apps.googleusercontent.com", "JRtS_TaeYpKOJWBCqt9h8-iG", "http://localhost:9821/GoogleManager/Google");

try
{
oAuthTokenYoutube objToken = new oAuthTokenYoutube("575089347457-74q0u81gj88ve5bfdmbklcf2dnc0353q.apps.googleusercontent.com", "JRtS_TaeYpKOJWBCqt9h8-iG", "http://localhost:9821/GoogleManager/Google");


string accessToken = objToken.GetRefreshToken(code);
JObject JData = JObject.Parse(accessToken);


try
{
refresh_token = JData["refresh_token"].ToString();
}
catch (Exception ex)
{
access_token = JData["access_token"].ToString();
objToken.RevokeToken(access_token);
return null;
}

access_token = JData["access_token"].ToString();

string channelsdata = _Channels.Get_Channel_List(access_token, "snippet,contentDetails,statistics", 50, true);
JObject JChanneldata = JObject.Parse(channelsdata);


foreach (var item in JChanneldata["items"])
{
try
{
string channelid = item["id"].ToString();
string channelname = item["snippet"]["title"].ToString();
string channelimage = item["snippet"]["thumbnails"]["default"]["url"].ToString();
string publishdate = item["snippet"]["publishedAt"].ToString();
string viewscount = item["statistics"]["viewCount"].ToString();
string commentscount = item["statistics"]["commentCount"].ToString();
string subscriberscount = item["statistics"]["subscriberCount"].ToString();
string videoscount = item["statistics"]["videoCount"].ToString();
string channeldescrip = item["snippet"]["description"].ToString();

try
{
_YoutubeChannels = new Domain.Socioboard.ViewModels.YoutubeProfiles();
_YoutubeChannels.Accesstoken = access_token;
_YoutubeChannels.Refreshtoken = refresh_token;
_YoutubeChannels.YtChannelId = channelid;
_YoutubeChannels.YtChannelName = channelname;
_YoutubeChannels.YtChannelImage = channelimage;
_YoutubeChannels.PublishDate = publishdate;
_YoutubeChannels.viewscount = viewscount;
_YoutubeChannels.commentscount = commentscount;
_YoutubeChannels.subscriberscount = subscriberscount;
_YoutubeChannels.videoscount = videoscount;
_YoutubeChannels.YtChannelDescrip = channeldescrip;
lstYoutubeProfiles.Add(_YoutubeChannels);
}
catch (Exception ex)
{

}

}
catch (Exception e)
{
}
}
}
catch
{

}
return lstYoutubeProfiles;
}

}
}
118 changes: 118 additions & 0 deletions src/Api.Socioboard/Repositories/GplusRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Socioboard.GoogleLib.App.Core;
using Socioboard.GoogleLib.Authentication;
using Socioboard.GoogleLib.GAnalytics.Core.AnalyticsMethod;
using Socioboard.GoogleLib.Youtube.Core;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -759,5 +760,122 @@ public static string DeleteGplusProfile(Model.DatabaseRepository dbr, string pro
return lstMongoGplusFeed.ToList();
}
}


#region Repository codes for Youtube Channel.....


public static Domain.Socioboard.Models.YoutubeChannel getYTChannel(string YtChannelId, Helper.Cache _redisCache, Model.DatabaseRepository dbr)
{
try
{
Domain.Socioboard.Models.YoutubeChannel inMemYTChannel = _redisCache.Get<Domain.Socioboard.Models.YoutubeChannel>(Domain.Socioboard.Consatants.SocioboardConsts.CacheYTChannel + YtChannelId);
if (inMemYTChannel != null)
{
return inMemYTChannel;
}
}
catch { }

List<Domain.Socioboard.Models.YoutubeChannel> lstYTChannel = dbr.Find<Domain.Socioboard.Models.YoutubeChannel>(t => t.YtubeChannelId.Equals(YtChannelId)).ToList();
if (lstYTChannel != null && lstYTChannel.Count() > 0)
{
_redisCache.Set(Domain.Socioboard.Consatants.SocioboardConsts.CacheYTChannel + YtChannelId, lstYTChannel.First());
return lstYTChannel.First();
}
else
{
return null;
}



}


public static int AddYoutubeChannels(string profiledata, long userId, long groupId, Helper.Cache _redisCache, Helper.AppSettings _appSettings, Model.DatabaseRepository dbr, IHostingEnvironment _appEnv)
{
int isSaved = 0;
Channels _Channels = new Channels("575089347457-74q0u81gj88ve5bfdmbklcf2dnc0353q.apps.googleusercontent.com", "JRtS_TaeYpKOJWBCqt9h8-iG", "http://localhost:9821/GoogleManager/Google");
Domain.Socioboard.Models.YoutubeChannel _YoutubeChannel;
string[] YTdata = Regex.Split(profiledata, "<:>");
_YoutubeChannel = Repositories.GplusRepository.getYTChannel(YTdata[2], _redisCache, dbr);


if (_YoutubeChannel != null)
{
try
{

_YoutubeChannel.UserId = userId;
_YoutubeChannel.YtubeChannelId = YTdata[2];
_YoutubeChannel.YtubeChannelName = YTdata[3];
_YoutubeChannel.ChannelpicUrl = YTdata[9];
_YoutubeChannel.WebsiteUrl = "https://www.youtube.com/channel/" + YTdata[2];
_YoutubeChannel.EntryDate = DateTime.UtcNow;
_YoutubeChannel.YtubeChannelDescription = YTdata[4];
_YoutubeChannel.IsActive = true;
_YoutubeChannel.AccessToken = YTdata[0];
_YoutubeChannel.RefreshToken = YTdata[1];
_YoutubeChannel.PublishingDate = Convert.ToDateTime(YTdata[5]);
_YoutubeChannel.VideosCount = Convert.ToDouble(YTdata[8]);
_YoutubeChannel.CommentsCount = Convert.ToDouble(YTdata[7]);
_YoutubeChannel.SubscribersCount = Convert.ToDouble(YTdata[10]);
_YoutubeChannel.ViewsCount = Convert.ToDouble(YTdata[6]);

}
catch (Exception ex)
{

}
isSaved = dbr.Update<Domain.Socioboard.Models.YoutubeChannel>(_YoutubeChannel);
}
else
{
_YoutubeChannel = new Domain.Socioboard.Models.YoutubeChannel();
try
{
_YoutubeChannel.UserId = userId;
_YoutubeChannel.YtubeChannelId = YTdata[2];
_YoutubeChannel.YtubeChannelName = YTdata[3];
_YoutubeChannel.ChannelpicUrl = YTdata[9];
_YoutubeChannel.WebsiteUrl = "https://www.youtube.com/channel/" + YTdata[2];
_YoutubeChannel.EntryDate = DateTime.UtcNow;
_YoutubeChannel.YtubeChannelDescription = YTdata[4];
_YoutubeChannel.IsActive = true;
_YoutubeChannel.AccessToken = YTdata[0];
_YoutubeChannel.RefreshToken = YTdata[1];
_YoutubeChannel.PublishingDate = Convert.ToDateTime(YTdata[5]);
_YoutubeChannel.VideosCount = Convert.ToDouble(YTdata[8]);
_YoutubeChannel.CommentsCount = Convert.ToDouble(YTdata[7]);
_YoutubeChannel.SubscribersCount = Convert.ToDouble(YTdata[10]);
_YoutubeChannel.ViewsCount = Convert.ToDouble(YTdata[6]);

}
catch (Exception ex)
{

}
isSaved = dbr.Add<Domain.Socioboard.Models.YoutubeChannel>(_YoutubeChannel);
}

if (isSaved == 1)
{
List<Domain.Socioboard.Models.YoutubeChannel> lstytChannel = dbr.Find<Domain.Socioboard.Models.YoutubeChannel>(t => t.YtubeChannelId.Equals(_YoutubeChannel.YtubeChannelId)).ToList();
if (lstytChannel != null && lstytChannel.Count() > 0)
{
isSaved = GroupProfilesRepository.AddGroupProfile(groupId, lstytChannel.First().YtubeChannelId, lstytChannel.First().YtubeChannelName, userId, lstytChannel.First().ChannelpicUrl, Domain.Socioboard.Enum.SocialProfileType.YouTube, dbr);
//codes to delete cache
_redisCache.Delete(Domain.Socioboard.Consatants.SocioboardConsts.CacheUserProfileCount + userId);
_redisCache.Delete(Domain.Socioboard.Consatants.SocioboardConsts.CacheGroupProfiles + groupId);

}

}
return isSaved;
}

#endregion

}
}
5 changes: 4 additions & 1 deletion src/Api.Socioboard/Repositories/RssFeedRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,12 @@ public static string ParseFeedUrl(string TextUrl, Domain.Socioboard.Enum.SocialP
{
try
{
objRssFeeds.Image = item.ChildNodes[1].InnerText;
objRssFeeds.Image = getBetween(objRssFeeds.Image, "src=\"", "\"");
objRssFeeds.Link = item.ChildNodes[1].InnerText;
objRssFeeds.Link = getBetween(objRssFeeds.Link, "<a href=\"", "\">");


}
catch (Exception ex)
{
Expand All @@ -173,7 +176,7 @@ public static string ParseFeedUrl(string TextUrl, Domain.Socioboard.Enum.SocialP
else
{
objRssFeeds.Link = item.ChildNodes[2].InnerText;
objRssFeeds.Link = getBetween(objRssFeeds.Link, "<a href=\"", "\">");
// objRssFeeds.Link = getBetween(objRssFeeds.Link, "<a href=\"", "\">");
}
objRssFeeds.RssFeedUrl = TextUrl;
objRssFeeds.ProfileId = profileid;
Expand Down
Loading

0 comments on commit 4052b85

Please sign in to comment.