void ProcessRequest() { if (!string.IsNullOrEmpty(Request.QueryString["op"])) { if (Request.QueryString["op"] == "removedata") { string network = Request.QueryString["network"]; string message = string.Empty; var users = Request.QueryString["data[]"]; Messages mstable = new Messages(); DataSet ds = DataTableGenerator.CreateDataSetForTable(mstable); DataTable dtt = ds.Tables[0]; string page = Request.QueryString["page"]; if (page == "feed") { AjaxFeed ajxfed = new AjaxFeed(); DataTable dt = null; if (network == "facebook") { dt = (DataTable)Session["FacebookFeedDataTable"]; } else if (network == "twitter") { dt = (DataTable)Session["TwitterFeedDataTable"]; } else if (network == "linkedin") { dt = (DataTable)Session["LinkedInFeedDataTable"]; } foreach (var parent in users) { DataView dv = new DataView(dtt); DataRow[] foundRows = dt.Select("ProfileId = '" + parent + "'"); foreach (var child in foundRows) { dtt.ImportRow(child); } } message = ajxfed.BindData(dtt); } else if (page == "message") { WooSuite.Message.AjaxMessage ajxmes = new WooSuite.Message.AjaxMessage(); DataSet dss = (DataSet)Session["MessageDataTable"]; //foreach (var parent in users) //{ DataView dv = new DataView(dtt); DataRow[] foundRows = dss.Tables[0].Select("ProfileId = '" + users + "'"); foreach (var child in foundRows) { dtt.ImportRow(child); } //} message = ajxmes.BindData(dtt); } Response.Write(message); } else if (Request.QueryString["op"] == "upgradeplan") { User user = (User)Session["LoggedUser"]; UserRepository userRepo = new UserRepository(); string accounttype = Request.QueryString["planid"]; if (accounttype == AccountType.Deluxe.ToString().ToLower()) { userRepo.UpdateAccountType(user.Id, AccountType.Deluxe.ToString()); user.AccountType = AccountType.Deluxe.ToString(); } else if (accounttype == AccountType.Standard.ToString().ToLower()) { userRepo.UpdateAccountType(user.Id, AccountType.Standard.ToString()); user.AccountType = AccountType.Standard.ToString(); } else if (accounttype == AccountType.Premium.ToString().ToLower()) { userRepo.UpdateAccountType(user.Id, AccountType.Premium.ToString()); user.AccountType = AccountType.Premium.ToString(); } Session["LoggedUser"] = user; } else if (Request.QueryString["op"] == "bindrssActive") { User user = (User)Session["LoggedUser"]; RssFeedsRepository rssFeedsRepo = new RssFeedsRepository(); List<RssFeeds> lstrssfeeds = rssFeedsRepo.getAllActiveRssFeeds(user.Id); TwitterAccountRepository twtAccountRepo = new TwitterAccountRepository(); if (lstrssfeeds != null) { if (lstrssfeeds.Count != 0) { int rssCount = 0; string rssData = string.Empty; rssData += "<h2 class=\"league section-ttl rss_header\">Active RSS Feeds</h2>"; foreach (RssFeeds item in lstrssfeeds) { TwitterAccount twtAccount = twtAccountRepo.getUserInformation(item.ProfileScreenName, user.Id); string picurl = string.Empty; if (string.IsNullOrEmpty(twtAccount.ProfileUrl)) { picurl = "../Contents/img/blank_img.png"; } else { picurl = twtAccount.ProfileUrl; } rssData += " <section id=\"" + item.Id + "\" class=\"publishing\">" + "<section class=\"twothird\">" + "<article class=\"quarter\">" + "<div href=\"#\" class=\"avatar_link view_profile\" title=\"\">" + "<img title=\"" + item.ProfileScreenName + "\" src=\"" + picurl + "\" data-src=\"\" class=\"avatar sm\">" + "<article class=\"rss_ava_icon\"><span title=\"Twitter\" class=\"icon twitter_16\"></span></article>" + "</div>" + "</article>" + "<article class=\"threefourth\">" + "<ul>" + "<li>" + item.FeedUrl + "</li>" + "<li>Prefix: </li>" + "<li class=\"freq\" title=\"New items from this feed will be posted at most once every hour\">Max Frequency: " + item.Duration + "</li>" + "</ul>" + "</article>" + "</section>" + "<section class=\"third\">" + "<ul class=\"rss_action_buttons\">" + "<li onclick=\"pauseFunction('" + item.Id + "');\" class=\"\"><a id=\"pause_" + item.Id + "\" href=\"#\" title=\"Pause\" class=\"small_pause icon pause\"></a></li>" + "<li onclick=\"deleteRssFunction('" + item.Id + "');\" class=\"show-on-hover\"><a id=\"delete_" + item.Id + "\" href=\"#\" title=\"Delete\" class=\"small_remove icon delete\"></a></li>" + "</ul>" + "</section>" + "</section>"; } Response.Write(rssData); } } } else if (Request.QueryString["op"] == "savedrafts") { Guid Id = Guid.Parse(Request.QueryString["id"]); string newstr = Request.QueryString["newstr"]; DraftsRepository draftsRepo = new DraftsRepository(); draftsRepo.UpdateDrafts(Id, newstr); } else if (Request.QueryString["op"] == "getTwitterUserTweets") { UrlExtractor urlext = new UrlExtractor(); User user = (User)Session["LoggedUser"]; string userid = Request.QueryString["profileid"]; TwitterAccountRepository twtAccountRepo = new TwitterAccountRepository(); ArrayList alst = twtAccountRepo.getAllTwitterAccountsOfUser(user.Id); oAuthTwitter oauth = new oAuthTwitter(); foreach (TwitterAccount childnoe in alst) { oauth.AccessToken = childnoe.OAuthToken; oauth.AccessTokenSecret = childnoe.OAuthSecret; oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"]; oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"]; oauth.TwitterUserId = childnoe.TwitterUserId; oauth.TwitterScreenName = childnoe.TwitterScreenName; break; } TimeLine timeLine = new TimeLine(); //need to be implement waiting for design string mes = string.Empty; JArray userlookup = timeLine.Get_Statuses_User_Timeline(oauth,userid); string jstring = string.Empty; int i = 0; foreach (var item in userlookup) { if (i < 2) { string[] str = urlext.splitUrlFromString(item["text"].ToString()); mes += "<li class=\"\">" + "<div class=\"twtcommands\">" + "<a class=\"account-group\">" + "<img class=\"avatar\" alt=\"\" src=\"" + item["user"]["profile_image_url"] + "\" alt=\"\" />" + "</a>" + "<div class=\"stream-item-header\">" + "<div class=\"user-details\">" + "<strong class=\"fullname\">" + item["user"]["name"] + "</strong>" + "<span class=\"username\">" + "<s>@</s>" + "<b>" + item["screen_name"] + "</b>" + "</span>" + "<small class=\"time\"></small>" + "</div><p class=\"tweet-text\">"; foreach (string substritem in str) { if (!string.IsNullOrEmpty(substritem)) { if (substritem.Contains("http")) { mes += "<a target=\"_blank\" href=\"" + substritem + "\">" + substritem + "</a>"; } else { mes += substritem; } } } //item["text"] " + //"<a target=\"_blank\" class=\"twitter-timeline-link\" href=\"#\" f69e857af67d2c=\"true\">" + // "<span class=\"tco-ellipsis\"></span>" + // "<span class=\"invisible\">http://</span>" + // "<span class=\"js-display-url\">ow.ly/o4o7l</span>" + // "<span class=\"invisible\"></span>" + // "<span class=\"tco-ellipsis\"><span class=\"invisible\"> </span></span>" + //"</a> mes += "</p>" + "<div class=\"details\">" + "<a class=\"stream_details\"></a>" + "</div>" + "</div>" + "</div>" + "</li>"; i++; } else { break; } } Response.Write(mes); } else if (Request.QueryString["op"] == "saveWooQueue") { Guid Id = Guid.Parse(Request.QueryString["id"]); string profileid = Request.QueryString["profid"]; string message = Request.QueryString["message"]; string network = Request.QueryString["network"]; string net = string.Empty; if (network == "fb") { net = "facebook"; } else if (network == "twt") { net = "twitter"; } else if (network == "lin") { net = "linkedin"; } ScheduledMessageRepository schmsgRepo = new ScheduledMessageRepository(); schmsgRepo.UpdateProfileScheduleMessage(Id, profileid, message, net); } else if (Request.QueryString["op"] == "saveRss") { try { User user = (User)Session["LoggedUser"]; RssFeedsRepository objRssFeedRepo = new RssFeedsRepository(); RssFeeds objRssFeeds = new RssFeeds(); objRssFeeds.ProfileScreenName = Request.QueryString["user"]; objRssFeeds.FeedUrl = Request.QueryString["feedsurl"]; objRssFeeds.UserId = user.Id; objRssFeeds.Status = false; objRssFeeds.Message = Request.QueryString["message"]; objRssFeeds.Duration = Request.QueryString["duration"]; objRssFeeds.CreatedDate = DateTime.Now; objRssFeedRepo.AddRssFeed(objRssFeeds); } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } else if (Request.QueryString["op"] == "deletewooqueuemessage") { try { Guid id = Guid.Parse(Request.QueryString["id"]); ScheduledMessageRepository schmsgRepo = new ScheduledMessageRepository(); schmsgRepo.deleteMessage(id); } catch (Exception ex) { logger.Error(ex.Message); } } else if (Request.QueryString["op"] == "chkrssurl") { try { string url = Request.QueryString["url"]; var facerequest = (HttpWebRequest)WebRequest.Create(url); facerequest.Method = "GET"; string outputface = string.Empty; using (var response = facerequest.GetResponse()) { using (var stream = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(1252))) { outputface = stream.ReadToEnd(); if (outputface.Contains("<rss version=\"2.0\"")) { Response.Write("true"); } } } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); Response.Write("Error"); } } else if (Request.QueryString["op"] == "rssusers") { try { User user = (User)Session["LoggedUser"]; TwitterAccountRepository twtAccRepo = new TwitterAccountRepository(); ArrayList alst = twtAccRepo.getAllTwitterAccountsOfUser(user.Id); string message = string.Empty; foreach (TwitterAccount item in alst) { message += "<option value=\"" + item.TwitterScreenName + "\">@" + item.TwitterScreenName + "</option>"; } Response.Write(message); } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } else if (Request.QueryString["op"] == "searchkeyword") { User user = (User)Session["LoggedUser"]; DiscoverySearchRepository disrepo = new DiscoverySearchRepository(); List<string> alst = disrepo.getAllSearchKeywords(user.Id); string message = string.Empty; foreach (var item in alst) { message += "<li onclick=\"getSearchResults('" + item + "');\"><a href=\"#\"><i class=\"show icon-caret-right\" style=\"visibility:visible;margin-right:5px\"></i>" + item + "</a></li>"; } Response.Write(message); } else if (Request.QueryString["op"] == "getResults") { string type = Request.QueryString["type"]; string key = Request.QueryString["keyword"]; Discovery discoverypage = new Discovery(); string search = discoverypage.getresults(key); string message = "<ul id=\"message-list\">" + search + "</ul>"; Response.Write(message); } else if (Request.QueryString["op"] == "getFollowers") { User user = (User)Session["LoggedUser"]; Users twtUser = new Users(); oAuthTwitter oauth = new oAuthTwitter(); TwitterAccountRepository TwtAccRepo = new TwitterAccountRepository(); TwitterAccount TwtAccount = TwtAccRepo.getUserInformation(user.Id, Request.QueryString["id"]); oauth.AccessToken = TwtAccount.OAuthToken; oauth.AccessTokenSecret = TwtAccount.OAuthSecret; oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"]; oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"]; oauth.TwitterScreenName = TwtAccount.TwitterScreenName; oauth.TwitterUserId = TwtAccount.TwitterUserId; JArray response = twtUser.Get_Followers_ById(oauth, Request.QueryString["id"]); string jquery = string.Empty; foreach (var item in response) { if (item["ids"] != null) { foreach (var child in item["ids"]) { JArray userprofile = twtUser.Get_Users_LookUp(oauth, child.ToString()); foreach (var items in userprofile) { try { jquery += "<li class=\"shadower\">" + "<div class=\"disco-feeds\">" + "<div class=\"star-ribbon\"></div>" + "<div class=\"disco-feeds-img\">" + "<img alt=\"\" src=\"" + items["profile_image_url"] + "\" style=\"height: 100px; width: 100px;\" class=\"pull-left\">" + "</div>" + "<div class=\"disco-feeds-content\">" + "<div class=\"disco-feeds-title\">" + "<h3 class=\"no-margin\">" + items["name"] + "</h3>" + "<span>@" + items["screen_name"] + "</span>" + "</div>" + "<p>"; try { jquery += items["status"]["text"]; } catch (Exception ex) { logger.Error(ex.Message); } jquery += "</p>" + //"<a href=\"#\" class=\"btn\">Hide</a>" + "<a href=\"#\" onclick=\"detailsprofile('" + items["id_str"] + "')\" class=\"btn\">Full Profile <i class=\"icon-caret-right\"></i> </a><div class=\"scl\">" + "<a href=\"#\"><img alt=\"\" src=\"../Contents/img/admin/usergrey.png\"></a>" + "<a href=\"#\"><img alt=\"\" src=\"../Contents/img/admin/goto.png\"></a>" + "<a href=\"#\"><img alt=\"\" src=\"../Contents/img/admin/setting.png\"></a>" + "</div></div></div>" + "<div class=\"disco-feeds-info\">" + "<ul class=\"no-margin\">" + "<li><a href=\"#\"><img src=\"../Contents/img/admin/markerbtn2.png\" alt=\"\">"; if (!string.IsNullOrEmpty(items["time_zone"].ToString())) { jquery += items["time_zone"]; } else { jquery += "Not Specific"; } jquery += "</a></li>"; if (string.IsNullOrEmpty(items["url"].ToString())) { jquery += "<li><a href=\"#\"><img src=\"../Contents/img/admin/url.png\" alt=\"\">"; jquery += "Not Specific"; } else { jquery += "<li><a target=\"_blank\" href=\"" + items["url"] + "\"><img src=\"../Contents/img/admin/url.png\" alt=\"\">"; jquery += items["url"]; } jquery += "</a></li></ul>" + "<ul class=\"no-margin\" style=\"margin-top:20px\">" + "<li><a href=\"#\"><img src=\"../Contents/img/admin/twittericon-white.png\" alt=\"\">Followers <big><b>" + items["followers_count"] + "</b></big></a></li>" + "<li><a href=\"#\"><img src=\"../Contents/img/admin/twitter-white.png\" alt=\"\">Following <big><b>" + items["friends_count"] + "</b></big></a></li>" + "</ul>" + "</div>" + "</li>"; #region old // jquery += "<div class=\"wentbg\">" + // "<div class=\"over\">" + // "<div class=\"topicon\">" + // //"<a href=\"#\"><img border=\"none\" alt=\"\" src=\"../Contents/img/manplus.png\"></a>" + // //"<a href=\"#\"><img border=\"none\" alt=\"\" src=\"../Contents/img/replay.png\"></a>" + // //"<a href=\"#\"><img border=\"none\" alt=\"\" src=\"../Contents/img/setting.png\"></a>" + // "</div>" + // "<div class=\"botombtn\">" + // "<div class=\"clickbtn\"><a href=\"#\"><img border=\"none\" alt=\"\" src=\"../Contents/img/full_profile.png\" onclick=\"detailsprofile('" + items["id_str"] + "')\"></a></div>" + // "</div>" + // "</div>" + // "<div class=\"wentbgf\"><img alt=\"\" src=\"" + items["profile_image_url"] + "\"></div>" + // "<div class=\"wentbgtext\">" + //"<span class=\"heading\">\"" + items["name"] + "\"</span> <span>@\"" + items["screen_name"] + "\"</span>" + //"<div class=\"viegil\">\"" + items["status"]["text"] + "\"</div>" + // "<div class=\"avenue\">" + // "<img alt=\"\" src=\"../Contents/img/avenue.png\">" + // "<div class=\"avenuetext\">\"" + items["time_zone"] + "\"</div>" + // "<img class=\"link\" alt=\"\" src=\"../Contents/img/url.png\">" + // "<div class=\"nourl\">No URL</div>" + // "</div>"; // jquery += "<div class=\"followerbg\">" + // "<div class=\"follower\">Followers <span>\"" + items["followers_count"] + "\"</span></div>" + // "<div class=\"following\">Friends <span>\"" + items["friends_count"] + "\"</span></div>" + // "</div>" + // "</div>" + // "</div>"; #endregion } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } } } else { jquery += "None of the User Is Following"; } } Response.Write(jquery); } else if (Request.QueryString["op"] == "deletedrafts") { Guid id = Guid.Parse(Request.QueryString["id"]); DraftsRepository draftsRepo = new DraftsRepository(); draftsRepo.DeleteDrafts(id); } else if (Request.QueryString["op"] == "usersearchresults") { ArrayList alstallusers = null; if (Session["AllUserList"] == null) { User user = (User)Session["LoggedUser"]; alstallusers = new ArrayList(); /*facebook*/ try { FacebookAccountRepository faceaccount = new FacebookAccountRepository(); ArrayList lstfacebookaccount = faceaccount.getAllFacebookAccountsOfUser(user.Id); foreach (FacebookAccount item in lstfacebookaccount) { alstallusers.Add(item.FbUserName + "_fb_" + item.FbUserId); } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } /*twitter*/ try { TwitterAccountRepository twtAccountrepo = new TwitterAccountRepository(); ArrayList lsttwitteraccount = twtAccountrepo.getAllTwitterAccountsOfUser(user.Id); foreach (TwitterAccount item in lsttwitteraccount) { alstallusers.Add(item.TwitterScreenName + "_twt_" + item.TwitterUserId); } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } /*linkedin*/ try { LinkedInAccountRepository linkedinaccountrepo = new LinkedInAccountRepository(); ArrayList lstaccount = linkedinaccountrepo.getAllLinkedinAccountsOfUser(user.Id); foreach (LinkedInAccount item in lstaccount) { alstallusers.Add(item.LinkedinUserName + "_lin_" + item.LinkedinUserId); } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } /*instagram*/ try { InstagramAccountRepository instaaccrepo = new InstagramAccountRepository(); ArrayList lstinstagramaccount = instaaccrepo.getAllInstagramAccountsOfUser(user.Id); foreach (InstagramAccount item in lstinstagramaccount) { alstallusers.Add(item.InsUserName + "_ins_" + item.InstagramId); } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } ///*googleplus*/ try { GooglePlusAccountRepository gpaccountrepo = new GooglePlusAccountRepository(); ArrayList lstgpaccount = gpaccountrepo.getAllGooglePlusAccountsOfUser(user.Id); foreach (GooglePlusAccount item in lstgpaccount) { alstallusers.Add(item.GpUserName + "_gp_" + item.GpUserId); } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } Session["AllUserList"] = alstallusers; } else { alstallusers = (ArrayList)Session["AllUserList"]; } } else if (Request.QueryString["op"] == "searchingresults") { string txtvalue = Request.QueryString["txtvalue"]; string message = string.Empty; if (!string.IsNullOrEmpty(txtvalue)) { ArrayList alstall = (ArrayList)Session["AllUserList"]; if (alstall.Count != 0) { foreach (string item in alstall) { if (item.ToLower().StartsWith(txtvalue)) { string[] nametype = item.Split('_'); if (nametype[1] == "fb") { message += "<div class=\"btn srcbtn\">" + "<img width=\"15\" src=\"../Contents/img/facebook.png\" alt=\"\">" + "<span onclick=\"getFacebookProfiles('" + nametype[2] + "')\">" + nametype[0] + "</span>" + "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" + "</div>"; } else if (nametype[1] == "twt" || item.Contains("_twt_")) { if (nametype.Count() < 4) { message += "<div class=\"btn srcbtn\">" + "<img width=\"15\" src=\"../Contents/img/twticon.png\" alt=\"\">" + " <span onclick=\"detailsprofile('" + nametype[0] + "');\">" + nametype[0] + "</span>" + "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" + "</div>"; } else { string[] containstwitter = item.Split(new string[] { "_twt_" }, StringSplitOptions.None); message += "<div class=\"btn srcbtn\">" + "<img width=\"15\" src=\"../Contents/img/twticon.png\" alt=\"\">" + "<span onclick=\"detailsprofile('" + containstwitter[0] + "');\"> " + containstwitter[0] + "</span>" + "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" + "</div>"; } } else if (nametype[1] == "ins") { message += "<div class=\"btn srcbtn\">" + "<img width=\"15\" src=\"../Contents/img/instagram_24X24.png\" alt=\"\">" + nametype[0] + "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" + "</div>"; } else if (nametype[1] == "lin") { message += "<div class=\"btn srcbtn\">" + "<img width=\"15\" src=\"../Contents/img/link_icon.png\" alt=\"\">" + nametype[0] + "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" + "</div>"; } else if (nametype[1] == "gp") { message += "<div class=\"btn srcbtn\">" + "<img width=\"15\" src=\"../Contents/img/google_plus.png\" alt=\"\">" + nametype[0] + "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" + "</div>"; } } } } else { message += "<div class=\"btn srcbtn\">" + "<img width=\"15\" src=\"../Contents/img/norecord.png\" alt=\"\">" + "No Records Found" + "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" + "</div>"; } message += "<div class=\"socailtile\">Twitter</div>"; /*twitter contact search */ #region twitter contact search try { User user = (User)Session["LoggedUser"]; Users twtUser = new Users(); oAuthTwitter oAuthTwt = new oAuthTwitter(); if (Session["oAuthUserSearch"] == null) { oAuthTwitter oauth = new oAuthTwitter(); oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"].ToString(); oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"].ToString(); oauth.CallBackUrl = ConfigurationManager.AppSettings["callbackurl"].ToString(); TwitterAccountRepository twtAccRepo = new TwitterAccountRepository(); ArrayList alst = twtAccRepo.getAllTwitterAccountsOfUser(user.Id); foreach (TwitterAccount item in alst) { oauth.AccessToken = item.OAuthToken; oauth.AccessTokenSecret = item.OAuthSecret; oauth.TwitterUserId = item.TwitterUserId; oauth.TwitterScreenName = item.TwitterScreenName; break; } Session["oAuthUserSearch"] = oauth; oAuthTwt = oauth; } else { oAuthTwitter oauth = (oAuthTwitter)Session["oAuthUserSearch"]; oAuthTwt = oauth; } JArray twtuserjson = twtUser.Get_Users_Search(oAuthTwt, txtvalue, "5"); foreach (var item in twtuserjson) { message += "<div class=\"btn srcbtn\">" + "<img width=\"15\" src=\"../Contents/img/twticon.png\" alt=\"\">" + " <span> " + item["screen_name"].ToString().TrimStart('"').TrimEnd('"') + "</span>" + "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" + "</div>"; } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } #endregion message += "<div class=\"socailtile\">Facebook</div>"; #region Facebook Contact search try { string accesstoken = string.Empty; FacebookAccountRepository facebookaccrepo = new FacebookAccountRepository(); ArrayList alstfacbookusers = facebookaccrepo.getAllFacebookAccounts(); foreach (FacebookAccount item in alstfacbookusers) { accesstoken = item.AccessToken; break; } string facebookSearchUrl = "https://graph.facebook.com/search?q=" + txtvalue + " &limit=5&type=user&access_token=" + accesstoken; var facerequest = (HttpWebRequest)WebRequest.Create(facebookSearchUrl); facerequest.Method = "GET"; string outputface = string.Empty; using (var response = facerequest.GetResponse()) { using (var stream = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding(1252))) { outputface = stream.ReadToEnd(); } } if (!outputface.StartsWith("[")) outputface = "[" + outputface + "]"; JArray facebookSearchResult = JArray.Parse(outputface); foreach (var item in facebookSearchResult) { var data = item["data"]; foreach (var chlid in data) { message += "<div class=\"btn srcbtn\">" + "<img width=\"15\" src=\"../Contents/img/facebook.png\" alt=\"\">" + "<span >" + chlid["name"] + "</span>" + "<span data-dismiss=\"alert\" class=\"close pull-right\">×</span>" + "</div>"; } } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } #endregion Response.Write(message); } } else if (Request.QueryString["op"] == "getTwitterUserDetails") { User user = (User)Session["LoggedUser"]; string userid = Request.QueryString["profileid"]; TwitterAccountRepository twtAccountRepo = new TwitterAccountRepository(); ArrayList alst = twtAccountRepo.getAllTwitterAccountsOfUser(user.Id); oAuthTwitter oauth = new oAuthTwitter(); foreach (TwitterAccount childnoe in alst) { oauth.AccessToken = childnoe.OAuthToken; oauth.AccessTokenSecret = childnoe.OAuthSecret; oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"]; oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"]; oauth.TwitterUserId = childnoe.TwitterUserId; oauth.TwitterScreenName = childnoe.TwitterScreenName; break; } Users userinfo = new Users(); //JArray foll = userinfo.Get_Followers_ById(oauth, userid); JArray userlookup = userinfo.Get_Users_LookUp(oauth, userid); string jstring = string.Empty; foreach (var item in userlookup) { jstring += "<div class=\"modal-small draggable\">"; jstring += "<div class=\"modal-content\">"; jstring += "<button class=\"modal-btn button b-close\" type=\"button\">"; jstring += "<span class=\"icon close-medium\"><span class=\"visuallyhidden\">X</span></span></button>"; jstring += "<div class=\"modal-header\"><h3 class=\"modal-title\">Profile summary</h3></div>"; jstring += "<div class=\"modal-body profile-modal\">"; jstring += "<div class=\"module profile-card component profile-header\">"; jstring += "<div class=\"profile-header-inner flex-module clearfix\" style=\"background-image: url('" + item["profile_banner_url"] + "');\">"; jstring += "<div class=\"profile-header-inner-overlay\"></div>"; jstring += "<a class=\"profile-picture media-thumbnail js-nav\" href=\"#\"><img class=\"avatar size73\" alt=\"" + item["name"] + "\" src=\"" + item["profile_image_url"] + "\" /></a>"; jstring += "<div class=\"profile-card-inner\">"; jstring += "<h1 class=\"fullname editable-group\">"; jstring += "<a href=\"#\" class=\"js-nav\">" + item["name"] + "</a>"; jstring += "<a class=\"verified-link js-tooltip\" href=\"#\"><span class=\"icon verified verified-large-border\"><span class=\"visuallyhidden\"></span> </span></a>"; jstring += "</h1>"; jstring += "<h2 class=\"username\"><a href=\"#\" class=\"pretty-link js-nav\"><span class=\"screen-name\"><s>@</s>" + item["screen_name"] + "</span> </a></h2>"; jstring += "<div class=\"bio-container editable-group\"><p class=\"bio profile-field\">"; try { jstring += item["status"]["text"]; } catch (Exception ex) { logger.Error(ex.Message); } jstring += "</p></div>"; jstring += "<p class=\"location-and-url\">"; jstring += "<span class=\"location-container editable-group\"><span class=\"location profile-field\"></span></span>"; jstring += "<span class=\"divider hidden\"></span> "; jstring += "<span class=\"url editable-group\"> <span class=\"profile-field\"><a title=\"#\" href=\"" + item["url"] + "\" rel=\"me nofollow\" target=\"_blank\">" + item["url"] + " </a>"; jstring += "<div style=\"cursor: pointer; width: 16px; height: 16px; display: inline-block;\"> </div>"; jstring += "</span></span></p></div></div>"; jstring += "<div class=\"clearfix\">"; jstring += "<div class=\"default-footer\">"; jstring += "<ul class=\"stats js-mini-profile-stats\">" + //"<li><a href=\"#\" class=\"js-nav\"><strong> 6,274</strong> Tweets </a></li>" + "<li><a href=\"#\" class=\"js-nav\"><strong>" + item["friends_count"] + "</strong> Following </a></li>" + "<li><a href=\"#\" class=\"js-nav\"><strong>" + item["followers_count"] + "</strong> Followers </a></li>"; jstring += "</ul>"; jstring += "<div class=\"btn-group\">" + "<div class=\"follow_button\">"; //"<span class=\"button-text follow-text\">Follow</span> " + //foreach (var child in foll) //{ // foreach (var childItem in child["ids"]) // { // string pl = childItem.ToString(); // } //} //jstring += "<span class=\"button-text follow-text\">Following</span>"; //jstring += "<span class=\"button-text unfollow-text\">Unfollow</span>"; jstring += "</div>" + "</div>"; jstring += "</div></div>"; jstring += "<div class=\"profile-social-proof\"><div class=\"follow-bar\"></div></div></div>"; jstring += "<ol id=\"twitterUserTweets\" class=\"recent-tweets\">" + "</ol>" + "<div class=\"go_to_profile\">" + "<small><a href=\"https://twitter.com/" + item["screen_name"] + "\" target=\"_blank\" class=\"view_profile\">Go to full profile →</a></small>" + "</div>" + "</div>" + "<div class=\"loading\">" + "<span class=\"spinner-bigger\"></span>" + "</div>" + "</div>"; jstring += "</div>"; } Response.Write(jstring); } else if (Request.QueryString["op"] == "pauseRssMessage") { Guid ID = Guid.Parse(Request.QueryString["id"]); RssFeedsRepository rssRepo = new RssFeedsRepository(); rssRepo.updateFeedStatus("pause", ID); } else if (Request.QueryString["op"] == "deleteRssMessage") { Guid ID = Guid.Parse(Request.QueryString["id"]); RssFeedsRepository rssRepo = new RssFeedsRepository(); rssRepo.DeleteRssMessage(ID); } else if (Request.QueryString["op"] == "playRssMessage") { Guid ID = Guid.Parse(Request.QueryString["id"]); RssFeedsRepository rssRepo = new RssFeedsRepository(); rssRepo.updateFeedStatus("play", ID); } else if (Request.QueryString["op"] == "facebookProfileDetails") { User user = (User)Session["LoggedUser"]; string userid = Request.QueryString["profileid"]; FacebookAccountRepository fbRepo = new FacebookAccountRepository(); ArrayList alst = fbRepo.getAllFacebookAccountsOfUser(user.Id); string accesstoken = string.Empty; foreach (FacebookAccount childnoe in alst) { accesstoken = childnoe.AccessToken; break; } FacebookClient fbclient = new FacebookClient(accesstoken); string jstring = string.Empty; dynamic item = fbclient.Get(userid); jstring += "<div class=\"modal-small draggable\">"; jstring += "<div class=\"modal-content\">"; jstring += "<button class=\"modal-btn button b-close\" type=\"button\">"; jstring += "<span class=\"icon close-medium\"><span class=\"visuallyhidden\">X</span></span></button>"; jstring += "<div class=\"modal-header\"><h3 class=\"modal-title\">Profile summary</h3></div>"; jstring += "<div class=\"modal-body profile-modal\">"; jstring += "<div class=\"module profile-card component profile-header\">"; try { jstring += "<div class=\"profile-header-inner flex-module clearfix\" style=\"background-image: url('" + item["cover"]["source"] + "');\">"; } catch (Exception ex) { Console.WriteLine(ex.Message); jstring += "<div class=\"profile-header-inner flex-module clearfix\" style=\"background-image: url('https://pbs.twimg.com/profile_banners/215936249/1371721359');\">"; } jstring += "<div class=\"profile-header-inner-overlay\"></div>"; jstring += "<a class=\"profile-picture media-thumbnail js-nav\" href=\"#\"><img class=\"avatar size73\" alt=\"" + item["name"] + "\" src=\"http://graph.facebook.com/" + item["id"] + "/picture?type=small\" /></a>"; jstring += "<div class=\"profile-card-inner\">"; jstring += "<h1 class=\"fullname editable-group\">"; try { jstring += "<a href=\"#\" class=\"js-nav\">" + item["name"] + "</a>"; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } jstring += "<a class=\"verified-link js-tooltip\" href=\"#\"><span class=\"icon verified verified-large-border\"><span class=\"visuallyhidden\"></span> </span></a>"; jstring += "</h1>"; try { jstring += "<h2 class=\"username\"><a href=\"#\" class=\"pretty-link js-nav\"><span class=\"screen-name\"><s>@</s>" + item["username"] + "</span> </a></h2>"; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } jstring += "<div class=\"bio-container editable-group\"><p class=\"bio profile-field\">"; try { jstring += item["about"]; } catch (Exception ex) { logger.Error(ex.Message); } jstring += "</p></div>"; jstring += "<p class=\"location-and-url\">"; jstring += "<span class=\"location-container editable-group\"><span class=\"location profile-field\"></span></span>"; jstring += "<span class=\"divider hidden\"></span> "; jstring += "<span class=\"url editable-group\"> <span class=\"profile-field\"><a title=\"#\" href=\"http://facebook.com/" + item["id"] + "\" rel=\"me nofollow\" target=\"_blank\">" + item["link"] + " </a>"; jstring += "<div style=\"cursor: pointer; width: 16px; height: 16px; display: inline-block;\"> </div>"; jstring += "</span></span></p></div></div>"; jstring += "<div class=\"clearfix\">"; jstring += "<div class=\"default-footer\">"; jstring += "<div class=\"btn-group\">" + "<div class=\"follow_button\">" + //"<span class=\"button-text following-text\">Following</span>" + //"<span class=\"button-text unfollow-text\">Unfollow</span>" + "</div>" + "</div>"; jstring += "</div></div>"; jstring += "<div class=\"profile-social-proof\"><div class=\"follow-bar\"></div></div></div>"; jstring += "<ol class=\"recent-tweets\">" + "<li class=\"\">" + "<div>" + "<i class=\"dogear\"></i>" + "</div>" + "</li>" + "</ol>" + "<div class=\"go_to_profile\">" + "<small><a href=\"http://facebook.com/" + item["id"] + "\" target=\"_blank\" class=\"view_profile\">Go to full profile →</a></small>" + "</div>" + "</div>" + "<div class=\"loading\">" + "<span class=\"spinner-bigger\"></span>" + "</div>" + "</div>"; jstring += "</div>"; Response.Write(jstring); } } }
protected void Page_Load(object sender, EventArgs e) { UserRepository userrepo = new UserRepository(); Registration regObject = new Registration(); TeamRepository objTeamRepo = new TeamRepository(); NewsRepository objNewsRepo = new NewsRepository(); AdsRepository objAdsRepo = new AdsRepository(); UserActivation objUserActivation=new UserActivation (); UserActivationRepository objUserActivationRepository=new UserActivationRepository (); SocialProfilesRepository objSocioRepo = new SocialProfilesRepository(); SocioBoard.Domain.User user = (User)Session["LoggedUser"]; Session["facebooktotalprofiles"] = null; if (!IsPostBack) { try { if (user == null) { Response.Redirect("Default.aspx"); } if (Request.QueryString["paymentTransaction"] == "Success") { ScriptManager.RegisterStartupScript(this, GetType(), "Paypall Success", "alert('Your transaction has been Suceeded !');", true); } if (Request.QueryString["paymentTransaction"] == "Cancel") { ScriptManager.RegisterStartupScript(this, GetType(), "Paypall Cancel", "<script type=\"text/javascript\">alert('Your transaction has been cancel !');</script>", true); } if (Request.QueryString["paymentTransaction"] == "Failed") { ScriptManager.RegisterStartupScript(this, GetType(), "Paypall Failed", "alert('Your transaction has been failed !');", true); } #region check user Activation try { objUserActivation = objUserActivationRepository.GetUserActivationStatus(user.Id.ToString()); if (objUserActivation.ActivationStatus == "0") { if (Request.QueryString["stat"] == "activate") { // if (Request.QueryString["id"] != null) { //objUserActivation = objUserActivationRepository.GetUserActivationStatusbyid(Request.QueryString["id"].ToString()); // if (objUserActivation.Id.ToString() == Request.QueryString["id"].ToString()) { objUserActivation.Id = objUserActivation.Id;//Guid.Parse(Request.QueryString["id"]); objUserActivation.UserId = objUserActivation.UserId; objUserActivation.ActivationStatus = "1"; UserActivationRepository.Update(objUserActivation); } //else //{ // Session["ActivationError"] = "Wrong Activation Link please contact Admin!"; // //ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Wrong Activation Link please contact Admin!');", true); // Response.Redirect("ActivationLink.aspx"); //} } //else //{ // Session["ActivationError"] = "Wrong Activation Link please contact Admin!"; // //ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Wrong Activation Link please contact Admin!');", true); // Response.Redirect("ActivationLink.aspx"); //} } else { Response.Redirect("ActivationLink.aspx"); } } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.StackTrace); } #endregion #region day count chkdate = user.CreateDate; DateTime curDate = DateTime.Now; TimeSpan ts = curDate - chkdate; datediff = ts.TotalDays; if (datediff > 30) { Response.Redirect("Settings/Billing.aspx"); } #endregion } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.StackTrace); } #region Count Used Accounts try { if (user.AccountType.ToString().ToUpper() == "SMALL BUSINESS".ToUpper()) tot_acc = 25; else if (user.AccountType.ToString().ToUpper() == "CORPORATION".ToUpper()) tot_acc = 60; else if (user.AccountType.ToString().ToUpper() == "INDIVIDUAL".ToUpper()) tot_acc = 10; profileCount = objSocioRepo.getAllSocialProfilesOfUser(user.Id).Count; Session["ProfileCount"] = profileCount; Session["TotalAccount"] = tot_acc; usedAccount.InnerHtml = " using " + profileCount + " of " + tot_acc; } catch (Exception ex) { logger.Error(ex.StackTrace); } #endregion if (!string.IsNullOrEmpty(Request.QueryString["type"])) { try { userrepo.UpdateAccountType(user.Id, Request.QueryString["type"]); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); logger.Error(ex.StackTrace); } } acrossProfile.InnerHtml = "Across " + user.UserName + "'s Twitter and Facebook accounts"; teamMem.InnerHtml = "managing " + user.UserName; try { News nws = objNewsRepo.getNewsForHome(); divNews.InnerHtml = nws.NewsDetail; } catch (Exception Err) { Console.Write(Err.StackTrace); logger.Error(Err.StackTrace); } try { ArrayList lstads = objAdsRepo.getAdsForHome(); foreach (var item in lstads) { Array temp = (Array)item; imgAds.ImageUrl = temp.GetValue(2).ToString(); break; // ads.ImageUrl; } } catch (Exception Err) { Console.Write(Err.StackTrace); logger.Error(Err.StackTrace); } #region Team Member Count try { GroupRepository grouprepo = new GroupRepository(); string groupsofhome = string.Empty; List<Groups> lstgroups = grouprepo.getAllGroups(user.Id); if (lstgroups.Count != 0) { foreach (Groups item in lstgroups) { groupsofhome += "<li><a href=\"../Settings/InviteMember.aspx?q=" + item.Id + "\"><img src=\"../Contents/img/groups_.png\" alt=\"\" style=\" margin-right:5px;\"> " + item.GroupName + "</a></li>"; } getAllGroupsOnHome.InnerHtml = groupsofhome; } } catch (Exception ex) { logger.Error(ex.StackTrace); } #endregion try { string strTeam = string.Empty; List<Team> team = objTeamRepo.getAllTeamsOfUser(user.Id); foreach (Team item in team) { strTeam += "<div class=\"userpictiny\"><a target=\"_blank\" href=\"#\">" + "<img width=\"48\" height=\"48\" title=\"" + item.FirstName + "\" alt=\"\" src=\"../Contents/img/blank_img.png\">" + "</a></div>"; } team_member.InnerHtml = strTeam; } catch (Exception Err) { Console.Write(Err.StackTrace); } #region Add Fan Page try { if (Session["fbSocial"] != null) { if (Session["fbSocial"] == "p") { FacebookAccount objFacebookAccount = (FacebookAccount)Session["fbpagedetail"]; // string strpageUrl = "https://graph.facebook.com/" + objFacebookAccount.FacebookId + "/accounts"; // objFacebookUrlBuilder = (FacebookUrlBuilder)Session["FacebookInsightUser"]; // string strData = objAuthentication.RequestUrl(strpageUrl, objFacebookAccount.Token); // JObject output = objWebRequest.FacebookRequest(strData, "Get"); FacebookClient fb = new FacebookClient(); fb.AccessToken = objFacebookAccount.AccessToken; dynamic output = fb.Get("/me/accounts"); // JArray data = (JArray)output["data"]; DataTable dtFbPage = new DataTable(); dtFbPage.Columns.Add("Email"); dtFbPage.Columns.Add("PageId"); dtFbPage.Columns.Add("PageName"); dtFbPage.Columns.Add("status"); dtFbPage.Columns.Add("customer_id"); string strPageDiv = string.Empty; if (output != null) { foreach (var item in output["data"]) { if (item.category.ToString() != "Application") { strPageDiv += "<div><a id=\"A1\" onclick=\"getInsights('" + item["id"].ToString() + "','" + item["name"].ToString() + "')\"><span>" + item["name"].ToString() + "</span> </a></div>"; fbpage.InnerHtml = strPageDiv; } } } else { strPageDiv += "<div>No Pages Found</div>"; } Page.ClientScript.RegisterStartupScript(Page.GetType(), "my", " ShowDialogHome(false);", true); Session["fbSocial"] = null; } } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.StackTrace); } #endregion #region InsightsData try { decimal malecount = 0, femalecount = 0, cnt = 0; FacebookStatsRepository objfbStatsRepo = new FacebookStatsRepository(); double daysSub = (DateTime.Now - user.CreateDate).TotalDays; int userdays = (int)daysSub; ArrayList arrFbStats = objfbStatsRepo.getAllFacebookStatsOfUser(user.Id, userdays); Random rNum = new Random(); foreach (var item in arrFbStats) { Array temp = (Array)item; cnt += int.Parse(temp.GetValue(3).ToString()) + int.Parse(temp.GetValue(4).ToString()); malecount += int.Parse(temp.GetValue(3).ToString()); femalecount += int.Parse(temp.GetValue(4).ToString()); } try { decimal mc = (malecount / cnt) * 100; male = Convert.ToInt16(mc); } catch (Exception Err) { Console.Write(Err.StackTrace); logger.Error(Err.StackTrace); } try { decimal fc = (femalecount / cnt) * 100; female = Convert.ToInt16(fc); } catch (Exception Err) { Console.Write(Err.StackTrace); logger.Error(Err.StackTrace); } int twtAccCount = objSocioRepo.getAllSocialProfilesTypeOfUser(user.Id, "twitter").Count; if (twtAccCount > 1) { twtmale = rNum.Next(100); twtfemale = 100 - twtmale; } else if (twtAccCount == 1) { twtmale = 100; twtfemale = 0; } Session["twtGender"] = twtmale + "," + twtfemale; } catch (Exception Err) { Console.Write(Err.Message.ToString()); logger.Error(Err.StackTrace); } getgrphData(); getNewFriends(7); getNewFollowers(7); #endregion #region IncomingMessages try { FacebookFeedRepository fbFeedRepo = new FacebookFeedRepository(); int fbmessagescout = fbFeedRepo.countUnreadMessages(user.Id); TwitterMessageRepository twtMsgRepo = new TwitterMessageRepository(); int twtcount = twtMsgRepo.getCountUnreadMessages(user.Id); Session["CountMessages"] = fbmessagescout + twtcount; } catch (Exception ex) { logger.Error(ex.StackTrace); } #endregion } }
protected void Page_Load(object sender, EventArgs e) { #region Varibles Initialize UserRepository userrepo = new UserRepository(); Registration regObject = new Registration(); TeamRepository objTeamRepo = new TeamRepository(); NewsRepository objNewsRepo = new NewsRepository(); AdsRepository objAdsRepo = new AdsRepository(); SocialProfilesRepository objSocioRepo = new SocialProfilesRepository(); #endregion SocioBoard.Domain.User user = (User)Session["LoggedUser"]; if (!IsPostBack) { try { if (user == null) Response.Redirect("Default.aspx"); } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.StackTrace); } if (!string.IsNullOrEmpty(Request.QueryString["type"])) { try { userrepo.UpdateAccountType(user.Id, Request.QueryString["type"]); User newUser = (User)Session["LoggedUser"]; newUser.Id = user.Id; newUser.Password = user.Password; newUser.PaymentStatus = user.PaymentStatus; newUser.ProfileUrl = user.ProfileUrl; newUser.TimeZone = user.TimeZone; newUser.UserName = user.UserName; newUser.UserStatus = user.UserStatus; newUser.AccountType = Request.QueryString["type"]; newUser.CreateDate = user.CreateDate; newUser.ExpiryDate = user.ExpiryDate; newUser.EmailId = user.EmailId; Session["LoggedUser"] = null; Session["LoggedUser"] = newUser; user.AccountType = newUser.AccountType; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); logger.Error(ex.StackTrace); } } #region Count Used Accounts try { PackageRepository packageRepo = new PackageRepository(); List<Package> lstPackage = packageRepo.getAllPackage(); foreach (Package item in lstPackage) { if (user.AccountType.ToLower() == item.PackageName.ToLower()) { tot_acc = item.TotalProfiles; break; } } profileCount = objSocioRepo.getAllSocialProfilesOfUser(user.Id).Count; Session["ProfileCount"] = profileCount; Session["TotalAccount"] = tot_acc; usedAccount.InnerHtml = " using " + profileCount + " of " + tot_acc; } catch(Exception ex) { logger.Error(ex.StackTrace); } #endregion #region News acrossProfile.InnerHtml = "Across " + user.UserName + "'s Twitter and Facebook accounts"; teamMem.InnerHtml = "managing " + user.UserName; try { News nws = objNewsRepo.getNewsForHome(); divNews.InnerHtml = nws.NewsDetail; } catch (Exception Err) { Console.Write(Err.StackTrace); logger.Error(Err.StackTrace); } try { ArrayList lstads = objAdsRepo.getAdsForHome(); foreach (var item in lstads) { Array temp = (Array)item; imgAds.ImageUrl = temp.GetValue(2).ToString(); break; // ads.ImageUrl; } } catch (Exception Err) { Console.Write(Err.StackTrace); logger.Error(Err.StackTrace); } #endregion #region Team Member Count try { GroupRepository grouprepo = new GroupRepository(); string groupsofhome = string.Empty; List<Groups> lstgroups = grouprepo.getAllGroups(user.Id); if (lstgroups.Count != 0) { foreach (Groups item in lstgroups) { groupsofhome += "<li><a href=\"../Settings/InviteMember.aspx?q=" + item.Id + "\"><img src=\"../Contents/img/groups_.png\" alt=\"\" style=\" margin-right:5px;\"> " + item.GroupName + "</a></li>"; } getAllGroupsOnHome.InnerHtml = groupsofhome; } } catch(Exception ex) { logger.Error(ex.StackTrace); } #endregion try { string strTeam = string.Empty; List<Team> team = objTeamRepo.getAllTeamsOfUser(user.Id); foreach (Team item in team) { strTeam += "<div class=\"userpictiny\"><a target=\"_blank\" href=\"#\">"+ "<img width=\"48\" height=\"48\" title=\""+ item.FirstName +"\" alt=\"\" src=\"../Contents/img/blank_img.png\">" + "</a></div>"; } team_member.InnerHtml = strTeam; } catch (Exception Err) { Console.Write(Err.StackTrace); } #region Add Fan Page try { if (Session["fbSocial"] != null) { if (Session["fbSocial"] == "p") { FacebookAccount objFacebookAccount = (FacebookAccount)Session["fbpagedetail"]; // string strpageUrl = "https://graph.facebook.com/" + objFacebookAccount.FacebookId + "/accounts"; // objFacebookUrlBuilder = (FacebookUrlBuilder)Session["FacebookInsightUser"]; // string strData = objAuthentication.RequestUrl(strpageUrl, objFacebookAccount.Token); // JObject output = objWebRequest.FacebookRequest(strData, "Get"); FacebookClient fb = new FacebookClient(); fb.AccessToken = objFacebookAccount.AccessToken; dynamic output = fb.Get("/me/accounts"); // JArray data = (JArray)output["data"]; DataTable dtFbPage = new DataTable(); dtFbPage.Columns.Add("Email"); dtFbPage.Columns.Add("PageId"); dtFbPage.Columns.Add("PageName"); dtFbPage.Columns.Add("status"); dtFbPage.Columns.Add("customer_id"); string strPageDiv = string.Empty; if (output != null) { foreach (var item in output["data"]) { if (item.category.ToString() != "Application") { strPageDiv += "<div><a id=\"A1\" onclick=\"getInsights('" + item["id"].ToString() + "','" + item["name"].ToString() + "')\"><span>" + item["name"].ToString() + "</span> </a></div>"; fbpage.InnerHtml = strPageDiv; } } } else { strPageDiv += "<div>No Pages Found</div>"; } Page.ClientScript.RegisterStartupScript(Page.GetType(), "my", " ShowDialogHome(false);", true); Session["fbSocial"] = null; } } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.StackTrace); } #endregion #region InsightsData try { decimal malecount = 0, femalecount = 0, cnt = 0; FacebookStatsRepository objfbStatsRepo = new FacebookStatsRepository(); double daysSub = (DateTime.Now - user.CreateDate).TotalDays; int userdays = (int)daysSub; ArrayList arrFbStats = objfbStatsRepo.getAllFacebookStatsOfUser(user.Id, userdays); Random rNum = new Random(); foreach (var item in arrFbStats) { Array temp = (Array)item; cnt += int.Parse(temp.GetValue(3).ToString()) + int.Parse(temp.GetValue(4).ToString()); malecount += int.Parse(temp.GetValue(3).ToString()); femalecount += int.Parse(temp.GetValue(4).ToString()); } try { decimal mc = (malecount / cnt) * 100; male = Convert.ToInt16(mc); } catch (Exception Err) { Console.Write(Err.StackTrace); logger.Error(Err.StackTrace); } try { decimal fc = (femalecount / cnt) * 100; female = Convert.ToInt16(fc); } catch (Exception Err) { Console.Write(Err.StackTrace); logger.Error(Err.StackTrace); } int twtAccCount=objSocioRepo.getAllSocialProfilesTypeOfUser(user.Id, "twitter").Count; if (twtAccCount > 1) { twtmale = rNum.Next(100); twtfemale = 100 - twtmale; } else if (twtAccCount == 1) { twtmale = 100; twtfemale = 0; } Session["twtGender"] = twtmale + "," + twtfemale; } catch (Exception Err) { Console.Write(Err.Message.ToString()); logger.Error(Err.StackTrace); } getgrphData(); getNewFriends(7); getNewFollowers(7); #endregion #region IncomingMessages try { FacebookFeedRepository fbFeedRepo = new FacebookFeedRepository(); int fbmessagescout = fbFeedRepo.countUnreadMessages(user.Id); TwitterMessageRepository twtMsgRepo = new TwitterMessageRepository(); int twtcount = twtMsgRepo.getCountUnreadMessages(user.Id); Session["CountMessages"] = fbmessagescout + twtcount; } catch (Exception ex) { logger.Error(ex.StackTrace); } #endregion } }
protected void Page_Load(object sender, EventArgs e) { try { UserRefRelationRepository objUserRefRelationRepository=new UserRefRelationRepository (); UserRepository userrepo = new UserRepository(); Registration regObject = new Registration(); TeamRepository objTeamRepo = new TeamRepository(); NewsRepository objNewsRepo = new NewsRepository(); AdsRepository objAdsRepo = new AdsRepository(); UserActivation objUserActivation = new UserActivation(); UserActivationRepository objUserActivationRepository = new UserActivationRepository(); SocialProfilesRepository objSocioRepo = new SocialProfilesRepository(); GroupRepository objGroupRepository = new GroupRepository(); TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository(); Team team; SocioBoard.Domain.User user = (User)Session["LoggedUser"]; if (Session["GroupName"] == null) { Groups objGroupDetails = objGroupRepository.getGroupDetail(user.Id); team = objTeamRepo.getAllDetails(objGroupDetails.Id, user.EmailId); Session["GroupName"] = team; } else { team = (SocioBoard.Domain.Team)Session["GroupName"]; } Session["facebooktotalprofiles"] = null; if (user.Password == null) { Response.Redirect("/Pricing.aspx"); } #region Days remaining if (Session["days_remaining"] == null ) { if (user.PaymentStatus == "unpaid" && user.AccountType!="Free") { int daysremaining = (user.ExpiryDate.Date - DateTime.Now.Date).Days; if (daysremaining < 0) { daysremaining = -1; } Session["days_remaining"] = daysremaining; //ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('You are using '" + user.AccountType + "' account only '" + daysremaining + "' days is remaining !');", true); if (daysremaining <= -1) { } else if (daysremaining == 0) { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Your trial " + user.AccountType + " account will expire end of the day, please upgrade to paid plan.');", true); } else { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Your trial " + user.AccountType + " account will expire in " + daysremaining + " days, please upgrade to paid plan.');", true); } } } #endregion #region for You can use only 30 days as Unpaid User if (user.PaymentStatus.ToLower() == "unpaid" && user.AccountType != "Free") { if (!SBUtils.IsUserWorkingDaysValid(user.ExpiryDate)) { // ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('You can use only 30 days as Unpaid User !');", true); Session["GreaterThan30Days"] = "GreaterThan30Days"; Response.Redirect("/Settings/Billing.aspx"); } } Session["GreaterThan30Days"] = null; #endregion if (!IsPostBack) { try { if (user == null) { Response.Redirect("Default.aspx"); } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.StackTrace); } try { objUserActivation = objUserActivationRepository.GetUserActivationStatus(user.Id.ToString()); } catch (Exception ex) { Session["objUserActivationException"] = "objUserActivationException"; Console.WriteLine(ex.Message); logger.Error(ex.StackTrace); } #region Count Used Accounts try { if (user.AccountType.ToString().ToLower() == AccountType.Deluxe.ToString().ToLower()) tot_acc = 50; else if (user.AccountType.ToString().ToLower() == AccountType.Standard.ToString().ToLower()) tot_acc = 10; else if (user.AccountType.ToString().ToLower() == AccountType.Premium.ToString().ToLower()) tot_acc = 20; else if (user.AccountType.ToString().ToLower() == AccountType.Free.ToString().ToLower()) tot_acc = 5; profileCount = objSocioRepo.getAllSocialProfilesOfUser(user.Id).Count; Session["ProfileCount"] = profileCount; Session["TotalAccount"] = tot_acc; try { Groups lstDetail = objGroupRepository.getGroupName(team.GroupId); if (lstDetail.GroupName == "Socioboard") { usedAccount.InnerHtml = " using " + profileCount + " of " + tot_acc; } } catch (Exception ex) { logger.Error(ex.StackTrace); } } catch (Exception ex) { logger.Error(ex.StackTrace); } #endregion try { Groups lstDetails = objGroupRepository.getGroupName(team.GroupId); if (lstDetails.GroupName != "Socioboard") { expander.Attributes.CssStyle.Add("display", "none"); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } //this is used to check whether facebok account Already Exist if (Session["alreadyexist"] != null) { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('This Profile is Already Added please add aother Account!');", true); Session["alreadyexist"] = null; } if ( Session["alreadypageexist"] != null) { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('This Page is Already Added please add aother Page!');", true); Session["alreadypageexist"] = null; } if (!string.IsNullOrEmpty(Request.QueryString["type"])) { try { userrepo.UpdateAccountType(user.Id, Request.QueryString["type"]); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); logger.Error(ex.StackTrace); } } //acrossProfile.InnerHtml = "Across " + user.UserName + "'s Twitter and Facebook accounts"; teamMem.InnerHtml = "managing " + user.UserName; try { News nws = objNewsRepo.getNewsForHome(); //divNews.InnerHtml = nws.NewsDetail; } catch (Exception Err) { Console.Write(Err.StackTrace); logger.Error(Err.StackTrace); } try { ArrayList lstads = objAdsRepo.getAdsForHome(); if (lstads.Count < 1) { if (user.PaymentStatus.ToUpper() == "PAID") { bindads.InnerHtml = "<img src=\"../Contents/img/admin/ads.png\" alt=\"\" >"; } else { #region ADS Script bindads.InnerHtml = "<script async src=\"//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\"></script>" + "<!-- socioboard -->" + "<ins class=\"adsbygoogle\"" + "style=\"display:inline-block;width:250px;height:250px\"" + "data-ad-client=\"ca-pub-7073257741073458\"" + "data-ad-slot=\"9533254693\"></ins>" + "<script>" + "(adsbygoogle = window.adsbygoogle || []).push({});" + "</script>"; #endregion } } foreach (var item in lstads) { Array temp = (Array)item; //imgAds.ImageUrl = temp.GetValue(2).ToString(); if (user.PaymentStatus.ToUpper() == "PAID") { bindads.InnerHtml = "<img src=\"" + temp.GetValue(2).ToString() + "\" alt=\"\" style=\"width:246px;height:331px\">"; } else { #region ADS Script bindads.InnerHtml = "<script async src=\"//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\"></script>" + "<!-- socioboard -->" + "<ins class=\"adsbygoogle\"" + "style=\"display:inline-block;width:250px;height:250px\"" + "data-ad-client=\"ca-pub-7073257741073458\"" + "data-ad-slot=\"9533254693\"></ins>" + "<script>" + "(adsbygoogle = window.adsbygoogle || []).push({});" + "</script>"; #endregion } break; // ads.ImageUrl; } } catch (Exception Err) { Console.Write(Err.StackTrace); logger.Error(Err.StackTrace); } #region Team Member Count try { GroupRepository grouprepo = new GroupRepository(); string groupsofhome = string.Empty; List<Groups> lstgroups = grouprepo.getAllGroups(user.Id); if (lstgroups.Count != 0) { foreach (Groups item in lstgroups) { groupsofhome += "<li><a href=\"../Settings/InviteMember.aspx?q=" + item.Id + "\"><img src=\"../Contents/img/groups_.png\" alt=\"\" style=\" margin-right:5px;\"> " + item.GroupName + "</a></li>"; } getAllGroupsOnHome.InnerHtml = groupsofhome; } } catch (Exception ex) { logger.Error(ex.StackTrace); } #endregion try { string strTeam = string.Empty; List<Team> teams = objTeamRepo.getAllTeamsOfUser(user.Id,team.GroupId,user.EmailId); foreach (Team item in teams) { strTeam += "<div class=\"userpictiny\"><a target=\"_blank\" href=\"#\">" + "<img width=\"48\" height=\"48\" title=\"" + item.FirstName + "\" alt=\"\" src=\"../Contents/img/blank_img.png\">" + "</a></div>"; } team_member.InnerHtml = strTeam; } catch (Exception Err) { Console.Write(Err.StackTrace); } #region Add Fan Page try { if (Session["fbSocial"] != null) { if (Session["fbSocial"] == "p") { FacebookAccount objFacebookAccount = (FacebookAccount)Session["fbpagedetail"]; // string strpageUrl = "https://graph.facebook.com/" + objFacebookAccount.FacebookId + "/accounts"; // objFacebookUrlBuilder = (FacebookUrlBuilder)Session["FacebookInsightUser"]; // string strData = objAuthentication.RequestUrl(strpageUrl, objFacebookAccount.Token); // JObject output = objWebRequest.FacebookRequest(strData, "Get"); FacebookClient fb = new FacebookClient(); fb.AccessToken = objFacebookAccount.AccessToken; dynamic output = fb.Get("/me/accounts"); // JArray data = (JArray)output["data"]; DataTable dtFbPage = new DataTable(); dtFbPage.Columns.Add("Email"); dtFbPage.Columns.Add("PageId"); dtFbPage.Columns.Add("PageName"); dtFbPage.Columns.Add("status"); dtFbPage.Columns.Add("customer_id"); string strPageDiv = string.Empty; if (output != null) { foreach (var item in output["data"]) { if (item.category.ToString() != "Application") { strPageDiv += "<div><a id=\"A1\" onclick=\"getInsights('" + item["id"].ToString() + "','" + item["name"].ToString() + "')\"><span>" + item["name"].ToString() + "</span> </a></div>"; fbpage.InnerHtml = strPageDiv; } } } else { strPageDiv += "<div>No Pages Found</div>"; } Page.ClientScript.RegisterStartupScript(Page.GetType(), "my", " ShowDialogHome(false);", true); Session["fbSocial"] = null; } } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.StackTrace); } #endregion #region InsightsData try { decimal malecount = 0, femalecount = 0, cnt = 0; FacebookStatsRepository objfbStatsRepo = new FacebookStatsRepository(); double daysSub = (DateTime.Now - user.CreateDate).TotalDays; int userdays; if (daysSub > 0 && daysSub <= 1) { userdays = 1; } else { userdays = (int)daysSub; } ArrayList arrFbStats = objfbStatsRepo.getAllFacebookStatsOfUser(user.Id, userdays); //ArrayList arrFbStats = objfbStatsRepo.getTotalFacebookStatsOfUser(user.Id); Random rNum = new Random(); foreach (var item in arrFbStats) { Array temp = (Array)item; cnt += int.Parse(temp.GetValue(3).ToString()) + int.Parse(temp.GetValue(4).ToString()); malecount += int.Parse(temp.GetValue(3).ToString()); femalecount += int.Parse(temp.GetValue(4).ToString()); } try { decimal mc = (malecount / cnt) * 100; male = Convert.ToInt16(mc); } catch (Exception Err) { Console.Write(Err.StackTrace); logger.Error(Err.StackTrace); } try { decimal fc = (femalecount / cnt) * 100; female = Convert.ToInt16(fc); } catch (Exception Err) { Console.Write(Err.StackTrace); logger.Error(Err.StackTrace); } int twtAccCount = objSocioRepo.getAllSocialProfilesTypeOfUser(user.Id, "twitter").Count; if (twtAccCount > 1) { twtmale = rNum.Next(100); twtfemale = 100 - twtmale; } else if (twtAccCount == 1) { twtmale = 100; twtfemale = 0; } Session["twtGender"] = twtmale + "," + twtfemale; } catch (Exception Err) { Console.Write(Err.Message.ToString()); logger.Error(Err.StackTrace); } //getgrphData(); // getNewFriends(7); // getNewFriends(); // getNewFollowers(); #endregion #region GetFollower try { String TwtProfileId = string.Empty; TwitterStatsRepository objtwtStatsRepo = new TwitterStatsRepository(); List<TeamMemberProfile> objTeamMemberProfile = objTeamMemberProfileRepository.getTwtTeamMemberProfileData(team.Id); foreach (TeamMemberProfile item in objTeamMemberProfile) { TwtProfileId += item.ProfileId + ','; } TwtProfileId = TwtProfileId.Substring(0, TwtProfileId.Length - 1); List<TwitterStats> arrTwtStats = objtwtStatsRepo.getAllAccountDetail(TwtProfileId); //strTwtArray = "["; int NewTweet_Count = 0; string TotalFollower = string.Empty; foreach (TwitterStats item in arrTwtStats) { NewTweet_Count += item.FollowerCount; } if (NewTweet_Count >= 100000) { TotalFollower = (System.Math.Round(((float)NewTweet_Count / 1000000), 2)) + "M"; } else if (NewTweet_Count > 1000 && NewTweet_Count < 100000) { TotalFollower = (System.Math.Round(((float)NewTweet_Count / 1000), 2)) + "K"; } else { TotalFollower = NewTweet_Count.ToString(); } spanNewTweets.InnerHtml = TotalFollower; } catch (Exception Err) { Console.Write(Err.Message.ToString()); logger.Error(Err.StackTrace); } #endregion #region GetFacebookFanPage try { String FbProfileId = string.Empty; FacebookStatsRepository objFacebookStatsRepository = new FacebookStatsRepository(); List<TeamMemberProfile> objTeamMemberProfile = objTeamMemberProfileRepository.getTeamMemberProfileData(team.Id); foreach (TeamMemberProfile item in objTeamMemberProfile) { FbProfileId += item.ProfileId + ','; } FbProfileId = FbProfileId.Substring(0, FbProfileId.Length - 1); List<FacebookStats> arrFbStats = objFacebookStatsRepository.getAllAccountDetail(FbProfileId); //strTwtArray = "["; int NewFbFan_Count = 0; string TotalFriends = string.Empty; foreach (FacebookStats item in arrFbStats) { NewFbFan_Count += item.FanCount; } if (NewFbFan_Count >= 100000) { TotalFriends = (System.Math.Round(((float)NewFbFan_Count / 1000000), 2)) + "M"; } else if (NewFbFan_Count > 1000 && NewFbFan_Count < 100000) { TotalFriends = (System.Math.Round(((float)NewFbFan_Count / 1000), 2)) + "K"; } else { TotalFriends = NewFbFan_Count.ToString(); } spanFbFans.InnerHtml = TotalFriends; } catch (Exception Err) { Console.Write(Err.Message.ToString()); logger.Error(Err.StackTrace); } #endregion #region IncomingMessages try { FacebookFeedRepository fbFeedRepo = new FacebookFeedRepository(); int fbmessagescout = fbFeedRepo.countUnreadMessages(user.Id); TwitterMessageRepository twtMsgRepo = new TwitterMessageRepository(); int twtcount = twtMsgRepo.getCountUnreadMessages(user.Id); Session["CountMessages"] = fbmessagescout + twtcount; } catch (Exception ex) { logger.Error(ex.StackTrace); } #endregion #region NewIncomingMessage try { String FbProfileId = string.Empty; String TwtProfileId = string.Empty; List<TeamMemberProfile> objTeamMemberProfile = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(team.Id); foreach (TeamMemberProfile item in objTeamMemberProfile) { try { if (item.ProfileType == "facebook") { FbProfileId += item.ProfileId + ','; } else if (item.ProfileType == "twitter") { TwtProfileId += item.ProfileId + ','; } } catch (Exception Err) { Console.Write(Err.StackTrace); logger.Error(Err.StackTrace); } } try { FbProfileId = FbProfileId.Substring(0, FbProfileId.Length - 1); TwtProfileId = TwtProfileId.Substring(0, TwtProfileId.Length - 1); } catch (Exception Err) { Console.Write(Err.StackTrace); logger.Error(Err.StackTrace); } FacebookFeedRepository objFacebookFeedRepository = new FacebookFeedRepository(); List<FacebookFeed> alstfb = objFacebookFeedRepository.getAllFeedDetail(FbProfileId); // FacebookMessageRepository objFacebookMessageRepository = new FacebookMessageRepository(); TwitterMessageRepository objtwttatsRepo = new TwitterMessageRepository(); // List<FacebookMessage> alstfb = objFacebookMessageRepository.getAllMessageDetail(FbProfileId); List<TwitterMessage> alstTwt = objtwttatsRepo.getAlltwtMessages(TwtProfileId); int TotalFbMsgCount = 0; int TotalTwtMsgCount = 0; try { TotalFbMsgCount = alstfb.Count; TotalTwtMsgCount = alstTwt.Count; } catch (Exception Err) { Console.Write(Err.StackTrace); logger.Error(Err.StackTrace); } spanIncoming.InnerHtml = (TotalFbMsgCount+TotalTwtMsgCount).ToString(); string profileid = string.Empty; ScheduledMessageRepository objScheduledMessageRepository = new ScheduledMessageRepository(); foreach (TeamMemberProfile item in objTeamMemberProfile) { profileid += item.ProfileId + ','; } profileid = profileid.Substring(0, profileid.Length - 1); spanSent.InnerHtml = objScheduledMessageRepository.getAllSentMessageDetails(profileid).Count().ToString(); } catch (Exception Err) { Console.Write(Err.StackTrace); logger.Error(Err.StackTrace); } } #endregion } catch (Exception Err) { Console.Write(Err.StackTrace); } }
protected void Page_Load(object sender, EventArgs e) { try { UserRepository userrepo = new UserRepository(); Registration regObject = new Registration(); TeamRepository objTeamRepo = new TeamRepository(); NewsRepository objNewsRepo = new NewsRepository(); AdsRepository objAdsRepo = new AdsRepository(); UserActivation objUserActivation = new UserActivation(); UserActivationRepository objUserActivationRepository = new UserActivationRepository(); SocialProfilesRepository objSocioRepo = new SocialProfilesRepository(); SocioBoard.Domain.User user = (User)Session["LoggedUser"]; Session["facebooktotalprofiles"] = null; if (user.Password == null) { Response.Redirect("/Pricing.aspx"); } #region Days remaining if (Session["days_remaining"] == null) { if (user.PaymentStatus == "unpaid") { int daysremaining = (user.ExpiryDate.Date - DateTime.Now.Date).Days; if (daysremaining < 0) { daysremaining = 0; } Session["days_remaining"] = daysremaining; //ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('You are using '" + user.AccountType + "' account only '" + daysremaining + "' days is remaining !');", true); ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Your trial " + user.AccountType + " account will expire in " + daysremaining + " days, please upgrade to paid plan.');", true); } } #endregion #region for You can use only 30 days as Unpaid User if (user.PaymentStatus.ToLower() == "unpaid") { if (!SBUtils.IsUserWorkingDaysValid(user.ExpiryDate)) { // ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('You can use only 30 days as Unpaid User !');", true); Session["GreaterThan30Days"] = "GreaterThan30Days"; Response.Redirect("/Settings/Billing.aspx"); } } Session["GreaterThan30Days"] = null; #endregion if (!IsPostBack) { try { if (user == null) { Response.Redirect("Default.aspx"); } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.StackTrace); } try { objUserActivation = objUserActivationRepository.GetUserActivationStatus(user.Id.ToString()); } catch (Exception ex) { Session["objUserActivationException"] = "objUserActivationException"; Console.WriteLine(ex.Message); logger.Error(ex.StackTrace); } //#region check user Activation //try //{ // if (objUserActivation != null) // { // if (objUserActivation.ActivationStatus == "0") // { // if (Request.QueryString["stat"] == "activate") // { // if (Request.QueryString["id"] != null) // { // //objUserActivation = objUserActivationRepository.GetUserActivationStatusbyid(Request.QueryString["id"].ToString()); // if (objUserActivation.UserId.ToString() == Request.QueryString["id"].ToString()) // { // objUserActivation.Id = objUserActivation.Id; //Guid.Parse(Request.QueryString["id"]); // objUserActivation.UserId = Guid.Parse(Request.QueryString["id"]);// objUserActivation.UserId; // objUserActivation.ActivationStatus = "1"; // UserActivationRepository.Update(objUserActivation); // } // else // { // Session["ActivationError"] = "Wrong Activation Link please contact Admin!"; // //ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Wrong Activation Link please contact Admin!');", true); // //Response.Redirect("ActivationLink.aspx"); // } // } // else // { // Session["ActivationError"] = "Wrong Activation Link please contact Admin!"; // //ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Wrong Activation Link please contact Admin!');", true); // //Response.Redirect("ActivationLink.aspx"); // } // } // else // { // // Response.Redirect("ActivationLink.aspx"); // } // } // } //} //catch (Exception ex) //{ // Console.WriteLine(ex.Message); // logger.Error(ex.StackTrace); //} //#endregion #region Count Used Accounts try { if (user.AccountType.ToString().ToLower() == AccountType.Deluxe.ToString().ToLower()) tot_acc = 20; else if (user.AccountType.ToString().ToLower() == AccountType.Standard.ToString().ToLower()) tot_acc = 10; else if (user.AccountType.ToString().ToLower() == AccountType.Premium.ToString().ToLower()) tot_acc = 50; else if (user.AccountType.ToString().ToLower() == AccountType.Free.ToString().ToLower()) tot_acc = 5; profileCount = objSocioRepo.getAllSocialProfilesOfUser(user.Id).Count; Session["ProfileCount"] = profileCount; Session["TotalAccount"] = tot_acc; usedAccount.InnerHtml = " using " + profileCount + " of " + tot_acc; } catch (Exception ex) { logger.Error(ex.StackTrace); } #endregion if (!string.IsNullOrEmpty(Request.QueryString["type"])) { try { userrepo.UpdateAccountType(user.Id, Request.QueryString["type"]); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); logger.Error(ex.StackTrace); } } acrossProfile.InnerHtml = "Across " + user.UserName + "'s Twitter and Facebook accounts"; teamMem.InnerHtml = "managing " + user.UserName; try { News nws = objNewsRepo.getNewsForHome(); divNews.InnerHtml = nws.NewsDetail; } catch (Exception Err) { Console.Write(Err.StackTrace); logger.Error(Err.StackTrace); } try { ArrayList lstads = objAdsRepo.getAdsForHome(); if (lstads.Count < 1) { if (user.PaymentStatus.ToUpper() == "PAID") { bindads.InnerHtml = "<img src=\"../Contents/img/admin/ads.png\" alt=\"\" >"; } else { #region ADS Script bindads.InnerHtml = "<script async src=\"//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\"></script>" + "<!-- socioboard -->" + "<ins class=\"adsbygoogle\"" + "style=\"display:inline-block;width:250px;height:250px\"" + "data-ad-client=\"ca-pub-7073257741073458\"" + "data-ad-slot=\"9533254693\"></ins>" + "<script>" + "(adsbygoogle = window.adsbygoogle || []).push({});" + "</script>"; #endregion } } foreach (var item in lstads) { Array temp = (Array)item; //imgAds.ImageUrl = temp.GetValue(2).ToString(); if (user.PaymentStatus.ToUpper() == "PAID") { bindads.InnerHtml = "<img src=\"" + temp.GetValue(2).ToString() + "\" alt=\"\" style=\"width:246px;height:331px\">"; } else { #region ADS Script bindads.InnerHtml = "<script async src=\"//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\"></script>" + "<!-- socioboard -->" + "<ins class=\"adsbygoogle\"" + "style=\"display:inline-block;width:250px;height:250px\"" + "data-ad-client=\"ca-pub-7073257741073458\"" + "data-ad-slot=\"9533254693\"></ins>" + "<script>" + "(adsbygoogle = window.adsbygoogle || []).push({});" + "</script>"; #endregion } break; // ads.ImageUrl; } } catch (Exception Err) { Console.Write(Err.StackTrace); logger.Error(Err.StackTrace); } #region Team Member Count try { GroupRepository grouprepo = new GroupRepository(); string groupsofhome = string.Empty; List<Groups> lstgroups = grouprepo.getAllGroups(user.Id); if (lstgroups.Count != 0) { foreach (Groups item in lstgroups) { groupsofhome += "<li><a href=\"../Settings/InviteMember.aspx?q=" + item.Id + "\"><img src=\"../Contents/img/groups_.png\" alt=\"\" style=\" margin-right:5px;\"> " + item.GroupName + "</a></li>"; } getAllGroupsOnHome.InnerHtml = groupsofhome; } } catch (Exception ex) { logger.Error(ex.StackTrace); } #endregion try { string strTeam = string.Empty; List<Team> team = objTeamRepo.getAllTeamsOfUser(user.Id); foreach (Team item in team) { strTeam += "<div class=\"userpictiny\"><a target=\"_blank\" href=\"#\">" + "<img width=\"48\" height=\"48\" title=\"" + item.FirstName + "\" alt=\"\" src=\"../Contents/img/blank_img.png\">" + "</a></div>"; } team_member.InnerHtml = strTeam; } catch (Exception Err) { Console.Write(Err.StackTrace); } #region Add Fan Page try { if (Session["fbSocial"] != null) { if (Session["fbSocial"] == "p") { FacebookAccount objFacebookAccount = (FacebookAccount)Session["fbpagedetail"]; // string strpageUrl = "https://graph.facebook.com/" + objFacebookAccount.FacebookId + "/accounts"; // objFacebookUrlBuilder = (FacebookUrlBuilder)Session["FacebookInsightUser"]; // string strData = objAuthentication.RequestUrl(strpageUrl, objFacebookAccount.Token); // JObject output = objWebRequest.FacebookRequest(strData, "Get"); FacebookClient fb = new FacebookClient(); fb.AccessToken = objFacebookAccount.AccessToken; dynamic output = fb.Get("/me/accounts"); // JArray data = (JArray)output["data"]; DataTable dtFbPage = new DataTable(); dtFbPage.Columns.Add("Email"); dtFbPage.Columns.Add("PageId"); dtFbPage.Columns.Add("PageName"); dtFbPage.Columns.Add("status"); dtFbPage.Columns.Add("customer_id"); string strPageDiv = string.Empty; if (output != null) { foreach (var item in output["data"]) { if (item.category.ToString() != "Application") { strPageDiv += "<div><a id=\"A1\" onclick=\"getInsights('" + item["id"].ToString() + "','" + item["name"].ToString() + "')\"><span>" + item["name"].ToString() + "</span> </a></div>"; fbpage.InnerHtml = strPageDiv; } } } else { strPageDiv += "<div>No Pages Found</div>"; } Page.ClientScript.RegisterStartupScript(Page.GetType(), "my", " ShowDialogHome(false);", true); Session["fbSocial"] = null; } } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.StackTrace); } #endregion #region InsightsData try { decimal malecount = 0, femalecount = 0, cnt = 0; FacebookStatsRepository objfbStatsRepo = new FacebookStatsRepository(); double daysSub = (DateTime.Now - user.CreateDate).TotalDays; int userdays = (int)daysSub; ArrayList arrFbStats = objfbStatsRepo.getAllFacebookStatsOfUser(user.Id, userdays); Random rNum = new Random(); foreach (var item in arrFbStats) { Array temp = (Array)item; cnt += int.Parse(temp.GetValue(3).ToString()) + int.Parse(temp.GetValue(4).ToString()); malecount += int.Parse(temp.GetValue(3).ToString()); femalecount += int.Parse(temp.GetValue(4).ToString()); } try { decimal mc = (malecount / cnt) * 100; male = Convert.ToInt16(mc); } catch (Exception Err) { Console.Write(Err.StackTrace); logger.Error(Err.StackTrace); } try { decimal fc = (femalecount / cnt) * 100; female = Convert.ToInt16(fc); } catch (Exception Err) { Console.Write(Err.StackTrace); logger.Error(Err.StackTrace); } int twtAccCount = objSocioRepo.getAllSocialProfilesTypeOfUser(user.Id, "twitter").Count; if (twtAccCount > 1) { twtmale = rNum.Next(100); twtfemale = 100 - twtmale; } else if (twtAccCount == 1) { twtmale = 100; twtfemale = 0; } Session["twtGender"] = twtmale + "," + twtfemale; } catch (Exception Err) { Console.Write(Err.Message.ToString()); logger.Error(Err.StackTrace); } getgrphData(); getNewFriends(7); getNewFollowers(7); #endregion #region IncomingMessages try { FacebookFeedRepository fbFeedRepo = new FacebookFeedRepository(); int fbmessagescout = fbFeedRepo.countUnreadMessages(user.Id); TwitterMessageRepository twtMsgRepo = new TwitterMessageRepository(); int twtcount = twtMsgRepo.getCountUnreadMessages(user.Id); Session["CountMessages"] = fbmessagescout + twtcount; } catch (Exception ex) { logger.Error(ex.StackTrace); } #endregion } } catch (Exception Err) { Console.Write(Err.StackTrace); } }