public override void PostScheduleMessage(dynamic data) { try { oAuthTwitter OAuthTwt = new oAuthTwitter(); TwitterAccountRepository fbaccrepo = new TwitterAccountRepository(); TwitterAccount twtaccount = fbaccrepo.getUserInformation(data.UserId, data.ProfileId); OAuthTwt.CallBackUrl = System.Configuration.ConfigurationSettings.AppSettings["callbackurl"]; OAuthTwt.ConsumerKey = System.Configuration.ConfigurationSettings.AppSettings["consumerKey"]; OAuthTwt.ConsumerKeySecret = System.Configuration.ConfigurationSettings.AppSettings["consumerSecret"]; OAuthTwt.AccessToken = twtaccount.OAuthToken; OAuthTwt.AccessTokenSecret = twtaccount.OAuthSecret; OAuthTwt.TwitterScreenName = twtaccount.TwitterScreenName; OAuthTwt.TwitterUserId = twtaccount.TwitterUserId; #region For Testing // For Testing //OAuthTwt.ConsumerKey = "udiFfPxtCcwXWl05wTgx6w"; //OAuthTwt.ConsumerKeySecret = "jutnq6N32Rb7cgbDSgfsrUVgRQKMbUB34yuvAfCqTI"; //OAuthTwt.AccessToken = "1904022338-Ao9chvPouIU8ejE1HMG4yJsP3hOgEoXJoNRYUF7"; //OAuthTwt.AccessTokenSecret = "Wj93a8csVFfaFS1MnHjbmbPD3V6DJbhEIf4lgSAefORZ5"; //OAuthTwt.TwitterScreenName = ""; //OAuthTwt.TwitterUserId = ""; #endregion TwitterUser twtuser = new TwitterUser(); if (string.IsNullOrEmpty(data.ShareMessage)) { data.ShareMessage = "There is no data in Share Message !"; } JArray post = twtuser.Post_Status_Update(OAuthTwt, data.ShareMessage); Console.WriteLine("Message post on twitter for Id :" + twtaccount.TwitterUserId + " and Message: " + data.ShareMessage); ScheduledMessageRepository schrepo = new ScheduledMessageRepository(); schrepo.updateMessage(data.Id); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); Log log = new Log(); log.CreatedDate = DateTime.Now; log.Exception = ex.Message; log.Id = Guid.NewGuid(); log.ModuleName = "TwitterScheduler"; log.ProfileId = data.ProfileId; log.Status = false; LogRepository logRepo = new LogRepository(); logRepo.AddLog(log); } }
protected void Page_Load(object sender, EventArgs e) { try { string ret = string.Empty; if (Request.QueryString != null) { ScheduledMessageRepository objScheduledMessageRepository = new ScheduledMessageRepository(); List<ScheduledMessage> lstScheduledMessage = objScheduledMessageRepository.getAllMessagesOfUser(Guid.Parse(Request.QueryString["id"])); foreach (ScheduledMessage item in lstScheduledMessage) { string tf = string.Empty; if (item.Status == true) { tf = "TRUE"; } else { tf = "FALSE"; } ret += "<tr class=\"gradeX\"><td>" + item.ShareMessage + "</td><td>" + item.ScheduleTime + "</td><td>" + tf + "</td></tr>"; } dtls.InnerHtml = ret; } } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } }
public override void PostScheduleMessage(dynamic data) { try { oAuthTwitter OAuthTwt = new oAuthTwitter(); TwitterAccountRepository fbaccrepo = new TwitterAccountRepository(); TwitterAccount twtaccount = fbaccrepo.getUserInformation(data.UserId, data.ProfileId); OAuthTwt.CallBackUrl = System.Configuration.ConfigurationSettings.AppSettings["callbackurl"]; OAuthTwt.ConsumerKey = System.Configuration.ConfigurationSettings.AppSettings["consumerKey"]; OAuthTwt.ConsumerKeySecret= System.Configuration.ConfigurationSettings.AppSettings["consumerSecret"]; OAuthTwt.AccessToken = twtaccount.OAuthToken; OAuthTwt.AccessTokenSecret= twtaccount.OAuthSecret; OAuthTwt.TwitterScreenName = twtaccount.TwitterScreenName; TwitterUser twtuser = new TwitterUser(); JArray post = twtuser.Post_Status_Update(OAuthTwt, data.ShareMessage); Console.WriteLine("Message post on twitter for Id :" + twtaccount.TwitterUserId + " and Message: " + data.ShareMessage); ScheduledMessageRepository schrepo = new ScheduledMessageRepository(); schrepo.updateMessage(data.Id); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } }
public override void PostScheduleMessage(dynamic data) { try { FacebookAccountRepository fbaccrepo = new FacebookAccountRepository(); //IEnumerable<FacebookAccount> lstfbaccount = fbaccrepo.getUserDetails(data.ProfileId); FacebookAccount fbaccount = fbaccrepo.getUserDetails(data.ProfileId); //FacebookAccount fbaccount = null; //foreach (FacebookAccount item in lstfbaccount) //{ // fbaccount = item; // break; //} FacebookClient fbclient = new FacebookClient(fbaccount.AccessToken); var args = new Dictionary<string, object>(); args["message"] = data.ShareMessage; //var facebookpost = fbclient.Post("/me/feed", args); var facebookpost = ""; if (fbaccount.Type == "page") { facebookpost = fbclient.Post("/" + fbaccount.FbUserId + "/feed", args).ToString(); } else { facebookpost = fbclient.Post("/me/feed", args).ToString(); } Console.WriteLine("Message post on facebook for Id :" + fbaccount.FbUserId + " and Message: " + data.ShareMessage); ScheduledMessageRepository schrepo = new ScheduledMessageRepository(); ScheduledMessage schmsg = new ScheduledMessage(); schmsg.Id = data.Id; schmsg.ProfileId = data.ProfileId; schmsg.ProfileType = ""; schmsg.Status = true; schmsg.UserId = data.UserId; schmsg.ShareMessage = data.ShareMessage; schmsg.ScheduleTime = data.ScheduleTime; schmsg.ClientTime = data.ClientTime; schmsg.CreateTime = data.CreateTime; schmsg.PicUrl = data.PicUrl; schrepo.updateMessage(data.Id); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } }
public override void PostScheduleMessage(dynamic data) { try { LinkedInAccountRepository linkedinrepo = new LinkedInAccountRepository(); LinkedInAccount linkedinaccount = linkedinrepo.getLinkedinAccountDetailsById(data.ProfileId); Console.WriteLine("========================================================================="); // IEnumerable<LinkedInAccount> lstlinkedinaccount = linkedinrepo.getLinkedinAccountDetailsById(data.ProfileId); //foreach (LinkedInAccount item in lstlinkedinaccount) //{ // linkedinaccount = item; // break; //} oAuthLinkedIn Linkedin_oauth = new oAuthLinkedIn(); Linkedin_oauth.ConsumerKey = System.Configuration.ConfigurationSettings.AppSettings["LiApiKey"].ToString(); Linkedin_oauth.ConsumerSecret = System.Configuration.ConfigurationSettings.AppSettings["LiSecretKey"].ToString(); Linkedin_oauth.FirstName = linkedinaccount.LinkedinUserName; Linkedin_oauth.Token = linkedinaccount.OAuthToken; Linkedin_oauth.TokenSecret = linkedinaccount.OAuthSecret; Linkedin_oauth.Verifier = linkedinaccount.OAuthVerifier; LinkedInUser linkeduser = new LinkedInUser(); var response = linkeduser.SetStatusUpdate(Linkedin_oauth, data.ShareMessage); Console.WriteLine("Message post on linkedin for Id :" + linkedinaccount.LinkedinUserId + " and Message: " + data.ShareMessage); Console.WriteLine("============================================================="); ScheduledMessageRepository schrepo = new ScheduledMessageRepository(); ScheduledMessage schmsg = new ScheduledMessage(); schmsg.Id = data.Id; schmsg.ProfileId = data.ProfileId; schmsg.ProfileType = "linkedin"; schmsg.Status = true; schmsg.UserId = data.UserId; schmsg.ShareMessage = data.ShareMessage; schmsg.ScheduleTime = data.ScheduleTime; schmsg.ClientTime = data.ClientTime; schmsg.CreateTime = data.CreateTime; schmsg.PicUrl = data.PicUrl; schrepo.updateMessage(data.Id); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } }
public override void PostScheduleMessage(dynamic data) { try { FacebookAccountRepository fbaccrepo = new FacebookAccountRepository(); FacebookAccount fbaccount = fbaccrepo.getUserDetails(data.ProfileId); FacebookClient fbclient = new FacebookClient(fbaccount.AccessToken); var args = new Dictionary<string, object>(); args["message"] = data.ShareMessage; var facebookpost = fbclient.Post("/me/feed", args); Console.WriteLine("Message post on facebook for Id :" + fbaccount.FbUserId + " and Message: " + data.ShareMessage); ScheduledMessageRepository schmesgrepo = new ScheduledMessageRepository(); schmesgrepo.updateMessage(data.Id); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } }
protected void Page_Load(object sender, EventArgs e) { string ret = string.Empty; try { User objUser = new User(); UserRepository objUserRepository = new UserRepository(); scheduling objscheduling = new scheduling(); ScheduledMessage objScheduledMessage = new ScheduledMessage(); ScheduledMessageRepository objScheduledMessageRepository = new ScheduledMessageRepository(); List<ScheduledTracker> lstScheduledTracker = objScheduledMessageRepository.GetAllScheduledDetails(); foreach (ScheduledTracker item in lstScheduledTracker) { try { //List<ScheduledMessage> lstScheduledMessage = objScheduledMessageRepository.getAllMessagesOfUser(Guid.Parse(item._Id)); List<ScheduledMessage> lstUnsentScheduledMessage = objScheduledMessageRepository.getAllIUnSentMessagesOfUser(Guid.Parse(item._Id)); objUser = objUserRepository.getUsersById(Guid.Parse(item._Id)); ret += "<tr class=\"gradeX\"><td><a href=\"ScheduledMessageDetail.aspx?id=" + objUser.Id + "\">" + objUser.UserName + "</a></td><td>" + item._count + "</td><td>" + (item._count - lstUnsentScheduledMessage.Count()) + "</td><td>" + lstUnsentScheduledMessage.Count() + "</td></tr>"; } catch (Exception ex) { Console.WriteLine(ex.Message); } } } catch (Exception ex) { Console.WriteLine(ex.Message); } Response.Write(ret); }
public override void PostScheduleMessage(dynamic data) { try { LinkedInAccountRepository linkedinrepo = new LinkedInAccountRepository(); LinkedInAccount linkedinaccount = linkedinrepo.getUserInformation(data.UserId, data.ProfileId); oAuthLinkedIn Linkedin_oauth = new oAuthLinkedIn(); Linkedin_oauth.ConsumerKey = System.Configuration.ConfigurationSettings.AppSettings["LiApiKey"]; Linkedin_oauth.ConsumerSecret = System.Configuration.ConfigurationSettings.AppSettings["LiSecretKey"]; Linkedin_oauth.FirstName = linkedinaccount.LinkedinUserName; Linkedin_oauth.Token = linkedinaccount.OAuthToken; Linkedin_oauth.TokenSecret = linkedinaccount.OAuthSecret; Linkedin_oauth.Verifier = linkedinaccount.OAuthVerifier; LinkedInUser linkeduser = new LinkedInUser(); var response = linkeduser.SetStatusUpdate(Linkedin_oauth, data.ShareMessage); Console.WriteLine("Message post on linkedin for Id :" + linkedinaccount.LinkedinUserId + " and Message: " + data.ShareMessage); ScheduledMessageRepository schrepo = new ScheduledMessageRepository(); schrepo.updateMessage(data.Id); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } }
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); } } }
public string GetScheduleMessageByMessageId(string MessageId) { try { Guid userid = Guid.Parse(MessageId); ScheduledMessageRepository objScheduledMessageRepository = new ScheduledMessageRepository(); ScheduledMessage ScheduledMessages = new ScheduledMessage(); ScheduledMessages = objScheduledMessageRepository.getScheduleMessageByMessageId(userid); //FacebookAccountRepository facebookAccountRepo = new FacebookAccountRepository(); // FacebookAccount facebook = facebookAccountRepo.getFacebookAccountDetailsById(FacebookId, userid); return new JavaScriptSerializer().Serialize(ScheduledMessages); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return new JavaScriptSerializer().Serialize("Please try Again"); } }
public string CheckMessageExistsAtTime(string UserId, DateTime schetime) { bool isexist; try { Guid userid = Guid.Parse(UserId); ScheduledMessageRepository objScheduledMessageRepository = new ScheduledMessageRepository(); //ScheduledMessage ScheduledMessages = new ScheduledMessage(); isexist = objScheduledMessageRepository.checkMessageExistsAtTime(userid, schetime); //FacebookAccountRepository facebookAccountRepo = new FacebookAccountRepository(); // FacebookAccount facebook = facebookAccountRepo.getFacebookAccountDetailsById(FacebookId, userid); return new JavaScriptSerializer().Serialize(isexist); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return new JavaScriptSerializer().Serialize("Please try Again"); } }
public void ProcessRequest() { SocialProfilesRepository socio = new SocialProfilesRepository(); List<SocialProfile> alstsocioprofiles = new List<SocialProfile>(); if (!string.IsNullOrEmpty(Request.QueryString["op"])) { Domain.User user = (Domain.User)Session["LoggedUser"]; if (Request.QueryString["op"] == "social_connectivity") { #region social connectivity alstsocioprofiles = socio.getAllSocialProfilesOfUser(user.Id); string profiles = string.Empty; foreach (SocialProfile item in alstsocioprofiles) { if (item.ProfileType == "facebook") { try { FacebookAccountRepository facereop = new FacebookAccountRepository(); FacebookAccount faceaccount = facereop.getFacebookAccountDetailsById(item.ProfileId, user.Id); profiles += "<div id=\"" + item.ProfileId + "\" class=\"ws_conct\"><span class=\"img\">" + "<div id='fb_del' onClick=\"confirmDel('" + item.ProfileId + "','fb')\"><span class=\"delete\"></span></div>" + "<a href=\"" + faceaccount.ProfileUrl + "\" target=\"_blank\" ><img src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\" width=\"48\" height=\"48\" alt=\"\" /></a>" + "<i>" + "<img src=\"../Contents/Images/fb_icon.png\" width=\"16\" height=\"16\" alt=\"\" /></i>" + "</span>" + "</div>"; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (item.ProfileType == "twitter") { try { TwitterAccountRepository twtrepo = new TwitterAccountRepository(); TwitterAccount twtaccount = twtrepo.getUserInformation(user.Id, item.ProfileId); profiles += "<div id=\"" + item.ProfileId + "\" class=\"ws_conct\">" + "<span class=\"img\"><div id='twt_del' onClick=\"confirmDel('" + item.ProfileId + "','twt')\"><span class=\"delete\"></span></div>" + "<img width=\"48\" height=\"48\" alt=\"\" src=\"" + twtaccount.ProfileImageUrl + "\">" + "<i><img src=\"../Contents/Images/twticon.png\" width=\"16\" height=\"16\" alt=\"\" /></i>" + "</span>" + "</div>"; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (item.ProfileType == "linkedin") { LinkedInAccountRepository liRepo = new LinkedInAccountRepository(); string access = string.Empty, tokenSecrate = string.Empty, LdprofileName = string.Empty, LdPreofilePic = string.Empty; LinkedInAccount liaccount = liRepo.getUserInformation(user.Id, item.ProfileId); if (liaccount != null) { try { if (!string.IsNullOrEmpty(liaccount.ProfileImageUrl)) { LdPreofilePic = liaccount.ProfileImageUrl; } else { LdPreofilePic = "../../Contents/Images/blank_img.png"; } profiles += "<div id=\"" + item.ProfileId + "\" class=\"ws_conct\">" + "<span class=\"img\">" + "<div id='fb_del' onClick=\"confirmDel('" + item.ProfileId + "','linkedin')\"><span class=\"delete\"></span></div>" + "<a href=\"" + liaccount.ProfileUrl + "\" target=\"_blank\"><img width=\"48\" height=\"48\" src=\"" + LdPreofilePic + "\" alt=\"\"></a>" + "<i><img src=\"../Contents/Images/link_icon.png\" width=\"16\" height=\"16\" alt=\"\" /></i>" + "</span>" + "</div>"; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } else if (item.ProfileType == "instagram") { try { InstagramAccountRepository objInsAccRepo = new InstagramAccountRepository(); InstagramAccount objInsAcc = objInsAccRepo.getInstagramAccountDetailsById(item.ProfileId, user.Id); string accessToken = string.Empty; profiles += "<div id=\"" + item.ProfileId + "\" class=\"ws_conct\">" + "<span class=\"img\">" + "<div id='fb_del' onClick=\"confirmDel('" + item.ProfileId + "','instagram')\"><span class=\"delete\"></span></div>" + "<img width=\"48\" height=\"48\" alt=\"\" src=\"" + objInsAcc.ProfileUrl + "\">" + "<i><img src=\"../Contents/Images/instagram_24X24.png\" width=\"16\" height=\"16\" alt=\"\" /></i>" + "</span>" + "</div>"; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } Response.Write(profiles); #endregion } else if (Request.QueryString["op"] == "midsnaps") { #region midsnaps Random rNum = new Random(); string loadtype = Request.QueryString["loadtype"]; string midsnaps = string.Empty; if (loadtype == "load") profilelimit = 0; if (profilelimit != -1) { ArrayList alst = socio.getLimitProfilesOfUser(user.Id, profilelimit); if (alst.Count == 0) profilelimit = -1; else profilelimit += 3; foreach (SocialProfile item in alst) { if (item.ProfileType == "facebook") { FacebookAccountRepository fbrepo = new FacebookAccountRepository(); FacebookMessageRepository fbmsgrepo = new FacebookMessageRepository(); FacebookAccount fbaccount = fbrepo.getFacebookAccountDetailsById(item.ProfileId, user.Id); List<FacebookMessage> fbmsgs = fbmsgrepo.getAllFacebookMessagesOfUser(user.Id, item.ProfileId); midsnaps += "<div id=\"midsnap_" + item.ProfileId + "\" class=\"col_two_fb\"> " + "<div class=\"col_two_fb_my_accounts\">" + "<div class=\"dt\"><a class=\"img\"><img src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\" width=\"48\" height=\"48\" alt=\"\" /></a>" + "<span class=\"icon\"></span></div><div class=\"dd\"><h5>" + fbaccount.FbUserName + "</h5><div class=\"friends_avg\"><div class=\"article_friends\">" + "<div class=\"facebook_blue\">" + fbaccount.Friends + "</div>" + "<div class=\"font-10\">Friends</div></div>" + "<div class=\"article_avg\"><div class=\"facebook_blue\">" + Math.Round(rNum.NextDouble(), 2) + "</div><div class=\"font-10\">Avg. Posts per Day</div>" + "</div> </div></div> </div>" + "<div class=\"pillow_fade\">" + "<div class=\"fb_notifications\">" + "Recent Messages</div>" + "<div class=\"empty-state\">"; if (fbmsgs.Count != 0) { try { int msgcount = 0; foreach (FacebookMessage child in fbmsgs) { string mess = string.Empty; if (msgcount < 2) { if (child.Message.Length > 40) { mess = child.Message.Substring(0, 39); mess = mess + "..........."; } else { mess = child.Message; } midsnaps += "<strong><img src=\"http://graph.facebook.com/" + child.FromId + "/picture?type=small\" />" + mess + "</strong><br/>"; } else { break; } msgcount++; } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else { midsnaps += "<strong>No messages were found within the past few days.</strong> \"Messages will be displayed once there is activity in this date range.\""; } midsnaps += "</div></div></div>"; } else if (item.ProfileType == "twitter") { TwitterAccountRepository twtrepo = new TwitterAccountRepository(); TwitterAccount twtaccount = twtrepo.getUserInformation(user.Id, item.ProfileId); TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository(); List<TwitterMessage> lsttwtmsgs = twtmsgrepo.getAllTwitterMessagesOfUser(user.Id, item.ProfileId); int tweetcount = 0; midsnaps += "<div id=\"midsnap_" + item.ProfileId + "\" class=\"col_four_twitter\"><div class=\"col_four_twitter_my_accounts\">" + "<div class=\"dt\"><a class=\"img\"><img src=\"" + twtaccount.ProfileImageUrl + "\" width=\"48\" height=\"48\" alt=\"\" /></a>" + "<span class=\"icon\"></span></div><div class=\"dd\"><h5>" + twtaccount.TwitterScreenName + "</h5>" + "<div class=\"friends_avg\"><div class=\"article_friends\"><div class=\"facebook_blue\">" + twtaccount.FollowersCount + "</div>" + "<div class=\"font-10\">Followers</div></div><div class=\"article_avg\"><div class=\"facebook_blue\">" + " " + Math.Round(rNum.NextDouble(), 2) + "</div><div class=\"font-10\">Avg. Posts per Day</div></div></div></div></div><div class=\"pillow_fade\">" + "<div class=\"fb_notifications\"> Recent Messages</div><div class=\"empty-state\">"; try { if (lsttwtmsgs.Count == 0) { midsnaps += "<strong>No messages were found within the past few days.</strong> \"Messages will be displayed once there is activity in this date range.\""; } else { foreach (TwitterMessage msg in lsttwtmsgs) { if (tweetcount < 2) { try { midsnaps += "<strong><img src=\"" + msg.FromProfileUrl + "\" />" + msg.TwitterMsg + "</strong><br/>"; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else { break; } tweetcount++; } } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } midsnaps += "</div></div> </div>"; } else if (item.ProfileType == "linkedin") { string access = string.Empty, tokenSecrate = string.Empty, LdprofileName = string.Empty, LdPreofilePic = string.Empty; LinkedInAccountRepository objLiRepo = new LinkedInAccountRepository(); LinkedInFeedRepository objliFeedRepo = new LinkedInFeedRepository(); LinkedInAccount liAccount = objLiRepo.getUserInformation(user.Id, item.ProfileId); // IEnumerable<dynamic> data = linkdrepo.GetAccessToken(item.profile_id, loginInfoEmail.Customer_Id); //foreach (var child in data) //{ if (liAccount != null) { LdprofileName = liAccount.LinkedinUserName; LdPreofilePic = liAccount.ProfileImageUrl; } // } if (string.IsNullOrEmpty(LdPreofilePic)) { LdPreofilePic = "../../Contents/Images/blank_img.png"; } int linkedinConcount = liAccount.Connections; midsnaps += " <div id=\"midsnap_" + item.ProfileId + "\" class=\"col_three_linkedin\">" + "<div class=\"col_three_link_my_accounts\">" + "<div class=\"dt\"><a class=\"img\">" + "<img src=\"" + LdPreofilePic + "\" width=\"48\" height=\"48\" alt=\"\" /></a>" + "<span class=\"icon\"></span></div><div class=\"dd\">" + "<h5>" + LdprofileName + "</h5><div class=\"friends_avg\">" + "<div class=\"article_friends\">" + " <div class=\"facebook_blue\">" + " " + linkedinConcount + "</div>" + " <div class=\"font-10\">" + " Friends</div>" + "</div>" + "<div class=\"article_avg\">" + " <div class=\"facebook_blue\">" + " " + Math.Round(rNum.NextDouble(), 2) + "</div>" + "<div class=\"font-10\">" + "Avg. Posts per Day</div>" + "</div>" + "</div>" + "</div>" + "</div>" + "<div class=\"pillow_fade\">" + "<div class=\"fb_notifications\">Recent Messages</div>" + "<div class=\"empty-state\">"; IEnumerable<dynamic> linkfed = objliFeedRepo.getAllLinkedInFeedsOfUser(user.Id, item.ProfileId);// = facerepo.GetMessages(item.profile_id, loginInfoEmail.Customer_Id);//linkdrepo.GetAllLinkedinFeeds(loginInfoEmail.Customer_Id, item.ToString()); int link = 0; if (linkfed.Count() == 0) { midsnaps += "<strong>No messages were found within the past 14 days.</strong> \"Messages will be displayed once there is activity in this date range.\""; } else { try { foreach (var l in linkfed) { try { if (link < 2) { string ms = string.Empty; if (l.Feeds.Length > 20) { ms = l.Feeds.Substring(0, 20) + "..."; ; } else { ms = l.Feeds; } midsnaps += "<strong><img src=\"" + l.FromPicUrl + "\">" + ms + " </strong><br/>"; link++; } else { break; } } catch { } } } catch { } } midsnaps += "</div></div> </div>"; } else if (item.ProfileType == "instagram") { InstagramAccountRepository objInsAccRepo = new InstagramAccountRepository(); InstagramAccount objInsAcc = objInsAccRepo.getInstagramAccountDetailsById(item.ProfileId, user.Id); midsnaps += " <div class=\"col_seven_instagram\">" + "<div class=\"col_seven_instagram_link_my_accounts\">" + "<div class=\"dt\"><a class=\"img\">" + "<img src=\"" + objInsAcc.ProfileUrl + "\" width=\"48\" height=\"48\" alt=\"\" /></a>" + "<span class=\"icon\"></span></div><div class=\"dd\">" + "<h5>" + objInsAcc.InsUserName + "</h5><div class=\"friends_avg\">" + "</div>" + "</div>" + "</div>" + "<div class=\"pillow_fade\">" + "<div class=\"fb_notifications\">" + "<ul class=\"user-stats\">" + "<li>" + "<div class=\"photo_stat\"> photos" + "</div>" + "<div class=\"number-stat\">" + objInsAcc.TotalImages + "</div>" + "</li>" + "<li>" + "<div class=\"photo_stat\"> followers" + "</div>" + "<div class=\"number-stat\">" + objInsAcc.FollowedBy + "</div>" + "</li>" + "<li>" + "<div class=\"photo_stat\"> following" + "</div>" + "<div class=\"number-stat\">" + objInsAcc.Followers + "</div>" + "</li>" + "</ul>" + "</div>" + "</div>" + "</div>"; } } Response.Write(midsnaps); } #endregion } else if (Request.QueryString["op"] == "accountdelete") { #region accountdelete string Profiletype = Request.QueryString["profile"]; string profileid = Request.QueryString["profileid"]; if (Profiletype == "fb") { try { FacebookAccountRepository fbrepo = new FacebookAccountRepository(); int delacc = fbrepo.deleteFacebookUser(profileid, user.Id); if (delacc != 0) { SocialProfilesRepository socioprofile = new SocialProfilesRepository(); socioprofile.deleteProfile(user.Id, profileid); FacebookMessageRepository fbmsgrepo = new FacebookMessageRepository(); fbmsgrepo.deleteAllMessagesOfUser(profileid, user.Id); FacebookFeedRepository fbfeedrepo = new FacebookFeedRepository(); fbfeedrepo.deleteAllFeedsOfUser(profileid, user.Id); } } catch (Exception exx) { Console.WriteLine(exx.StackTrace); } } else if (Profiletype == "twt") { TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository(); int deltwtacc = twtaccountrepo.deleteTwitterUser(user.Id, profileid); if (deltwtacc != 0) { SocialProfilesRepository socioprofile = new SocialProfilesRepository(); socioprofile.deleteProfile(user.Id, profileid); } } #endregion } else if (Request.QueryString["op"] == "MasterCompose") { #region mastercompose string profiles = string.Empty; if (Session["profilesforcomposemessage"] == null) { profiles += "<div class=\"drop_top\"></div><div class=\"drop_mid\">"; /*facebook users binding*/ FacebookAccountRepository fbrepo = new FacebookAccountRepository(); ArrayList lstfbaccounts = fbrepo.getAllFacebookAccountsOfUser(user.Id); profiles += "<div class=\"twitte_text\">FACEBOOK</div><div class=\"teitter\"><ul>"; if (lstfbaccounts.Count == 0) { profiles += "<li>No Records Found</li>"; } else { foreach (FacebookAccount fbacc in lstfbaccounts) { profiles += "<li id=\"liid_" + fbacc.FbUserId + "\" onclick=\"composemessage(this.id,'fb')\"><a href=\"#\"><img id=\"img_" + fbacc.FbUserId + "\" src=\"../Contents/Images/facebook.png\" alt=\"" + fbacc.AccessToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"composename_" + fbacc.FbUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + fbacc.FbUserName + "</span><span id=\"imgurl_" + fbacc.FbUserId + "\" style=\"display:none;\">http://graph.facebook.com/" + fbacc.FbUserId + "/picture?type=small</span></a></li>"; } } profiles += "</ul> </div>"; /*twitter users binding*/ TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository(); ArrayList alsttwtaccounts = twtaccountrepo.getAllTwitterAccountsOfUser(user.Id); profiles += "<div class=\"twitte_text\">TWITTER</div><div class=\"teitter\"><ul>"; if (alsttwtaccounts.Count == 0) { profiles += "<li>No Records Found</li>"; } else { foreach (TwitterAccount item in alsttwtaccounts) { profiles += "<li id=\"liid_" + item.TwitterUserId + "\" onclick=\"composemessage(this.id,'twt')\"><a href=\"#\"><img id=\"img_" + item.TwitterUserId + "\" src=\"../Contents/Images/twitter.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.TwitterUserId + "\" style=\"display:none;\">" + item.ProfileImageUrl + "</span><span id=\"composename_" + item.TwitterUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.TwitterScreenName + "</span></a></li>"; } } profiles += "</ul> </div>"; /*linkedinuserbinding*/ LinkedInAccountRepository linkaccountrepo = new LinkedInAccountRepository(); ArrayList alstlinkacc = linkaccountrepo.getAllLinkedinAccountsOfUser(user.Id); profiles += "<div class=\"twitte_text\">LinkedIn</div><div class=\"teitter\"><ul>"; if (alstlinkacc.Count == 0) { profiles += "<li>No Records Found</li>"; } else { foreach (LinkedInAccount item in alstlinkacc) { string profileurl = string.Empty; if (!string.IsNullOrEmpty(item.ProfileUrl)) { profileurl = item.ProfileUrl; } else { profileurl = "../../Contents/Images/blank_img.png"; } profiles += "<li id=\"liid_" + item.LinkedinUserId + "\" onclick=\"composemessage(this.id,'lin')\"><a href=\"#\"><img id=\"img_" + item.LinkedinUserId + "\" src=\"../Contents/Images/link.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.LinkedinUserId + "\" style=\"display:none;\">" + profileurl + "</span><span id=\"composename_" + item.LinkedinUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.LinkedinUserName + "</span></a></li>"; } } profiles += "</ul> </div>"; Session["profilesforcomposemessage"] = profiles; } else { profiles = (string)Session["profilesforcomposemessage"]; } Response.Write(profiles); #endregion } else if (Request.QueryString["op"] == "sendmessage") { #region sendmessage string message = Request.QueryString["message"]; var userid = Request.QueryString["userid[]"].Split(','); foreach (var item in userid) { string[] networkingwithid = item.Split('_'); if (networkingwithid[0] == "fb") { FacebookAccountRepository fbaccountrepo = new FacebookAccountRepository(); FacebookAccount fbaccount = fbaccountrepo.getFacebookAccountDetailsById(networkingwithid[1], user.Id); var args = new Dictionary<string, object>(); args["message"] = message; FacebookClient fc = new FacebookClient(fbaccount.AccessToken); var facebookpost = fc.Post("/me/feed", args); if (facebookpost.ToString() != string.Empty) { Response.Write("Succesfully posted"); } else { Response.Write("Not posted"); } } else if (networkingwithid[0] == "twt") { TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository(); TwitterAccount twtaccount = twtaccountrepo.getUserInformation(user.Id, networkingwithid[1]); oAuthTwitter OAuthTwt = new oAuthTwitter(); TwitterHelper twthelper = new TwitterHelper(); OAuthTwt.AccessToken = twtaccount.OAuthToken; OAuthTwt.AccessTokenSecret = twtaccount.OAuthSecret; OAuthTwt.TwitterScreenName = twtaccount.TwitterScreenName; twthelper.SetCofigDetailsForTwitter(OAuthTwt); TwitterUser twtuser = new TwitterUser(); JArray post = twtuser.Post_Status_Update(OAuthTwt, message); if (post.ToString() != string.Empty) { Response.Write("Succesfully posted"); } else { Response.Write("Not posted"); } } else if (networkingwithid[0] == "lin") { LinkedInAccountRepository linkedinaccrepo = new LinkedInAccountRepository(); LinkedInAccount linkedaccount = linkedinaccrepo.getUserInformation(user.Id, networkingwithid[1]); oAuthLinkedIn Linkedin_oauth = new oAuthLinkedIn(); Linkedin_oauth.Verifier = linkedaccount.OAuthVerifier; Linkedin_oauth.TokenSecret = linkedaccount.OAuthSecret; Linkedin_oauth.Token = linkedaccount.OAuthToken; Linkedin_oauth.Id = linkedaccount.LinkedinUserId; Linkedin_oauth.FirstName = linkedaccount.LinkedinUserName; SocialStream sociostream = new SocialStream(); string res = sociostream.SetStatusUpdate(Linkedin_oauth, message); } } #endregion } else if (Request.QueryString["op"] == "wooqueuemessages") { ScheduledMessageRepository schmsgRepo = new ScheduledMessageRepository(); List<ScheduledMessage> lstschMsg = schmsgRepo.getAllMessagesOfUser(user.Id); string schmessages = string.Empty; string profurl = string.Empty; if (string.IsNullOrEmpty(user.ProfileUrl)) { profurl = "../Contents/img/blank_img.png"; } else { profurl = user.ProfileUrl; } foreach (ScheduledMessage item in lstschMsg) { schmessages += "<div class=\"js-task-cont read\">" + "<section class=\"task-owner\">" + "<img width=\"32\" height=\"32\" border=\"0\" src=\""+profurl+"\" class=\"avatar\">" + "</section>" + "<section class=\"task-activity third\">" + "<p>"+user.UserName+"</p>" + "<div>"+item.CreateTime+"</div>" + "<input type=\"hidden\" value=\"#\" id=\"hdntaskid_1\">" + "<p></p>" + "</section>" + "<section class=\"task-message font-13 third\"><a class=\"tip_left\">"+item.ShareMessage+"</a></section>" + "<section class=\"task-status\">" + "<span class=\"ficon task_active\" id=\"taskcomment\">" + // "<img width=\"14\" height=\"17\" alt=\"\" src=\"../Contents/img/task/task_pin.png\" onclick=\"getmemberdata('7fd5773f-c5b0-4624-bba1-b8a6c0fbd56d');\">" + "</span>" + "<div class=\"ui_light floating task_status_change\">" + "<a href=\"#nogo\" class=\"ui-sproutmenu\">" + "<span class=\"ui-sproutmenu-status\">True" + // "<img title=\"Edit Status\" onclick=\"PerformClick(this.id)\" src=\"../Contents/img/icon_edit.png\" class=\"edit_button\" id=\"img_7fd5773f-c5b0-4624-bba1-b8a6c0fbd56d_True\"> "</span>" + "</a>" + "</div>" + "</section>" + "</div>"; } Response.Write(schmessages); } else if (Request.QueryString["op"] == "schedulemessage") { var userid = Request.QueryString["users[]"].Split(','); var datearr = Request.QueryString["datearr[]"].Split(','); string message = Request.QueryString["message"]; ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository(); string time = Request.QueryString["time"]; string clienttime = Request.QueryString["clittime"]; foreach (var item in userid) { if (!string.IsNullOrEmpty(item.ToString())) { foreach (var child in datearr) { ScheduledMessage schmessage = new ScheduledMessage(); string[] networkingwithid = item.Split('_'); if (networkingwithid[0] == "fbscheduler") { schmessage.CreateTime = DateTime.Now; schmessage.ProfileType = "facebook"; schmessage.ProfileId = networkingwithid[1]; schmessage.Id = Guid.NewGuid(); schmessage.PicUrl = string.Empty; schmessage.ClientTime = Convert.ToDateTime(clienttime); string servertime = this.CompareDateWithServer(clienttime, child + " " + time); schmessage.ScheduleTime = Convert.ToDateTime(servertime); schmessage.ShareMessage = message; schmessage.UserId = user.Id; schmessage.Status = false; } else if (networkingwithid[0] == "twtscheduler") { schmessage.CreateTime = DateTime.Now; schmessage.ProfileType = "twitter"; schmessage.ProfileId = networkingwithid[1]; schmessage.Id = Guid.NewGuid(); schmessage.PicUrl = string.Empty; schmessage.ClientTime = Convert.ToDateTime(clienttime); string servertime = this.CompareDateWithServer(clienttime, child + " " + time); schmessage.ScheduleTime = Convert.ToDateTime(servertime); schmessage.ShareMessage = message; schmessage.UserId = user.Id; schmessage.Status = false; } else if (networkingwithid[0] == "linscheduler") { schmessage.ClientTime = Convert.ToDateTime(clienttime); schmessage.CreateTime = DateTime.Now; schmessage.ProfileType = "linkedin"; schmessage.ProfileId = networkingwithid[1]; schmessage.Id = Guid.NewGuid(); schmessage.PicUrl = string.Empty; string servertime = this.CompareDateWithServer(clienttime, child + " " + time); schmessage.ScheduleTime = Convert.ToDateTime(servertime); schmessage.ShareMessage = message; schmessage.UserId = user.Id; schmessage.Status = false; } if (!string.IsNullOrEmpty(message)) { if (!schmsgrepo.checkMessageExistsAtTime(user.Id, schmessage.ShareMessage, schmessage.ScheduleTime, schmessage.ProfileId)) { schmsgrepo.addNewMessage(schmessage); } } } } } } } }
public void ProcessRequest() { SocialProfilesRepository socio = new SocialProfilesRepository(); List<SocialProfile> alstsocioprofiles = new List<SocialProfile>(); if (!string.IsNullOrEmpty(Request.QueryString["op"])) { SocioBoard.Domain.User user = (SocioBoard.Domain.User)Session["LoggedUser"]; if (Request.QueryString["op"] == "social_connectivity") { alstsocioprofiles = socio.getAllSocialProfilesOfUser(user.Id); string profiles = string.Empty; profiles += "<ul class=\"rsidebar-profile\">"; foreach (SocialProfile item in alstsocioprofiles) { try { if (item.ProfileType == "facebook") { try { FacebookAccountRepository facerepo = new FacebookAccountRepository(); FacebookAccount faceaccount = facerepo.getFacebookAccountDetailsById(item.ProfileId, user.Id); if (faceaccount != null) { profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onclick=\"confirmDel('" + item.ProfileId + "','fb');\"></div><a href=\"http://www.facebook.com/" + faceaccount.FbUserId + "\" target=\"_blank\"><img src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\" height=\"48\" width=\"48\" alt=\"\" title=\"" + faceaccount.FbUserName + "\" /></a>" + "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/fb_icon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>"; } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (item.ProfileType == "twitter") { try { TwitterAccountRepository twtrepo = new TwitterAccountRepository(); SocioBoard.Domain.TwitterAccount twtaccount = twtrepo.getUserInformation(user.Id, item.ProfileId); if (twtaccount != null) { profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','twt')\"></div><a href=\"http://twitter.com/" + twtaccount.TwitterScreenName + "\" target=\"_blank\"><img src=\"" + twtaccount.ProfileImageUrl + "\" height=\"48\" width=\"48\" alt=\"\" title=\"" + twtaccount.TwitterScreenName + "\" /></a>" + "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/twticon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>"; } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (item.ProfileType == "linkedin") { try { LinkedInAccountRepository liRepo = new LinkedInAccountRepository(); string access = string.Empty, tokenSecrate = string.Empty, LdprofileName = string.Empty, LdPreofilePic = string.Empty; LinkedInAccount liaccount = liRepo.getUserInformation(user.Id, item.ProfileId); if (liaccount != null) { if (!string.IsNullOrEmpty(liaccount.ProfileImageUrl)) { LdPreofilePic = liaccount.ProfileImageUrl; } else { LdPreofilePic = "../../Contents/img/blank_img.png"; } profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','linkedin')\"></div><a href=\"" + liaccount.ProfileUrl + "\" target=\"_blank\"><img src=\"" + LdPreofilePic + "\" height=\"48\" width=\"48\" alt=\"\" title=\"" + liaccount.LinkedinUserName + "\" /></a>" + "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/link_icon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>"; } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (item.ProfileType == "instagram") { try { InstagramAccountRepository objInsAccRepo = new InstagramAccountRepository(); InstagramAccount objInsAcc = objInsAccRepo.getInstagramAccountDetailsById(item.ProfileId, user.Id); string accessToken = string.Empty; if (objInsAcc != null) { profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','instagram')\"></div><a href=\"http://instagram.com/" + objInsAcc.InsUserName + "\" target=\"_blank\"><img src=\"" + objInsAcc.ProfileUrl + "\" height=\"48\" width=\"48\" alt=\"\" title=\"" + objInsAcc.InsUserName + "\" /></a>" + "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/instagram_24X24.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>"; } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (item.ProfileType == "googleplus") { try { //GooglePlusAccountRepository objgpAccRepo = new GooglePlusAccountRepository(); //GooglePlusAccount objgpAcc = objgpAccRepo.getGooglePlusAccountDetailsById(item.ProfileId, user.Id); //string accessToken = string.Empty; //profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','googleplus')\"></div><a href=\"http://plus.google.com/" + item.ProfileId + "\" target=\"_blank\"><img src=\"" + objgpAcc.GpProfileImage + "\" height=\"48\" width=\"48\" alt=\"\" title=\"" + objgpAcc.GpUserName + "\" /></a>" + // "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/google_plus.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>"; } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (item.ProfileType == "googleanalytics") { try { //GoogleAnalyticsAccountRepository objgaAccRepo = new GoogleAnalyticsAccountRepository(); //GoogleAnalyticsAccount objgaAcc = objgaAccRepo.getGoogelAnalyticsAccountHomeDetailsById(user.Id,item.ProfileId); //string accessToken = string.Empty; //profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','googleanalytics')\"></div><a href=\"http://plus.google.com/" + item.ProfileId + "\" target=\"_blank\"><img src=\"../Contents/img/google_analytics.png\" height=\"48\" width=\"48\" alt=\"\" title=\"" + objgaAcc.GaAccountName + "\" /></a>" + // "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>"; } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } } catch (Exception ex) { logger.Error(ex.Message); } } profiles += "</ul>"; Response.Write(profiles); } else if (Request.QueryString["op"] == "woodrafts") { string message = string.Empty; try { DraftsRepository draftsRepository = new DraftsRepository(); List<Drafts> lstDrafts = draftsRepository.getAllDrafts(user.Id); string profurl = string.Empty; if (string.IsNullOrEmpty(user.ProfileUrl)) { profurl = "../Contents/img/blank_img.png"; } else { profurl = user.ProfileUrl; } if (lstDrafts.Count != 0) { foreach (Drafts item in lstDrafts) { message += "<section class=\"section\" style=\"width:648px;\">" + "<div class=\"js-task-cont read\"><section class=\"task-owner\">" + "<img width=\"32\" height=\"32\" border=\"0\" class=\"avatar\" src=\"../Contents/img/task_pin.png\">" + "</section><section class=\"task-activity third\" style=\"width: 19.6%;\"><p>" + user.UserName + "</p><div>" + item.CreatedDate + " </div><p>" + //"</p></section><section style=\"margin-right: 6px; height: auto; width: 35%;\" class=\"task-message font-13 third\"><a onclick=\"writemessage(this.innerHTML);\" class=\"tip_left\">" + item.Message + "</a></section>" + "</p></section><section style=\"margin-right: 6px; height: auto; width: 31%;\" class=\"task-message font-13 third\"><span class=\"tip_left\">" + item.Message + "</span></section>" + "<div class=\"userpictiny\" style=\"height:70px; margin-top: 0;\"><img alt=\"\" src=\"" + profurl + "\" />" + "</div>" + "<a class=\"small_remove icon publish_delete\" href=\"#\" style=\"top: 7px; float: right; margin-top: 13px; margin-right: 10px;\" title=\"Delete\" onclick=\"deleteDraftMessage('" + item.Id + "')\"></a>" + "<section style=\"margin-top: 18px; width: 45px; margin-right: 17px;\" class=\"task-status\"><div class=\"ui_light floating task_status_change\"><a class=\"ui-sproutmenu\" href=\"#nogo\">" + "<span onclick=\"editDraftsMessage('" + item.Id + "');\" class=\"ui-sproutmenu-status\">" + "<img class=\"edit_button\" src=\"../Contents/img/icon_edit.png\" alt=\"\" />" + "</span>" + "</a></div></section></div></section>"; } } else { //message += "<section class=\"section\"><div class=\"js-task-cont read\"><section class=\"task-owner\">" + // "<img width=\"32\" height=\"32\" border=\"0\" class=\"avatar\" src=\"" + profurl + "\">" + // "</section><section class=\"task-activity third\"><p>" + user.UserName + "</p><div></div><p></p></section><section style=\"margin-right: 6px; width: 31%; height: auto;\" class=\"task-message font-13 third\">" + // "<a class=\"tip_left\">No Messages in Drafts</a></section><section style=\"width:113px;\" class=\"task-status\"><span class=\"ficon task_active\"></span>" + // "<div class=\"ui_light floating task_status_change\"><a class=\"ui-sproutmenu\" href=\"#nogo\">" + // "<span class=\"ui-sproutmenu-status\"></span></a></div></section></div></section>"; message += "<section class=\"section\"><div class=\"js-task-cont read\"><section style=\"margin-right: 6px; width: 31%; height: auto;\" class=\"task-message font-13 third\">" + "<a class=\"tip_left\">No Messages in Drafts</a></section><section style=\"width:113px;\" class=\"task-status\"><span class=\"ficon task_active\"></span>" + "<div class=\"ui_light floating task_status_change\"><a class=\"ui-sproutmenu\" href=\"#nogo\">" + "<span class=\"ui-sproutmenu-status\"></span></a></div></section></div></section>"; } } catch (Exception ex) { logger.Error(ex.Message); } Response.Write(message); } else if (Request.QueryString["op"] == "savedrafts") { try { string message = Request.QueryString["message"]; Drafts d = new Drafts(); d.CreatedDate = DateTime.Now; d.Message = message; d.ModifiedDate = DateTime.Now; d.UserId = user.Id; d.Id = Guid.NewGuid(); DraftsRepository dRepo = new DraftsRepository(); if (!dRepo.IsDraftsMessageExist(user.Id, message)) { dRepo.AddDrafts(d); } } catch (Exception ex) { logger.Error(ex.Message); } } else if (Request.QueryString["op"] == "midsnaps") { try { Random rNum = new Random(); string loadtype = Request.QueryString["loadtype"]; string midsnaps = string.Empty; if (loadtype == "load") profilelimit = 0; if (profilelimit != -1) { ArrayList alst = socio.getLimitProfilesOfUser(user.Id, profilelimit); if (alst.Count == 0) profilelimit = -1; else if (profilelimit == 0) profilelimit += 2; else profilelimit += 3; midsnaps += "<div class=\"row-fluid\" >"; if (loadtype == "load") { AdsRepository objAdsRepo = new AdsRepository(); ArrayList lstads = objAdsRepo.getAdsForHome(); int i = 0; if (lstads.Count <= 1) { midsnaps += "<div class=\"span4 rounder recpro\"><button data-dismiss=\"alert\" class=\"close pull-right\" type=\"button\">×</button>" + "<a href=\"#\"><img src=\"../Contents/img/admin/ads.png\" alt=\"\" style=\"width:246px;height:331px\"></a></div>"; } else { foreach (var item in lstads) { Array temp = (Array)item; i++; if (temp != null) { if (i == 2) { midsnaps += "<div class=\"span4 rounder recpro\"><button data-dismiss=\"alert\" class=\"close pull-right\" type=\"button\">×</button>" + "<a href=\"#\"><img src=\"" + temp.GetValue(2).ToString() + "\" alt=\"\" style=\"width:246px;height:331px\"></a></div>"; } } } } } foreach (SocialProfile item in alst) { if (item.ProfileType == "facebook") { try { FacebookAccountRepository fbrepo = new FacebookAccountRepository(); FacebookFeedRepository facefeedrepo = new FacebookFeedRepository(); List<FacebookFeed> fbmsgs = facefeedrepo.getAllFacebookUserFeeds(item.ProfileId); FacebookAccount fbaccount = fbrepo.getFacebookAccountDetailsById(item.ProfileId, user.Id); midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:333px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" + "<div onclick=\"detailsdiscoveryfacebook('" + fbaccount.FbUserId + "');\" class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + fbaccount.FbUserName + "\" alt=\"\" src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\"\">" + "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/fb_icon.png\" width=\"16\" height=\"16\"></a></div>" + "<div onclick=\"detailsdiscoveryfacebook('" + fbaccount.FbUserId + "');\" class=\"useraccname\">" + fbaccount.FbUserName + "</div><div class=\"usercounter\">" + "<div class=\"userfoll\">" + fbaccount.Friends; if (fbaccount.Type == "page") { midsnaps += "<a>Fans</a>"; } else { midsnaps += "<a>Friends</a>"; } midsnaps += "</div>" + "<div class=\"userppd\">" + Math.Round(rNum.NextDouble(), 2) + "<span>Avg. Post <br> Per Day</span></div></div></div>" + "<div class=\"concoteng\"><h5>recent message</h5> <ul class=\"mess\">"; if (fbmsgs.Count != 0) { int msgcount = 0; foreach (FacebookFeed child in fbmsgs) { string mess = string.Empty; if (msgcount < 2) { if (child.FeedDescription.Length > 40) { mess = child.FeedDescription.Substring(0, 39); mess = mess + "..........."; } else { mess = child.FeedDescription; } midsnaps += "<li><div class=\"messpic\"><img title=\"\" alt=\"\" src=\"http://graph.facebook.com/" + child.FromId + "/picture?type=small\"></div>" + "<div class=\"messtext\">" + mess + "</div></li>"; // midsnaps += "<strong><img src=\"http://graph.facebook.com/" + child.FromId + "/picture?type=small\" />" + mess + "</strong><br/>"; } else { break; } msgcount++; } } else { midsnaps += "<strong>No messages were found within the past few days.</strong> \"Messages will be displayed once there is activity in this date range.\""; } midsnaps += "</ul></div></div>"; } catch (Exception ex) { logger.Error(ex.Message); } } if (item.ProfileType == "googleplus") { // try //{ // GooglePlusAccountRepository objgpAccRepo = new GooglePlusAccountRepository(); // GooglePlusActivitiesRepository objgpActRepo = new GooglePlusActivitiesRepository(); // GooglePlusAccount gaaccount = objgpAccRepo.getGooglePlusAccountDetailsById(item.ProfileId, user.Id); // List<GooglePlusActivities> gpmsgs = objgpActRepo.getAllgoogleplusActivityOfUser(user.Id, item.ProfileId); // midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:333px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" + // "<div class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + gaaccount.GpUserName + "\" alt=\"\" src='" + gaaccount.GpProfileImage + "'>" + // "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/google_plus.png\" width=\"16\" height=\"16\"></a></div>" + // "<div class=\"useraccname\">" + gaaccount.GpUserName + "</div><div class=\"usercounter\">" + // "<div class=\"userfoll\">" + gaaccount.PeopleCount + "<span>Friends</span></div>" + // "<div class=\"userppd\">" + Math.Round(rNum.NextDouble(), 2) + "<span>Avg. Post Per Day</span></div></div></div>" + // "<div class=\"concoteng\"><h5>recent message</h5> <ul class=\"mess\">"; // if (gpmsgs.Count() != 0) // { // try // { // int msgcount = 0; // foreach (GooglePlusActivities child in gpmsgs) // { // string mess = string.Empty; // if (msgcount < 2) // { // if (child.Content.Length > 40) // { // mess = child.Content.Substring(0, 39); // mess = mess + "..........."; // } // else // { // mess = child.Content; // } // midsnaps += "<li><div class=\"messpic\"><img title=\"\" width=\"24px\" height=\"24px\" alt=\"\" src=\"" + child.FromProfileImage + "\"></div>" + // "<div class=\"messtext\">" + mess + "</div></li>"; // // midsnaps += "<strong><img src=\"http://graph.facebook.com/" + child.FromId + "/picture?type=small\" />" + mess + "</strong><br/>"; // } // else // { // break; // } // msgcount++; // } // } // catch (Exception exx) // { // Console.WriteLine(exx.Message); // logger.Error(exx.Message); // } // } // else // { // midsnaps += "<strong>No messages were found within the past few days.</strong> \"Messages will be displayed once there is activity in this date range.\""; // } // midsnaps += "</ul></div></div>"; //} //catch (Exception ex) //{ // Console.WriteLine(ex.Message); // logger.Error(ex.Message); //} } else if (item.ProfileType == "twitter") { TwitterAccountRepository twtrepo = new TwitterAccountRepository(); SocioBoard.Domain.TwitterAccount twtaccount = twtrepo.getUserInformation(user.Id, item.ProfileId); TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository(); List<TwitterMessage> lsttwtmsgs = twtmsgrepo.getAllTwitterMessagesOfProfile(item.ProfileId); int tweetcount = 0; midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:333px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" + "<div onclick=\"detailsdiscoverytwitter('" + twtaccount.TwitterUserId + "');\" class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + twtaccount.TwitterName + "\" alt=\"\" src=\"" + twtaccount.ProfileImageUrl + "\">" + "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/twticon.png\" width=\"16\" height=\"16\"></a></div>" + "<div onclick=\"detailsdiscoverytwitter('" + twtaccount.TwitterUserId + "');\" class=\"useraccname\">" + twtaccount.TwitterScreenName + "</div><div class=\"usercounter\">" + "<div class=\"userfoll\">" + twtaccount.FollowersCount + "<a>Followers</a></div>" + "<div class=\"userppd\">" + Math.Round(rNum.NextDouble(), 2) + "<span>Avg. Post <br> Per Day</span></div></div></div>" + "<div class=\"concoteng\"><h5>recent message</h5> <ul class=\"mess\">"; try { if (lsttwtmsgs.Count == 0) { midsnaps += "<strong>No messages were found within the past few days.</strong> \"Messages will be displayed once there is activity in this date range.\""; } else { foreach (TwitterMessage msg in lsttwtmsgs) { if (tweetcount < 2) { try { string ms = string.Empty; if (msg.TwitterMsg.Length > 20) { ms = msg.TwitterMsg.Substring(0, 20) + "..."; } else { ms = msg.TwitterMsg; } midsnaps += "<li><div class=\"messpic\"><img title=\"\" alt=\"\" src=\"" + msg.FromProfileUrl + "\"></div>" + "<div class=\"messtext\">" + ms + "</div></li>"; } catch (Exception ex) { Console.WriteLine(ex.Message); } } else { break; } tweetcount++; } } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } midsnaps += "</ul></div></div>"; } else if (item.ProfileType == "linkedin") { try { string access = string.Empty, tokenSecrate = string.Empty, LdprofileName = string.Empty, LdPreofilePic = string.Empty; LinkedInAccountRepository objLiRepo = new LinkedInAccountRepository(); LinkedInFeedRepository objliFeedRepo = new LinkedInFeedRepository(); LinkedInAccount liAccount = objLiRepo.getUserInformation(user.Id, item.ProfileId); LinkedInFeedRepository lifeedrepo = new LinkedInFeedRepository(); List<LinkedInFeed> alstliaccount = lifeedrepo.getAllLinkedInFeedsOfProfile(item.ProfileId); if (liAccount != null) { LdprofileName = liAccount.LinkedinUserName; LdPreofilePic = liAccount.ProfileImageUrl; } if (string.IsNullOrEmpty(LdPreofilePic)) { LdPreofilePic = "../../Contents/img/blank_img.png"; } int linkedinConcount = 0; try { linkedinConcount = liAccount.Connections; } catch (Exception ex) { Console.WriteLine(ex.Message); } midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:333px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" + "<div class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + LdprofileName + "\" alt=\"\" src=\"" + LdPreofilePic + "\">" + "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/link_icon.png\" width=\"16\" height=\"16\"></a></div>" + "<div class=\"useraccname\">" + LdprofileName + "</div><div class=\"usercounter\">" + "<div class=\"userfoll\">" + linkedinConcount + "<span>Connections</span></div>" + "<div class=\"userppd\">" + Math.Round(rNum.NextDouble(), 2) + "<span>Avg. Post <br> Per Day</span></div></div></div>" + "<div class=\"concoteng\"><h5>recent message</h5> <ul class=\"mess\">"; int link = 0; if (alstliaccount.Count == 0) { midsnaps += "<strong>No messages were found within the past 14 days.</strong> \"Messages will be displayed once there is activity in this date range.\""; } else { try { foreach (LinkedInFeed liFeed in alstliaccount) { try { if (link < 2) { string ms = string.Empty; if (liFeed.Feeds.Length > 20) { ms = liFeed.Feeds.Substring(0, 20) + "..."; } else { ms = liFeed.Feeds; } midsnaps += "<li><div class=\"messpic\"><img title=\"\" alt=\"\" src=\"" + liFeed.FromPicUrl + "\"></div>" + "<div class=\"messtext\">" + ms + "</div></li>"; link++; } else { break; } } catch (Exception ex) { logger.Error(ex.Message); } } } catch (Exception ex) { logger.Error(ex.Message); } } midsnaps += "</ul></div></div>"; } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (item.ProfileType == "instagram") { try { InstagramAccountRepository objInsAccRepo = new InstagramAccountRepository(); InstagramAccount objInsAcc = objInsAccRepo.getInstagramAccountDetailsById(item.ProfileId, user.Id); midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:333px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" + "<div class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + objInsAcc.InsUserName + "\" alt=\"\" src=\"" + objInsAcc.ProfileUrl + "\">" + "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/instagram_24X24.png\" width=\"16\" height=\"16\"></a></div>" + "<div class=\"useraccname\">" + objInsAcc.InsUserName + "</div></div>" + "<div class=\"concoteng\"><div class=\"pillow_fade\">" + " <div class=\"fb_notifications\">" + "<ul class=\"user-stats\"> " + "<li><div class=\"photo_stat\"> photos</div> <div class=\"number-stat\">" + objInsAcc.TotalImages + "</div></li>" + "<li><div class=\"photo_stat\">following</div><div class=\"number-stat\">" + objInsAcc.Followers + "</div></li>" + "<li><div class=\"photo_stat\">followers</div><div class=\"number-stat\">" + objInsAcc.FollowedBy + "</div></li>" + "</ul></div></div></div></div>"; } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } // midsnaps += " <div class=\"col_seven_instagram\">" + // "<div class=\"col_seven_instagram_link_my_accounts\">" + // "<div class=\"dt\"><a class=\"img\">" + // "<img src=\"" + objInsAcc.ProfileUrl + "\" width=\"48\" height=\"48\" alt=\"\" /></a>" + // "<span class=\"icon\"></span></div><div class=\"dd\">" + // "<h5>" + objInsAcc.InsUserName + "</h5><div class=\"friends_avg\">" + // "</div>" + // "</div>" + //"</div>" + // "<div class=\"pillow_fade\">" + // "<div class=\"fb_notifications\">" + // "<ul class=\"user-stats\">" + // "<li>" + // "<div class=\"photo_stat\"> photos" + // "</div>" + // "<div class=\"number-stat\">" + objInsAcc.TotalImages + // "</div>" + // "</li>" + // "<li>" + // "<div class=\"photo_stat\"> followers" + // "</div>" + // "<div class=\"number-stat\">" + objInsAcc.FollowedBy + // "</div>" + // "</li>" + // "<li>" + // "<div class=\"photo_stat\"> following" + // "</div>" + // "<div class=\"number-stat\">" + objInsAcc.Followers + // "</div>" + // "</li>" + // "</ul>" + // "</div>" + // "</div>" + //"</div>"; } else if (item.ProfileType == "googleanalytics") { //try //{ // GoogleAnalyticsAccountRepository objGaAccRepo = new GoogleAnalyticsAccountRepository(); // GoogleAnalyticsAccount objGaAcc = objGaAccRepo.getGoogelAnalyticsAccountHomeDetailsById(user.Id, item.ProfileId); // ArrayList arrlist = objGaAccRepo.getMaxGAStats(item.ProfileId); // int dayvisit = 0, monthvisit = 0, yearvisit = 0; // foreach (var itemData in arrlist) // { // Array temp = (Array)itemData; // if (temp.GetValue(0).ToString() == "year") // yearvisit = int.Parse(temp.GetValue(2).ToString()); // else if (temp.GetValue(0).ToString() == "month") // monthvisit = int.Parse(temp.GetValue(2).ToString()); // else if (temp.GetValue(0).ToString() == "day") // dayvisit = int.Parse(temp.GetValue(2).ToString()); // } // midsnaps += "<div class=\"span4 rounder recpro\" style=\"height:333px;\"><div class=\"col_five_ga_my_accounts\"><div class=\"dt\">" + // "<a class=\"img\"><img src=\"../Contents/img/google_analytics.png\" width=\"48\" height=\"48\" alt=\"\" /></a></div>" + // "<div class=\"dd\"><div class=\"useraccname\" style=\"margin-left:0px;\">" + objGaAcc.GaAccountName + "</div><div class=\"friends_avg\"><div class=\"ga_content\">Google Analytics</div></div></div></div>" + //"<div class=\"pillow_fade\">" + // "<div class=\"ga_trafic_number_graph\"><div class=\"ga_trafic\">Year</div><div class=\"ga_number\">" + yearvisit + "</div><div class=\"ga_graph\"></div></div>" + // "<div class=\"ga_trafic_number_graph\"><div class=\"ga_trafic\">Month</div><div class=\"ga_number\">" + monthvisit + "</div><div class=\"ga_graph\"></div></div>" + // "<div class=\"ga_trafic_number_graph\"><div class=\"ga_trafic\">Day</div><div class=\"ga_number\">" + dayvisit + "</div><div class=\"ga_graph\"></div></div></div></div>"; //} //catch (Exception ex) //{ // Console.WriteLine(ex.Message); // logger.Error(ex.Message); //} } } midsnaps += "</div>"; Response.Write(midsnaps); } } catch (Exception ex) { logger.Error(ex.Message); } } else if (Request.QueryString["op"] == "accountdelete") { Session["facebooktotalprofiles"] = null; SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository(); string Profiletype = Request.QueryString["profile"]; string profileid = Request.QueryString["profileid"]; if (Profiletype == "fb") { try { FacebookAccountRepository fbrepo = new FacebookAccountRepository(); int delacc = fbrepo.deleteFacebookUser(profileid, user.Id); if (delacc != 0) { socioprofilerepo.deleteProfile(user.Id, profileid); List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid); if (lstsocioprofile.Count == 0) { FacebookMessageRepository fbmsgrepo = new FacebookMessageRepository(); fbmsgrepo.deleteAllMessagesOfUser(profileid, user.Id); FacebookFeedRepository fbfeedrepo = new FacebookFeedRepository(); fbfeedrepo.deleteAllFeedsOfUser(profileid, user.Id); FacebookStatsRepository fbstatsrepo = new FacebookStatsRepository(); fbstatsrepo.deleteFacebookStats(profileid, user.Id); } } } catch (Exception exx) { Console.WriteLine(exx.Message); logger.Error(exx.Message); } } else if (Profiletype == "twt") { try { TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository(); int deltwtacc = twtaccountrepo.deleteTwitterUser(user.Id, profileid); if (deltwtacc != 0) { socioprofilerepo.deleteProfile(user.Id, profileid); List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid); if (lstsocioprofile.Count == 0) { TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository(); int d = twtmsgrepo.deleteTwitterMessage(profileid, user.Id); TwitterFeedRepository twtfeedrepo = new TwitterFeedRepository(); int s = twtfeedrepo.deleteTwitterFeed(profileid, user.Id); TwitterStatsRepository twtstatsrepo = new TwitterStatsRepository(); int a = twtstatsrepo.deleteTwitterStats(user.Id, profileid); TwitterDirectMessageRepository twtdirectmsgrepo = new TwitterDirectMessageRepository(); int f = twtdirectmsgrepo.deleteDirectMessage(user.Id, profileid); } } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } else if (Profiletype == "linkedin") { try { LinkedInAccountRepository linkedaccrepo = new LinkedInAccountRepository(); int dellinacc = linkedaccrepo.deleteLinkedinUser(profileid, user.Id); if (dellinacc != 0) { socioprofilerepo.deleteProfile(user.Id, profileid); List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid); if (lstsocioprofile.Count == 0) { LinkedInFeedRepository linkedfeedrepo = new LinkedInFeedRepository(); int s = linkedfeedrepo.deleteAllFeedsOfUser(profileid, user.Id); } } } catch (Exception ex) { logger.Error(ex.Message); } } else if (Profiletype == "instagram") { try { InstagramAccountRepository insaccrepo = new InstagramAccountRepository(); int insacc = insaccrepo.deleteInstagramUser(profileid, user.Id); if (insacc != 0) { socioprofilerepo.deleteProfile(user.Id, profileid); List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid); if (lstsocioprofile.Count == 0) { } } } catch (Exception ex) { logger.Error(ex.Message); } } else if (Profiletype == "googleplus") { try { GooglePlusAccountRepository googleplusaccrepo = new GooglePlusAccountRepository(); int gplusacc = googleplusaccrepo.deleteGooglePlusUser(profileid, user.Id); if (gplusacc != 0) { socioprofilerepo.deleteProfile(user.Id, profileid); List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid); if (lstsocioprofile.Count == 0) { } } } catch (Exception ex) { logger.Error(ex.Message); } } string profiles = string.Empty; profiles += "<div class=\"drop_top\"></div><div class=\"drop_mid\">"; /*facebook users binding*/ FacebookAccountRepository fbprepo = new FacebookAccountRepository(); ArrayList lstfbaccounts = fbprepo.getFacebookAccountsOfUser(user.Id); profiles += "<div class=\"twitte_text\">FACEBOOK</div><div class=\"teitter\"><ul>"; if (lstfbaccounts.Count == 0) { profiles += "<li>No Records Found</li>"; } else { foreach (FacebookAccount fbacc in lstfbaccounts) { profiles += "<li id=\"liid_" + fbacc.FbUserId + "\" onclick=\"composemessage(this.id,'fb')\"><a><img id=\"img_" + fbacc.FbUserId + "\" src=\"../Contents/img/facebook.png\" alt=\"" + fbacc.AccessToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"composename_" + fbacc.FbUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + fbacc.FbUserName + "</span><span id=\"imgurl_" + fbacc.FbUserId + "\" style=\"display:none;\">http://graph.facebook.com/" + fbacc.FbUserId + "/picture?type=small</span></a></li>"; } } profiles += "</ul> </div>"; /*twitter users binding*/ TwitterAccountRepository twtpaccountrepo = new TwitterAccountRepository(); ArrayList alsttwtaccounts = twtpaccountrepo.getAllTwitterAccountsOfUser(user.Id); profiles += "<div class=\"twitte_text\">TWITTER</div><div class=\"teitter\"><ul>"; if (alsttwtaccounts.Count == 0) { profiles += "<li>No Records Found</li>"; } else { foreach (SocioBoard.Domain.TwitterAccount item in alsttwtaccounts) { profiles += "<li id=\"liid_" + item.TwitterUserId + "\" onclick=\"composemessage(this.id,'twt')\"><a><img id=\"img_" + item.TwitterUserId + "\" src=\"../Contents/img/twitter.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.TwitterUserId + "\" style=\"display:none;\">" + item.ProfileImageUrl + "</span><span id=\"composename_" + item.TwitterUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.TwitterScreenName + "</span></a></li>"; } } profiles += "</ul> </div>"; /*linkedinuserbinding*/ LinkedInAccountRepository linkaccountrepo = new LinkedInAccountRepository(); ArrayList alstlinkacc = linkaccountrepo.getAllLinkedinAccountsOfUser(user.Id); profiles += "<div class=\"twitte_text\">LINKEDIN</div><div class=\"teitter\"><ul>"; if (alstlinkacc.Count == 0) { profiles += "<li>No Records Found</li>"; } else { foreach (LinkedInAccount item in alstlinkacc) { string profileurl = string.Empty; if (!string.IsNullOrEmpty(item.ProfileImageUrl)) { profileurl = item.ProfileImageUrl; } else { profileurl = "../../Contents/img/blank_img.png"; } profiles += "<li id=\"liid_" + item.LinkedinUserId + "\" onclick=\"composemessage(this.id,'lin')\"><a><img id=\"img_" + item.LinkedinUserId + "\" src=\"../Contents/img/link.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.LinkedinUserId + "\" style=\"display:none;\">" + profileurl + "</span><span id=\"composename_" + item.LinkedinUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.LinkedinUserName + "</span></a></li>"; } } profiles += "</ul> </div>"; Session["profilesforcomposemessage"] = profiles; } else if (Request.QueryString["op"] == "MasterCompose") { string profiles = string.Empty; if (Session["profilesforcomposemessage"] == null) { profiles += "<div class=\"drop_top\"></div><div class=\"drop_mid\">"; /*facebook users binding*/ FacebookAccountRepository fbrepo = new FacebookAccountRepository(); ArrayList lstfbaccounts = fbrepo.getFacebookAccountsOfUser(user.Id); profiles += "<div class=\"twitte_text\">FACEBOOK</div><div class=\"teitter\"><ul>"; if (lstfbaccounts.Count == 0) { profiles += "<li>No Records Found</li>"; } else { foreach (FacebookAccount fbacc in lstfbaccounts) { profiles += "<li nwtk='fb' class=\"getAllNetworkProfile\" id=\"liid_" + fbacc.FbUserId + "\" onclick=\"composemessage(this.id,'fb')\"><a><img id=\"img_" + fbacc.FbUserId + "\" src=\"../Contents/img/facebook.png\" alt=\"" + fbacc.AccessToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"composename_" + fbacc.FbUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + fbacc.FbUserName + "</span><span id=\"imgurl_" + fbacc.FbUserId + "\" style=\"display:none;\">http://graph.facebook.com/" + fbacc.FbUserId + "/picture?type=small</span></a></li>"; } } profiles += "</ul> </div>"; /*twitter users binding*/ TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository(); ArrayList alsttwtaccounts = twtaccountrepo.getAllTwitterAccountsOfUser(user.Id); profiles += "<div class=\"twitte_text\">TWITTER</div><div class=\"teitter\"><ul>"; if (alsttwtaccounts.Count == 0) { profiles += "<li>No Records Found</li>"; } else { foreach (SocioBoard.Domain.TwitterAccount item in alsttwtaccounts) { profiles += "<li nwtk='twt' class=\"getAllNetworkProfile\" id=\"liid_" + item.TwitterUserId + "\" onclick=\"composemessage(this.id,'twt')\"><a><img id=\"img_" + item.TwitterUserId + "\" src=\"../Contents/img/twitter.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.TwitterUserId + "\" style=\"display:none;\">" + item.ProfileImageUrl + "</span><span id=\"composename_" + item.TwitterUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.TwitterScreenName + "</span></a></li>"; } } profiles += "</ul> </div>"; /*linkedinuserbinding*/ LinkedInAccountRepository linkaccountrepo = new LinkedInAccountRepository(); ArrayList alstlinkacc = linkaccountrepo.getAllLinkedinAccountsOfUser(user.Id); profiles += "<div class=\"twitte_text\">LINKEDIN</div><div class=\"teitter\"><ul>"; if (alstlinkacc.Count == 0) { profiles += "<li>No Records Found</li>"; } else { foreach (LinkedInAccount item in alstlinkacc) { string profileurl = string.Empty; if (!string.IsNullOrEmpty(item.ProfileImageUrl)) { profileurl = item.ProfileImageUrl; } else { profileurl = "../../Contents/img/blank_img.png"; } profiles += "<li nwtk='lin' class=\"getAllNetworkProfile\" id=\"liid_" + item.LinkedinUserId + "\" onclick=\"composemessage(this.id,'lin')\"><a><img id=\"img_" + item.LinkedinUserId + "\" src=\"../Contents/img/link.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.LinkedinUserId + "\" style=\"display:none;\">" + profileurl + "</span><span id=\"composename_" + item.LinkedinUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.LinkedinUserName + "</span></a></li>"; } } profiles += "</ul> </div>"; Session["profilesforcomposemessage"] = profiles; } else { profiles = (string)Session["profilesforcomposemessage"]; } Response.Write(profiles); } else if (Request.QueryString["op"] == "sendmessage") { string message = Request.QueryString["message"]; var userid = Request.QueryString["userid[]"].Split(','); var files = Request.Files.Count; var fi = Request.Files["file"]; string file = string.Empty; try { if (Request.Files.Count > 0) { if (fi != null) { var path = Server.MapPath("~/Contents/img/upload"); file = path + "/" + fi.FileName; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } fi.SaveAs(file); } } } catch (Exception ex) { logger.Error(ex.Message); } foreach (var item in userid) { string[] networkingwithid = item.Split('_'); if (networkingwithid[0] == "fb") { try { FacebookAccountRepository fbaccountrepo = new FacebookAccountRepository(); FacebookAccount fbaccount = fbaccountrepo.getFacebookAccountDetailsById(networkingwithid[1], user.Id); var args = new Dictionary<string, object>(); args["message"] = message; if (Request.Files.Count > 0) { string strPathAndQuery = HttpContext.Current.Request.Url.PathAndQuery; string strUrl = HttpContext.Current.Request.Url.AbsoluteUri.Replace(strPathAndQuery, "/"); string filepath = strUrl + "/Contents/img/upload/" + fi.FileName; args["picture"] = filepath; } FacebookClient fc = new FacebookClient(fbaccount.AccessToken); string facebookpost = string.Empty; if (fbaccount.Type == "page") { facebookpost=fc.Post("/" + fbaccount.FbUserId + "/feed", args).ToString(); } else { facebookpost = fc.Post("/me/feed", args).ToString(); } if (facebookpost.ToString() != string.Empty) { Response.Write("Succesfully posted"); } else { Response.Write("Not posted"); } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } else if (networkingwithid[0] == "twt") { try { TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository(); SocioBoard.Domain.TwitterAccount twtaccount = twtaccountrepo.getUserInformation(user.Id, networkingwithid[1]); TwitterHelper twthelper = new TwitterHelper(); oAuthTwitter OAuthTwt = new oAuthTwitter(); OAuthTwt.AccessToken = twtaccount.OAuthToken; OAuthTwt.AccessTokenSecret = twtaccount.OAuthSecret; OAuthTwt.TwitterScreenName = twtaccount.TwitterScreenName; OAuthTwt.TwitterUserId = twtaccount.TwitterUserId; twthelper.SetCofigDetailsForTwitter(OAuthTwt); #region For Testing // For Testing //OAuthTwt.ConsumerKey = "udiFfPxtCcwXWl05wTgx6w"; //OAuthTwt.ConsumerKeySecret = "jutnq6N32Rb7cgbDSgfsrUVgRQKMbUB34yuvAfCqTI"; //OAuthTwt.AccessToken = "1453351098-Lz4H7cHKp26pXarF6l9zEwdiHDnwH7D0H4zteH3"; //OAuthTwt.AccessTokenSecret = "dGBPxR9wxhQMioIcj5P4Wemxo5EZIZ8wlvDz7i39lSNFg"; //OAuthTwt.TwitterScreenName = ""; //OAuthTwt.TwitterUserId = ""; #endregion Tweet twt = new Tweet(); if (Request.Files.Count > 0) { PhotoUpload ph = new PhotoUpload(); //ph.Tweet(file, message, OAuthTwt); string res = string.Empty; ph.NewTweet(file, message, OAuthTwt, ref res); // for testing Response.Write(res); Console.WriteLine(res); } else { JArray post = twt.Post_Statuses_Update(OAuthTwt, message); } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (networkingwithid[0] == "lin") { try { LinkedInAccountRepository linkedinaccrepo = new LinkedInAccountRepository(); LinkedInAccount linkedaccount = linkedinaccrepo.getUserInformation(user.Id, networkingwithid[1]); oAuthLinkedIn Linkedin_oauth = new oAuthLinkedIn(); Linkedin_oauth.Verifier = linkedaccount.OAuthVerifier; Linkedin_oauth.TokenSecret = linkedaccount.OAuthSecret; Linkedin_oauth.Token = linkedaccount.OAuthToken; Linkedin_oauth.Id = linkedaccount.LinkedinUserId; Linkedin_oauth.FirstName = linkedaccount.LinkedinUserName; SocialStream sociostream = new SocialStream(); string res = sociostream.SetStatusUpdate(Linkedin_oauth, message); } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } } } else if (Request.QueryString["op"] == "wooqueue_messages") { ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository(); } else if (Request.QueryString["op"] == "schedulemessage") { var userid = Request.QueryString["users[]"].Split(','); var datearr = Request.QueryString["datearr[]"].Split(','); string message = Request.QueryString["message"]; ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository(); string time = Request.QueryString["time"]; string clienttime = Request.QueryString["clittime"]; foreach (var item in userid) { if (!string.IsNullOrEmpty(item.ToString())) { foreach (var child in datearr) { ScheduledMessage schmessage = new ScheduledMessage(); string[] networkingwithid = item.Split('_'); if (networkingwithid[0] == "fbscheduler") { schmessage.CreateTime = DateTime.Now; schmessage.ProfileType = "facebook"; schmessage.ProfileId = networkingwithid[1]; schmessage.Id = Guid.NewGuid(); schmessage.PicUrl = string.Empty; schmessage.ClientTime = Convert.ToDateTime(clienttime); string servertime = this.CompareDateWithServer(clienttime, child + " " + time); schmessage.ScheduleTime = Convert.ToDateTime(servertime); schmessage.ShareMessage = message; schmessage.UserId = user.Id; schmessage.Status = false; } else if (networkingwithid[0] == "twtscheduler") { schmessage.CreateTime = DateTime.Now; schmessage.ProfileType = "twitter"; schmessage.ProfileId = networkingwithid[1]; schmessage.Id = Guid.NewGuid(); schmessage.PicUrl = string.Empty; schmessage.ClientTime = Convert.ToDateTime(clienttime); string servertime = this.CompareDateWithServer(clienttime, child + " " + time); schmessage.ScheduleTime = Convert.ToDateTime(servertime); schmessage.ShareMessage = message; schmessage.UserId = user.Id; schmessage.Status = false; } else if (networkingwithid[0] == "linscheduler") { schmessage.ClientTime = Convert.ToDateTime(clienttime); schmessage.CreateTime = DateTime.Now; schmessage.ProfileType = "linkedin"; schmessage.ProfileId = networkingwithid[1]; schmessage.Id = Guid.NewGuid(); schmessage.PicUrl = string.Empty; string servertime = this.CompareDateWithServer(clienttime, child + " " + time); schmessage.ScheduleTime = Convert.ToDateTime(servertime); schmessage.ShareMessage = message; schmessage.UserId = user.Id; schmessage.Status = false; } if (!string.IsNullOrEmpty(message)) { if (!schmsgrepo.checkMessageExistsAtTime(user.Id, schmessage.ShareMessage, schmessage.ScheduleTime, schmessage.ProfileId)) { schmsgrepo.addNewMessage(schmessage); } } } } } } else if (Request.QueryString["op"] == "insight") { FacebookAccount objFacebookAccount = (FacebookAccount)Session["fbpagedetail"]; FacebookHelper objFbHelper = new FacebookHelper(); SocialProfile socioprofile = new SocialProfile(); SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository(); FacebookAccountRepository fbrepo = new FacebookAccountRepository(); FacebookClient fbClient = new FacebookClient(objFacebookAccount.AccessToken); int fancountPage = 0; dynamic fancount = fbClient.Get("fql", new { q = " SELECT fan_count FROM page WHERE page_id =" + Request["id"].ToString() }); foreach (var friend in fancount.data) { fancountPage = Convert.ToInt32(friend.fan_count); } objFacebookAccount.Friends = Convert.ToInt32(fancountPage); objFacebookAccount.FbUserId = Request["id"].ToString(); objFacebookAccount.FbUserName = Request["name"].ToString(); objFacebookAccount.Type = "page"; objFacebookAccount.UserId = user.Id; socioprofile.Id = Guid.NewGuid(); socioprofile.ProfileDate = DateTime.Now; socioprofile.ProfileId = Request["id"].ToString(); socioprofile.ProfileStatus = 1; socioprofile.ProfileType = "facebook"; socioprofile.UserId = user.Id; if (!fbrepo.checkFacebookUserExists(objFacebookAccount.FbUserId, user.Id)) { fbrepo.addFacebookUser(objFacebookAccount); if (!socioprofilerepo.checkUserProfileExist(socioprofile)) { socioprofilerepo.addNewProfileForUser(socioprofile); } else { socioprofilerepo.updateSocialProfile(socioprofile); } } else { fbrepo.updateFacebookUser(objFacebookAccount); if (!socioprofilerepo.checkUserProfileExist(socioprofile)) { socioprofilerepo.addNewProfileForUser(socioprofile); } else { socioprofilerepo.updateSocialProfile(socioprofile); } } Session["fbSocial"] = null; } else if (Request.QueryString["op"] == "countmessages") { try { int val = 0; /*facebook*/ FacebookAccountRepository fbAccoutsRepo = new FacebookAccountRepository(); ArrayList lstfacebookAccounts = fbAccoutsRepo.getAllFacebookAccountsOfUser(user.Id); foreach (FacebookAccount item in lstfacebookAccounts) { try { FacebookClient fb = new FacebookClient(item.AccessToken); dynamic unreadcount = fb.Get("fql", new { q = "SELECT unread_count FROM mailbox_folder WHERE folder_id = 0 AND viewer_id = " + item.FbUserId + "" }); foreach (var chile in unreadcount.data) { var count = chile.unread_count; int countable = Convert.ToInt32(count.ToString()); val = val + countable; } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } /*Twitter*/ Session["CountMessages"] = val; Response.Write(val); } catch (Exception ex) { Console.WriteLine(ex.Message); } } else if (Request.QueryString["op"] == "recentfollowers") { string recentfollowers = string.Empty; #region RecentFollowers Users twtUsers = new Users(); TwitterAccountRepository twtAccRepo = new TwitterAccountRepository(); ArrayList lstAccRepo = twtAccRepo.getAllTwitterAccountsOfUser(user.Id); oAuthTwitter oauth = null; foreach (TwitterAccount itemTwt in lstAccRepo) { oauth = new oAuthTwitter(); oauth.AccessToken = itemTwt.OAuthToken; oauth.AccessTokenSecret = itemTwt.OAuthSecret; oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"]; oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"]; oauth.TwitterScreenName = itemTwt.TwitterScreenName; oauth.TwitterUserId = itemTwt.TwitterUserId; JArray jarresponse = twtUsers.Get_Followers_ById(oauth, itemTwt.TwitterUserId); foreach (var item in jarresponse) { int resposecount = 0; if (item["ids"] != null) { foreach (var child in item["ids"]) { if (resposecount < 2) { JArray userprofile = twtUsers.Get_Users_LookUp(oauth, child.ToString()); foreach (var items in userprofile) { resposecount++; try { recentfollowers += "<li><a href=\"https://twitter.com/" + items["screen_name"] + "\" target=\"_blank\"><img style=\"border:3px solid #FCFCFC;\" title=\"" + items["name"] + "\" width=\"48\" height=\"48\" alt=\"\" src=\"" + items["profile_image_url"] + "\"></a></li>"; } catch (Exception ex) { Console.WriteLine(ex.Message); } } } } } } } Response.Write(recentfollowers); #endregion } else if (Request.QueryString["op"] == "removefollowers") { string removeid = Request.QueryString["removeid"]; string userid = Request.QueryString["userid"]; Friendship friendship = new Friendship(); oAuthTwitter oauth = new oAuthTwitter(); TwitterAccountRepository twtaccrepo = new TwitterAccountRepository(); TwitterAccount twtAccount = twtaccrepo.getUserInformation(user.Id, userid); oauth.TwitterUserId = twtAccount.TwitterUserId; oauth.TwitterScreenName = twtAccount.TwitterScreenName; oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"]; oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"]; oauth.AccessToken = twtAccount.OAuthToken; oauth.AccessTokenSecret = twtAccount.OAuthSecret; JArray responseremove = friendship.Post_Friendship_Destroy(oauth, removeid); } else if (Request.QueryString["op"] == "wooqueuemessages") { ScheduledMessageRepository schmsgRepo = new ScheduledMessageRepository(); List<ScheduledMessage> lstschMsg = schmsgRepo.getAllMessagesOfUser(user.Id); string schmessages = string.Empty; string profurl = string.Empty; if (string.IsNullOrEmpty(user.ProfileUrl)) { profurl = "../Contents/img/blank_img.png"; } else { // profurl = "../Contents/img/blank_img.png"; profurl = user.ProfileUrl; } if (lstschMsg.Count != 0) { foreach (ScheduledMessage item in lstschMsg) { schmessages += "<section class=\"section\"><div class=\"js-task-cont read\">" + "<section class=\"task-owner\">" + "<img width=\"32\" height=\"32\" border=\"0\" src=\"" + profurl + "\" class=\"avatar\">" + "</section>" + "<section class=\"task-activity third\">" + "<p>" + user.UserName + "</p>" + "<div>" + item.CreateTime + "</div>" + "<input type=\"hidden\" value=\"#\" id=\"hdntaskid_1\">" + "<p></p>" + "</section>" + "<section class=\"task-message font-13 third\" style=\"height: auto; width: 31%; margin-right: 9px;\"><a class=\"tip_left\">" + item.ShareMessage + "</a></section>"; if (item.ProfileType == "facebook") { schmessages += "<div style=\"height:70px; margin-top: 0;\" class=\"userpictiny\">" + "<img width=\"48\" height=\"48\" src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\" alt=\"\">" + "<a style=\"right: 2px; top: 40px;\" title=\"\" class=\"userurlpic\" href=\"#\">" + "<img alt=\"\" src=\"../Contents/img/facebook.png\" style=\"height: 16px;width: 16x;\"></a></div>"; } else if (item.ProfileType == "twitter") { TwitterAccountRepository twtAccRepo = new TwitterAccountRepository(); TwitterAccount twtAccount = twtAccRepo.getUserInformation(user.Id, item.ProfileId); if (twtAccount != null) { schmessages += "<div style=\"height:70px; margin-top: 0;\" class=\"userpictiny\">" + "<img width=\"48\" height=\"48\" src=\"" + twtAccount.ProfileImageUrl + "\" alt=\"\">" + "<a style=\"right: 2px; top: 40px;\" title=\"\" class=\"userurlpic\" href=\"#\">" + "<img alt=\"\" src=\"../Contents/img/twitter.png\" style=\"height: 16px;width: 16x;\"></a></div>"; } } else if (item.ProfileType == "linkedin") { LinkedInAccountRepository linkAccRepo = new LinkedInAccountRepository(); LinkedInAccount linkedAccount = linkAccRepo.getUserInformation(user.Id, item.ProfileId); if (linkedAccount != null) { schmessages += "<div style=\"height:70px; margin-top: 0;\" class=\"userpictiny\">" + "<img width=\"48\" height=\"48\" src=\"" + linkedAccount.ProfileImageUrl + "\" alt=\"\">" + "<a style=\"right: 2px; top: 40px;\" title=\"\" class=\"userurlpic\" href=\"#\">" + "<img alt=\"\" src=\"../Contents/img/link.png\" style=\"height: 16px;width: 16x;\"></a></div>"; } } schmessages += "<section class=\"task-status\" style=\"width:34px;\"><div class=\"ui_light floating task_status_change\">" + "<a href=\"#nogo\" class=\"ui-sproutmenu\"><span class=\"ui-sproutmenu-status\"><img title=\"Edit Status\" onclick=\"PerformClick(this.id)\" src=\"../Contents/img/icon_edit.png\" class=\"edit_button\" id=\"img_" + item.Id + "_" + item.Status + "\"></span></a></div></section>" + "<section class=\"task-status\" style=\"width: 65px; margin-right: 39px;\">" + //"<span class=\"ficon task_active\" id=\"taskcomment\">" + // "<img width=\"14\" height=\"17\" alt=\"\" src=\"../Contents/img/task/task_pin.png\" onclick=\"getmemberdata('7fd5773f-c5b0-4624-bba1-b8a6c0fbd56d');\">" + //"</span>" + "<div class=\"ui_light floating task_status_change\">" + "<a href=\"#nogo\" class=\"ui-sproutmenu\">" + "<span class=\"ui-sproutmenu-status\">" + item.Status + "</span>" + "</a>" + "</div>" + "</section>" + "</div></section>"; } } else { schmessages = "<section class=\"section\"><div class=\"js-task-cont read\"><section class=\"task-owner\">" + "<img width=\"32\" height=\"32\" border=\"0\" class=\"avatar\" src=\"" + profurl + "\">" + "</section><section class=\"task-activity third\"><p>" + user.UserName + "</p><div></div><p></p></section><section style=\"margin-right: 6px; width: 31%; height: auto;\" class=\"task-message font-13 third\">" + "<a class=\"tip_left\">No Schduled Messages</a></section><section style=\"width:113px;\" class=\"task-status\"><span class=\"ficon task_active\"></span>" + "<div class=\"ui_light floating task_status_change\"><a class=\"ui-sproutmenu\" href=\"#nogo\">" + "<span class=\"ui-sproutmenu-status\"></span></a></div></section></div></section>"; } Response.Write(schmessages); } else if (Request.QueryString["op"] == "drafts_messages") { } else if (Request.QueryString["op"] == "updatequeue") { updatequeue(Request.QueryString["id"], Request.QueryString["status"]); } else if (Request.QueryString["op"] == "messagechk") { SocioBoard.Domain.Messages mstable = new SocioBoard.Domain.Messages(); string[] types = Request.QueryString["type[]"].Split(','); DataSet ds = (DataSet)Session["MessageDataTable"]; DataSet dss = DataTableGenerator.CreateDataSetForTable(mstable); DataTable dtt = dss.Tables[0]; DataView dv = new DataView(dtt); AjaxMessage ajxfed = new AjaxMessage(); string message = string.Empty; foreach (var item in types) { try { DataRow[] foundRows = ds.Tables[0].Select("Type = '" + item + "'"); foreach (var child in foundRows) { dtt.ImportRow(child); } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } message = ajxfed.BindData(dtt); Response.Write(message); } } }
public void updatequeue(string id, string stat) { bool check = false; ScheduledMessageRepository obj = new ScheduledMessageRepository(); if (stat.ToUpper() == "TRUE") { check = true; } else { check = false; } obj.UpdateProfileScheduleMessageStat(Guid.Parse(id), check); }
public void shareMessage() { try { //string path = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\SocioBoardScheduler\SocioBoardScheduler\1.0.0.0\hibernate.cfg.xml";//Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\hibernate.cfg.xml";////System.IO.Path.GetFullPath("hibernate.cfg.xml"); string dirPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\SocialScoupSchedulerNew"; string path = dirPath + "\\hibernate.cfg.xml"; string startUpFilePath = Application.StartupPath + "\\hibernate.cfg.xml"; if (!Directory.Exists(dirPath)) { Directory.CreateDirectory(dirPath); } if (!File.Exists(path)) { File.Copy(startUpFilePath, path); } SessionFactory.configfilepath = path; //@"D:\Ajay\New_SocialBoard\New folder\socioboard\trunk\SocialScoup\hibernate.cfg.xml";// For Testing NHibernate.ISession session = SessionFactory.GetNewSession(); ScheduledMessageRepository schrepo = new ScheduledMessageRepository(); //new Thread(() => //{ while (true) { try { IEnumerable<ScheduledMessage> lstmsg = schrepo.getAllMessage(); if (lstmsg != null) { if (lstmsg.Count() != 0) { foreach (var item in lstmsg) { try { string media = item.ProfileType; switch (media) { case "twitter": try { TwitterScheduler twtscheduler = new TwitterScheduler(); ScheduledMessage twtSch = item; Thread thread_TwtMailSend = new Thread(() => { twtscheduler.PostScheduleMessage(twtSch); }); thread_TwtMailSend.Start(); #region For Testing // twtscheduler.PostScheduleMessage(twtSch); #endregion } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } break; case "facebook": try { FacebookScheduler facescheduler = new FacebookScheduler(); ScheduledMessage fbSch = item; // Thread thread_FaceBook = new Thread(() => { facescheduler.PostScheduleMessage(fbSch); }); // thread_FaceBook.Start(); #region For Testing facescheduler.PostScheduleMessage(fbSch); #endregion } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } break; case "linkedin": try { LinkedInScheduler linkedscheduler = new LinkedInScheduler(); ScheduledMessage linkedinSch = item; Thread thread_LinkedIn = new Thread(() => { linkedscheduler.PostScheduleMessage(linkedinSch); }); thread_LinkedIn.Start(); #region For Testing //linkedscheduler.PostScheduleMessage(linkedinSch); #endregion } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } break; } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } else { Console.WriteLine("No active record in Database"); } } else { Console.WriteLine("No active record in Database"); } Thread.Sleep(10 * 12000); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } //}).Start(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } }
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); } }
public string GetAllMessagesOfUser(string UserId, string profileid) { try { Guid userid = Guid.Parse(UserId); ScheduledMessageRepository objScheduledMessageRepository = new ScheduledMessageRepository(); List<ScheduledMessage> lstScheduledMessages = new List<ScheduledMessage>(); lstScheduledMessages = objScheduledMessageRepository.getAllMessagesOfUser(userid, profileid); //FacebookAccountRepository facebookAccountRepo = new FacebookAccountRepository(); // FacebookAccount facebook = facebookAccountRepo.getFacebookAccountDetailsById(FacebookId, userid); return new JavaScriptSerializer().Serialize(lstScheduledMessages); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return new JavaScriptSerializer().Serialize("Please try Again"); } }
public string DeleteAllUsersByCreateDate(string date) { int i = 0; int count = 0; UserRepository objUserRepository = new UserRepository(); List<User> lstuser = objUserRepository.GetAllUsersByCreateDate(date); ArchiveMessageRepository objArchiveMessageRepository = new ArchiveMessageRepository(); DiscoverySearchRepository objDiscoverySearchRepository = new DiscoverySearchRepository(); DraftsRepository objDraftsRepository = new DraftsRepository(); FacebookAccountRepository objFacebookAccountRepository = new FacebookAccountRepository(); FacebookFeedRepository objFacebookFeedRepository = new FacebookFeedRepository(); FacebookInsightPostStatsRepository objFacebookInsightPostStatsRepository = new FacebookInsightPostStatsRepository(); FacebookInsightStatsRepository objFacebookInsightStatsRepository = new FacebookInsightStatsRepository(); FacebookMessageRepository objFacebookMessageRepository = new FacebookMessageRepository(); FacebookStatsRepository objFacebookStatsRepository = new FacebookStatsRepository(); GoogleAnalyticsAccountRepository objGoogleAnalyticsAccountRepository = new GoogleAnalyticsAccountRepository(); GoogleAnalyticsStatsRepository objGoogleAnalyticsStatsRepository = new GoogleAnalyticsStatsRepository(); GooglePlusAccountRepository objGooglePlusAccountRepository = new GooglePlusAccountRepository(); GooglePlusActivitiesRepository objGooglePlusActivitiesRepository = new GooglePlusActivitiesRepository(); GroupProfileRepository objGroupProfileRepository = new GroupProfileRepository(); GroupRepository objGroupRepository = new GroupRepository(); InstagramAccountRepository objInstagramAccountRepository = new InstagramAccountRepository(); InstagramCommentRepository objInstagramCommentRepository = new InstagramCommentRepository(); InstagramFeedRepository objInstagramFeedRepository = new InstagramFeedRepository(); LinkedInAccountRepository objLinkedInAccountRepository = new LinkedInAccountRepository(); LinkedInFeedRepository objLinkedInFeedRepository = new LinkedInFeedRepository(); LogRepository objLogRepository = new LogRepository(); RssFeedsRepository objRssFeedsRepository = new RssFeedsRepository(); RssReaderRepository objRssReaderRepository = new RssReaderRepository(); ScheduledMessageRepository objScheduledMessageRepository = new ScheduledMessageRepository(); SocialProfilesRepository objSocialProfilesRepository = new SocialProfilesRepository(); TaskCommentRepository objTaskCommentRepository = new TaskCommentRepository(); TaskRepository objTaskRepository = new TaskRepository(); TeamRepository objTeamRepository = new TeamRepository(); TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository(); TwitterAccountRepository objTwitterAccountRepository = new TwitterAccountRepository(); TwitterDirectMessageRepository objTwitterDirectMessageRepository = new TwitterDirectMessageRepository(); TwitterFeedRepository objTwitterFeedRepository = new TwitterFeedRepository(); TwitterMessageRepository objTwitterMessageRepository = new TwitterMessageRepository(); TwitterStatsRepository objTwitterStatsRepository = new TwitterStatsRepository(); UserActivationRepository objUserActivationRepository = new UserActivationRepository(); UserPackageRelationRepository objUserPackageRelationRepository = new UserPackageRelationRepository(); count = lstuser.Count(); foreach (var item in lstuser) { i++; try { if (item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**" || item.EmailId == "*****@*****.**") { } else { objArchiveMessageRepository.DeleteArchiveMessageByUserid(item.Id); objDiscoverySearchRepository.DeleteDiscoverySearchByUserid(item.Id); objDraftsRepository.DeleteDraftsByUserid(item.Id); objFacebookAccountRepository.DeleteFacebookAccountByUserid(item.Id); objFacebookFeedRepository.DeleteFacebookFeedByUserid(item.Id); objFacebookInsightPostStatsRepository.DeleteFacebookInsightPostStatsByUserid(item.Id); objFacebookInsightStatsRepository.DeleteFacebookInsightStatsByUserid(item.Id); objFacebookMessageRepository.DeleteFacebookMessageByUserid(item.Id); objFacebookStatsRepository.DeleteFacebookStatsByUserid(item.Id); objGoogleAnalyticsAccountRepository.DeleteGoogleAnalyticsAccountByUserid(item.Id); objGoogleAnalyticsStatsRepository.DeleteGoogleAnalyticsStatsByUserid(item.Id); objGooglePlusAccountRepository.DeleteGooglePlusAccountByUserid(item.Id); objGooglePlusActivitiesRepository.DeleteGooglePlusActivitiesByUserid(item.Id); objGroupProfileRepository.DeleteGroupProfileByUserid(item.Id); objGroupRepository.DeleteGroupsByUserid(item.Id); objInstagramAccountRepository.DeleteInstagramAccountByUserid(item.Id); objInstagramCommentRepository.DeleteInstagramCommentByUserid(item.Id); objInstagramFeedRepository.DeleteInstagramFeedByUserid(item.Id); objLinkedInAccountRepository.DeleteLinkedInAccountByUserid(item.Id); objLinkedInFeedRepository.DeleteLinkedInFeedByUserid(item.Id); objLogRepository.DeleteLogByUserid(item.Id); objRssFeedsRepository.DeleteRssFeedsByUserid(item.Id); objRssReaderRepository.DeleteRssReaderByUserid(item.Id); objScheduledMessageRepository.DeleteScheduledMessageByUserid(item.Id); objSocialProfilesRepository.DeleteSocialProfileByUserid(item.Id); objTaskCommentRepository.DeleteTaskCommentByUserid(item.Id); objTaskRepository.DeleteTasksByUserid(item.Id); objTeamRepository.DeleteTeamByUserid(item.Id); objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(item.Id); objTwitterAccountRepository.DeleteTwitterAccountByUserid(item.Id); objTwitterDirectMessageRepository.DeleteTwitterDirectMessagesByUserid(item.Id); objTwitterFeedRepository.DeleteTwitterFeedByUserid(item.Id); objTwitterMessageRepository.DeleteTwitterMessageByUserid(item.Id); objTwitterStatsRepository.DeleteTwitterStatsByUserid(item.Id); objUserActivationRepository.DeleteUserActivationByUserid(item.Id); objUserPackageRelationRepository.DeleteuserPackageRelationByUserid(item.Id); objUserRepository.DeleteUserByUserid(item.Id); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } return i +" "+count; }
public void ProcessRequest() { //experimental code selected index changed of dropdown if (!string.IsNullOrEmpty(Request.QueryString["groupsselection"])) { SocioBoard.Domain.User user = (SocioBoard.Domain.User)Session["LoggedUser"]; string selectedValue = Request.QueryString["groupsselection"]; TeamRepository objTeamRepository = new TeamRepository(); Team lstDetails = objTeamRepository.getAllGroupsDetails(user.EmailId.ToString(), Guid.Parse(selectedValue),user.Id); Session["GroupName"] = lstDetails; Session["groupcheck"] = selectedValue; SocioBoard.Domain.Team team = (SocioBoard.Domain.Team)Session["GroupName"]; Response.Write(selectedValue); return; } SocialProfilesRepository socio = new SocialProfilesRepository(); List<SocialProfile> alstsocioprofiles = new List<SocialProfile>(); TeamRepository objTeamRepo = new TeamRepository(); if (!string.IsNullOrEmpty(Request.QueryString["op"])) { SocioBoard.Domain.User user = (SocioBoard.Domain.User)Session["LoggedUser"]; Team team = (SocioBoard.Domain.Team)Session["GroupName"]; TeamRepository objTeamRepository = new TeamRepository(); TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository(); GroupRepository objGroupRepository = new GroupRepository(); if (Request.QueryString["op"] == "social_connectivity") { List<TeamMemberProfile> allprofiles = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(team.Id); string profiles = string.Empty; profiles += "<ul class=\"rsidebar-profile\">"; foreach (TeamMemberProfile item in allprofiles) { try { if (item.ProfileType == "facebook") { try { FacebookAccountRepository facerepo = new FacebookAccountRepository(); FacebookAccount faceaccount = facerepo.getFacebookAccountDetailsById(item.ProfileId); if (faceaccount != null) { profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onclick=\"confirmDel('" + item.ProfileId + "','" + faceaccount.Type + "','fb');\"></div><a href=\"http://www.facebook.com/" + faceaccount.FbUserId + "\" target=\"_blank\"><img src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\" height=\"48\" width=\"48\" alt=\"\" title=\""+ faceaccount.FbUserName + "\" /></a>" + "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/fb_icon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>"; } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (item.ProfileType == "youtube") { try { YoutubeAccountRepository facerepo = new YoutubeAccountRepository(); YoutubeAccount youtube = facerepo.getYoutubeAccountDetailsById(item.ProfileId); if (youtube != null) { profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onclick=\"confirmDel('" + item.ProfileId + "','youtube','youtube');\"></div><a href=\"https://plus.google.com/" + youtube.Ytuserid + "\" target=\"_blank\"><img src=\"" + youtube.Ytprofileimage + " height=\"48\" width=\"48\" alt=\"\" title=\"" + youtube.Ytusername + "\" /></a>" + "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/youtube.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>"; } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (item.ProfileType == "tumblr") { try { TumblrAccountRepository tumbrepo = new TumblrAccountRepository(); TumblrAccount tumblraccount = tumbrepo.getTumblrAccountDetailsById(item.ProfileId); if (tumblraccount != null) { //if (tumblraccount!=null) //{ // profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','tumblr','tumblr')\"></div><a href=\"http://twitter.com/" + tumblraccount.tblrUserName + "\" target=\"_blank\"><img src=\"http://api.tumblr.com/v2/blog/" + tumblraccount.tblrUserName + ".tumblr.com/avatar\" height=\"48\" width=\"48\" alt=\"\" title=\"" + tumblraccount.tblrUserName + "\" /></a>" + // "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/tumblr.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>"; //} //else //{ profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','tumblr','tumblr')\"></div><a href=\"http://" + tumblraccount.tblrUserName + ".tumblr.com\" target=\"_blank\"><img src=\"http://api.tumblr.com/v2/blog/" + tumblraccount.tblrUserName + ".tumblr.com/avatar\" height=\"48\" width=\"48\" alt=\"\" title=\"" + tumblraccount.tblrUserName + "\" /></a>" + "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/tumblr.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>"; // } } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (item.ProfileType == "twitter") { try { TwitterAccountRepository twtrepo = new TwitterAccountRepository(); SocioBoard.Domain.TwitterAccount twtaccount = twtrepo.getUserInformation(item.ProfileId); if (twtaccount != null) { profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','twt','twt')\"></div><a href=\"http://twitter.com/" + twtaccount.TwitterScreenName + "\" target=\"_blank\"><img src=\"" + twtaccount.ProfileImageUrl + "\" height=\"48\" width=\"48\" alt=\"\" title=\"" + twtaccount.TwitterScreenName + "\" /></a>" + "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/twticon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>"; } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (item.ProfileType == "linkedin") { try { LinkedInAccountRepository liRepo = new LinkedInAccountRepository(); string access = string.Empty, tokenSecrate = string.Empty, LdprofileName = string.Empty, LdPreofilePic = string.Empty; LinkedInAccount liaccount = liRepo.getUserInformation(item.ProfileId); if (liaccount != null) { if (!string.IsNullOrEmpty(liaccount.ProfileImageUrl)) { LdPreofilePic = liaccount.ProfileImageUrl; } else { LdPreofilePic = "../../Contents/img/blank_img.png"; } profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','linkedin')\"></div><a href=\"" + liaccount.ProfileUrl + "\" target=\"_blank\"><img src=\"" + LdPreofilePic + "\" height=\"48\" width=\"48\" alt=\"\" title=\"" + liaccount.LinkedinUserName + "\" /></a>" + "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/link_icon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>"; } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (item.ProfileType == "instagram") { try { InstagramAccountRepository objInsAccRepo = new InstagramAccountRepository(); InstagramAccount objInsAcc = objInsAccRepo.getInstagramAccountDetailsById(item.ProfileId); string accessToken = string.Empty; if (objInsAcc != null) { profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','instagram')\"></div><a href=\"http://instagram.com/" + objInsAcc.InsUserName + "\" target=\"_blank\"><img src=\"" + objInsAcc.ProfileUrl + "\" height=\"48\" width=\"48\" alt=\"\" title=\"" + objInsAcc.InsUserName + "\" /></a>" + "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/instagram_24X24.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>"; } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (item.ProfileType == "googleplus") { try { //GooglePlusAccountRepository objgpAccRepo = new GooglePlusAccountRepository(); //GooglePlusAccount objgpAcc = objgpAccRepo.getGooglePlusAccountDetailsById(item.ProfileId, user.Id); //string accessToken = string.Empty; //profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','googleplus')\"></div><a href=\"http://plus.google.com/" + item.ProfileId + "\" target=\"_blank\"><img src=\"" + objgpAcc.GpProfileImage + "\" height=\"48\" width=\"48\" alt=\"\" title=\"" + objgpAcc.GpUserName + "\" /></a>" + // "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/google_plus.png\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>"; } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (item.ProfileType == "googleanalytics") { try { //GoogleAnalyticsAccountRepository objgaAccRepo = new GoogleAnalyticsAccountRepository(); //GoogleAnalyticsAccount objgaAcc = objgaAccRepo.getGoogelAnalyticsAccountHomeDetailsById(user.Id,item.ProfileId); //string accessToken = string.Empty; //profiles += "<li id=\"so_" + item.ProfileId + "\"><div id=\"" + item.ProfileId + "\" class=\"userpictiny\"><div class=\"delet_icon\" onClick=\"confirmDel('" + item.ProfileId + "','googleanalytics')\"></div><a href=\"http://plus.google.com/" + item.ProfileId + "\" target=\"_blank\"><img src=\"../Contents/img/google_analytics.png\" height=\"48\" width=\"48\" alt=\"\" title=\"" + objgaAcc.GaAccountName + "\" /></a>" + // "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"\" width=\"16\" height=\"16\" alt=\"\"></a></div></li>"; } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } } catch (Exception ex) { logger.Error(ex.Message); } } profiles += "</ul>"; Response.Write(profiles); } else if (Request.QueryString["op"] == "woodrafts") { string message = string.Empty; try { DraftsRepository draftsRepository = new DraftsRepository(); List<Drafts> lstDrafts = draftsRepository.getAllDrafts(team.GroupId); string profurl = string.Empty; if (string.IsNullOrEmpty(user.ProfileUrl)) { profurl = "../Contents/img/blank_img.png"; } else { profurl = user.ProfileUrl; } if (lstDrafts.Count != 0) { foreach (Drafts item in lstDrafts) { try { message += "<section class=\"section\" style=\"width:648px;\">" + "<div class=\"js-task-cont read\"><section class=\"task-owner\">" + "<img width=\"32\" height=\"32\" border=\"0\" class=\"avatar\" src=\"../Contents/img/task_pin.png\">" + // "<img width=\"32\" height=\"32\" border=\"0\" class=\"avatar\" src=\"" + profurl + "\" />" + "</section><section class=\"task-activity third\" style=\"width: 19.6%;\"><p>" + user.UserName + "</p><div>" + item.CreatedDate + " </div><p>" + //"</p></section><section style=\"margin-right: 6px; height: auto; width: 35%;\" class=\"task-message font-13 third\"><a onclick=\"writemessage(this.innerHTML);\" class=\"tip_left\">" + item.Message + "</a></section>" + "</p></section><section style=\"margin-right: 6px; height: auto; width: 31%;\" class=\"task-message font-13 third\"><span class=\"tip_left\">" + gethtmlfromstring(item.Message) + "</span></section>" + "<div class=\"userpictiny\" style=\"height:70px; margin-top: 0;\"><img alt=\"\" src=\"" + profurl + "\" />" + "</div>" + "<a class=\"small_remove icon publish_delete\" href=\"#\" style=\"top: 7px; float: right; margin-top: 13px; margin-right: 10px;\" title=\"Delete\" onclick=\"deleteDraftMessage('" + item.Id + "')\"></a>" + "<section style=\"margin-top: 18px; width: 45px; margin-right: 17px;\" class=\"task-status\"><div class=\"ui_light floating task_status_change\"><a class=\"ui-sproutmenu\" href=\"#nogo\">" + "<span onclick=\"editDraftsMessage('" + item.Id + "','" + item.Message + "');\" class=\"ui-sproutmenu-status\">" + "<img class=\"edit_button\" src=\"../Contents/img/icon_edit.png\" alt=\"\" />" + "</span>" + "</a></div></section></div></section>"; } catch (Exception ex) { logger.Error(ex.Message); } } } else { message += "<div style=\"margin-left: 2%; margin-top: 3%;\">No Messages in Drafts</div>"; } } catch (Exception ex) { logger.Error(ex.Message); } Response.Write(message); } else if (Request.QueryString["op"] == "savedrafts") { try { string message = Request.QueryString["message"]; message = Request.Form["messagee"]; Drafts d = new Drafts(); d.CreatedDate = DateTime.Now; d.Message = message; d.ModifiedDate = DateTime.Now; d.UserId = user.Id; d.GroupId = team.GroupId; d.Id = Guid.NewGuid(); DraftsRepository dRepo = new DraftsRepository(); if (!dRepo.IsDraftsMessageExist(user.Id, message)) { dRepo.AddDrafts(d); } } catch (Exception ex) { logger.Error(ex.Message); } Response.Write("added successfully"); } else if (Request.QueryString["op"] == "midsnaps") { try { Random rNum = new Random(); string loadtype = Request.QueryString["loadtype"]; string midsnaps = string.Empty; if (loadtype == "load") profilelimit = 0; if (profilelimit != -1) { // Team lstDetails = objTeamRepository.getAllDetails(team.GroupId, team.EmailId); List<TeamMemberProfile> alst = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(team.Id); // ArrayList alst = socio.getLimitProfilesOfUser(user.Id, profilelimit); if (alst.Count == 0) profilelimit = -1; else if (profilelimit == 0) //profilelimit += 2; profilelimit += 6; else profilelimit += 6; midsnaps += "<div class=\"row-fluid\" >"; if (loadtype == "load") { AdsRepository objAdsRepo = new AdsRepository(); ArrayList lstads = objAdsRepo.getAdsForHome(); int i = 0; if (lstads.Count <= 1) { if (user.PaymentStatus.ToUpper() == "PAID") { midsnaps += ""; } } else { foreach (var item in lstads) { Array temp = (Array)item; i++; if (temp != null) { if (i == 2) { if (user.AccountType == "Paid") { midsnaps += "<div class=\"span4 rounder recpro\"><button data-dismiss=\"alert\" class=\"close pull-right\" type=\"button\">×</button>" + "<a href=\"#\"><img src=\"" + temp.GetValue(2).ToString() + "\" alt=\"\" style=\"width:246px;height:331px\"></a></div>"; } } } } } } foreach (TeamMemberProfile item in alst) { if (item.ProfileType == "facebook") { try { FacebookAccountRepository fbrepo = new FacebookAccountRepository(); FacebookFeedRepository facefeedrepo = new FacebookFeedRepository(); List<FacebookFeed> fbmsgs = facefeedrepo.getAllFacebookUserFeeds(item.ProfileId); FacebookAccount fbaccount = fbrepo.getFacebookAccountDetailsById(item.ProfileId); midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:213px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" + "<div onclick=\"detailsdiscoveryfacebook('" + fbaccount.FbUserId + "');\" class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + fbaccount.FbUserName + "\" alt=\"\" src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\"\">" + "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/fb_icon.png\" width=\"16\" height=\"16\"></a></div>" + "<div onclick=\"detailsdiscoveryfacebook('" + fbaccount.FbUserId + "');\" class=\"useraccname\">" + getsortpofilename(fbaccount.FbUserName) + "</div><div class=\"usercounter\">" + "<div class=\"userfoll\">" + fbaccount.Friends; if (fbaccount.Type == "page") { midsnaps += "<span><b style=\"font-size: 13px;\">Fans</b></span>"; } else { midsnaps += "<span><b style=\"font-size: 13px;\">Friends</b></span>"; } midsnaps += "</div>" + "<div class=\"userppd\">" + Math.Round(rNum.NextDouble(), 2) + "<span>Avg. Post <br> Per Day</span></div></div><h5>Recent message</h5></div>" + "<div class=\"concoteng\"> <ul class=\"mess\">"; if (fbmsgs.Count != 0) { int msgcount = 0; foreach (FacebookFeed child in fbmsgs) { string mess = string.Empty; if (msgcount < 2) { if (child.FeedDescription.Length > 40) { mess = child.FeedDescription.Substring(0, 39); mess = mess + "..........."; } else { mess = child.FeedDescription; } midsnaps += "<li><div class=\"messpic\"><img title=\"\" alt=\"\" src=\"http://graph.facebook.com/" + child.FromId + "/picture?type=small\"></div>" + "<div class=\"messtext\">" + mess + "</div></li>"; } else { break; } msgcount++; } } else { midsnaps += "<strong>No messages were found within the past few days.</strong> \"Messages will be displayed once there is activity in this date range.\""; } midsnaps += "</ul></div></div>"; } catch (Exception ex) { logger.Error(ex.Message); } } else if (item.ProfileType == "googleplus") { } else if (item.ProfileType == "twitter") { TwitterAccountRepository twtrepo = new TwitterAccountRepository(); SocioBoard.Domain.TwitterAccount twtaccount = twtrepo.getUserInformation(item.ProfileId); TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository(); List<TwitterMessage> lsttwtmsgs = twtmsgrepo.getAllTwitterMessagesOfProfile(item.ProfileId); int tweetcount = 0; midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:213px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" + "<div onclick=\"detailsdiscoverytwitter('" + item.ProfileId + "');\" class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + twtaccount.TwitterScreenName + "\" alt=\"\" src=\"" + twtaccount.ProfileImageUrl + "\">" + "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/twticon.png\" width=\"16\" height=\"16\"></a></div>" + "<div onclick=\"detailsdiscoverytwitter('" + twtaccount.TwitterUserId + "');\" class=\"useraccname\">" + getsortpofilename(twtaccount.TwitterScreenName) + "</div><div class=\"usercounter\">" + "<div class=\"userfoll\">" + twtaccount.FollowersCount + "<span><b style=\"font-size: 13px;\">Followers</b></span></div>" + "<div class=\"userppd\">" + Math.Round(rNum.NextDouble(), 2) + "<span>Avg. tweet <br> Per Day</span></div></div><h5>Recent message</h5></div>" + "<div class=\"concoteng\"> <ul class=\"mess\">"; try { if (lsttwtmsgs.Count == 0) { midsnaps += "<strong>No messages were found within the past few days.</strong> \"Messages will be displayed once there is activity in this date range.\""; } else { foreach (TwitterMessage msg in lsttwtmsgs) { if (tweetcount < 2) { try { string ms = string.Empty; if (msg.TwitterMsg.Length > 20) { ms = msg.TwitterMsg.Substring(0, 20) + "..."; } else { ms = msg.TwitterMsg; } midsnaps += "<li><div class=\"messpic\"><img title=\"\" alt=\"\" src=\"" + msg.FromProfileUrl + "\"></div>" + "<div class=\"messtext\">" + ms + "</div></li>"; } catch (Exception ex) { Console.WriteLine(ex.Message); } } else { break; } tweetcount++; } } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } midsnaps += "</ul></div></div>"; } else if (item.ProfileType == "tumblr") { try { string PostCount = string.Empty; string LikesCount = string.Empty; TumblrAccountRepository tumblrrepo = new TumblrAccountRepository(); SocioBoard.Domain.TumblrAccount tumblrccount = tumblrrepo.getTumblrAccountDetailsById(item.ProfileId); TumblrFeedRepository tumblrfeedrepo = new TumblrFeedRepository(); List<TumblrFeed> lsttumblrmsgs = tumblrfeedrepo.getFeedOfProfile(item.ProfileId); BlogInfo objBlogInfo = new BlogInfo(); string objData = objBlogInfo.getTumblrUserInfo(tumblrccount.tblrUserName); //string objFollower = objBlogInfo.getTumblrUserfollower(tumblrccount.tblrUserName); string[] words = objData.Split('&'); PostCount = words[1].ToString(); LikesCount = words[0].ToString(); midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:213px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" + "<a href=\"http://"+ item.ProfileId + ".tumblr.com\" target=\"_blank\"><div class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + tumblrccount.tblrUserName + "\" alt=\"\" src=\"http://api.tumblr.com/v2/blog/" + tumblrccount.tblrUserName + ".tumblr.com/avatar\"></a>" + "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/tumblr.png\" width=\"16\" height=\"16\"></a></div>" + "<a href=\"http://" + item.ProfileId + ".tumblr.com\" target=\"_blank\"><div class=\"useraccname\">" + getsortpofilename(tumblrccount.tblrUserName) + "</div></a></div>" + "<div class=\"concoteng\"><div class=\"pillow_fade\">" + " <div class=\"fb_notifications\">" + "<ul class=\"user-stats\"> " + "<li><div class=\"photo_stat\"> post</div> <div class=\"number-stat\">" + PostCount + "</div></li>" + "<li><div class=\"photo_stat\">likes</div><div class=\"number-stat\">" + LikesCount + "</div></li>" + "</ul></div></div></div></div>"; } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (item.ProfileType == "youtube") { try { YoutubeAccountRepository ytrepo = new YoutubeAccountRepository(); YoutubeChannelRepository objYoutubeChannelRepository=new YoutubeChannelRepository(); SocioBoard.Domain.YoutubeAccount ytacount = ytrepo.getYoutubeAccountDetailsById(item.ProfileId); YoutubeChannel objYoutubeChannel = objYoutubeChannelRepository.getYoutubeChannelDetailsById(item.ProfileId); if (string.IsNullOrEmpty(ytacount.Ytprofileimage)) { ytacount.Ytprofileimage = "../../Contents/img/blank_img.png"; } midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:213px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" + "<a href=\"#\" target=\"_blank\"><div class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + ytacount.Ytuserid + "\" alt=\"\" src=\"" + ytacount.Ytprofileimage + "\"></a>" + "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/youtube.png\" width=\"16\" height=\"16\"></a></div>" + "<a href=\"#\" target=\"_blank\"><div class=\"useraccname\">" + getsortpofilename(ytacount.Ytusername) + "</div></a></div>" + "<div class=\"concoteng\"><div class=\"pillow_fade\">" + " <div class=\"fb_notifications\">" + "<ul class=\"user-stats\"> " + "<li><div class=\"photo_stat\">Total View</div> <div class=\"number-stat\">" + objYoutubeChannel.ViewCount + "</div></li>" + "<li><div class=\"photo_stat\">Total Subcriber</div><div class=\"number-stat\">" + objYoutubeChannel.SubscriberCount + "</div></li>" + "<li><div class=\"photo_stat\">Total Video</div><div class=\"number-stat\">" + objYoutubeChannel.VideoCount + "</div></li>" + "</ul></div></div></div></div>"; } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (item.ProfileType == "linkedin") { try { string access = string.Empty, tokenSecrate = string.Empty, LdprofileName = string.Empty, LdPreofilePic = string.Empty; LinkedInAccountRepository objLiRepo = new LinkedInAccountRepository(); LinkedInFeedRepository objliFeedRepo = new LinkedInFeedRepository(); LinkedInAccount liAccount = objLiRepo.getUserInformation(item.ProfileId); LinkedInFeedRepository lifeedrepo = new LinkedInFeedRepository(); List<LinkedInFeed> alstliaccount = lifeedrepo.getAllLinkedInFeedsOfProfile(item.ProfileId); if (liAccount != null) { LdprofileName = liAccount.LinkedinUserName; LdPreofilePic = liAccount.ProfileImageUrl; } if (string.IsNullOrEmpty(LdPreofilePic)) { LdPreofilePic = "../../Contents/img/blank_img.png"; } int linkedinConcount = 0; try { linkedinConcount = liAccount.Connections; } catch (Exception ex) { Console.WriteLine(ex.Message); } midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:213px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" + "<div class=\"userpictiny\"><a target=\"_blank\" href=\"" + liAccount.ProfileUrl + "\"><img width=\"56\" height=\"56\" title=\"" + LdprofileName + "\" alt=\"\" src=\"" + LdPreofilePic + "\"></a>" + "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/link_icon.png\" width=\"16\" height=\"16\"></a></div>" + "<div class=\"useraccname\">" + getsortpofilename(LdprofileName) + "</div><div class=\"usercounter\">" + "<div class=\"userfoll\">" + linkedinConcount + "<span>Connections</span></div>" + "<div class=\"userppd\">" + Math.Round(rNum.NextDouble(), 2) + "<span>Avg. Post <br> Per Day</span></div></div><h5>Recent message</h5></div>" + "<div class=\"concoteng\"> <ul class=\"mess\">"; int link = 0; if (alstliaccount.Count == 0) { midsnaps += "<strong>No messages were found within the past 14 days.</strong> \"Messages will be displayed once there is activity in this date range.\""; } else { try { foreach (LinkedInFeed liFeed in alstliaccount) { try { if (link < 2) { string ms = string.Empty; if (liFeed.Feeds.Length > 20) { ms = liFeed.Feeds.Substring(0, 20) + "..."; } else { ms = liFeed.Feeds; } midsnaps += "<li><div class=\"messpic\"><img title=\"\" alt=\"\" src=\"" + liFeed.FromPicUrl + "\"></div>" + "<div class=\"messtext\">" + ms + "</div></li>"; link++; } else { break; } } catch (Exception ex) { logger.Error(ex.Message); } } } catch (Exception ex) { logger.Error(ex.Message); } } midsnaps += "</ul></div></div>"; } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (item.ProfileType == "instagram") { try { InstagramAccountRepository objInsAccRepo = new InstagramAccountRepository(); InstagramAccount objInsAcc = objInsAccRepo.getInstagramAccountDetailsById(item.ProfileId); midsnaps += "<div id=\"mid_" + item.ProfileId + "\" style=\"height:213px;\" class=\"span4 rounder recpro\"><div class=\"concotop\">" + "<a href=\"http://instagram.com/" + objInsAcc.InsUserName + "\" target=\"_blank\"><div class=\"userpictiny\"><img width=\"56\" height=\"56\" title=\"" + objInsAcc.InsUserName + "\" alt=\"\" src=\"" + objInsAcc.ProfileUrl + "\"></a>" + "<a title=\"\" class=\"userurlpic\" href=\"#\"><img alt=\"\" src=\"../Contents/img/instagram_24X24.png\" width=\"16\" height=\"16\"></a></div>" + "<a href=\"http://instagram.com/" + objInsAcc.InsUserName + "\" target=\"_blank\"><div class=\"useraccname\">" + getsortpofilename(objInsAcc.InsUserName) + "</div></a></div>" + "<div class=\"concoteng\"><div class=\"pillow_fade\">" + " <div class=\"fb_notifications\">" + "<ul class=\"user-stats\"> " + "<li><div class=\"photo_stat\"> photos</div> <div class=\"number-stat\">" + objInsAcc.TotalImages + "</div></li>" + "<li><div class=\"photo_stat\">following</div><div class=\"number-stat\">" + objInsAcc.Followers + "</div></li>" + "<li><div class=\"photo_stat\">followers</div><div class=\"number-stat\">" + objInsAcc.FollowedBy + "</div></li>" + "</ul></div></div></div></div>"; } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (item.ProfileType == "googleanalytics") { } } midsnaps += "</div>"; Response.Write(midsnaps); } } catch (Exception ex) { logger.Error(ex.Message); } } else if (Request.QueryString["op"] == "accountdelete") { Groups lstDetails = objGroupRepository.getGroupName(team.GroupId); if (lstDetails.GroupName == "Socioboard") { Session["facebooktotalprofiles"] = null; SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository(); string Profiletype = Request.QueryString["profile"]; string profileid = Request.QueryString["profileid"]; if (Profiletype == "fb") { try { FacebookAccountRepository fbrepo = new FacebookAccountRepository(); int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid); int delacc = fbrepo.deleteFacebookUser(profileid, user.Id); if (delacc > 0) { socioprofilerepo.deleteProfile(user.Id, profileid); List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid); if (lstsocioprofile.Count >= 0) { try { FacebookMessageRepository fbmsgrepo = new FacebookMessageRepository(); fbmsgrepo.deleteAllMessagesOfUser(profileid, user.Id); FacebookFeedRepository fbfeedrepo = new FacebookFeedRepository(); fbfeedrepo.deleteAllFeedsOfUser(profileid, user.Id); FacebookStatsRepository fbstatsrepo = new FacebookStatsRepository(); fbstatsrepo.deleteFacebookStats(profileid, user.Id); ScheduledMessageRepository schedulemsgrepo = new ScheduledMessageRepository(); schedulemsgrepo.deleteMessage(user.Id, profileid); ArchiveMessageRepository archmsgrepo = new ArchiveMessageRepository(); int del = archmsgrepo.DeleteArchiveMessage(user.Id, profileid); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } } catch (Exception exx) { Console.WriteLine(exx.Message); logger.Error(exx.Message); } } else if (Profiletype == "tumblr") { try { TumblrAccountRepository tumblraccountrepo = new TumblrAccountRepository(); TumblrFeedRepository objTumblrFeedRepository = new TumblrFeedRepository(); int deltwtacc = tumblraccountrepo.deleteTumblrUser(profileid, user.Id); int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid); if (deltwtacc > 0) { try { socioprofilerepo.deleteProfile(user.Id, profileid); objTumblrFeedRepository.DeleteTumblrDataByUserid(user.Id, profileid); ScheduledMessageRepository schedulemsgrepo = new ScheduledMessageRepository(); schedulemsgrepo.deleteMessage(user.Id, profileid); ArchiveMessageRepository archmsgrepo = new ArchiveMessageRepository(); int del = archmsgrepo.DeleteArchiveMessage(user.Id, profileid); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } else if (Profiletype == "youtube") { try { YoutubeAccountRepository youtubeaccountrepo = new YoutubeAccountRepository(); YoutubeChannelRepository objYoutubeChannelRepository = new YoutubeChannelRepository(); int deltwtacc = youtubeaccountrepo.deleteYoutubeUser(user.Id,profileid); int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid); if (deltwtacc > 0) { socioprofilerepo.deleteProfile(user.Id, profileid); objYoutubeChannelRepository.DeleteProfileDataByUserid(profileid); } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } else if (Profiletype == "twt") { try { TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository(); int deltwtacc = twtaccountrepo.deleteTwitterUser(user.Id, profileid); int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid); if (deltwtacc > 0) { socioprofilerepo.deleteProfile(user.Id, profileid); List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid); if (lstsocioprofile.Count >= 0) { try { TwitterMessageRepository twtmsgrepo = new TwitterMessageRepository(); int d = twtmsgrepo.deleteTwitterMessage(profileid, user.Id); TwitterFeedRepository twtfeedrepo = new TwitterFeedRepository(); int s = twtfeedrepo.deleteTwitterFeed(profileid, user.Id); TwitterStatsRepository twtstatsrepo = new TwitterStatsRepository(); int a = twtstatsrepo.deleteTwitterStats(user.Id, profileid); TwitterDirectMessageRepository twtdirectmsgrepo = new TwitterDirectMessageRepository(); int f = twtdirectmsgrepo.deleteDirectMessage(user.Id, profileid); ScheduledMessageRepository schedulemsgrepo = new ScheduledMessageRepository(); schedulemsgrepo.deleteMessage(user.Id, profileid); ArchiveMessageRepository archmsgrepo = new ArchiveMessageRepository(); int del = archmsgrepo.DeleteArchiveMessage(user.Id, profileid); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } else if (Profiletype == "linkedin") { try { LinkedInAccountRepository linkedaccrepo = new LinkedInAccountRepository(); int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid); int dellinacc = linkedaccrepo.deleteLinkedinUser(profileid, user.Id); if (dellinacc > 0) { socioprofilerepo.deleteProfile(user.Id, profileid); List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid); if (lstsocioprofile.Count >= 0) { try { LinkedInFeedRepository linkedfeedrepo = new LinkedInFeedRepository(); int s = linkedfeedrepo.deleteAllFeedsOfUser(profileid, user.Id); ScheduledMessageRepository schedulemsgrepo = new ScheduledMessageRepository(); schedulemsgrepo.deleteMessage(user.Id, profileid); ArchiveMessageRepository archmsgrepo = new ArchiveMessageRepository(); int del = archmsgrepo.DeleteArchiveMessage(user.Id, profileid); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } } catch (Exception ex) { logger.Error(ex.Message); } } else if (Profiletype == "instagram") { try { InstagramAccountRepository insaccrepo = new InstagramAccountRepository(); int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid); int insacc = insaccrepo.deleteInstagramUser(profileid, user.Id); if (insacc > 0) { socioprofilerepo.deleteProfile(user.Id, profileid); List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid); if (lstsocioprofile.Count >= 0) { try { ScheduledMessageRepository schedulemsgrepo = new ScheduledMessageRepository(); schedulemsgrepo.deleteMessage(user.Id, profileid); ArchiveMessageRepository archmsgrepo = new ArchiveMessageRepository(); int del = archmsgrepo.DeleteArchiveMessage(user.Id, profileid); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } } catch (Exception ex) { logger.Error(ex.Message); } } else if (Profiletype == "googleplus") { try { GooglePlusAccountRepository googleplusaccrepo = new GooglePlusAccountRepository(); int delaccFromTeamMemberProfile = objTeamMemberProfileRepository.DeleteTeamMemberProfileByUserid(profileid); int gplusacc = googleplusaccrepo.deleteGooglePlusUser(profileid, user.Id); if (gplusacc > 0) { socioprofilerepo.deleteProfile(user.Id, profileid); List<SocialProfile> lstsocioprofile = socioprofilerepo.checkProfileExistsMoreThanOne(profileid); if (lstsocioprofile.Count >= 0) { } } } catch (Exception ex) { logger.Error(ex.Message); } } string profiles = string.Empty; profiles += "<div class=\"drop_top\"></div><div class=\"drop_mid\">"; /*facebook users binding*/ FacebookAccountRepository fbprepo = new FacebookAccountRepository(); ArrayList lstfbaccounts = fbprepo.getFacebookAccountsOfUser(user.Id); profiles += "<div class=\"twitte_text\">FACEBOOK</div><div class=\"teitter\"><ul>"; if (lstfbaccounts.Count == 0) { profiles += "<li>No Records Found</li>"; } else { foreach (FacebookAccount fbacc in lstfbaccounts) { profiles += "<li id=\"liid_" + fbacc.FbUserId + "\" onclick=\"composemessage(this.id,'fb')\"><a><img id=\"img_" + fbacc.FbUserId + "\" src=\"../Contents/img/facebook.png\" alt=\"" + fbacc.AccessToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"composename_" + fbacc.FbUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + fbacc.FbUserName + "</span><span id=\"imgurl_" + fbacc.FbUserId + "\" style=\"display:none;\">http://graph.facebook.com/" + fbacc.FbUserId + "/picture?type=small</span></a></li>"; } } profiles += "</ul> </div>"; /*twitter users binding*/ TwitterAccountRepository twtpaccountrepo = new TwitterAccountRepository(); ArrayList alsttwtaccounts = twtpaccountrepo.getAllTwitterAccountsOfUser(user.Id); profiles += "<div class=\"twitte_text\">TWITTER</div><div class=\"teitter\"><ul>"; if (alsttwtaccounts.Count == 0) { profiles += "<li>No Records Found</li>"; } else { foreach (SocioBoard.Domain.TwitterAccount item in alsttwtaccounts) { profiles += "<li id=\"liid_" + item.TwitterUserId + "\" onclick=\"composemessage(this.id,'twt')\"><a><img id=\"img_" + item.TwitterUserId + "\" src=\"../Contents/img/twitter.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.TwitterUserId + "\" style=\"display:none;\">" + item.ProfileImageUrl + "</span><span id=\"composename_" + item.TwitterUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.TwitterScreenName + "</span></a></li>"; } } profiles += "</ul> </div>"; /*linkedinuserbinding*/ LinkedInAccountRepository linkaccountrepo = new LinkedInAccountRepository(); ArrayList alstlinkacc = linkaccountrepo.getAllLinkedinAccountsOfUser(user.Id); profiles += "<div class=\"twitte_text\">LINKEDIN</div><div class=\"teitter\"><ul>"; if (alstlinkacc.Count == 0) { profiles += "<li>No Records Found</li>"; } else { foreach (LinkedInAccount item in alstlinkacc) { string profileurl = string.Empty; if (!string.IsNullOrEmpty(item.ProfileImageUrl)) { profileurl = item.ProfileImageUrl; } else { profileurl = "../../Contents/img/blank_img.png"; } profiles += "<li id=\"liid_" + item.LinkedinUserId + "\" onclick=\"composemessage(this.id,'lin')\"><a><img id=\"img_" + item.LinkedinUserId + "\" src=\"../Contents/img/link.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.LinkedinUserId + "\" style=\"display:none;\">" + profileurl + "</span><span id=\"composename_" + item.LinkedinUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.LinkedinUserName + "</span></a></li>"; } } profiles += "</ul> </div>"; Response.Write(RemainingAccount(user)); } } else if (Request.QueryString["op"] == "MasterCompose") { string profiles = string.Empty; string FbprofileId = string.Empty; string TwtprofileId = string.Empty; string TumblrprofileId = string.Empty; string LinkedInprofileId = string.Empty; profiles += "<div class=\"drop_top\"></div><div class=\"drop_mid\">"; try { List<TeamMemberProfile> allprofiles = objTeamMemberProfileRepository.getTeamMemberProfileData(team.Id); foreach (TeamMemberProfile item in allprofiles) { FbprofileId += item.ProfileId + ','; } FbprofileId = FbprofileId.Substring(0, FbprofileId.Length - 1); /*facebook users binding*/ FacebookAccountRepository fbrepo = new FacebookAccountRepository(); List<FacebookAccount> lstfbaccounts = fbrepo.getAllAccountDetail(FbprofileId); profiles += "<div class=\"twitte_text\">FACEBOOK</div><div class=\"teitter\"><ul>"; if (lstfbaccounts.Count == 0) { profiles += "<li>No Records Found</li>"; } else { foreach (FacebookAccount fbacc in lstfbaccounts) { profiles += "<li nwtk='fb' class=\"getAllNetworkProfile\" id=\"liid_" + fbacc.FbUserId + "\" onclick=\"composemessage(this.id,'fb')\"><a><img id=\"img_" + fbacc.FbUserId + "\" src=\"../Contents/img/facebook.png\" alt=\"" + fbacc.AccessToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"composename_" + fbacc.FbUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + fbacc.FbUserName + "</span><span id=\"imgurl_" + fbacc.FbUserId + "\" style=\"display:none;\">http://graph.facebook.com/" + fbacc.FbUserId + "/picture?type=small</span></a></li>"; } } profiles += "</ul> </div>"; } catch (Exception ex) { logger.Error(ex.Message); } /*tumbler users binding*/ try { List<TeamMemberProfile> allTumblrprofiles = objTeamMemberProfileRepository.getTumblrTeamMemberProfileData(team.Id); foreach (TeamMemberProfile item in allTumblrprofiles) { TumblrprofileId += item.ProfileId + ','; } TumblrprofileId = TumblrprofileId.Substring(0, TumblrprofileId.Length - 1); TumblrAccountRepository tumblrtaccountrepo = new TumblrAccountRepository(); List<TumblrAccount> alsttumblrtaccounts = tumblrtaccountrepo.getAllAccountDetail(TumblrprofileId); profiles += "<div class=\"twitte_text\">TUMBLR</div><div class=\"teitter\"><ul>"; if (alsttumblrtaccounts.Count == 0) { profiles += "<li>No Records Found</li>"; } else { foreach (TumblrAccount item in alsttumblrtaccounts) { profiles += "<li nwtk='tumb' class=\"getAllNetworkProfile\" id=\"liid_" + item.tblrUserName + "\" onclick=\"composemessage(this.id,'tumb')\"><a><img id=\"img_" + item.tblrUserName + "\" src=\"../Contents/img/tumblr.png\" alt=\"" + item.tblrAccessToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.tblrUserName + "\" style=\"display:none;\">http://api.tumblr.com/v2/blog/" + item.tblrProfilePicUrl + ".tumblr.com/avatar</span><span id=\"composename_" + item.tblrUserName + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.tblrUserName + "</span></a></li>"; } } profiles += "</ul> </div>"; } catch (Exception ex) { logger.Error(ex.Message); } /*twitter users binding*/ try { List<TeamMemberProfile> allTwtprofiles = objTeamMemberProfileRepository.getTwtTeamMemberProfileData(team.Id); foreach (TeamMemberProfile item in allTwtprofiles) { TwtprofileId += item.ProfileId + ','; } TwtprofileId = TwtprofileId.Substring(0, TwtprofileId.Length - 1); TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository(); List<TwitterAccount> alsttwtaccounts = twtaccountrepo.getAllAccountDetail(TwtprofileId); profiles += "<div class=\"twitte_text\">TWITTER</div><div class=\"teitter\"><ul>"; if (alsttwtaccounts.Count == 0) { profiles += "<li>No Records Found</li>"; } else { foreach (TwitterAccount item in alsttwtaccounts) { profiles += "<li nwtk='twt' class=\"getAllNetworkProfile\" id=\"liid_" + item.TwitterUserId + "\" onclick=\"composemessage(this.id,'twt')\"><a><img id=\"img_" + item.TwitterUserId + "\" src=\"../Contents/img/twitter.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.TwitterUserId + "\" style=\"display:none;\">" + item.ProfileImageUrl + "</span><span id=\"composename_" + item.TwitterUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.TwitterScreenName + "</span></a></li>"; } } profiles += "</ul> </div>"; } catch (Exception ex) { logger.Error(ex.Message); } /*linkedinuserbinding*/ try { List<TeamMemberProfile> allLinkedInprofiles = objTeamMemberProfileRepository.getLinkedInTeamMemberProfileData(team.Id); foreach (TeamMemberProfile item in allLinkedInprofiles) { LinkedInprofileId += item.ProfileId + ','; } LinkedInprofileId = LinkedInprofileId.Substring(0, LinkedInprofileId.Length - 1); LinkedInAccountRepository linkaccountrepo = new LinkedInAccountRepository(); List<LinkedInAccount> alstlinkacc = linkaccountrepo.getAllAccountDetail(LinkedInprofileId); profiles += "<div class=\"twitte_text\">LINKEDIN</div><div class=\"teitter\"><ul>"; if (alstlinkacc.Count == 0) { profiles += "<li>No Records Found</li>"; } else { foreach (LinkedInAccount item in alstlinkacc) { string profileurl = string.Empty; if (!string.IsNullOrEmpty(item.ProfileImageUrl)) { profileurl = item.ProfileImageUrl; } else { profileurl = "../../Contents/img/blank_img.png"; } profiles += "<li nwtk='lin' class=\"getAllNetworkProfile\" id=\"liid_" + item.LinkedinUserId + "\" onclick=\"composemessage(this.id,'lin')\"><a><img id=\"img_" + item.LinkedinUserId + "\" src=\"../Contents/img/link.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.LinkedinUserId + "\" style=\"display:none;\">" + profileurl + "</span><span id=\"composename_" + item.LinkedinUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.LinkedinUserName + "</span></a></li>"; } } profiles += "</ul> </div>"; } catch (Exception ex) { logger.Error(ex.Message); } Response.Write(profiles); } //============================================================= else if (Request.QueryString["op"] == "MasterComposesc") { string profiles = string.Empty; string FbprofileId = string.Empty; string TwtprofileId = string.Empty; string LinkedInprofileId = string.Empty; string TumblrprofileId = string.Empty; //if (Session["profilesforcomposemessage"] == null) //{ profiles += "<div class=\"drop_top\"></div><div class=\"drop_mid\">"; try { List<TeamMemberProfile> allprofiles = objTeamMemberProfileRepository.getTeamMemberProfileData(team.Id); foreach (TeamMemberProfile item in allprofiles) { FbprofileId += item.ProfileId + ','; } FbprofileId = FbprofileId.Substring(0, FbprofileId.Length - 1); /*facebook users binding*/ FacebookAccountRepository fbrepo = new FacebookAccountRepository(); List<FacebookAccount> lstfbaccounts = fbrepo.getAllAccountDetail(FbprofileId); profiles += "<div class=\"twitte_text\">FACEBOOK</div><div class=\"teitter\"><ul>"; if (lstfbaccounts.Count == 0) { profiles += "<li>No Records Found</li>"; } else { foreach (FacebookAccount fbacc in lstfbaccounts) { profiles += "<li nwtk='fb' class=\"getAllNetworkProfile\" id=\"liid_" + fbacc.FbUserId + "\" onclick=\"composemessage(this.id,'fb')\"><a><img id=\"img_" + fbacc.FbUserId + "\" src=\"../Contents/img/facebook.png\" alt=\"" + fbacc.AccessToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"composename_" + fbacc.FbUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + fbacc.FbUserName + "</span><span id=\"imgurl_" + fbacc.FbUserId + "\" style=\"display:none;\">http://graph.facebook.com/" + fbacc.FbUserId + "/picture?type=small</span></a></li>"; } } profiles += "</ul> </div>"; } catch (Exception ex) { logger.Error(ex.Message); } /*tumbler users binding*/ try { List<TeamMemberProfile> allTumblrprofiles = objTeamMemberProfileRepository.getTumblrTeamMemberProfileData(team.Id); foreach (TeamMemberProfile item in allTumblrprofiles) { TumblrprofileId += item.ProfileId + ','; } TumblrprofileId = TumblrprofileId.Substring(0, TumblrprofileId.Length - 1); TumblrAccountRepository tumblrtaccountrepo = new TumblrAccountRepository(); List<TumblrAccount> alsttumblrtaccounts = tumblrtaccountrepo.getAllAccountDetail(TumblrprofileId); profiles += "<div class=\"twitte_text\">TUMBLR</div><div class=\"teitter\"><ul>"; if (alsttumblrtaccounts.Count == 0) { profiles += "<li>No Records Found</li>"; } else { foreach (TumblrAccount item in alsttumblrtaccounts) { profiles += "<li nwtk='twt' class=\"getAllNetworkProfile\" id=\"liid_" + item.tblrUserName + "\" onclick=\"composemessage(this.id,'twt')\"><a><img id=\"img_" + item.tblrUserName + "\" src=\"../Contents/img/twitter.png\" alt=\"" + item.tblrAccessToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.tblrUserName + "\" style=\"display:none;\">" + item.tblrProfilePicUrl + "</span><span id=\"composename_" + item.tblrUserName + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.tblrUserName + "</span></a></li>"; } } profiles += "</ul> </div>"; } catch (Exception ex) { logger.Error(ex.Message); } /*twitter users binding*/ try { List<TeamMemberProfile> allTwtprofiles = objTeamMemberProfileRepository.getTwtTeamMemberProfileData(team.Id); foreach (TeamMemberProfile item in allTwtprofiles) { TwtprofileId += item.ProfileId + ','; } TwtprofileId = TwtprofileId.Substring(0, TwtprofileId.Length - 1); TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository(); List<TwitterAccount> alsttwtaccounts = twtaccountrepo.getAllAccountDetail(TwtprofileId); profiles += "<div class=\"twitte_text\">TWITTER</div><div class=\"teitter\"><ul>"; if (alsttwtaccounts.Count == 0) { profiles += "<li>No Records Found</li>"; } else { foreach (TwitterAccount item in alsttwtaccounts) { profiles += "<li nwtk='twt' class=\"getAllNetworkProfile\" id=\"liid_" + item.TwitterUserId + "\" onclick=\"composemessage(this.id,'twt')\"><a><img id=\"img_" + item.TwitterUserId + "\" src=\"../Contents/img/twitter.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.TwitterUserId + "\" style=\"display:none;\">" + item.ProfileImageUrl + "</span><span id=\"composename_" + item.TwitterUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.TwitterScreenName + "</span></a></li>"; } } profiles += "</ul> </div>"; } catch (Exception ex) { logger.Error(ex.Message); } /*linkedinuserbinding*/ try { List<TeamMemberProfile> allLinkedInprofiles = objTeamMemberProfileRepository.getLinkedInTeamMemberProfileData(team.Id); foreach (TeamMemberProfile item in allLinkedInprofiles) { LinkedInprofileId += item.ProfileId + ','; } LinkedInprofileId = LinkedInprofileId.Substring(0, LinkedInprofileId.Length - 1); LinkedInAccountRepository linkaccountrepo = new LinkedInAccountRepository(); List<LinkedInAccount> alstlinkacc = linkaccountrepo.getAllAccountDetail(LinkedInprofileId); profiles += "<div class=\"twitte_text\">LINKEDIN</div><div class=\"teitter\"><ul>"; if (alstlinkacc.Count == 0) { profiles += "<li>No Records Found</li>"; } else { foreach (LinkedInAccount item in alstlinkacc) { string profileurl = string.Empty; if (!string.IsNullOrEmpty(item.ProfileImageUrl)) { profileurl = item.ProfileImageUrl; } else { profileurl = "../../Contents/img/blank_img.png"; } profiles += "<li nwtk='lin' class=\"getAllNetworkProfile\" id=\"liid_" + item.LinkedinUserId + "\" onclick=\"composemessage(this.id,'lin')\"><a><img id=\"img_" + item.LinkedinUserId + "\" src=\"../Contents/img/link.png\" alt=\"" + item.OAuthToken + "\" border=\"none\" width=\"18\" style=\"float:left;\" /><span id=\"imgurl_" + item.LinkedinUserId + "\" style=\"display:none;\">" + profileurl + "</span><span id=\"composename_" + item.LinkedinUserId + "\" style=\"float:left;margin: 3px 0 0 5px;\">" + item.LinkedinUserName + "</span></a></li>"; } } profiles += "</ul> </div>"; } catch (Exception ex) { logger.Error(ex.Message); } Response.Write(profiles); } else if (Request.QueryString["op"] == "sendmessage") { string messagecount = string.Empty; string message = Request.QueryString["message"]; string time = Request.QueryString["now"]; //message = Request.Form["massagee"]; var userid = Request.QueryString["userid[]"].Split(','); //var userid = Request.Form["userid[]"].Split(','); var files = Request.Files.Count; var fi = Request.Files["file"]; string file = string.Empty; try { if (Request.Files.Count > 0) { if (fi != null) { var path = Server.MapPath("~/Contents/img/upload"); // var path = System.Configuration.ConfigurationManager.AppSettings["MailSenderDomain"]+"Contents/img/upload"; file = path + "/" + fi.FileName; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } fi.SaveAs(file); } } } catch (Exception ex) { logger.Error(ex.Message); } foreach (var item in userid) { string[] networkingwithid = item.Split('_'); if (networkingwithid[0] == "fb") { try { //for (int i = 0; i < 5000; i++) // { FacebookAccountRepository fbaccountrepo = new FacebookAccountRepository(); FacebookAccount fbaccount = fbaccountrepo.getFacebookAccountDetailsById(networkingwithid[1]); var args = new Dictionary<string, object>(); args["message"] = message; if (Request.Files.Count > 0) { string strPathAndQuery = HttpContext.Current.Request.Url.PathAndQuery; string strUrl = HttpContext.Current.Request.Url.AbsoluteUri.Replace(strPathAndQuery, "/"); string filepath = strUrl + "/Contents/img/upload/" + fi.FileName; args["picture"] = filepath; } FacebookClient fc = new FacebookClient(fbaccount.AccessToken); string facebookpost = string.Empty; if (fbaccount.Type == "page") { facebookpost = fc.Post("/" + fbaccount.FbUserId + "/feed", args).ToString(); } else { facebookpost = fc.Post("/me/feed", args).ToString(); } //} } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } else if (networkingwithid[0] == "twt") { try { TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository(); SocioBoard.Domain.TwitterAccount twtaccount = twtaccountrepo.getUserInformation(networkingwithid[1]); TwitterHelper twthelper = new TwitterHelper(); oAuthTwitter OAuthTwt = new oAuthTwitter(); OAuthTwt.AccessToken = twtaccount.OAuthToken; OAuthTwt.AccessTokenSecret = twtaccount.OAuthSecret; OAuthTwt.TwitterScreenName = twtaccount.TwitterScreenName; OAuthTwt.TwitterUserId = twtaccount.TwitterUserId; twthelper.SetCofigDetailsForTwitter(OAuthTwt); #region For Testing // For Testing //OAuthTwt.ConsumerKey = "udiFfPxtCcwXWl05wTgx6w"; //OAuthTwt.ConsumerKeySecret = "jutnq6N32Rb7cgbDSgfsrUVgRQKMbUB34yuvAfCqTI"; //OAuthTwt.AccessToken = "1453351098-Lz4H7cHKp26pXarF6l9zEwdiHDnwH7D0H4zteH3"; //OAuthTwt.AccessTokenSecret = "dGBPxR9wxhQMioIcj5P4Wemxo5EZIZ8wlvDz7i39lSNFg"; //OAuthTwt.TwitterScreenName = ""; //OAuthTwt.TwitterUserId = ""; #endregion Tweet twt = new Tweet(); if (Request.Files.Count > 0) { PhotoUpload ph = new PhotoUpload(); //ph.Tweet(file, message, OAuthTwt); string res = string.Empty; ph.NewTweet(file, message, OAuthTwt, ref res); // for testing Response.Write(res); Console.WriteLine(res); } else { JArray post = twt.Post_Statuses_Update(OAuthTwt, message); } } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (networkingwithid[0] == "lin") { try { LinkedInAccountRepository linkedinaccrepo = new LinkedInAccountRepository(); LinkedInAccount linkedaccount = linkedinaccrepo.getUserInformation(networkingwithid[1]); oAuthLinkedIn Linkedin_oauth = new oAuthLinkedIn(); Linkedin_oauth.Verifier = linkedaccount.OAuthVerifier; Linkedin_oauth.TokenSecret = linkedaccount.OAuthSecret; Linkedin_oauth.Token = linkedaccount.OAuthToken; Linkedin_oauth.Id = linkedaccount.LinkedinUserId; Linkedin_oauth.FirstName = linkedaccount.LinkedinUserName; SocialStream sociostream = new SocialStream(); string res = sociostream.SetStatusUpdate(Linkedin_oauth, message); } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } else if (networkingwithid[0] == "tumb") { string title = string.Empty; try { TumblrAccountRepository objTumblrAccountRepository = new TumblrAccountRepository(); TumblrAccount tumblraccount = objTumblrAccountRepository.getTumblrAccountDetailsById(networkingwithid[1]); PublishedPosts objPublishedPosts = new PublishedPosts(); objPublishedPosts.PostData(tumblraccount.tblrAccessToken, tumblraccount.tblrAccessTokenSecret, networkingwithid[1], message, title, "text"); } catch (Exception ex) { Console.WriteLine(ex.Message); logger.Error(ex.Message); } } string profiletype=""; if(networkingwithid[0] == "fb") { profiletype="facebook"; } else if(networkingwithid[0] == "twt") { profiletype="twitter"; } else if(networkingwithid[0] == "lin") { profiletype="linkedin"; } else if (networkingwithid[0] == "tumb") { profiletype = "tumblr"; } ScheduledMessageRepository objScheduledMessageRepository = new ScheduledMessageRepository(); ScheduledMessage objScheduledMessage = new ScheduledMessage(); try { objScheduledMessage.ShareMessage = message; objScheduledMessage.ClientTime = Convert.ToDateTime(time); objScheduledMessage.ScheduleTime = Convert.ToDateTime(time); objScheduledMessage.CreateTime = Convert.ToDateTime(time); objScheduledMessage.Status = true; objScheduledMessage.UserId = user.Id; objScheduledMessage.ProfileType = profiletype; try { var path = System.Configuration.ConfigurationManager.AppSettings["MailSenderDomain"]+"Contents/img/upload"; file = path + "/" + fi.FileName; objScheduledMessage.PicUrl = file; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } objScheduledMessage.ProfileId = networkingwithid[1]; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } objScheduledMessageRepository.addNewMessage(objScheduledMessage); messagecount = objScheduledMessageRepository.getAllSentMessagesOfUser(user.Id).Count().ToString(); } Response.Write("~"+messagecount); } else if (Request.QueryString["op"] == "wooqueue_messages") { ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository(); } else if (Request.QueryString["op"] == "schedulemessage") { var userid = Request.QueryString["users[]"].Split(','); var datearr = Request.QueryString["datearr[]"].Split(','); string message = Request.QueryString["message"]; message = Request.Form["messagee"]; ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository(); string time = Request.QueryString["time"]; string clienttime = Request.QueryString["clittime"]; foreach (var item in userid) { if (!string.IsNullOrEmpty(item.ToString())) { foreach (var child in datearr) { ScheduledMessage schmessage = new ScheduledMessage(); string[] networkingwithid = item.Split('_'); if (networkingwithid[0] == "fbscheduler") { schmessage.CreateTime = DateTime.Now; schmessage.ProfileType = "facebook"; schmessage.ProfileId = networkingwithid[1]; schmessage.Id = Guid.NewGuid(); schmessage.PicUrl = string.Empty; schmessage.ClientTime = Convert.ToDateTime(clienttime); string servertime = this.CompareDateWithclient(clienttime, child + " " + time); schmessage.ScheduleTime = Convert.ToDateTime(servertime); schmessage.ShareMessage = message; schmessage.UserId = user.Id; schmessage.Status = false; } else if (networkingwithid[0] == "twtscheduler") { schmessage.CreateTime = DateTime.Now; schmessage.ProfileType = "twitter"; schmessage.ProfileId = networkingwithid[1]; schmessage.Id = Guid.NewGuid(); schmessage.PicUrl = string.Empty; schmessage.ClientTime = Convert.ToDateTime(clienttime); string servertime = this.CompareDateWithServer(clienttime, child + " " + time); schmessage.ScheduleTime = Convert.ToDateTime(servertime); schmessage.ShareMessage = message; schmessage.UserId = user.Id; schmessage.Status = false; } else if (networkingwithid[0] == "linscheduler") { schmessage.ClientTime = Convert.ToDateTime(clienttime); schmessage.CreateTime = DateTime.Now; schmessage.ProfileType = "linkedin"; schmessage.ProfileId = networkingwithid[1]; schmessage.Id = Guid.NewGuid(); schmessage.PicUrl = string.Empty; string servertime = this.CompareDateWithServer(clienttime, child + " " + time); schmessage.ScheduleTime = Convert.ToDateTime(servertime); schmessage.ShareMessage = message; schmessage.UserId = user.Id; schmessage.Status = false; } if (!string.IsNullOrEmpty(message)) { if (!schmsgrepo.checkMessageExistsAtTime(user.Id, schmessage.ShareMessage, schmessage.ScheduleTime, schmessage.ProfileId)) { schmsgrepo.addNewMessage(schmessage); } } } } } } else if (Request.QueryString["op"] == "insight") { string check = ""; FacebookAccount objFacebookAccount = (FacebookAccount)Session["fbpagedetail"]; FacebookHelper objFbHelper = new FacebookHelper(); SocialProfile socioprofile = new SocialProfile(); SocialProfilesRepository socioprofilerepo = new SocialProfilesRepository(); FacebookAccountRepository fbrepo = new FacebookAccountRepository(); FacebookClient fbClient = new FacebookClient(objFacebookAccount.AccessToken); int fancountPage = 0; dynamic fancount = fbClient.Get("fql", new { q = " SELECT fan_count FROM page WHERE page_id =" + Request["id"].ToString() }); foreach (var friend in fancount.data) { fancountPage = Convert.ToInt32(friend.fan_count); } objFacebookAccount.Friends = Convert.ToInt32(fancountPage); objFacebookAccount.FbUserId = Request["id"].ToString(); objFacebookAccount.FbUserName = Request["name"].ToString(); objFacebookAccount.Type = "page"; objFacebookAccount.UserId = user.Id; socioprofile.Id = Guid.NewGuid(); socioprofile.ProfileDate = DateTime.Now; socioprofile.ProfileId = Request["id"].ToString(); socioprofile.ProfileStatus = 1; socioprofile.ProfileType = "facebook"; socioprofile.UserId = user.Id; if (!fbrepo.checkFacebookUserExists(objFacebookAccount.FbUserId, user.Id)) { fbrepo.addFacebookUser(objFacebookAccount); Groups lstDetails = objGroupRepository.getGroupName(team.GroupId); if (lstDetails.GroupName == "Socioboard") { TeamMemberProfile teammemberprofile = new TeamMemberProfile(); teammemberprofile.Id = Guid.NewGuid(); teammemberprofile.TeamId = team.Id; teammemberprofile.ProfileId = objFacebookAccount.FbUserId; teammemberprofile.ProfileType = "facebook"; teammemberprofile.StatusUpdateDate = DateTime.Now; objTeamMemberProfileRepository.addNewTeamMember(teammemberprofile); } if (!socioprofilerepo.checkUserProfileExist(socioprofile)) { socioprofilerepo.addNewProfileForUser(socioprofile); } else { socioprofilerepo.updateSocialProfile(socioprofile); } } else { check = "exist"; Session["alreadypageexist"] = objFacebookAccount; fbrepo.updateFacebookUser(objFacebookAccount); if (!socioprofilerepo.checkUserProfileExist(socioprofile)) { socioprofilerepo.addNewProfileForUser(socioprofile); } else { socioprofilerepo.updateSocialProfile(socioprofile); } } //get facebookpagefeeds fbClient = new FacebookClient(objFacebookAccount.AccessToken); FacebookHelper fbhelper = new FacebookHelper(); FacebookInsightStatsHelper fbiHelper = new FacebookInsightStatsHelper(); var feeds = fbClient.Get("/" + Request["id"].ToString() + "/feed"); fbiHelper.getPageImpresion(Request["id"].ToString(), user.Id, 15); fbiHelper.getFanPageLikesByGenderAge(Request["id"].ToString(), user.Id, 15); fbiHelper.getLocation(Request["id"].ToString(), user.Id, 15); // fbiHelper.getFanPost("459630637383010", user.Id, 10); dynamic profile = fbClient.Get(Request["id"].ToString()); fbhelper.getFacebookUserFeeds(feeds, profile); //end facebookpagefeeds string id = "id"; string value = Request["id"].ToString(); Dictionary<string, string> Did = new Dictionary<string, string>(); Did.Add(id, value); dynamic Pageid = Did; // var friendgenderstats=fbClient.Get("me/friends?fields=gender"); objFbHelper.getfbFriendsGenderStatsForFanPage(Pageid, user.Id, ref objFacebookAccount); Session["fbSocial"] = null; Response.Write(RemainingAccount(user)); } else if (Request.QueryString["op"] == "countmessages") { try { int val = 0; /*facebook*/ FacebookAccountRepository fbAccoutsRepo = new FacebookAccountRepository(); ArrayList lstfacebookAccounts = fbAccoutsRepo.getAllFacebookAccountsOfUser(user.Id); foreach (FacebookAccount item in lstfacebookAccounts) { try { FacebookClient fb = new FacebookClient(item.AccessToken); dynamic unreadcount = fb.Get("fql", new { q = "SELECT unread_count FROM mailbox_folder WHERE folder_id = 0 AND viewer_id = " + item.FbUserId + "" }); foreach (var chile in unreadcount.data) { var count = chile.unread_count; int countable = Convert.ToInt32(count.ToString()); val = val + countable; } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } /*Twitter*/ Session["CountMessages"] = val; Response.Write(val); } catch (Exception ex) { Console.WriteLine(ex.Message); } } else if (Request.QueryString["op"] == "recentfollowers") { string recentfollowers = string.Empty; #region RecentFollowers Users twtUsers = new Users(); TwitterAccountRepository twtAccRepo = new TwitterAccountRepository(); ArrayList lstAccRepo = twtAccRepo.getAllTwitterAccountsOfUser(user.Id); oAuthTwitter oauth = null; foreach (TwitterAccount itemTwt in lstAccRepo) { oauth = new oAuthTwitter(); oauth.AccessToken = itemTwt.OAuthToken; oauth.AccessTokenSecret = itemTwt.OAuthSecret; oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"]; oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"]; oauth.TwitterScreenName = itemTwt.TwitterScreenName; oauth.TwitterUserId = itemTwt.TwitterUserId; JArray jarresponse = twtUsers.Get_Followers_ById(oauth, itemTwt.TwitterUserId); foreach (var item in jarresponse) { int resposecount = 0; if (item["ids"] != null) { foreach (var child in item["ids"]) { if (resposecount < 2) { JArray userprofile = twtUsers.Get_Users_LookUp(oauth, child.ToString()); foreach (var items in userprofile) { resposecount++; try { recentfollowers += "<li><a href=\"https://twitter.com/" + items["screen_name"] + "\" target=\"_blank\"><img style=\"border:3px solid #FCFCFC;\" title=\"" + items["name"] + "\" width=\"48\" height=\"48\" alt=\"\" src=\"" + items["profile_image_url"] + "\"></a></li>"; } catch (Exception ex) { Console.WriteLine(ex.Message); } } } } } } } Response.Write(recentfollowers); #endregion } else if (Request.QueryString["op"] == "removefollowers") { string removeid = Request.QueryString["removeid"]; string userid = Request.QueryString["userid"]; Friendship friendship = new Friendship(); oAuthTwitter oauth = new oAuthTwitter(); TwitterAccountRepository twtaccrepo = new TwitterAccountRepository(); TwitterAccount twtAccount = twtaccrepo.getUserInformation(user.Id, userid); oauth.TwitterUserId = twtAccount.TwitterUserId; oauth.TwitterScreenName = twtAccount.TwitterScreenName; oauth.ConsumerKey = ConfigurationManager.AppSettings["consumerKey"]; oauth.ConsumerKeySecret = ConfigurationManager.AppSettings["consumerSecret"]; oauth.AccessToken = twtAccount.OAuthToken; oauth.AccessTokenSecret = twtAccount.OAuthSecret; JArray responseremove = friendship.Post_Friendship_Destroy(oauth, removeid); } //for Deleting socialqueue Message else if (Request.QueryString["op"] == "deletequeuemsg") { try { string res = string.Empty; string messageId = Request.QueryString["messageid"].ToString(); Guid userid = user.Id; ScheduledMessageRepository obj = new ScheduledMessageRepository(); bool check = obj.deleteScheduleMessage(userid, messageId); if (check == true) { res = "success"; } else { } } catch (Exception ex) { logger.Error(ex.Message); } } //for Editing socialqueue Message else if (Request.QueryString["op"] == "Editqueuemsg") { try { string messageId = Request.QueryString["messageid"].ToString(); string newstr = Request.QueryString["newstr"]; Guid userid = user.Id; DateTime dt = DateTime.Now; ScheduledMessageRepository obj = new ScheduledMessageRepository(); obj.UpdateScheduleMessage(userid, messageId, newstr, dt); } catch (Exception ex) { logger.Error(ex.Message); } } else if (Request.QueryString["op"] == "wooqueuemessages") { string profileid = string.Empty; ScheduledMessageRepository schmsgRepo = new ScheduledMessageRepository(); List<TeamMemberProfile> allprofiles = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(team.Id); foreach (TeamMemberProfile item in allprofiles) { profileid += item.ProfileId + ','; } profileid = profileid.Substring(0, profileid.Length - 1); List<ScheduledMessage> lstschMsg = schmsgRepo.getAllMessagesDetail(profileid); string schmessages = string.Empty; //string profurl = string.Empty; //if (string.IsNullOrEmpty(user.ProfileUrl)) //{ string profurls = "../Contents/img/blank_img.png"; //} //else //{ // // profurl = "../Contents/img/blank_img.png"; // profurl = user.ProfileUrl; //} if (lstschMsg.Count != 0) { foreach (ScheduledMessage item in lstschMsg) try { UserRepository objUserRepository=new UserRepository(); User objuser = objUserRepository.getUsersById(item.UserId); string profurl = string.Empty; if (string.IsNullOrEmpty(objuser.ProfileUrl)) { profurl = "../Contents/img/blank_img.png"; } else { // profurl = "../Contents/img/blank_img.png"; profurl = objuser.ProfileUrl; } { schmessages += "<section class=\"section\"><div class=\"js-task-cont read\">" + "<section class=\"task-owner\">" + "<img width=\"32\" height=\"32\" border=\"0\" src=\"" + profurl + "\" class=\"avatar\">" + "</section>" + "<section class=\"task-activity third\">" + "<p>" + objuser.UserName + "</p>" + "<div>" + CompareDateWithServerNew(item.ClientTime, item.CreateTime, item.ScheduleTime) + "</div>" + "<input type=\"hidden\" value=\"#\" id=\"hdntaskid_1\">" + "<p></p>" + "</section>" + "<section class=\"task-message font-13 third\" style=\"height: auto; width: 31%; margin-right: 9px;\"><a id=\"edit_" + item.Id + "\" onclick=\"Editqueue('" + item.Id + "','" + item.ShareMessage + "');\" class=\"tip_left\">" + gethtmlfromstring(item.ShareMessage) + "</a></section>"; if (item.ProfileType == "facebook") { schmessages += "<div style=\"height:70px; margin-top: 0;\" class=\"userpictiny\">" + "<img width=\"48\" height=\"48\" src=\"http://graph.facebook.com/" + item.ProfileId + "/picture?type=small\" alt=\"\">" + "<a style=\"right: 2px; top: 40px;\" title=\"\" class=\"userurlpic\" href=\"#\">" + "<img alt=\"\" src=\"../Contents/img/facebook.png\" style=\"height: 16px;width: 16x;\"></a></div>"; } else if (item.ProfileType == "twitter") { TwitterAccountRepository twtAccRepo = new TwitterAccountRepository(); TwitterAccount twtAccount = twtAccRepo.getUserInformation(item.ProfileId); if (twtAccount != null) { schmessages += "<div style=\"height:70px; margin-top: 0;\" class=\"userpictiny\">" + "<img width=\"48\" height=\"48\" src=\"" + twtAccount.ProfileImageUrl + "\" alt=\"\">" + "<a style=\"right: 2px; top: 40px;\" title=\"\" class=\"userurlpic\" href=\"#\">" + "<img alt=\"\" src=\"../Contents/img/twitter.png\" style=\"height: 16px;width: 16x;\"></a></div>"; } } else if (item.ProfileType == "linkedin") { LinkedInAccountRepository linkAccRepo = new LinkedInAccountRepository(); LinkedInAccount linkedAccount = linkAccRepo.getUserInformation(item.ProfileId); if (linkedAccount != null) { schmessages += "<div style=\"height:70px; margin-top: 0;\" class=\"userpictiny\">" + "<img width=\"48\" height=\"48\" src=\"" + linkedAccount.ProfileImageUrl + "\" alt=\"\">" + "<a style=\"right: 2px; top: 40px;\" title=\"\" class=\"userurlpic\" href=\"#\">" + "<img alt=\"\" src=\"../Contents/img/link.png\" style=\"height: 16px;width: 16x;\"></a></div>"; } } string status = (item.Status == true) ? "Completed" : "Pending"; schmessages += "<section class=\"task-status\" style=\"width:34px;\"><div class=\"ui_light floating task_status_change\">" + //"<a href=\"#nogo\" class=\"ui-sproutmenu\"><span class=\"ui-sproutmenu-status\"><img title=\"Edit Status\" onclick=\"PerformClick(this.id)\" src=\"../Contents/img/icon_edit.png\" class=\"edit_button\" id=\"img_" + item.Id + "_" + item.Status + "\"></span></a></div></section>" + "<a class=\"ui-sproutmenu\"><span class=\"ui-sproutmenu-status\"><img title=\"Edit Status\" onclick=\"PerformClick(this.id)\" src=\"../Contents/img/icon_edit.png\" class=\"edit_button\" id=\"img_" + item.Id + "_" + item.Status + "\"></span></a></div></section>" + "<section class=\"task-status\" style=\"width: 65px; margin-right: 39px;\">" + "<div class=\"ui_light floating task_status_change\">" + "<span class=\"ui-sproutmenu-status\">" + status + "</span>" + "</div>" + "</section>" + "<section class=\"task-status\" style=\"width: 65px; margin-right: 39px;\">" + "<div class=\"ui_light floating task_status_change\">" + "<span class=\"ui-sproutmenu-status\"><img title=\"Delete\" onclick=\"deletequeue(this.id)\" style=\"width:33px;margin-left:60px;margin-top:-10px;\" img src=\"../Contents/img/deleteimage.png\" img id=\"" + item.Id + "\"></span>" + "</div>" + "</section>" + "</div></section>"; } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); Response.Write(schmessages); } } else { schmessages = "<section class=\"section\"><div class=\"js-task-cont read\"><section class=\"task-owner\">" + "<img width=\"32\" height=\"32\" border=\"0\" class=\"avatar\" src=\"" + profurls + "\">" + "</section><section class=\"task-activity third\"><p>" + user.UserName + "</p><div></div><p></p></section><section style=\"margin-right: 6px; width: 31%; height: auto;\" class=\"task-message font-13 third\">" + "<a class=\"tip_left\">No Scheduled Messages</a></section><section style=\"width:113px;\" class=\"task-status\"><span class=\"ficon task_active\"></span>" + //"<div class=\"ui_light floating task_status_change\"><a class=\"ui-sproutmenu\" href=\"#nogo\">" + "<div class=\"ui_light floating task_status_change\"><a class=\"ui-sproutmenu\">" + "<span class=\"ui-sproutmenu-status\"></span></a></div></section></div></section>"; } Response.Write(schmessages); } else if (Request.QueryString["op"] == "drafts_messages") { } else if (Request.QueryString["op"] == "updatequeue") { updatequeue(Request.QueryString["id"], Request.QueryString["status"]); } else if (Request.QueryString["op"] == "messagechk") { SocioBoard.Domain.Messages mstable = new SocioBoard.Domain.Messages(); string[] types = Request.QueryString["type[]"].Split(','); DataSet ds = (DataSet)Session["MessageDataTable"]; DataSet dss = DataTableGenerator.CreateDataSetForTable(mstable); DataTable dtt = dss.Tables[0]; DataView dv = new DataView(dtt); AjaxMessage ajxfed = new AjaxMessage(); string message = string.Empty; foreach (var item in types) { try { DataRow[] foundRows = ds.Tables[0].Select("Type = '" + item + "'"); foreach (var child in foundRows) { dtt.ImportRow(child); } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } message = ajxfed.BindData(dtt); Response.Write(message); } } }
public void ProcessRequest() { if (!string.IsNullOrEmpty(Request.QueryString["op"])) { SocioBoard.Domain.User user = (SocioBoard.Domain.User)Session["LoggedUser"]; if (Request.QueryString["op"] == "networkprofiles") { #region NetworkProfiles string profiles = string.Empty; if (Request.QueryString["network"] == "facebook") { ArrayList alstfacebook = null; if (Session["facebooktotalprofiles"] == null) { FacebookAccountRepository faceaccrepo = new FacebookAccountRepository(); alstfacebook = faceaccrepo.getFacebookAccountsOfUser(user.Id); Session["facebooktotalprofiles"] = alstfacebook; } else { alstfacebook = (ArrayList)Session["facebooktotalprofiles"]; } if (alstfacebook.Count == 0) { profiles += "<li><a href=\"#\" class=\"active\">No Records Found</a> </li>"; } else { foreach (FacebookAccount item in alstfacebook) { profiles += "<li><a id=\"lifb_" + item.FbUserId + "\" href=\"#\" onclick=\"facebookdetails('" + item.FbUserId + "');\" class=\"active\">" + item.FbUserName + "</a> </li>"; } } } else if (Request.QueryString["network"] == "twitter") { ArrayList alsttwitter = null; if (Session["twittertotalprofiles"] == null) { TwitterAccountRepository twtaccrepo = new TwitterAccountRepository(); alsttwitter = twtaccrepo.getAllTwitterAccountsOfUser(user.Id); Session["twittertotalprofiles"] = alsttwitter; } else { alsttwitter = (ArrayList)Session["twittertotalprofiles"]; } if (alsttwitter.Count == 0) { profiles += "<li><a href=\"#\" class=\"active\">No Records Found</a> </li>"; } else { foreach (TwitterAccount item in alsttwitter) { profiles += "<li><a id=\"litwt_" + item.TwitterUserId + "\" href=\"#\" onclick=\"twitterdetails('" + item.TwitterUserId + "');\" class=\"active\">" + item.TwitterScreenName + "</a> </li>"; } } } else if (Request.QueryString["network"] == "linkedin") { ArrayList alstlinklist = null; if (Session["linkedintotalprofiles"] == null) { LinkedInAccountRepository linkaccrepo = new LinkedInAccountRepository(); alstlinklist = linkaccrepo.getAllLinkedinAccountsOfUser(user.Id); } else { alstlinklist = (ArrayList)Session["linkedintotalprofiles"]; } if (alstlinklist.Count == 0) { profiles += "<li><a href=\"#\" class=\"active\">No Records Found</a> </li>"; } else { foreach (LinkedInAccount item in alstlinklist) { profiles += "<li><a id=\"lilin_" + item.LinkedinUserId + "\" href=\"#\" onclick=\"linkedindetails('" + item.LinkedinUserId + "');\" class=\"active\">" + item.LinkedinUserName + "</a> </li>"; } } } else if (Request.QueryString["network"] == "instagram") { ArrayList alstinstagram = null; if (Session["instagramtotalprofiles"] == null) { InstagramAccountRepository insaccrepo = new InstagramAccountRepository(); alstinstagram = insaccrepo.getAllInstagramAccountsOfUser(user.Id); Session["instagramtotalprofiles"] = alstinstagram; } else { alstinstagram = (ArrayList)Session["instagramtotalprofiles"]; } if (alstinstagram.Count == 0) { profiles += "<li><a href=\"#\" class=\"active\">No Records Found</a> </li>"; } else { foreach (InstagramAccount item in alstinstagram) { profiles += "<li><a id=\"liins_" + item.InstagramId + "\" href=\"#\" onclick=\"Instagramdetails('" + item.InstagramId + "');\" class=\"active\">" + item.InsUserName + "</a> </li>"; } } } Response.Write(profiles); #endregion } else if (Request.QueryString["op"] == "facebookwallposts") { string messages = string.Empty; string profileid = string.Empty; string load = Request.QueryString["load"]; //Session[""] = profileid; if (load == "first") { profileid = Request.QueryString["profileid"]; Session["FacebookProfileIdForFeeds"] = profileid; facebookwallcount = 0; } else { profileid = (string)Session["FacebookProfileIdForFeeds"]; facebookwallcount = facebookwallcount + 10; } FacebookMessageRepository fbmsgrepo = new FacebookMessageRepository(); FacebookAccountRepository fbAccRepo = new FacebookAccountRepository(); List<FacebookMessage> lsgfbmsgs = fbmsgrepo.getAllWallpostsOfProfile(profileid, facebookwallcount); UrlExtractor urlext = new UrlExtractor(); foreach (FacebookMessage item in lsgfbmsgs) { try { string[] str = urlext.splitUrlFromString(item.Message); messages += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + item.FromProfileUrl + "\" onclick=\"getFacebookProfiles('" + item.FromId + "');\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\" onclick=\"getFacebookProfiles('" + item.FromId + "');\">" + item.FromName + "</a> <span>" + item.MessageDate + " </span>" + "<p>"; if (!string.IsNullOrEmpty(item.Picture)) { //string largeimage = item.Picture.Replace("_s.jpg","_n.jpg"); messages += "<img src=\"" + item.Picture + "\" alt=\"\" onclick=\"fbimage('" + item.Picture + "');\" /><br/>"; } foreach (string substritem in str) { if (!string.IsNullOrEmpty(substritem)) { if (substritem.Contains("http")) { messages += "<a target=\"_blank\" href=\"" + substritem + "\">" + substritem + "</a>"; } else { messages += substritem; } } } messages += "</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><p><span onclick=\"facebookLike('" + item.FbLike + "','" + profileid + "','" + item.MessageId + "')\" id=\"likefb_" + item.MessageId + "\" class=\"like\">Like</span><span id=\"commentfb_" + item.MessageId + "\" onclick=\"commentText('"+item.MessageId+"');\" class=\"comment\">Comment</span></p>" + "<p><input id=\"textfb_"+item.MessageId+"\" type=\"text\" class=\"put_comments\"></p>"+ "<p><span onclick=\"commentFB('"+item.MessageId+"','"+profileid+"')\" id=\"okfb_"+item.MessageId+"\" class=\"ok\">ok</span><span id=\"cancelfb_"+item.MessageId+"\" onclick=\"cancelFB('"+item.MessageId+"');\" class=\"cancel\"> cancel</span></p>"+ "</div>" + "</li>"; } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } Response.Write(messages); } else if (Request.QueryString["op"] == "fblike") { try { //System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream); //string line = ""; //line = sr.ReadToEnd(); //JObject jo = JObject.Parse(line); //string accesstoken = Server.UrlDecode((string)jo["access"]); //string id = Server.UrlDecode((string)jo["fbid"]); string profileid = Request.QueryString["profileid"]; FacebookAccountRepository fbAccRepo = new FacebookAccountRepository(); FacebookAccount fbAccount = fbAccRepo.getFacebookAccountDetailsById(profileid, user.Id); string id = Request.QueryString["fbid"]; FacebookClient fbClient = new FacebookClient(fbAccount.AccessToken); var s = fbClient.Post(id + "/likes",null); } catch (Exception ex) { logger.Error(ex.Message); } } else if (Request.QueryString["op"] == "fbcomment") { string profileid = Request.QueryString["profileid"]; string message = Request.QueryString["message"]; FacebookAccountRepository fbAccRepo = new FacebookAccountRepository(); FacebookAccount fbAccount = fbAccRepo.getFacebookAccountDetailsById(profileid, user.Id); string id = Request.QueryString["fbid"]; FacebookClient fbClient = new FacebookClient(fbAccount.AccessToken); var args = new Dictionary<string, object>(); args["message"] = message; var s = fbClient.Post(id+"/comments",args); } else if (Request.QueryString["op"] == "twitternetworkdetails") { string messages = string.Empty; string profileid = Request.QueryString["profileid"]; TwitterFeedRepository fbmsgrepo = new TwitterFeedRepository(); List<TwitterFeed> lsgfbmsgs = fbmsgrepo.getTwitterFeedOfProfile(profileid); UrlExtractor urlext = new UrlExtractor(); foreach (TwitterFeed item in lsgfbmsgs) { try { messages += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + item.FromProfileUrl + "\" onclick=\"detailsprofile('" + item.FromId + "');\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\" onclick=\"detailsprofile('" + item.FromId + "');\">" + item.FromName + "</a> <span>" + item.FeedDate + " </span>" + "<p>"; string[] str = urlext.splitUrlFromString(item.Feed); foreach (string substritem in str) { if (!string.IsNullOrEmpty(substritem)) { if (substritem.Contains("http")) { messages += "<a target=\"_blank\" href=\"" + substritem + "\">" + substritem + "</a>"; } else { messages += substritem; } } } messages += "</p>" + "<a class=\"retweets\" href=\"#\">" + /*"<img alt=\"\" src=\"../contents/img/admin/arrow.png\">*/"</a><span></span>" + "</div>" + "</li>"; } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } Response.Write(messages); } else if (Request.QueryString["op"] == "scheduler") { #region Schduler string message = string.Empty; string profileid = Request.QueryString["profileid"]; string network = Request.QueryString["network"]; if (network == "facebook") { ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository(); List<ScheduledMessage> lstschmsg = schmsgrepo.getAllMessagesOfUser(user.Id, profileid); if (lstschmsg.Count != 0) { foreach (ScheduledMessage item in lstschmsg) { FacebookAccountRepository faceaccrepo = new FacebookAccountRepository(); FacebookAccount faceacc = faceaccrepo.getFacebookAccountDetailsById(profileid, user.Id); try { message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\">" + faceacc.FbUserName + "</a> <span>" + item.ScheduleTime + " </span>" + "<p>" + item.ShareMessage + "</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } catch (Exception ex) { Console.WriteLine(ex.Message); } } } else { message = "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\"></a> <span>" + " </span>" + "<p>No Scheduled Messages</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } } else if (network == "twitter") { ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository(); List<ScheduledMessage> lstschmsg = schmsgrepo.getAllMessagesOfUser(user.Id, profileid); if (lstschmsg.Count != 0) { foreach (ScheduledMessage item in lstschmsg) { TwitterAccountRepository twtaccrepo = new TwitterAccountRepository(); TwitterAccount twtacc = twtaccrepo.getUserInformation(user.Id, profileid); message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\">" + twtacc.TwitterScreenName + "</a> <span>" + item.ScheduleTime + " </span>" + "<p>" + item.ShareMessage + "</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } } else { message = "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\"></a> <span>" + " </span>" + "<p>No Scheduled Messages</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } } else if (network == "linkedin") { ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository(); List<ScheduledMessage> lstschmsg = schmsgrepo.getAllMessagesOfUser(user.Id, profileid); if (lstschmsg.Count != 0) { foreach (ScheduledMessage item in lstschmsg) { LinkedInAccountRepository linkedinrepo = new LinkedInAccountRepository(); LinkedInAccount linkedacc = linkedinrepo.getUserInformation(user.Id, profileid); message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\">" + linkedacc.LinkedinUserName + "</a> <span>" + item.ScheduleTime + " </span>" + "<p>" + item.ShareMessage + "</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } } else { message = "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\"></a> <span>" + " </span>" + "<p>No Scheduled Messages</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } } Response.Write(message); #endregion } else if (Request.QueryString["op"] == "facebookfeeds") { string message = string.Empty; string profileid = Request.QueryString["profileid"]; FacebookAccountRepository faceaccrepo = new FacebookAccountRepository(); FacebookAccount faceaac = faceaccrepo.getFacebookAccountDetailsById(profileid, user.Id); FacebookFeedRepository facefeedrepo = new FacebookFeedRepository(); List<FacebookFeed> lstfbfeed = facefeedrepo.getAllFacebookUserFeeds(profileid); UrlExtractor urlext = new UrlExtractor(); foreach (FacebookFeed item in lstfbfeed) { message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"https://www.facebook.com/" + item.ProfileId + "/picture?type=small\" onclick=\"getFacebookProfiles('" + item.FromId + "');\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\" onclick=\"getFacebookProfiles('" + item.FromId + "');\">" + faceaac.FbUserName + "</a> <span>" + item.FeedDate + " </span>" + "<p>"; string[] str = urlext.splitUrlFromString(item.FeedDescription); foreach (string substritem in str) { if (!string.IsNullOrEmpty(substritem)) { if (substritem.Contains("http")) { message += "<a target=\"_blank\" href=\"" + substritem + "\">" + substritem + "</a>"; } else { message += substritem; } } } message += "</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } Response.Write(message); } else if (Request.QueryString["op"] == "twitterfeeds") { string message = string.Empty; string profileid = Request.QueryString["profileid"]; TwitterMessageRepository twtmsgreop = new TwitterMessageRepository(); List<TwitterMessage> lstmsg = twtmsgreop.getAllTwitterMessagesOfProfile(profileid); //TwitterFeedRepository twtmsgrepo = new TwitterFeedRepository(); //List<TwitterFeed> lstfeed = twtmsgrepo.getTwitterFeedOfProfile(profileid); UrlExtractor urlext = new UrlExtractor(); foreach (TwitterMessage item in lstmsg) { try { message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + item.FromProfileUrl + "\" onclick=\"detailsprofile('" + item.FromId + "');\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\" onclick=\"detailsprofile('" + item.FromId + "');\">" + item.FromName + "</a> <span>" + item.MessageDate + " </span>" + "<p>"; string[] str = urlext.splitUrlFromString(item.TwitterMsg); foreach (string substritem in str) { if (!string.IsNullOrEmpty(substritem)) { if (substritem.Contains("http")) { message += "<a target=\"_blank\" href=\"" + substritem + "\">" + substritem + "</a>"; } else { message += substritem; } } } message += "</p>" + "<a class=\"retweets\" href=\"#\">" + /*"<img alt=\"\" src=\"../Contents/img/admin/arrow.png\">*/"</a><span></span>" + "</div>" + "</li>"; } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } Response.Write(message); } else if (Request.QueryString["op"] == "linkedinwallposts") { string message = string.Empty; string profileid = Request.QueryString["profileid"]; LinkedInFeedRepository linkedinfeedrepo = new LinkedInFeedRepository(); List<LinkedInFeed> lstfeed = linkedinfeedrepo.getAllLinkedInFeedsOfProfile(profileid); if (lstfeed != null) { if (lstfeed.Count != 0) { foreach (LinkedInFeed item in lstfeed) { message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + item.FromPicUrl + "\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\">" + item.FromName + "</a> <span>" + item.FeedsDate + " </span>" + "<p>" + item.Feeds + "</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } } else { message = "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\"></a> <span>" + " </span>" + "<p>No Messages Found</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } } Response.Write(message); } else if (Request.QueryString["op"] == "linkedinfeeds") { string profileid = Request.QueryString["profileid"]; LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository(); LinkedInAccount linkacc = linkedinAccRepo.getUserInformation(user.Id, profileid); oAuthLinkedIn oauthlin = new oAuthLinkedIn(); oauthlin.ConsumerKey = ConfigurationManager.AppSettings["LiApiKey"]; oauthlin.ConsumerSecret = ConfigurationManager.AppSettings["LiSecretKey"]; oauthlin.FirstName = linkacc.LinkedinUserName; oauthlin.Id = linkacc.LinkedinUserId; oauthlin.Token = linkacc.OAuthToken; oauthlin.TokenSecret = linkacc.OAuthSecret; oauthlin.Verifier = linkacc.OAuthVerifier; LinkedInUser l = new LinkedInUser(); List<LinkedInUser.User_Updates> lst = l.GetUserUpdates(oauthlin, linkacc.LinkedinUserId, 10); string message = string.Empty; if (lst.Count != 0) { foreach (LinkedInUser.User_Updates item in lst) { try { string picurl = string.Empty; if (string.IsNullOrEmpty(item.PictureUrl)) { picurl = "../Contents/img/blank_img.png"; } else { picurl = item.PictureUrl; } message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + picurl + "\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\">" + item.PersonFirstName + " " + item.PersonLastName + "</a> <span>" + item.DateTime + " </span>" + "<p>" + item.Message + "</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } catch (Exception ex) { Console.WriteLine(ex.Message); } } } else { message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\"></a> <span>" + " </span>" + "<p>No Messages Found</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } Response.Write(message); } else if (Request.QueryString["op"] == "facebookapi") { try { string profileid = Request.QueryString["profileid"]; FacebookAccountRepository facerepo = new FacebookAccountRepository(); FacebookAccount faceaccount = facerepo.getFacebookAccountDetailsById(profileid, user.Id); FacebookHelper fbhelper = new FacebookHelper(); FacebookClient fbclient = new FacebookClient(faceaccount.AccessToken); dynamic profile = fbclient.Get("me"); var feeds = fbclient.Get("/me/feed"); var home = fbclient.Get("me/home"); fbhelper.getFacebookUserFeeds(feeds, profile); fbhelper.getFacebookUserHome(home, profile); } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } else if (Request.QueryString["op"] == "twitterapi") { string profileid = Request.QueryString["profileid"]; TwitterAccountRepository twtAccountRepo = new TwitterAccountRepository(); TwitterAccount twtAccount = twtAccountRepo.getUserInformation(user.Id, profileid); oAuthTwitter oAuth = new oAuthTwitter(); TwitterHelper twthelper = new TwitterHelper(); oAuth.AccessToken = twtAccount.OAuthToken; oAuth.AccessTokenSecret = twtAccount.OAuthSecret; twthelper.SetCofigDetailsForTwitter(oAuth); oAuth.TwitterScreenName = twtAccount.TwitterScreenName; oAuth.TwitterUserId = twtAccount.TwitterUserId; twthelper.getUserTweets(oAuth, twtAccount, user.Id); twthelper.getUserFeed(oAuth, twtAccount, user.Id); twthelper.getSentDirectMessages(oAuth, twtAccount, user.Id); twthelper.getReTweetsOfUser(oAuth, twtAccount, user.Id); } else if (Request.QueryString["op"] == "instagramlike") { string mediaid = Request.QueryString["mediaid"]; bool b = this.likefunction(mediaid, Request.QueryString["userid"], Request.QueryString["access"]); } else if (Request.QueryString["op"] == "instagramunlike") { string mediaid = Request.QueryString["mediaid"]; bool b = this.unlikefunction(mediaid, Request.QueryString["userid"], Request.QueryString["access"]); } else if (Request.QueryString["op"] == "instagramimages") { if (Request.QueryString["loadtime"] != "first") { instagramcount = instagramcount + 10; } else { instagramcount = 0; } InstagramAccountRepository objInsAccRepo = new InstagramAccountRepository(); InstagramFeedRepository objInsFeedRepo = new InstagramFeedRepository(); InstagramFeed objInsFeed = new InstagramFeed(); InstagramCommentRepository objInsCmtRepo = new InstagramCommentRepository(); List<SocioBoard.Domain.InstagramComment> lstInsCmt = new List<SocioBoard.Domain.InstagramComment>(); string strInsImage = string.Empty; try { string profileid = Request.QueryString["profileid"]; InstagramAccount insaccount = objInsAccRepo.getInstagramAccountDetailsById(profileid, user.Id); List<InstagramFeed> lstInsFeed = objInsFeedRepo.getAllInstagramFeedsOfUser(user.Id, profileid, instagramcount); if (lstInsFeed.Count != 0) { strInsImage += "<div class=\"feedcontainer\">"; foreach (InstagramFeed feed in lstInsFeed) { try { lstInsCmt = objInsCmtRepo.getAllInstagramCommentsOfUser(user.Id, profileid, feed.FeedId); } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } try { strInsImage += "<div class=\"span3\" class=\"row-fluid\"><div class=\"span12 box whitebg feedwrap\"><div class=\"topicon\"><div class=\"pull-left\">" + "</div><div class=\"pull-right\" id=\"like\"><a title=\"\" href=\"#\" onClick=\"insUser('" + feed.FeedId + "','" + insaccount.AccessToken + "')\" ><img id=\"heartEmpty_" + feed.FeedId + "\" width=\"14\" alt=\"\" src=\"../Contents/img/admin/heart-empty.png\" style=\"margin-top: 9px;\"></a><a title=\"\" href=\"#\"><img width=\"14\" alt=\"\" src=\"../Contents/img/admin/speech-bubble-left.png\" style=\"margin-top: 9px;\"></a>" + "</div></div><div class=\"pic\"><img alt=\"\" src=\"" + feed.FeedImageUrl + "\"></div><div class=\"desc\"><p></p><span class=\"pull-left span3\">" + "<img width=\"12\" alt=\"\" src=\"../Contents/img/admin/heart-empty.png\"> " + feed.LikeCount + "</span><span class=\"pull-left span3\"><img width=\"12\" alt=\"\" src=\"../Contents/img/admin/speech-bubble-left.png\"> "+ lstInsCmt.Count +"</span><div class=\"clearfix\"></div>"; foreach (InstagramComment insCmt in lstInsCmt) { try { strInsImage += "<div class=\"userprof\"><div class=\"pull-left\"><a href=\"#\">" + "<img width=\"36\" alt=\"\" src=\"" + insCmt.FromProfilePic + "\"></a></div><div class=\"pull-left descr\"><p>" + insCmt.Comment + "</p>" + "<span class=\"usert\">" + DateExtension.ToDateTime(DateTime.Now, (long)Convert.ToDouble(insCmt.CommentDate)) + "</span></div></div>"; } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } strInsImage += "</div></div></div>"; } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } strInsImage += "</div>"; } else { if (instagramcount == 0) { strInsImage = "<div class=\"grid\"><div class=\"box whitebg feedwrap\">" + "<div class=\"topicon\"><div class=\"pull-left\"></div><div class=\"pull-right\">" + "<a href=\"#\" title=\"\"></a><a href=\"#\" title=\"\"></a></div></div><div class=\"pic\">" + "<img src=\"../Contents/img/no_image_found.png\" alt=\"\"></div><div class=\"desc\"><p></p></div></div></div>"; } } Response.Write(strInsImage); } catch (Exception ex) { logger.Error(ex.Message); } } else if (Request.QueryString["op"] == "instagramApi") { try { InstagramManager insManager = new InstagramManager(); string profileid = Request.QueryString["profileid"]; InstagramAccountRepository insAccRepo = new InstagramAccountRepository(); InstagramAccount instagramAccount = insAccRepo.getInstagramAccountDetailsById(profileid, user.Id); insManager.getIntagramImages(instagramAccount); } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } } }
public void ProcessRequest() { SocioBoard.Domain.Team team = (SocioBoard.Domain.Team)Session["GroupName"]; TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository(); TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository(); FacebookAccountRepository facerepo = new FacebookAccountRepository(); LinkedInAccountRepository linkaccrepo = new LinkedInAccountRepository(); InstagramAccountRepository insaccrepo = new InstagramAccountRepository(); TumblrAccountRepository tumblraccrepo = new TumblrAccountRepository(); TumblrFeedRepository objTumblrFeedRepository = new TumblrFeedRepository(); YoutubeAccountRepository ytaccrepo = new YoutubeAccountRepository(); YoutubeChannelRepository ytrchannelrpo = new YoutubeChannelRepository(); if (!string.IsNullOrEmpty(Request.QueryString["op"])) { SocioBoard.Domain.User user = (SocioBoard.Domain.User)Session["LoggedUser"]; if (Request.QueryString["op"] == "networkprofiles") { #region NetworkProfiles string profiles = string.Empty; List<TeamMemberProfile> allprofiles = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(team.Id); int facebookcount = 0; int twittercount = 0; int linkedincount = 0; int instagramcount = 0; int tumblrcount = 0; int youtubecount = 0; int totalcounts = 0; foreach (TeamMemberProfile items in allprofiles) { totalcounts++; if (Request.QueryString["network"] == "facebook") { if (items.ProfileType == "facebook") { facebookcount++; FacebookAccount faceaccount = facerepo.getFacebookAccountDetailsById(items.ProfileId); if (faceaccount.Type != "page") { profiles += "<li><a id=\"lifb_" + faceaccount.FbUserId + "\" href=\"#\" onclick=\"facebookdetails('" + faceaccount.FbUserId + "');\" class=\"active\">" + faceaccount.FbUserName + "</a> </li>"; } } if (totalcounts == allprofiles.Count) { if (facebookcount == 0) { profiles = "<li>No Records Found !</li>"; } } } else if (Request.QueryString["network"] == "twitter") { if (items.ProfileType == "twitter") { twittercount++; TwitterAccount twtaccount = twtaccountrepo.getUserInformation(items.ProfileId); profiles += "<li><a id=\"litwt_" + twtaccount.TwitterUserId + "\" href=\"#\" onclick=\"twitterdetails('" + twtaccount.TwitterUserId + "');\" class=\"active\">" + twtaccount.TwitterScreenName + "</a> </li>"; } if (totalcounts == allprofiles.Count) { if (twittercount == 0) { profiles = "<li>No Records Found !</li>"; } } } else if (Request.QueryString["network"] == "linkedin") { if (items.ProfileType == "linkedin") { linkedincount++; LinkedInAccount linkedinaccount = linkaccrepo.getLinkedinAccountDetailsById(items.ProfileId); profiles += "<li><a id=\"lilin_" + linkedinaccount.LinkedinUserId + "\" href=\"#\" onclick=\"linkedindetails('" + linkedinaccount.LinkedinUserId + "');\" class=\"active\">" + linkedinaccount.LinkedinUserName + "</a> </li>"; } if (totalcounts == allprofiles.Count) { if (linkedincount == 0) { profiles = "<li>No Records Found !</li>"; } } } else if (Request.QueryString["network"] == "tumblr") { if (items.ProfileType == "tumblr") { tumblrcount++; TumblrAccount tumblraccount = tumblraccrepo.getTumblrAccountDetailsById(items.ProfileId); profiles += "<li><a id=\"lilin_" + tumblraccount.tblrUserName + "\" href=\"#\" onclick=\"tumblrdetails('" + tumblraccount.tblrUserName + "');\" class=\"active\">" + tumblraccount.tblrUserName + "</a> </li>"; } if (totalcounts == allprofiles.Count) { if (tumblrcount == 0) { profiles = "<li>No Records Found !</li>"; } } } else if (Request.QueryString["network"] == "youtube") { if (items.ProfileType == "youtube") { youtubecount++; YoutubeAccount youtubeaccount = ytaccrepo.getYoutubeAccountDetailsById(items.ProfileId); profiles += "<li><a id=\"lilin_" + youtubeaccount.Ytusername + "\" href=\"#\" onclick=\"youtubedetails('" + youtubeaccount.Ytuserid + "','" + youtubeaccount.Refreshtoken + "');\" class=\"active\">" + youtubeaccount.Ytusername + "</a> </li>"; } if (totalcounts == allprofiles.Count) { if (youtubecount == 0) { profiles = "<li>No Records Found !</li>"; } } } else if (Request.QueryString["network"] == "instagram") { if (items.ProfileType == "instagram") { instagramcount++; InstagramAccount alstinstagram = insaccrepo.getInstagramAccountDetailsById(items.ProfileId); profiles += "<li><a id=\"liins_" + alstinstagram.InstagramId + "\" href=\"#\" onclick=\"Instagramdetails('" + alstinstagram.InstagramId + "');\" class=\"active\">" + alstinstagram.InsUserName + "</a> </li>"; } if (totalcounts == allprofiles.Count) { if (instagramcount == 0) { profiles = "<li>No Records Found !</li>"; } } } } Response.Write(profiles); #endregion } else if (Request.QueryString["op"] == "facebookwallposts") { #region facebookwallposts string messages = string.Empty; string profileid = string.Empty; string load = Request.QueryString["load"]; //Session[""] = profileid; if (load == "first") { profileid = Request.QueryString["profileid"]; Session["FacebookProfileIdForFeeds"] = profileid; facebookwallcount = 0; } else { profileid = (string)Session["FacebookProfileIdForFeeds"]; facebookwallcount = facebookwallcount + 10; } FacebookMessageRepository fbmsgrepo = new FacebookMessageRepository(); FacebookAccountRepository fbAccRepo = new FacebookAccountRepository(); List<FacebookMessage> lsgfbmsgs = fbmsgrepo.getAllWallpostsOfProfile(profileid, facebookwallcount); UrlExtractor urlext = new UrlExtractor(); foreach (FacebookMessage item in lsgfbmsgs) { try { string[] str = urlext.splitUrlFromString(item.Message); messages += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + item.FromProfileUrl + "\" onclick=\"getFacebookProfiles('" + item.FromId + "');\">" + "</div><div class=\"pull-left feedcontent\">" + //"<a href=\"#\" class=\"feednm\" onclick=\"getFacebookProfiles('" + item.FromId + "');\">" + item.FromName + "</a> <span>" + item.MessageDate + "<a target=\"_blank\" href=\"http://www.facebook.com/" + item.FromId + "\" class=\"feednm\">" + item.FromName + "</a> <span>" + item.MessageDate + " </span>" + "<p>"; if (!string.IsNullOrEmpty(item.Picture)) { //string largeimage = item.Picture.Replace("_s.jpg","_n.jpg"); messages += "<img src=\"" + item.Picture + "\" alt=\"\" onclick=\"fbimage('" + item.Picture + "');\" /><br/>"; } foreach (string substritem in str) { try { if (!string.IsNullOrEmpty(substritem)) { if (substritem.Contains("http")) { messages += "<a target=\"_blank\" href=\"" + substritem + "\">" + substritem + "</a>"; } else { string hrefPost = string.Empty; try { hrefPost = "https://www.facebook.com/" + item.FromId + "/posts/" + item.MessageId.Replace(item.FromId, string.Empty).Replace("_", string.Empty).Trim(); } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } if (!string.IsNullOrEmpty(hrefPost)) { messages += "<a target=\"_blank\" href=\"" + hrefPost + "\">" + substritem + "</a>";//substritem; } else { messages += substritem; } } } } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } } // messages += "</p>" + // "<a class=\"retweets\" href=\"#\">" + // "</a><p><span onclick=\"facebookLike('" + item.FbLike + "','" + profileid + "','" + item.MessageId + "')\" id=\"likefb_" + item.MessageId + "\" class=\"like\">Like</span><span id=\"commentfb_" + item.MessageId + "\" onclick=\"commentText('" + item.MessageId + "');\" class=\"comment\">Comment</span></p>" + // "<p class=\"commeent_box\"><input id=\"textfb_" + item.MessageId + "\" type=\"text\" class=\"put_comments\"></p>" + // "<p><span onclick=\"commentFB('" + item.MessageId + "','" + profileid + "')\" id=\"okfb_" + item.MessageId + "\" class=\"ok\">ok</span><span id=\"cancelfb_" + item.MessageId + "\" onclick=\"cancelFB('" + item.MessageId + "');\" class=\"cancel\"> cancel</span></p>" + // "</div>" + // "</li>"; //} //messages += "</p>" + // "<a class=\"retweets\" href=\"#\">" + // "</a><p><span onclick=\"facebookShare('" + profileid + "','" + item.MessageId + "')\" id=\"likefb_" + item.MessageId + "\" class=\"like\">Share</span><span onclick=\"facebookLike('" + item.FbLike + "','" + profileid + "','" + item.MessageId + "')\" id=\"likefb_" + item.MessageId + "\" class=\"like\">Like</span><span id=\"commentfb_" + item.MessageId + "\" onclick=\"commentText('" + item.MessageId + "');\" class=\"comment\">Comment</span></p>" + // "<p class=\"commeent_box\"><input id=\"textfb_" + item.MessageId + "\" type=\"text\" class=\"put_comments\"></p>" + // "<p><span onclick=\"commentFB('" + item.MessageId + "','" + profileid + "')\" id=\"okfb_" + item.MessageId + "\" class=\"ok\">ok</span><span id=\"cancelfb_" + item.MessageId + "\" onclick=\"cancelFB('" + item.MessageId + "');\" class=\"cancel\"> cancel</span></p>" + // "</div>" + // "</li>"; messages += "</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><p><span onclick=\"facebookLike('" + item.FbLike + "','" + profileid + "','" + item.MessageId + "')\" id=\"likefb_" + item.MessageId + "\" class=\"like\">Like</span><span id=\"commentfb_" + item.MessageId + "\" onclick=\"commentText('" + item.MessageId + "');\" class=\"comment\">Comment</span></p>" + "<p class=\"commeent_box\"><input id=\"textfb_" + item.MessageId + "\" type=\"text\" class=\"put_comments\"></p>" + "<p><span onclick=\"commentFB('" + item.MessageId + "','" + profileid + "')\" id=\"okfb_" + item.MessageId + "\" class=\"ok\">ok</span><span id=\"cancelfb_" + item.MessageId + "\" onclick=\"cancelFB('" + item.MessageId + "');\" class=\"cancel\"> cancel</span></p>" + "</div>" + "</li>"; } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } Response.Write(messages); #endregion } else if (Request.QueryString["op"] == "fblike") { #region fblikes try { //System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream); //string line = ""; //line = sr.ReadToEnd(); //JObject jo = JObject.Parse(line); //string accesstoken = Server.UrlDecode((string)jo["access"]); //string id = Server.UrlDecode((string)jo["fbid"]); string profileid = Request.QueryString["profileid"]; FacebookAccountRepository fbAccRepo = new FacebookAccountRepository(); FacebookAccount fbAccount = fbAccRepo.getFacebookAccountDetailsById(profileid, user.Id); string id = Request.QueryString["fbid"]; FacebookClient fbClient = new FacebookClient(fbAccount.AccessToken); var s = fbClient.Post(id + "/likes", null); } catch (Exception ex) { logger.Error(ex.Message); } #endregion } else if (Request.QueryString["op"] == "fbshare") { try { string profileid = Request.QueryString["profileid"]; string id = Request.QueryString["msgid"]; FacebookAccountRepository fbAccRepo = new FacebookAccountRepository(); FacebookAccount fbAccount = fbAccRepo.getFacebookAccountDetailsById(profileid); FacebookClient fbClient = new FacebookClient(fbAccount.AccessToken); var s = fbClient.Post(id + "/sharedposts", null); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (Request.QueryString["op"] == "fbcomment") { #region fbcomment string profileid = Request.QueryString["profileid"]; string message = Request.QueryString["message"]; FacebookAccountRepository fbAccRepo = new FacebookAccountRepository(); FacebookAccount fbAccount = fbAccRepo.getFacebookAccountDetailsById(profileid, user.Id); string id = Request.QueryString["fbid"]; FacebookClient fbClient = new FacebookClient(fbAccount.AccessToken); var args = new Dictionary<string, object>(); args["message"] = message; var s = fbClient.Post(id + "/comments", args); #endregion } else if (Request.QueryString["op"] == "twitternetworkdetails") { #region twitternetworkdetails string messages = string.Empty; string profileid = Request.QueryString["profileid"]; TwitterFeedRepository fbmsgrepo = new TwitterFeedRepository(); List<TwitterFeed> lsgfbmsgs = fbmsgrepo.getTwitterFeedOfProfile(profileid); UrlExtractor urlext = new UrlExtractor(); foreach (TwitterFeed item in lsgfbmsgs) { try { messages += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + item.FromProfileUrl + "\" onclick=\"detailsdiscoverytwitter('" + item.FromId + "');\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\" onclick=\"detailsdiscoverytwitter('" + item.FromId + "');\">" + item.FromName + "</a> <span>" + item.FeedDate + " </span>" + "<p>"; string[] str = urlext.splitUrlFromString(item.Feed); foreach (string substritem in str) { try { if (!string.IsNullOrEmpty(substritem)) { if (substritem.Contains("http")) { messages += "<a target=\"_blank\" href=\"" + substritem + "\">" + substritem + "</a>"; } else { string hrefPost = string.Empty; try { //https://twitter.com/265982289/status/431552741341941760 hrefPost = "https://twitter.com/" + item.FromId + "/status/" + item.MessageId.Replace(item.FromId, string.Empty).Replace("_", string.Empty).Trim(); } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } if (!string.IsNullOrEmpty(hrefPost)) { messages += "<a target=\"_blank\" href=\"" + hrefPost + "\">" + substritem + "</a>";//substritem; } else { messages += substritem; } } } } catch (Exception) { } } messages += "</p>" + "<a class=\"retweets\" href=\"#\">" + /*"<img alt=\"\" src=\"../contents/img/admin/arrow.png\">*/"</a><span></span>" + "</div>" + "</li>"; } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } Response.Write(messages); #endregion } else if (Request.QueryString["op"] == "scheduler") { #region Schduler string message = string.Empty; string profileid = Request.QueryString["profileid"]; string network = Request.QueryString["network"]; if (network == "facebook") { ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository(); List<ScheduledMessage> lstschmsg = schmsgrepo.getAllMessagesOfUser(profileid); if (lstschmsg.Count != 0) { foreach (ScheduledMessage item in lstschmsg) { try { FacebookAccountRepository faceaccrepo = new FacebookAccountRepository(); FacebookAccount faceacc = faceaccrepo.getFacebookAccountDetailsById(profileid); try { message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"https://graph.facebook.com/" + item.ProfileId + "/picture?type=small\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\">" + faceacc.FbUserName + "</a> <span>" + item.ScheduleTime + " </span>" + "<p>" + item.ShareMessage + "</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } catch (Exception ex) { Console.WriteLine(ex.Message); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } } else { message = "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\"></a> <span>" + " </span>" + "<p>No Scheduled Messages</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } } else if (network == "twitter") { ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository(); List<ScheduledMessage> lstschmsg = schmsgrepo.getAllMessagesOfUser(profileid); if (lstschmsg.Count != 0) { foreach (ScheduledMessage item in lstschmsg) { try { TwitterAccountRepository twtaccrepo = new TwitterAccountRepository(); TwitterAccount twtacc = twtaccrepo.getUserInformation(profileid); message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + twtacc.ProfileImageUrl + "\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\">" + twtacc.TwitterScreenName + "</a> <span>" + item.ScheduleTime + " </span>" + "<p>" + item.ShareMessage + "</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } catch (Exception ex) { Console.WriteLine(ex.Message); } } } else { message = "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\"></a> <span>" + " </span>" + "<p>No Scheduled Messages</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } } else if (network == "linkedin") { ScheduledMessageRepository schmsgrepo = new ScheduledMessageRepository(); List<ScheduledMessage> lstschmsg = schmsgrepo.getAllMessagesOfUser(profileid); if (lstschmsg.Count != 0) { foreach (ScheduledMessage item in lstschmsg) { try { LinkedInAccountRepository linkedinrepo = new LinkedInAccountRepository(); LinkedInAccount linkedacc = linkedinrepo.getUserInformation(profileid); message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + linkedacc.ProfileImageUrl + "\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\">" + linkedacc.LinkedinUserName + "</a> <span>" + item.ScheduleTime + " </span>" + "<p>" + item.ShareMessage + "</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } } } else { message = "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\"></a> <span>" + " </span>" + "<p>No Scheduled Messages</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } } Response.Write(message); #endregion } else if (Request.QueryString["op"] == "facebookfeeds") { #region facebookfeeds string message = string.Empty; string profileid = Request.QueryString["profileid"]; FacebookAccountRepository faceaccrepo = new FacebookAccountRepository(); FacebookAccount faceaac = faceaccrepo.getFacebookAccountDetailsById(profileid); FacebookFeedRepository facefeedrepo = new FacebookFeedRepository(); List<FacebookFeed> lstfbfeed = facefeedrepo.getAllFacebookUserFeeds(profileid); UrlExtractor urlext = new UrlExtractor(); foreach (FacebookFeed item in lstfbfeed) { try { message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"https://graph.facebook.com/" + item.ProfileId + "/picture?type=small\" onclick=\"getFacebookProfiles('" + item.FromId + "');\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\" onclick=\"getFacebookProfiles('" + item.FromId + "');\">" + faceaac.FbUserName + "</a> <span>" + item.FeedDate + " </span>" + "<p>"; string[] str = urlext.splitUrlFromString(item.FeedDescription); foreach (string substritem in str) { try { if (!string.IsNullOrEmpty(substritem)) { if (substritem.Contains("http")) { message += "<a target=\"_blank\" href=\"" + substritem + "\">" + substritem + "</a>"; } else { string hrefPost = string.Empty; try { hrefPost = "https://www.facebook.com/" + item.FromId + "/posts/" + item.FeedId.Replace(item.FromId, string.Empty).Replace("_", string.Empty).Trim(); } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } if (!string.IsNullOrEmpty(hrefPost)) { message += "<a target=\"_blank\" href=\"" + hrefPost + "\">" + substritem + "</a>";//substritem; } else { message += substritem; } } } } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } } message += "</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } } Response.Write(message); #endregion } else if (Request.QueryString["op"] == "twitterfeeds") { #region twitternfeeds string message = string.Empty; string profileid = Request.QueryString["profileid"]; TwitterMessageRepository twtmsgreop = new TwitterMessageRepository(); List<TwitterMessage> lstmsg = twtmsgreop.getAllTwitterMessagesOfProfile(profileid); //TwitterFeedRepository twtmsgrepo = new TwitterFeedRepository(); //List<TwitterFeed> lstfeed = twtmsgrepo.getTwitterFeedOfProfile(profileid); UrlExtractor urlext = new UrlExtractor(); foreach (TwitterMessage item in lstmsg) { try { message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + item.FromProfileUrl + "\" onclick=\"detailsdiscoverytwitter('" + item.FromId + "');\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\" onclick=\"detailsdiscoverytwitter('" + item.FromId + "');\">" + item.FromName + "</a> <span>" + item.MessageDate + " </span>" + "<p>"; string[] str = urlext.splitUrlFromString(item.TwitterMsg); foreach (string substritem in str) { try { if (!string.IsNullOrEmpty(substritem)) { if (substritem.Contains("http")) { message += "<a target=\"_blank\" href=\"" + substritem + "\">" + substritem + "</a>"; } else { string hrefPost = string.Empty; try { //https://twitter.com/265982289/status/431552741341941760 hrefPost = "https://twitter.com/" + item.FromId + "/status/" + item.MessageId.Replace(item.FromId, string.Empty).Replace("_", string.Empty).Trim(); } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } if (!string.IsNullOrEmpty(hrefPost)) { message += "<a target=\"_blank\" href=\"" + hrefPost + "\">" + substritem + "</a>";//substritem; } else { message += substritem; } } } } catch (Exception) { } } message += "</p>" + "<a class=\"retweets\" href=\"#\">" + /*"<img alt=\"\" src=\"../Contents/img/admin/arrow.png\">*/"</a><span></span>" + "</div>" + "</li>"; } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } Response.Write(message); #endregion } else if (Request.QueryString["op"] == "linkedinwallposts") { #region linkedinwallposts string message = string.Empty; string profileid = Request.QueryString["profileid"]; LinkedInFeedRepository linkedinfeedrepo = new LinkedInFeedRepository(); List<LinkedInFeed> lstfeed = linkedinfeedrepo.getAllLinkedInFeedsOfProfile(profileid); if (lstfeed != null) { if (lstfeed.Count != 0) { if (lstfeed.Count > 500) { int check = 0; foreach (LinkedInFeed item in lstfeed) { string PicUrl = string.Empty; if (string.IsNullOrEmpty(item.FromPicUrl)) { PicUrl = "../Contents/img/blank_img.png"; } else { PicUrl = item.FromPicUrl; } check++; try { message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + PicUrl + "\">" + "</div><div class=\"pull-left feedcontent\">" + "<a style=\"cursor:default\" class=\"feednm\">" + item.FromName + "</a> <span>" + item.FeedsDate + " </span>" + " <a href=\"#\">" + item.Feeds + "</a>"+ "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } if (check == 500) { break; } } } else { foreach (LinkedInFeed item in lstfeed) { try { string PicUrl = string.Empty; if (string.IsNullOrEmpty(item.FromPicUrl)) { PicUrl = "../Contents/img/blank_img.png"; } else { PicUrl = item.FromPicUrl; } message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + PicUrl + "\">" + "</div><div class=\"pull-left feedcontent\">" + "<a style=\"cursor:default\" class=\"feednm\">" + item.FromName + "</a> <span>" + item.FeedsDate + " </span>" + " <a href=\"#\">" + item.Feeds + "</a>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } } } else { message = "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\"></a> <span>" + " </span>" + "<p>No Messages Found</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } } Response.Write(message); #endregion } else if (Request.QueryString["op"] == "tumblrimages") { #region tumblrBlog string messages = string.Empty; string profileid = Request.QueryString["profileid"]; TumblrAccount objTumblrAccount = tumblraccrepo.getTumblrAccountDetailsById(profileid); List<TumblrFeed> lstfeed = objTumblrFeedRepository.getFeedOfProfile(profileid); string strTumblrImage = string.Empty; string image = string.Empty; try { if (lstfeed.Count != 0) { strTumblrImage += "<div class=\"feedcontainer\"><div class=\"pull-left span\"><div id=\"tumblrcontents\">" + "<a href=\"#\"><img onClick=\"Bpopup()\" src=\"../Contents/img/share.png\" width=\"20\" title=\"Share Content\" /></a>" + "</div></div>"; foreach (TumblrFeed feed in lstfeed) { if (string.IsNullOrEmpty(feed.imageurl)) { image = "../../Contents/img/admin/Demo-Image.png"; } else { image = feed.imageurl; } try { // strTumblrImage += "<div class=\"span3\" class=\"row-fluid\"><div class=\"span box whitebg tumb_bg feedwrap\"><div class=\"tumb_title\"><span class=\"tumb_span\">" + feed.blogname+ "</span></div><div class=\"pic tumb_pic\"><img onclick=\"tumblrimage('" + feed.imageurl + "')\" alt=\"\" src=\"" + image + "\"></div><div class=\"topicon\">" + //"<div class=\"pull-right\" id=\"like\"><a title=\"\" href=\"#\" onClick=\"LikePic('" + feed.ProfileId + "','" + feed.Id + "','" + objTumblrAccount.tblrAccessToken + "','" + objTumblrAccount.tblrAccessTokenSecret + "','" + feed.liked + "','" + feed.notes + "')\" >" + getlike(feed.liked, feed.ProfileId) + "</a><a title=\"\" href=\"#\"><img onClick=\"UnfollowBlog('" + feed.ProfileId + "','" + feed.Id + "','" + objTumblrAccount.tblrAccessToken + "','" + objTumblrAccount.tblrAccessTokenSecret + "','" + feed.blogname + "')\" width=\"14\" alt=\"\" src=\"../Contents/img/admin/speech-bubble-left.png\" style=\"margin-top: 9px;\"></a>" + //"</div></div><div class=\"desc\"><p></p><span class=\"pull-left pics_space span4\">" + //"<img width=\"12\" alt=\"\" src=\"../Contents/img/admin/dil.png\"> " + feed.notes + "</span><div class=\"clearfix\">" + //"<div class=\"tumb_description\"><p class=\"feed_slug\"><strong>" + feed.slug + "</strong></p><p class=\"teaser\">" + feed.description + "</p></div></div>"; strTumblrImage += "<div class=\"span3\" class=\"row-fluid\"><div class=\"span box whitebg tumb_bg feedwrap\"><div class=\"tumb_title\"><span class=\"tumb_span\">" + feed.blogname + "</span></div><div class=\"pic tumb_pic\"><img onclick=\"tumblrimage('" + feed.imageurl + "')\" alt=\"\" src=\"" + image + "\"></div><div class=\"topicon\">" + "<div class=\"pull-right\" id=\"like\"><a title=\"\" href=\"#\" onClick=\"LikePic('" + feed.ProfileId + "','" + feed.Id + "','" + objTumblrAccount.tblrAccessToken + "','" + objTumblrAccount.tblrAccessTokenSecret + "','" + feed.liked + "','" + feed.notes + "')\" >" + getlike(feed.liked, feed.ProfileId) + "</a><a title=\"\" href=\"#\"><img onClick=\"UnfollowBlog('" + feed.ProfileId + "','" + feed.Id + "','" + objTumblrAccount.tblrAccessToken + "','" + objTumblrAccount.tblrAccessTokenSecret + "','" + feed.blogname + "')\" width=\"14\" alt=\"\" src=\"../Contents/img/admin/speech-bubble-left.png\" style=\"margin-top: 9px;\"></a>" + "</div></div><div class=\"desc\"><p></p><span class=\"pull-left pics_space span4\">" + "<img width=\"12\" alt=\"\" src=\"../Contents/img/admin/dil.png\"> " + feed.notes + "</span><div class=\"clearfix\">" + "<div class=\"tumb_description\"><p class=\"feed_slug\"><strong>" + feed.slug + "</strong></p><p class=\"teaser\">" + feed.description + "</p></div></div>"; strTumblrImage += "</div></div></div>"; } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } strTumblrImage += "</div>"; } else { if (instagramcount == 0) { strTumblrImage = "<div class=\"grid\"><div class=\"box whitebg feedwrap\">" + "<div class=\"topicon\"><div class=\"pull-left\"></div><div class=\"pull-right\">" + "<a href=\"#\" title=\"\"></a><a href=\"#\" title=\"\"></a></div></div><div class=\"pic\">" + "<img src=\"../Contents/img/no_image_found.png\" alt=\"\"></div><div class=\"desc\"><p></p></div></div></div>"; } } Response.Write(strTumblrImage); } catch (Exception ex) { logger.Error(ex.Message); } #endregion } //VIDEOS else if (Request.QueryString["op"] == "youtubechannel") { #region youtube_channel string thumbnail = string.Empty; string videoid = string.Empty; string strYoutubechanell = string.Empty; string GooglePlusUserId = Request.QueryString["profileid"]; string accesstoken = Request.QueryString["accesstoken"]; oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube(); string finaltoken = objoAuthTokenYoutube.GetAccessToken(accesstoken); string strfinaltoken = string.Empty; try { if (!finaltoken.StartsWith("[")) finaltoken = "[" + finaltoken + "]"; JArray objArray = JArray.Parse(finaltoken); foreach (var item in objArray) { try { strfinaltoken = item["access_token"].ToString(); break; } catch (Exception ex) { //logger.Error(ex.StackTrace); Console.WriteLine(ex.StackTrace); } } } catch (Exception ex) { //logger.Error(ex.StackTrace); Console.WriteLine(ex.StackTrace); } YoutubeChannel objChnnelData = ytrchannelrpo.getYoutubeChannelDetailsById(GooglePlusUserId); PlaylistItems objPlaylistItems = new PlaylistItems(); string objDetails = objPlaylistItems.Get_PlaylistItems_List(strfinaltoken, GlobusGooglePlusLib.Authentication.oAuthTokenYoutube.Parts.snippet.ToString(), objChnnelData.Uploadsid); JObject obj = JObject.Parse(objDetails); JArray array = (JArray)obj["items"]; //strYoutubechanell = " <div class=\"row\"> "; int rowCount = 0; int columnCount = 0; //strYoutubechanell = "<div class=\"row top_select\"> <div class=\"pull-left\"><a href=\"#\"><div class=\"YtIns\">Hello</div></a></div> <div class=\"pull-right\"><select class=\"form-control\" onchange=\"dropDownChange(this,'" + GooglePlusUserId + "','" + accesstoken + "')\"><option>Video</option> <option>Play list</option> <option>Activities</option></select></div></div><div class=\"container yt_details\">"; //strYoutubechanell = "<div class=\"row\"> <div class=\"pull-right\"><select class=\"form-control\" onchange=\"dropDownChange(this,'" + GooglePlusUserId + "','" + accesstoken + "')\"><option>Video</option> <option>Play list</option> <option>Activities</option></select></div></div>"; strYoutubechanell = "<div class=\"row top_select\"> <div class=\"pull-left\"><a href=\"#\"><div class=\"YtIns\"></div></a></div> <div class=\"pull-right\">" + "<ul class=\"nav nav-tabs\"><li class=\"active\"><a href=\"#VIDEO\" onclick=\"dropDownChange(this,'" + GooglePlusUserId + "','" + accesstoken + "')\" data-toggle=\"tab\">VIDEO</a></li><li><a href=\"#ACT\" onclick=\"dropDownChange(this,'" + GooglePlusUserId + "','" + accesstoken + "')\" data-toggle=\"tab\">ACTIVITES</a></li><li>" + "<a href=\"#SUB\" onclick=\"dropDownChange(this,'" + GooglePlusUserId + "','" + accesstoken + "')\" data-toggle=\"tab\">SUBSCRIBTIONS</a></li></ul></div></div><div class=\"tab-content yt_details_container\"><div class=\"tab-pane active\" id=\"ACT\">" + "<div class=\"container yt_details\">"; string strYoutubechanell1 = string.Empty; foreach (var item in array) { columnCount++; try { thumbnail = item["snippet"]["thumbnails"]["maxres"]["url"].ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } if (string.IsNullOrEmpty(thumbnail)) { try { thumbnail = item["snippet"]["thumbnails"]["high"]["url"].ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } try { videoid = item["snippet"]["resourceId"]["videoId"].ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } string viewCount = string.Empty; string likeCount = string.Empty; string dislikeCount = string.Empty; string favoriteCount = string.Empty; string commentCount = string.Empty; if (!string.IsNullOrEmpty(videoid)) { try { GlobusGooglePlusLib.Youtube.Core.Video ObjClsVideo = new Video(); string videoDetails = ObjClsVideo.Get_VideoDetails_byId(videoid, strfinaltoken, "snippet,statistics"); JObject JobjvideoDetails = JObject.Parse(videoDetails); var JArrvideoDetails = (JArray)(JobjvideoDetails["items"]); foreach (var DataVal in JArrvideoDetails) { viewCount = DataVal["statistics"]["viewCount"].ToString(); likeCount = DataVal["statistics"]["likeCount"].ToString(); dislikeCount = DataVal["statistics"]["dislikeCount"].ToString(); favoriteCount = DataVal["statistics"]["favoriteCount"].ToString(); commentCount = DataVal["statistics"]["commentCount"].ToString(); break; } } catch (Exception) { } } //strYoutubechanell1 += "<div class=\"span4\">" + // "<div class=\"well\">" + // "<div class=\"video-containers thumbnail\">" + // "<img onclick=\"youtubevideo('" + videoid + "')\" alt=\"\" src=\"" + thumbnail + "\">" + // "</div><span class=\"pull-left\"><a href=\"#\"> <i class=\"icon-eye-open\"></i></a>" + // "</span></div></div>"; strYoutubechanell1 += "<div class=\"span3\">" + "<div class=\"span box whitebg tumb_bg\">" + "<div class=\"yt_title\"></div><div class=\"video-containers thumbnail\">" + "<img onclick=\"youtubevideo('" + videoid + "')\" alt=\"\" src=\"" + thumbnail + "\">" + "</div><div class=\"icons\" style=\"width: 225px; float: left;\"><span class=\"span6 pull-left\">" + "<a href=\"#\" style=\"float: left;\"> <i style=\"color: green;\" class=\"icon-hand-up\"></i></a><span class=\"pull-left\">" + likeCount + "</span></a><a href=\"#\" style=\"float: left;\"> <i style=\"color: red;\" class=\"icon-hand-down\"></i><span>" + dislikeCount + "</span>" + "</a></span><span class=\"pull-right\"><a href=\"#\"> <i style=\"color: red;\" class=\"icon-eye-open\"></i><span>" + viewCount + "</span></a></span></div><div class=\"yt_description\"></div></div></div>"; try { if (rowCount == 3) { //strYoutubechanell += " <div class=\"row space\">" + strYoutubechanell1 + "</div></div></div>"; strYoutubechanell += " <div class=\"row space\">" + strYoutubechanell1 + "</div>"; strYoutubechanell1 = string.Empty; rowCount = 0; } else { rowCount++; } if (!strYoutubechanell.Contains(strYoutubechanell1) && array.Count == columnCount) { //strYoutubechanell += " <div class=\"row space\">" + strYoutubechanell1 + "</div></div>"; strYoutubechanell += " <div class=\"row space\">" + strYoutubechanell1 + "</div>"; } } catch (Exception) { } //strYoutubechanell += "<div class=\"span3\" class=\"row-fluid\"><div class=\"span12 box whitebg feedwrap\"><div class=\"topicon\"><div class=\"pull-left\">" + // "</div><div class=\"pull-right\" id=\"like\"><a title=\"\" href=\"#\" onClick=\"LikePic()\" ></a><a title=\"\" href=\"#\"></a>" + // "</div></div><div class=\"pic\"><img onclick=\"youtubevideo('" + videoid + "')\" alt=\"\" src=\"" + thumbnail + "\"></div><div class=\"desc\"><p></p><span class=\"pull-left span3\">" + // "<img width=\"12\" alt=\"\" src=\"../Contents/img/admin/dil.png\"></span><div class=\"clearfix\">" + // "</div>"; //strYoutubechanell += "</div></div></div>"; } Response.Write("<div id=\"ACT\" class=\"tab-pane active\"><div class=\"container yt_details\">" + strYoutubechanell + "\"</div></div>"); #endregion } //ACTIVITIES else if (Request.QueryString["op"] == "youtubeactivity") { #region youtube_ACTIVITIES string strYoutubechanell = string.Empty; string GooglePlusUserId = Request.QueryString["profileid"]; string accesstoken = Request.QueryString["accesstoken"]; oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube(); string finaltoken = objoAuthTokenYoutube.GetAccessToken(accesstoken); string strfinaltoken = string.Empty; try { if (!finaltoken.StartsWith("[")) finaltoken = "[" + finaltoken + "]"; JArray objArray = JArray.Parse(finaltoken); foreach (var item in objArray) { try { strfinaltoken = item["access_token"].ToString(); break; } catch (Exception ex) { //logger.Error(ex.StackTrace); Console.WriteLine(ex.StackTrace); } } } catch (Exception ex) { //logger.Error(ex.StackTrace); Console.WriteLine(ex.StackTrace); } YoutubeChannel objChnnelData = ytrchannelrpo.getYoutubeChannelDetailsById(GooglePlusUserId); GlobusGooglePlusLib.Youtube.Core.Activities objActivities = new Activities(); string objDetails = objActivities.Get_All_Activities(strfinaltoken, oAuthTokenYoutube.Parts.snippet, true, 50); JObject obj = JObject.Parse(objDetails); JArray array = (JArray)obj["items"]; int rowCount = 0; int columnCount = 0; strYoutubechanell = ""; string strYoutubechanell1 = string.Empty; foreach (var item in array) { string title = string.Empty; string description = string.Empty; string thumbnail = string.Empty; string videoid = string.Empty; columnCount++; #region << Title >> try { title = item["snippet"]["title"].ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } #endregion #region << Description >> try { description = item["snippet"]["description"].ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } #endregion #region << Thumbnail >> try { thumbnail = item["snippet"]["thumbnails"]["maxres"]["url"].ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } if (string.IsNullOrEmpty(thumbnail)) { try { thumbnail = item["snippet"]["thumbnails"]["high"]["url"].ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } #endregion try { videoid = item["snippet"]["resourceId"]["videoId"].ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } string viewCount = string.Empty; string likeCount = string.Empty; string dislikeCount = string.Empty; string favoriteCount = string.Empty; string commentCount = string.Empty; if (!string.IsNullOrEmpty(videoid)) { try { GlobusGooglePlusLib.Youtube.Core.Video ObjClsVideo = new Video(); string videoDetails = ObjClsVideo.Get_VideoDetails_byId(videoid, strfinaltoken, "snippet,statistics"); JObject JobjvideoDetails = JObject.Parse(videoDetails); var JArrvideoDetails = (JArray)(JobjvideoDetails["items"]); foreach (var DataVal in JArrvideoDetails) { viewCount = DataVal["statistics"]["viewCount"].ToString(); likeCount = DataVal["statistics"]["likeCount"].ToString(); dislikeCount = DataVal["statistics"]["dislikeCount"].ToString(); favoriteCount = DataVal["statistics"]["favoriteCount"].ToString(); commentCount = DataVal["statistics"]["commentCount"].ToString(); break; } } catch (Exception) { } } if (string.IsNullOrEmpty(title) && thumbnail.EndsWith("hq1.jpg") && string.IsNullOrEmpty(videoid) && string.IsNullOrEmpty(description)) { continue; } strYoutubechanell1 += "<div class=\"span3\">" + "<div class=\"span box whitebg tumb_bg\">" + "<div class=\"yt_title\">" + title + "</div><div class=\"video-containers thumbnail\">" + "<img onclick=\"youtubevideo('" + videoid + "')\" alt=\"\" src=\"" + thumbnail + "\">" + "</div><div class=\"yt_description\">" + description + "</div></div></div>"; try { if (rowCount == 3) { strYoutubechanell += " <div class=\"row space\">" + strYoutubechanell1 + "</div>"; strYoutubechanell1 = string.Empty; rowCount = 0; } else { rowCount++; } if (!strYoutubechanell.Contains(strYoutubechanell1) && array.Count == columnCount) { strYoutubechanell += " <div class=\"row space\">" + strYoutubechanell1 + "</div>"; } } catch (Exception) { } } Response.Write(strYoutubechanell); #endregion } //SUBSCRIBTIONS else if (Request.QueryString["op"] == "youtubesubscribe") { #region youtube_SUBSCRIBE string strYoutubechanell = string.Empty; string GooglePlusUserId = Request.QueryString["profileid"]; string accesstoken = Request.QueryString["accesstoken"]; oAuthTokenYoutube objoAuthTokenYoutube = new oAuthTokenYoutube(); string finaltoken = objoAuthTokenYoutube.GetAccessToken(accesstoken); string strfinaltoken = string.Empty; try { if (!finaltoken.StartsWith("[")) finaltoken = "[" + finaltoken + "]"; JArray objArray = JArray.Parse(finaltoken); foreach (var item in objArray) { try { strfinaltoken = item["access_token"].ToString(); break; } catch (Exception ex) { //logger.Error(ex.StackTrace); Console.WriteLine(ex.StackTrace); } } } catch (Exception ex) { //logger.Error(ex.StackTrace); Console.WriteLine(ex.StackTrace); } Subscriptions _Subscriptions = new Subscriptions(); string _strSubscriptions = _Subscriptions.Get_Subscriptions_List(strfinaltoken, oAuthTokenYoutube.Parts.snippet.ToString()); //YoutubeChannel objChnnelData = ytrchannelrpo.getYoutubeChannelDetailsById(GooglePlusUserId); //GlobusGooglePlusLib.Youtube.Core.Activities objActivities = new Activities(); //string objDetails = objActivities.Get_All_Activities(strfinaltoken, oAuthTokenYoutube.Parts.snippet, true, 50); JObject obj = JObject.Parse(_strSubscriptions); JArray array = (JArray)obj["items"]; int rowCount = 0; int columnCount = 0; strYoutubechanell = ""; string strYoutubechanell1 = string.Empty; foreach (var item in array) { string title = string.Empty; string description = string.Empty; string _resoucechannelId = string.Empty; string thumbnail = string.Empty; columnCount++; #region << Title >> try { title = item["snippet"]["title"].ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } #endregion #region << Description >> try { description = item["snippet"]["description"].ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } #endregion #region << Thumbnail >> try { thumbnail = item["snippet"]["thumbnails"]["maxres"]["url"].ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } if (string.IsNullOrEmpty(thumbnail)) { try { thumbnail = item["snippet"]["thumbnails"]["high"]["url"].ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } #endregion try { _resoucechannelId = item["snippet"]["resourceId"]["channelId"].ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } string viewCount = string.Empty; string subscriberCount = string.Empty; string hiddenSubscriberCount = string.Empty; string videoCount = string.Empty; string commentCount = string.Empty; if (!string.IsNullOrEmpty(_resoucechannelId)) { try { GlobusGooglePlusLib.Youtube.Core.Channels _Channels = new Channels(); string videoDetails = _Channels.Get_Channel_List(strfinaltoken, (oAuthTokenYoutube.Parts.snippet.ToString() + "," + oAuthTokenYoutube.Parts.statistics.ToString()), _resoucechannelId); JObject JobjvideoDetails = JObject.Parse(videoDetails); var JArrvideoDetails = (JArray)(JobjvideoDetails["items"]); foreach (var DataVal in JArrvideoDetails) { viewCount = DataVal["statistics"]["viewCount"].ToString(); subscriberCount = DataVal["statistics"]["subscriberCount"].ToString(); hiddenSubscriberCount = DataVal["statistics"]["hiddenSubscriberCount"].ToString(); videoCount = DataVal["statistics"]["videoCount"].ToString(); commentCount = DataVal["statistics"]["commentCount"].ToString(); break; } } catch (Exception) { } } //strYoutubechanell1 += "<div class=\"span3\">" + // "<div class=\"span box whitebg tumb_bg\">" + // "<div class=\"yt_title\">" + title + "</div><div class=\"video-containers thumbnail\">" + // "<img onclick=\"#\" alt=\"\" src=\"" + thumbnail + "\">" + // "</div><div class=\"icons\" style=\"width: 225px; float: left;\"><span class=\"span6 pull-left\">" + // "<a href=\"#\" style=\"float: left;\"> <i style=\"color: green;\" class=\"icon-facetime-video\"></i></a>" + // "<span class=\"pull-left\"> " + videoCount + "</span></a><a href=\"#\" style=\"float: left;\"> <i style=\"color: red;\" class=\"icon-comment\"></i>" + // "<span> " + commentCount + "</span></a></span><span class=\"pull-right\"><a href=\"#\"> <i style=\"color: red; padding-right: 5px;\" class=\"icon-eye-open\"></i><span> " + viewCount + "</span></a>" + // "</span></div><div class=\"yt_description\">" + description + "</div></div></div>"; strYoutubechanell1 += "<div class=\"span3\">" + "<div class=\"span box whitebg tumb_bg\">" + "<div class=\"yt_title\">" + title + "</div><div class=\"video-containers thumbnail\">" + "<img onclick=\"#\" alt=\"\" src=\"" + thumbnail + "\">" + "</div><div class=\"icons\" style=\"width: 225px; float: left;\"><span class=\"span7 pull-left\">" + "<a href=\"#\" style=\"float: left;\"> <i style=\"color: green;\" class=\"icon-facetime-video\"></i></a>" + "<span class=\"pull-left\"> " + ConvertMillionAndBillion(videoCount) + "</span></a><a href=\"#\" style=\"float: left;\"> <i style=\"color: red;\" class=\"icon-comment\"></i>" + "<span> " + ConvertMillionAndBillion(commentCount) + "</span></a></span><span class=\"pull-right\"><a href=\"#\"> <i style=\"color: red; padding-right: 5px;\" class=\"icon-eye-open\"></i><span> " + ConvertMillionAndBillion(viewCount) + "</span></a>" + "</span></div><div class=\"yt_description\">" + description + "</div></div></div>"; try { if (rowCount == 3) { strYoutubechanell += " <div class=\"row space\">" + strYoutubechanell1 + "</div>"; strYoutubechanell1 = string.Empty; rowCount = 0; } else { rowCount++; } if (!strYoutubechanell.Contains(strYoutubechanell1) && array.Count == columnCount) { strYoutubechanell += " <div class=\"row space\">" + strYoutubechanell1 + "</div>"; } } catch (Exception) { } } Response.Write(strYoutubechanell); #endregion } else if (Request.QueryString["op"] == "linkedinfeeds") { #region linkedinfeeds string profileid = Request.QueryString["profileid"]; LinkedInAccountRepository linkedinAccRepo = new LinkedInAccountRepository(); LinkedInAccount linkacc = linkedinAccRepo.getUserInformation(profileid); oAuthLinkedIn oauthlin = new oAuthLinkedIn(); oauthlin.ConsumerKey = ConfigurationManager.AppSettings["LiApiKey"]; oauthlin.ConsumerSecret = ConfigurationManager.AppSettings["LiSecretKey"]; oauthlin.FirstName = linkacc.LinkedinUserName; oauthlin.Id = linkacc.LinkedinUserId; oauthlin.Token = linkacc.OAuthToken; oauthlin.TokenSecret = linkacc.OAuthSecret; oauthlin.Verifier = linkacc.OAuthVerifier; LinkedInUser l = new LinkedInUser(); List<LinkedInUser.User_Updates> lst = l.GetUserUpdates(oauthlin, linkacc.LinkedinUserId, 10); string message = string.Empty; if (lst.Count != 0) { foreach (LinkedInUser.User_Updates item in lst) { try { string picurl = string.Empty; if (string.IsNullOrEmpty(item.PictureUrl)) { picurl = "../Contents/img/blank_img.png"; } else { picurl = item.PictureUrl; } message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"" + picurl + "\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"" + linkacc.ProfileUrl + "\" target=\"_blank\" class=\"feednm\">" + item.PersonFirstName + " " + item.PersonLastName + "</a> <span>" + item.DateTime + " </span>" + "<p>" + item.Message + "</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } catch (Exception ex) { Console.WriteLine(ex.Message); } } } else { message += "<li><div class=\"feedim pull-left\"><img alt=\"\" width=\"31\" height=\"31\" src=\"../Contents/img/blank_img.png\">" + "</div><div class=\"pull-left feedcontent\">" + "<a href=\"#\" class=\"feednm\"></a> <span>" + " </span>" + "<p>No Messages Found</p>" + "<a class=\"retweets\" href=\"#\">" + "</a><span></span>" + "</div>" + "</li>"; } Response.Write(message); #endregion } else if (Request.QueryString["op"] == "facebookapi") { #region facebookapi try { string profileid = Request.QueryString["profileid"]; // FacebookAccountRepository facerepo = new FacebookAccountRepository(); FacebookAccount faceaccount = facerepo.getFacebookAccountDetailsById(profileid); FacebookHelper fbhelper = new FacebookHelper(); FacebookClient fbclient = new FacebookClient(faceaccount.AccessToken); dynamic profile = fbclient.Get("me"); var feeds = fbclient.Get("/me/feed"); var home = fbclient.Get("me/home"); fbhelper.getFacebookUserFeeds(feeds, profile); fbhelper.getFacebookUserHome(home, profile); } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } #endregion } else if (Request.QueryString["op"] == "twitterapi") { string profileid = Request.QueryString["profileid"]; TwitterAccountRepository twtAccountRepo = new TwitterAccountRepository(); TwitterAccount twtAccount = twtAccountRepo.getUserInformation(user.Id, profileid); oAuthTwitter oAuth = new oAuthTwitter(); TwitterHelper twthelper = new TwitterHelper(); oAuth.AccessToken = twtAccount.OAuthToken; oAuth.AccessTokenSecret = twtAccount.OAuthSecret; twthelper.SetCofigDetailsForTwitter(oAuth); oAuth.TwitterScreenName = twtAccount.TwitterScreenName; oAuth.TwitterUserId = twtAccount.TwitterUserId; twthelper.getUserTweets(oAuth, twtAccount, user.Id); twthelper.getUserFeed(oAuth, twtAccount, user.Id); twthelper.getSentDirectMessages(oAuth, twtAccount, user.Id); twthelper.getReTweetsOfUser(oAuth, twtAccount, user.Id); } else if (Request.QueryString["op"] == "instagramlike") { string mediaid = Request.QueryString["mediaid"]; bool b = this.likefunction(mediaid, Request.QueryString["userid"], Request.QueryString["access"]); } else if (Request.QueryString["op"] == "instagramunlike") { string mediaid = Request.QueryString["mediaid"]; bool b = this.unlikefunction(mediaid, Request.QueryString["userid"], Request.QueryString["access"]); } else if (Request.QueryString["op"] == "instagramimages") { if (Request.QueryString["loadtime"] != "first") { instagramcount = instagramcount + 10; } else { instagramcount = 0; } InstagramAccountRepository objInsAccRepo = new InstagramAccountRepository(); InstagramFeedRepository objInsFeedRepo = new InstagramFeedRepository(); InstagramFeed objInsFeed = new InstagramFeed(); InstagramCommentRepository objInsCmtRepo = new InstagramCommentRepository(); List<SocioBoard.Domain.InstagramComment> lstInsCmt = new List<SocioBoard.Domain.InstagramComment>(); string strInsImage = string.Empty; try { string profileid = Request.QueryString["profileid"]; InstagramAccount insaccount = objInsAccRepo.getInstagramAccountDetailsById(profileid, user.Id); List<InstagramFeed> lstInsFeed = objInsFeedRepo.getAllInstagramFeedsOfUser(user.Id, profileid, instagramcount); if (lstInsFeed.Count != 0) { strInsImage += "<div class=\"feedcontainer\">"; foreach (InstagramFeed feed in lstInsFeed) { try { lstInsCmt = objInsCmtRepo.getAllInstagramCommentsOfUser(user.Id, profileid, feed.FeedId); } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } try { strInsImage += "<div class=\"span3\" class=\"row-fluid\"><div class=\"span12 box whitebg feedwrap\"><div class=\"topicon\"><div class=\"pull-left\">" + "</div><div class=\"pull-right\" id=\"like\"><a title=\"\" href=\"#\" onClick=\"insUser('" + feed.FeedId + "','" + insaccount.AccessToken + "')\" ><img id=\"heartEmpty_" + feed.FeedId + "\" width=\"14\" alt=\"\" src=\"../Contents/img/admin/heart-empty.png\" style=\"margin-top: 9px;\"></a><a title=\"\" href=\"#\"><img width=\"14\" alt=\"\" src=\"../Contents/img/admin/speech-bubble-left.png\" style=\"margin-top: 9px;\"></a>" + "</div></div><div class=\"pic\"><img alt=\"\" src=\"" + feed.FeedImageUrl + "\"></div><div class=\"desc\"><p></p><span class=\"pull-left span3\">" + "<img width=\"12\" alt=\"\" src=\"../Contents/img/admin/heart-empty.png\"> " + feed.LikeCount + "</span><span class=\"pull-left span3\"><img width=\"12\" alt=\"\" src=\"../Contents/img/admin/speech-bubble-left.png\"> " + lstInsCmt.Count + "</span><div class=\"clearfix\"></div>"; foreach (InstagramComment insCmt in lstInsCmt) { try { strInsImage += "<div class=\"userprof\"><div class=\"pull-left\"><a href=\"#\">" + "<img width=\"36\" alt=\"\" src=\"" + insCmt.FromProfilePic + "\"></a></div><div class=\"pull-left descr\"><p>" + insCmt.Comment + "</p>" + "<span class=\"usert\">" + DateExtension.ToDateTime(DateTime.Now, (long)Convert.ToDouble(insCmt.CommentDate)) + "</span></div></div>"; } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } strInsImage += "</div></div></div>"; } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } strInsImage += "</div>"; } else { if (instagramcount == 0) { strInsImage = "<div class=\"grid\"><div class=\"box whitebg feedwrap\">" + "<div class=\"topicon\"><div class=\"pull-left\"></div><div class=\"pull-right\">" + "<a href=\"#\" title=\"\"></a><a href=\"#\" title=\"\"></a></div></div><div class=\"pic\">" + "<img src=\"../Contents/img/no_image_found.png\" alt=\"\"></div><div class=\"desc\"><p></p></div></div></div>"; } } Response.Write(strInsImage); } catch (Exception ex) { logger.Error(ex.Message); } } else if (Request.QueryString["op"] == "instagramApi") { try { InstagramManager insManager = new InstagramManager(); string profileid = Request.QueryString["profileid"]; InstagramAccountRepository insAccRepo = new InstagramAccountRepository(); InstagramAccount instagramAccount = insAccRepo.getInstagramAccountDetailsById(profileid, user.Id); insManager.getIntagramImages(instagramAccount); } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } else if (Request.QueryString["op"] == "UnfollowTumblrBlog") { try { string blogname = Request.QueryString["blogname"].ToString(); string profileid = Request.QueryString["profileid"]; string accesstoken = Request.QueryString["accesstoken"]; string accesstokensecret = Request.QueryString["accesstokensecret"]; Guid id = Guid.Parse(Request.QueryString["id"]); try { string msg = "success"; BlogsFollowers objunfollowblog = new BlogsFollowers(); objunfollowblog.Unfollowblog(accesstoken, accesstokensecret, blogname); int result = objTumblrFeedRepository.DeleteTumblrDataByProfileid(profileid, blogname); Response.Write(msg); } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } else if (Request.QueryString["op"] == "tumblrTextPost") { try { string ProfileId = Request.QueryString["profileid"].ToString(); string body = Request.QueryString["msg"].ToString(); string title = Request.QueryString["title"].ToString(); TumblrAccount objTumblrAccount = tumblraccrepo.getTumblrAccountDetailsById(ProfileId); PublishedPosts objPublishedPosts = new PublishedPosts(); objPublishedPosts.PostData(objTumblrAccount.tblrAccessToken, objTumblrAccount.tblrAccessTokenSecret, ProfileId, body, title, "text"); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (Request.QueryString["op"] == "tumblrQuotePost") { try { string ProfileId = Request.QueryString["profileid"].ToString(); string source = Request.QueryString["source"].ToString(); string quote = Request.QueryString["quote"].ToString(); TumblrAccount objTumblrAccount = tumblraccrepo.getTumblrAccountDetailsById(ProfileId); PublishedPosts objPublishedPosts = new PublishedPosts(); objPublishedPosts.PostData(objTumblrAccount.tblrAccessToken, objTumblrAccount.tblrAccessTokenSecret, ProfileId, source, quote, "quote"); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (Request.QueryString["op"] == "tumblrLinkPost") { try { string ProfileId = Request.QueryString["profileid"].ToString(); string linkurl = Request.QueryString["linkurl"].ToString(); string title = Request.QueryString["title"].ToString(); string description = Request.QueryString["description"].ToString(); TumblrAccount objTumblrAccount = tumblraccrepo.getTumblrAccountDetailsById(ProfileId); PublishedPosts objPublishedPosts = new PublishedPosts(); objPublishedPosts.PostdescriptionData(objTumblrAccount.tblrAccessToken, objTumblrAccount.tblrAccessTokenSecret, ProfileId, linkurl, title, description, "link"); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (Request.QueryString["op"] == "tumblrImagePost") { string caption = string.Empty; try { string ProfileId = Request.QueryString["profileid"].ToString(); try { caption = Request.QueryString["caption"].ToString(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } var fi = Request.Files["file"]; string file = string.Empty; if (fi != null) { var path = Server.MapPath("~/Contents/img/upload"); file = path + "/" + fi.FileName; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } fi.SaveAs(file); } string filepath = file; TumblrAccount objTumblrAccount = tumblraccrepo.getTumblrAccountDetailsById(ProfileId); PublishedPosts objPublishedPosts = new PublishedPosts(); objPublishedPosts.PostData(objTumblrAccount.tblrAccessToken, objTumblrAccount.tblrAccessTokenSecret, ProfileId, caption, filepath, "photo"); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (Request.QueryString["op"] == "tumblrAudioPost") { string caption = string.Empty; try { string ProfileId = Request.QueryString["profileid"].ToString(); var fi = Request.Files["file"]; string file = string.Empty; if (fi != null) { var path = Server.MapPath("~/Contents/img/upload"); file = path + "/" + fi.FileName; //if (!Directory.Exists(path)) //{ // Directory.CreateDirectory(path); //} //fi.SaveAs(file); } string filepath = file; TumblrAccount objTumblrAccount = tumblraccrepo.getTumblrAccountDetailsById(ProfileId); PublishedPosts objPublishedPosts = new PublishedPosts(); objPublishedPosts.PostAudioData(objTumblrAccount.tblrAccessToken, objTumblrAccount.tblrAccessTokenSecret, ProfileId, filepath, "audio"); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (Request.QueryString["op"] == "tumblrVideoPost") { string caption = string.Empty; try { string ProfileId = Request.QueryString["profileid"].ToString(); string VideoUrl = Request.QueryString["VideoUrl"].ToString(); string VideoContent = Request.QueryString["VideoContent"].ToString(); var fi = Request.Files["file"]; string file = string.Empty; if (fi != null) { var path = Server.MapPath("~/Contents/img/upload"); file = path + "/" + fi.FileName; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } fi.SaveAs(file); } string filepath = file; TumblrAccount objTumblrAccount = tumblraccrepo.getTumblrAccountDetailsById(ProfileId); PublishedPosts objPublishedPosts = new PublishedPosts(); objPublishedPosts.PostdescriptionData(objTumblrAccount.tblrAccessToken, objTumblrAccount.tblrAccessTokenSecret, ProfileId, filepath, VideoUrl, VideoContent, "video"); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (Request.QueryString["op"] == "tumblrChatPost") { try { string ProfileId = Request.QueryString["profileid"].ToString(); string body = Request.QueryString["body"].ToString(); string title = Request.QueryString["title"].ToString(); string tag = Request.QueryString["tag"].ToString(); TumblrAccount objTumblrAccount = tumblraccrepo.getTumblrAccountDetailsById(ProfileId); PublishedPosts objPublishedPosts = new PublishedPosts(); objPublishedPosts.PostdescriptionData(objTumblrAccount.tblrAccessToken, objTumblrAccount.tblrAccessTokenSecret, ProfileId, body, title, tag, "chat"); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (Request.QueryString["op"] == "LikeUnlikeTumblrImage") { int likestatus = Convert.ToInt16(Request.QueryString["likes"]); string profileid = Request.QueryString["profileid"]; string accesstoken = Request.QueryString["accesstoken"]; string accesstokensecret = Request.QueryString["accesstokensecret"]; Guid id = Guid.Parse(Request.QueryString["id"]); int notes = Convert.ToInt16(Request.QueryString["notes"]); try { int like = 0; if (likestatus == 0) { like = 1; } int i = objTumblrFeedRepository.UpdateDashboardOfProfileLikes(profileid, id, like); int s = objTumblrFeedRepository.UpdateDashboardOfProfileNotes(profileid, id, like, notes); TumblrFeed obj = objTumblrFeedRepository.getFeedOfProfilebyIdProfileId(profileid, id); BlogsLikes objBlogsLikes = new BlogsLikes(); objBlogsLikes.likeBlog(accesstoken, accesstokensecret, obj.blogId, obj.reblogkey, like); //KeyValuePair<string, string> LoginDetails = new KeyValuePair<string, string>(accesstoken, accesstokensecret); //var prms = new Dictionary<string, object>(); //prms.Add("id", obj.blogId); //prms.Add("reblog_key", obj.reblogkey); //var postUrl = ""; //if (like == 1) //{ // postUrl = "https://api.tumblr.com/v2/user/like/"; //} //else //{ // postUrl = "https://api.tumblr.com/v2/user/unlike/"; //} //string result = oAuthTumbler.OAuthData(postUrl, "POST", LoginDetails.Key, LoginDetails.Value, prms); //string result1 = string.Empty; //result1 = result; } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } } }
public string ADDScheduledMessage(string typeandid, string ShareMessage, DateTime ClientTime, DateTime ScheduleTime, bool Status, string UserId, string PicUrl, DateTime CreateTime) { try { Guid userid = Guid.Parse(UserId); List<string> type = new List<string>(); List<string> profileid = new List<string>(); string[] TypeandId = typeandid.Split(','); for (int i = 0; i < TypeandId.Length; i = i + 2) { type.Add(TypeandId[i]); profileid.Add(TypeandId[i + 1]); } ScheduledMessageRepository objScheduledMessageRepository = new ScheduledMessageRepository(); ScheduledMessage objScheduledMessage = new ScheduledMessage(); try { for (int i = 0; i < type.Count; i++) { objScheduledMessage.Id = Guid.NewGuid(); objScheduledMessage.ShareMessage = ShareMessage; objScheduledMessage.ClientTime = ClientTime; objScheduledMessage.ScheduleTime = ScheduleTime; objScheduledMessage.CreateTime = CreateTime; objScheduledMessage.Status = Status; objScheduledMessage.UserId = userid; objScheduledMessage.ProfileType = type[i]; objScheduledMessage.PicUrl = PicUrl; objScheduledMessage.ProfileId = profileid[i]; objScheduledMessageRepository.addNewMessage(objScheduledMessage); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } ScheduledMessage objScheduledMessages = new ScheduledMessage(); return new JavaScriptSerializer().Serialize(typeandid); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return new JavaScriptSerializer().Serialize("Please try Again"); } }
void ProcessRequest() { SocioBoard.Domain.Team team = (SocioBoard.Domain.Team)Session["GroupName"]; TeamMemberProfileRepository objTeamMemberProfileRepository = new TeamMemberProfileRepository(); TwitterAccountRepository twtaccountrepo = new TwitterAccountRepository(); FacebookAccountRepository facerepo = new FacebookAccountRepository(); LinkedInAccountRepository linkrepo = new LinkedInAccountRepository(); clsFeedsAndMessages clsfeedsandmess = new clsFeedsAndMessages(); try { User user = (User)Session["LoggedUser"]; if (Request.QueryString["op"] != null) { //if (Request.QueryString["op"] == "bindMessages") //{ // DataSet ds = null; // //if (Session["MessageDataTable"] == null) // //{ // clsFeedsAndMessages clsfeedsandmess = new clsFeedsAndMessages(); // ds = clsfeedsandmess.bindMessagesIntoDataTable(team.Id); // FacebookFeedRepository fbFeedRepo = new FacebookFeedRepository(); // Session["MessageDataTable"] = ds; // //} // //else // //{ // ds = (DataSet)Session["MessageDataTable"]; // // } // string message = this.BindData(ds.Tables[0]); // if (string.IsNullOrEmpty(message)) // { // message = "Sorry no data !"; // } // Response.Write(message); //} string[] profid = null; if (Request.QueryString["op"] == "bindMessages") { try { string message = string.Empty; try { profid = Request.QueryString["profileid[]"].Split(','); if (Request.QueryString["type"] != null) { Session["countMesageDataTable_" + profid] = null; } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } string facebook = string.Empty; foreach (var item in profid) { if (string.IsNullOrEmpty(item)) { facebook = "emptyprofile"; } else { facebook = "profile"; } } if (facebook == "emptyprofile") { try { DataSet ds = null; Session["countMesageDataTable_" + profid] = null; ds = clsfeedsandmess.bindMessagesIntoDataTable(team.Id); FacebookFeedRepository fbFeedRepo = new FacebookFeedRepository(); Session["MessageDataTable"] = ds; ds = (DataSet)Session["MessageDataTable"]; if (Session["countMessageDataTable"] == null) { Session["countMessageDataTable"] = 0; } int noOfDataToSkip = (int)Session["countMessageDataTable"]; DataTable records = ds.Tables[0].Rows.Cast<System.Data.DataRow>().Skip(noOfDataToSkip).Take(noOfDataToSkip + 15).CopyToDataTable(); Session["countMessageDataTable"] = noOfDataToSkip + 15; message = this.BindData(records);//this.BindData(ds.Tables[0]); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else { try { DataSet ds = null; Session["countMessageDataTable"] = null; ds = clsfeedsandmess.bindFeedMessageIntoDataTable(profid); Session["MessageDataTable"] = ds; ds = (DataSet)Session["MessageDataTable"]; if (Session["countMesageDataTable_" + profid] == null) { Session["countMesageDataTable_" + profid] = 0; } int noOfDataToSkip = (int)Session["countMesageDataTable_" + profid]; DataTable records = ds.Tables[0].Rows.Cast<System.Data.DataRow>().Skip(noOfDataToSkip).Take(noOfDataToSkip + 15).CopyToDataTable(); Session["countMesageDataTable_" + profid] = noOfDataToSkip + 15; message = this.BindData(records); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } if (string.IsNullOrEmpty(message)) { } Response.Write(message); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (Request.QueryString["op"] == "inbox_messages") { DataSet ds = null; if (Session["InboxMessages"] == null) { clsFeedsAndMessages clsfeedsandmessages = new clsFeedsAndMessages(); ds = clsfeedsandmessages.bindSentMessagesToDataTable(user, ""); Session["InboxMessages"] = ds; } else { ds = (DataSet)Session["InboxMessages"]; } string message = this.BindData(ds.Tables[0]); Response.Write(message); } else if (Request.QueryString["op"] == "bindProfiles") { string profiles = string.Empty; int i = 0; // profiles += "<ul class=\"options_list\">"; profiles += "<ul >"; /*Binding facebook profiles in Accordian*/ List<TeamMemberProfile> alstprofiles = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(team.Id); foreach (TeamMemberProfile item in alstprofiles) { if (item.ProfileType == "facebook") { FacebookAccount alstfacebookprofiles = facerepo.getUserDetails(item.ProfileId); try { // profiles += "<ul><li><a id=\"checkimg_" + i + "\" href=\"#\" onclick=\"checkprofile('checkimg_" + i + "','" + alstfacebookprofiles.FbUserId + "','message','facebook');\"><img src=\"../Contents/img/admin/fbicon.png\" width=\"15\" height=\"15\" alt=\"\" >" + alstfacebookprofiles.FbUserName + "</a></li>"; profiles += "<li class=\"messagetype\"><a href=\"#\"><img src=\"../Contents/img/admin/fbicon.png\" width=\"15\" height=\"15\" alt=\"\"/>" + alstfacebookprofiles.FbUserName + "</a>" + "<img onclick=\"chkProfilemessage(this.id);\" id=\"fb_" + alstfacebookprofiles.FbUserId + "\" src=\"../Contents/img/uncheck_click.png\" alt=\"\" /></li>"; i++; } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } else if (item.ProfileType == "twitter") { TwitterAccount alsttwt = twtaccountrepo.getUserInformation(item.ProfileId); try { //profiles += "<ul><li><a href=\"#\" id=\"checkimg_" + i + "\" onclick=\"checkprofile('checkimg_" + i + "','" + alsttwt.TwitterUserId + "','message','twitter');\"><img src=\"../Contents/img/admin/twittericon.png\" width=\"15\" height=\"15\" alt=\"\" >" + alsttwt.TwitterScreenName + "</a></li>"; profiles += "<li class=\"messagetype\"><a href=\"#\"><img src=\"../Contents/img/admin/twittericon.png\" width=\"15\" height=\"15\" alt=\"\"/>" + alsttwt.TwitterScreenName + "</a>" + "<img onclick=\"chkProfilemessage(this.id);\" id=\"twt_" + alsttwt.TwitterUserId + "\" src=\"../Contents/img/uncheck_click.png\" alt=\"\" /></li>"; i++; } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } else if (item.ProfileType == "google") { GooglePlusAccountRepository gpAccRepo = new GooglePlusAccountRepository(); GooglePlusAccount alstgp = gpAccRepo.getUserDetails(item.ProfileId); try { profiles += "<ul><li><a href=\"#\" id=\"checkimg_" + i + "\" onclick=\"checkprofile('checkimg_" + i + "','" + alstgp.GpUserId + "','message','googleplus');\"><img src=\"../Contents/img/google_plus.png\" width=\"15\" height=\"15\" alt=\"\" >" + alstgp.GpUserName + "</a></li>"; i++; } catch (Exception esx) { logger.Error(esx.Message); Console.WriteLine(esx.Message); } } } profiles += "</ul><input type=\"hidden\" id=\"profilecounter\" value=\"" + i + "\">"; Response.Write(profiles); } else if (Request.QueryString["op"] == "changeTaskStatus") { Guid taskid = Guid.Parse(Request.QueryString["taskid"]); bool status = bool.Parse(Request.QueryString["status"]); if (status == true) status = false; else status = true; TaskRepository objTaskRepo = new TaskRepository(); objTaskRepo.updateTaskStatus(taskid, user.Id, status); } else if (Request.QueryString["op"] == "savetask") { string descritption = Request.QueryString["description"]; //string time = Request.QueryString["now"]; Guid idtoassign = Guid.Empty; try { if (Request.QueryString["memberid"] != string.Empty) { idtoassign = Guid.Parse(Request.QueryString["memberid"]); } } catch (Exception ex) { logger.Error(ex.Message); // idtoassign = 0; } Tasks objTask = new Tasks(); TaskRepository objTaskRepo = new TaskRepository(); objTask.AssignDate = Request.QueryString["now"]; //DateTime.Now.ToString("yyyy-MM-dd H:mm:ss").ToString(); objTask.GroupId = team.GroupId; objTask.AssignTaskTo = idtoassign; objTask.TaskStatus = false; objTask.TaskMessage = descritption; objTask.UserId = user.Id; Guid taskid = Guid.NewGuid(); objTask.Id = taskid; objTaskRepo.addTask(objTask); string comment = Request.QueryString["comment"]; if (!string.IsNullOrEmpty(comment)) { string curdate = Request.QueryString["now"]; //DateTime.Now.ToString("yyyy-MM-dd H:mm:ss").ToString(); TaskComment objcmt = new TaskComment(); TaskCommentRepository objcmtRepo = new TaskCommentRepository(); objcmt.Comment = comment; objcmt.CommentDate = DateTime.Now; objcmt.EntryDate = DateTime.Now; objcmt.Id = Guid.NewGuid(); objcmt.TaskId = objTask.Id; objcmt.UserId = user.Id; objcmtRepo.addTaskComment(objcmt); } } else if (Request.QueryString["op"] == "bindteam") { TeamRepository objTeam = new TeamRepository(); string message = string.Empty; message += "<ul>"; //IEnumerable<dynamic> result = objTeam.getAllTeamsOfUser(user.Id,team.GroupId); //IEnumerable<dynamic> result = objTeam.getAllTeamsOfUser(user.Id, team.GroupId); BusinessSettingRepository objBsnsSettingRepo = new BusinessSettingRepository(); BusinessSetting objbsns = objBsnsSettingRepo.IsNotificationTaskEnable(team.GroupId); if (objbsns.AssigningTasks == true || team.UserId == user.Id) { IEnumerable<dynamic> result = objTeam.getAllTeamsOfUser(user.Id, team.GroupId, user.EmailId); foreach (Team item in result) { try { //===========================new code added========================= UserRepository objUserRepository = new UserRepository(); User objdetails = objUserRepository.getUserInfoByEmail(item.EmailId); if (objdetails != null) { message += "<li><a>"; if (objdetails.ProfileUrl == null) { message += "<img src=\"../Contents/img/blank_img.png\" alt=\"\" />"; } else { message += "<img src=\"" + objdetails.ProfileUrl + "\" alt=\"\" />"; } message += "<span class=\"name\">" + objdetails.UserName + "</span>" + " <span>" + "<input id=\"customerid_" + objdetails.Id + "\" type=\"radio\" name=\"team_members\" value=\"customerid_" + objdetails.Id + "\">" + "</span>" + "</a></li>"; //message += "<li><a>"; } } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } } // message += "<li><a>"; if (string.IsNullOrEmpty(user.ProfileUrl)) { message += "<li><a>"; message += "<img src=\"../Contents/img/blank_img.png\" alt=\"\" />"; } else { message += "<img src=\"" + user.ProfileUrl + "\" alt=\"\" />"; } message += "<span class=\"name\">" + user.UserName + "</span>" + " <span>" + "<input id=\"customerid_" + user.Id + "\" type=\"radio\" name=\"team_members\" value=\"customerid_" + user.Id + "\">" + "</span></a></li>"; } else { message += "<li><a>"; if (string.IsNullOrEmpty(user.ProfileUrl)) { message += "<img src=\"../Contents/img/blank_img.png\" alt=\"\" />"; } else { message += "<img src=\"" + user.ProfileUrl + "\" alt=\"\" />"; } message += "<span class=\"name\">" + user.UserName + "</span>" + " <span>" + "<input id=\"customerid_" + user.Id + "\" type=\"radio\" name=\"team_members\" value=\"customerid_" + user.Id + "\">" + "</span>" + "</a></li>"; } message += "</ul>"; Response.Write(message); } else if (Request.QueryString["op"] == "sentmsg") { ScheduledMessageRepository objScheduledMessageRepository = new ScheduledMessageRepository(); string message = string.Empty; // message += "<ul id=\"message-list\">"; try { List<TeamMemberProfile> alstprofiles = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(team.Id); foreach (TeamMemberProfile items in alstprofiles) { List<ScheduledMessage> result = objScheduledMessageRepository.getAllSentMessagesOfUser(items.ProfileId); int sorteddatacount = 0; if (result != null && result.Count > 0) { foreach (ScheduledMessage item in result) { try { //message += "<ul id=\"message-list\">"; //message += "<li>"; sorteddatacount++; if (item.ProfileType == "twitter") { message += "<ul id=\"message-list\">"; message += "<li>"; TwitterAccountRepository objTwitterAccountRepository = new TwitterAccountRepository(); TwitterAccount objTwitterAccount = objTwitterAccountRepository.getUserInformation(item.ProfileId); if (string.IsNullOrEmpty(item.PicUrl)) { message += "<div id=\"messagetaskable_" + sorteddatacount + "\" class=\"userpictiny\"><div style=\"width:60px;height:60px;float:left\"><img href=\"http://twitter.com/" + objTwitterAccount.TwitterScreenName + "\" target=\"_blank\" id=\"formprofileurl_" + sorteddatacount + "\" src=\"" + objTwitterAccount.ProfileImageUrl + "\" height=\"48\" width=\"48\" alt=\"\" title=\"\" />" + "<a href=\"http://twitter.com/" + objTwitterAccount.TwitterScreenName + "\" target=\"_blank\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/twticon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div>" + "</div><div id=\"messagedescription_" + sorteddatacount + "\" class=\"message-list-content\"><div id=\"msgdescription_" + sorteddatacount + "\" style=\"width:500px;height:auto;float:left\"><p>" + item.ShareMessage + "</p>" + "<div class=\"message-list-info\"><span><a href=\"http://twitter.com/" + objTwitterAccount.TwitterScreenName + "\" target=\"_blank\" id=\"rowname_" + sorteddatacount + "\" >" + objTwitterAccount.TwitterScreenName + "</a> " + item.CreateTime + "</span>" + "<div class=\"scl\">" + //"<a id=\"createtasktwt_" + sorteddatacount + "\" href=\"#\" onclick=\"createtask(this.id);\"><img title=\"Task\" src=\"../Contents/img/pin.png\" alt=\"\" width=\"14\" height=\"17\" border=\"none\"></a><a href=\"#\"><img title=\"Comment\" src=\"../Contents/img/admin/goto.png\" width=\"12\" height=\"12\" alt=\"\"/></a></div></div></div></div></li>"; "</div></div></div></div></li>"; } else if(!string.IsNullOrEmpty(item.PicUrl)) { string src = item.PicUrl; message += "<div id=\"messagetaskable_" + sorteddatacount + "\" class=\"userpictiny\"><div style=\"width:60px;height:60px;float:left\"><img href=\"http://twitter.com/" + objTwitterAccount.TwitterScreenName + "\" target=\"_blank\" id=\"formprofileurl_" + sorteddatacount + "\" src=\"" + objTwitterAccount.ProfileImageUrl + "\" height=\"48\" width=\"48\" alt=\"\" title=\"\" />" + "<a href=\"http://twitter.com/" + objTwitterAccount.TwitterScreenName + "\" target=\"_blank\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/twticon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div>" + "</div><div id=\"messagedescription_" + sorteddatacount + "\" class=\"message-list-content\"><div id=\"msgdescription_" + sorteddatacount + "\" style=\"width:500px;height:auto;float:left\"><p><img style=\"margin-right:10px;margin-top:10px\" width=\"80px;\" hight=\"80px;\" src=\"" + src + "\">" + item.ShareMessage + "</p>" + "<div class=\"message-list-info\"><span><a href=\"http://twitter.com/" + objTwitterAccount.TwitterScreenName + "\" target=\"_blank\" id=\"rowname_" + sorteddatacount + "\" >" + objTwitterAccount.TwitterScreenName + "</a> " + item.CreateTime + "</span>" + "<div class=\"scl\">" + "</div></div></div></div></li>"; } message += "</ul>"; } else if (item.ProfileType == "facebook") { message += "<ul id=\"message-list\">"; message += "<li>"; FacebookAccountRepository objFacebookAccountRepository = new FacebookAccountRepository(); FacebookAccount objFacebookAccount = objFacebookAccountRepository.getFacebookAccountDetailsById(item.ProfileId); if (objFacebookAccount != null) { if (string.IsNullOrEmpty(item.PicUrl)) { message += "<div id=\"messagetaskable_" + sorteddatacount + "\" class=\"userpictiny\"><div style=\"width:60px;height:60px;float:left\"><img href=\"http://www.facebook.com/" + objFacebookAccount.FbUserId + "\" target=\"_blank\" id=\"formprofileurl_" + sorteddatacount + "\" src=\"http://graph.facebook.com/" + objFacebookAccount.FbUserId + "/picture?type=small\" height=\"48\" width=\"48\" alt=\"\" title=\"\" />" + "<a href=\"http://www.facebook.com/" + objFacebookAccount.FbUserId + "\" target=\"_blank\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/fb_icon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div>" + "</div><div id=\"messagedescription_" + sorteddatacount + "\" class=\"message-list-content\"><div id=\"msgdescription_" + sorteddatacount + "\" style=\"width:500px;height:auto;float:left\"><p>" + item.ShareMessage + "</p>" + "<div class=\"message-list-info\"><span><a href=\"http://www.facebook.com/" + objFacebookAccount.FbUserId + "\" target=\"_blank\" id=\"rowname_" + sorteddatacount + "\" >" + objFacebookAccount.FbUserName + "</a> " + item.CreateTime + "</span>" + "<div class=\"scl\">" + //"<a id=\"createtasktwt_" + sorteddatacount + "\" href=\"#\" onclick=\"createtask(this.id);\"><img title=\"Task\" src=\"../Contents/img/pin.png\" alt=\"\" width=\"14\" height=\"17\" border=\"none\"></a><a href=\"#\"><img title=\"Comment\" src=\"../Contents/img/admin/goto.png\" width=\"12\" height=\"12\" alt=\"\"/></a></div></div></div></div></li>"; "</div></div></div></div></li>"; } else if (!string.IsNullOrEmpty(item.PicUrl)) { string src = item.PicUrl; message += "<div id=\"messagetaskable_" + sorteddatacount + "\" class=\"userpictiny\"><div style=\"width:60px;height:60px;float:left\"><img href=\"http://www.facebook.com/" + objFacebookAccount.FbUserId + "\" target=\"_blank\" id=\"formprofileurl_" + sorteddatacount + "\" src=\"http://graph.facebook.com/" + objFacebookAccount.FbUserId + "/picture?type=small\" height=\"48\" width=\"48\" alt=\"\" title=\"\" />" + "<a href=\"http://www.facebook.com/" + objFacebookAccount.FbUserId + "\" target=\"_blank\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/fb_icon.png\" width=\"16\" height=\"16\" alt=\"\"></a></div>" + "</div><div id=\"messagedescription_" + sorteddatacount + "\" class=\"message-list-content\"><div id=\"msgdescription_" + sorteddatacount + "\" style=\"width:500px;height:auto;float:left\"><p><img style=\"margin-right:10px;margin-top:10px\" width=\"80px;\" hight=\"80px;\" src=\"" + src + "\">" + item.ShareMessage + "</p>" + "<div class=\"message-list-info\"><span><a href=\"http://www.facebook.com/" + objFacebookAccount.FbUserId + "\" target=\"_blank\" id=\"rowname_" + sorteddatacount + "\" >" + objFacebookAccount.FbUserName + "</a> " + item.CreateTime + "</span>" + "<div class=\"scl\">" + "</div></div></div></div></li>"; } message += "</ul>"; } } else if (item.ProfileType == "linkedin") { message += "<ul id=\"message-list\">"; message += "<li>"; LinkedInAccountRepository objLinkedInAccountRepository = new LinkedInAccountRepository(); LinkedInAccount objLinkedInAccount = objLinkedInAccountRepository.getLinkedinAccountDetailsById(item.ProfileId); if (objLinkedInAccount != null) { if (string.IsNullOrEmpty(item.PicUrl)) { message += "<div id=\"messagetaskable_" + sorteddatacount + "\" class=\"userpictiny\"><div style=\"width:60px;height:60px;float:left\"><img id=\"formprofileurl_" + sorteddatacount + "\" src=\"" + objLinkedInAccount.ProfileImageUrl + "\" height=\"48\" width=\"48\" alt=\"\" title=\"\" />" + "<span class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/link_icon.png\" width=\"16\" height=\"16\" alt=\"\" ></span></div>" + "</div><div id=\"messagedescription_" + sorteddatacount + "\" class=\"message-list-content\"><div id=\"msgdescription_" + sorteddatacount + "\" style=\"width:500px;height:auto;float:left\"><p>" + item.ShareMessage + "</p>" + "<div class=\"message-list-info\"><span><a href=\"" + objLinkedInAccount.ProfileUrl + "\" target=\"_blank\" id=\"rowname_" + sorteddatacount + "\" >" + objLinkedInAccount.LinkedinUserName + "</a> " + item.CreateTime + "</span>" + "<div class=\"scl\">" + //"<a id=\"createtasktwt_" + sorteddatacount + "\" href=\"#\" onclick=\"createtask(this.id);\"><img title=\"Task\" src=\"../Contents/img/pin.png\" alt=\"\" width=\"14\" height=\"17\" border=\"none\"></a><a href=\"#\"><img title=\"Comment\" src=\"../Contents/img/admin/goto.png\" width=\"12\" height=\"12\" alt=\"\"/></a></div></div></div></div></li>"; "</div></div></div></div></li>"; } else if (!string.IsNullOrEmpty(item.PicUrl)) { string src = item.PicUrl; message += "<div id=\"messagetaskable_" + sorteddatacount + "\" class=\"userpictiny\"><div style=\"width:60px;height:60px;float:left\"><img id=\"formprofileurl_" + sorteddatacount + "\" src=\"" + objLinkedInAccount.ProfileImageUrl + "\" height=\"48\" width=\"48\" alt=\"\" title=\"\" />" + "<span class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/link_icon.png\" width=\"16\" height=\"16\" alt=\"\" ></span></div>" + "</div><div id=\"messagedescription_" + sorteddatacount + "\" class=\"message-list-content\"><div id=\"msgdescription_" + sorteddatacount + "\" style=\"width:500px;height:auto;float:left\"><p><img style=\"margin-right:10px;margin-top:10px\" width=\"80px;\" hight=\"80px;\" src=\"" + src + "\">" + item.ShareMessage + "</p>" + "<div class=\"message-list-info\"><span><a href=\"" + objLinkedInAccount.ProfileUrl + "\" target=\"_blank\" id=\"rowname_" + sorteddatacount + "\" >" + objLinkedInAccount.LinkedinUserName + "</a> " + item.CreateTime + "</span>" + "<div class=\"scl\">" + "</div></div></div></div></li>"; } message += "</ul>"; } } } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } } // message += "</ul>"; } else { // message = "Sorry no data !"; } } } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } Response.Write(message); } else if (Request.QueryString["op"] == "bindarchive") { ArchiveMessageRepository objArchiveRepo = new ArchiveMessageRepository(); string message = string.Empty; try { List<TeamMemberProfile> alstprofiles = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(team.Id); foreach (TeamMemberProfile items in alstprofiles) { List<ArchiveMessage> result = objArchiveRepo.getAllArchiveMessage(items.ProfileId); int sorteddatacount = 0; if (result != null && result.Count > 0) { foreach (ArchiveMessage item in result) { try { message += "<ul id=\"message-list\">"; message += "<li>"; sorteddatacount++; if (item.SocialGroup == "twitter") { message += "<div id=\"messagetaskable_" + sorteddatacount + "\" class=\"userpictiny\"><div style=\"width:60px;height:60px;float:left\"><img id=\"formprofileurl_" + sorteddatacount + "\" onclick=\"detailsdiscoverytwitter(" + item.ProfileId + ");\" src=\"" + item.ImgUrl + "\" height=\"48\" width=\"48\" alt=\"\" title=\"\" />" + "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/twticon.png\" width=\"16\" height=\"16\" alt=\"\" onclick=\"detailsdiscoverytwitter(\"item.ProfileId\");\"></a></div>" + "</div><div id=\"messagedescription_" + sorteddatacount + "\" class=\"message-list-content\"><div id=\"msgdescription_" + sorteddatacount + "\" style=\"width:500px;height:auto;float:left\"><p>" + item.Message + "</p>" + "<div class=\"message-list-info\"><span><a href=\"#\" id=\"rowname_" + sorteddatacount + "\" onclick=\"detailsdiscoverytwitter(" + item.ProfileId + ");\">" + item.UserName + "</a> " + item.CreatedDateTime + "</span>" + "<div class=\"scl\">" + // "<a id=\"createtasktwt_" + sorteddatacount + "\" href=\"#\" onclick=\"createtask(this.id);\"><img title=\"Task\" src=\"../Contents/img/pin.png\" alt=\"\" width=\"14\" height=\"17\" border=\"none\"></a><a href=\"#\"><img title=\"Comment\" src=\"../Contents/img/admin/goto.png\" width=\"12\" height=\"12\" alt=\"\"/></a></div></div></div></div></li>"; "<a><img onclick=replyfunction(" + sorteddatacount + ",'twitter','" + item.MessageId + "','" + item.ProfileId + "') title=\"Comment\" src=\"../Contents/img/admin/goto.png\" width=\"12\" height=\"12\" alt=\"\"/></a></div></div></div></div></li>"; } else if (item.SocialGroup == "facebook") { message += "<div id=\"messagetaskable_" + sorteddatacount + "\" class=\"userpictiny\"><div style=\"width:60px;height:60px;float:left\"><img id=\"formprofileurl_" + sorteddatacount + "\" onclick=\"getFacebookProfiles(" + item.ProfileId + ");\" src=\"" + item.ImgUrl + "\" height=\"48\" width=\"48\" alt=\"\" title=\"\" />" + "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/fb_icon.png\" width=\"16\" height=\"16\" alt=\"\" onclick=\"getFacebookProfiles(\"item.ProfileId\");\"></a></div>" + "</div><div id=\"messagedescription_" + sorteddatacount + "\" class=\"message-list-content\"><div id=\"msgdescription_" + sorteddatacount + "\" style=\"width:500px;height:auto;float:left\"><p>" + item.Message + "</p>" + "<div class=\"message-list-info\"><span><a href=\"#\" id=\"rowname_" + sorteddatacount + "\" onclick=\"getFacebookProfiles(" + item.ProfileId + ");\">" + item.UserName + "</a> " + item.CreatedDateTime + "</span>" + "<div class=\"scl\">" + "<a><img onclick=replyfunction(" + sorteddatacount + ",'facebook','" + item.MessageId + "','" + item.ProfileId + "') title=\"Comment\" src=\"../Contents/img/admin/goto.png\" width=\"12\" height=\"12\" alt=\"\"/></a></div></div></div></div></li>"; //"<a id=\"createtasktwt_" + sorteddatacount + "\" href=\"#\" onclick=\"createtask(this.id);\"><img title=\"Task\" src=\"../Contents/img/pin.png\" alt=\"\" width=\"14\" height=\"17\" border=\"none\"></a><a href=\"#\"><img title=\"Comment\" src=\"../Contents/img/admin/goto.png\" width=\"12\" height=\"12\" alt=\"\"/></a></div></div></div></div></li>"; } else if (item.SocialGroup == "googleplus") { message += "<div id=\"messagetaskable_" + sorteddatacount + "\" class=\"userpictiny\"><div style=\"width:60px;height:60px;float:left\"><img id=\"formprofileurl_" + sorteddatacount + "\" onclick=\"detailsprofile(this.alt);\" src=\"" + item.ImgUrl + "\" height=\"48\" width=\"48\" alt=\"\" title=\"\" />" + "<a href=\"#\" class=\"userurlpic\" title=\"\"><img src=\"../Contents/img/google_plus.png\" width=\"16\" height=\"16\" alt=\"\" onclick=\"detailsprofile(this.alt);></a></div>" + "</div><div id=\"messagedescription_" + sorteddatacount + "\" class=\"message-list-content\"><div id=\"msgdescription_" + sorteddatacount + "\" style=\"width:500px;height:auto;float:left\"><p>" + item.Message + "</p>" + "<div class=\"message-list-info\"><span><a href=\"#\" id=\"rowname_" + sorteddatacount + "\" onclick=\"detailsprofile(" + item.ProfileId + ");\">" + item.ProfileId + "</a> " + item.CreatedDateTime + "</span>" + "<div class=\"scl\">" + "<a href=\"#\"><img title=\"Comment\" src=\"../Contents/img/admin/goto.png\" width=\"12\" height=\"12\" alt=\"\"/></a></div></div></div></div></li>"; //"<a id=\"createtasktwt_" + sorteddatacount + "\" href=\"#\" onclick=\"createtask(this.id);\"><img title=\"Task\" src=\"../Contents/img/pin.png\" alt=\"\" width=\"14\" height=\"17\" border=\"none\"></a></div></div></div></div></li>"; } message += "</li>"; message += "</ul>"; } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } } //message += "</ul>"; } else { // message = "Sorry no data !"; } } } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } Response.Write(message); } else if (Request.QueryString["op"] == "savearchivemsg") { User use = (User)Session["LoggedUser"]; ArchiveMessage am = new ArchiveMessage(); ArchiveMessageRepository objArchiveRepo = new ArchiveMessageRepository(); am.UserId = user.Id; am.ImgUrl = Request.QueryString["imgurl"]; //am.user_name = Request.QueryString["UserName"]; //am.msg = Request.QueryString["Msg"]; ////am.sociel_group = Request.QueryString["Network"]; //am.createdtime = Request.QueryString["CreatedTime"]; System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream); string line = ""; line = sr.ReadToEnd(); // JObject jo = JObject.Parse("[" + line + "]"); // am.UserName = Request.QueryString["UserName"];//Server.UrlDecode((string)jo["UserName"]); //am.Message = Request.QueryString["Msg"];//Server.UrlDecode((string)jo["Msg"]); JObject jo = JObject.Parse(line); am.Message = Server.UrlDecode((string)jo["Msg"]);//Server.UrlDecode((string)jo["Msg"]); am.SocialGroup = Request.QueryString["Network"];// Server.UrlDecode((string)jo["Network"]); am.CreatedDateTime = Convert.ToDateTime(Request.QueryString["CreatedTime"]); am.MessageId = Request.QueryString["MessageId"]; am.ProfileId = Request.QueryString["ProfileId"]; am.UserName = Request.QueryString["Username"]; am.UserId = use.Id; // Server.UrlDecode((string)jo["CreatedTime"]); if (am.UserName != string.Empty) { if (!objArchiveRepo.checkArchiveMessageExists(user.Id, am.MessageId)) { objArchiveRepo.AddArchiveMessage(am); Response.Write("Message Archive Successfully"); } else { Response.Write("Message Already in Archive"); } } } else if (Request.QueryString["op"] == "createfacebookcomments") { //FacebookAccountRepository facerepo = new FacebookAccountRepository(); string postid = Request.QueryString["replyid"]; string message = Request.QueryString["replytext"]; string userid = Request.QueryString["userid"]; FacebookAccount result = facerepo.getFacebookAccountDetailsById(userid, user.Id); FacebookClient fc = new FacebookClient(result.AccessToken); Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("message", message); JsonObject dyn = (JsonObject)fc.Post("/" + postid + "/comments", parameters); } else if (Request.QueryString["op"] == "getFacebookComments") { // FacebookAccountRepository facerepo = new FacebookAccountRepository(); string postid = Request.QueryString["postid"]; string userid = Request.QueryString["userid"]; FacebookAccount result = facerepo.getFacebookAccountDetailsById(userid, user.Id); FacebookClient fc = new FacebookClient(result.AccessToken); JsonObject dyn = (JsonObject)fc.Get("/" + postid + "/comments"); string mess = string.Empty; dynamic jc = dyn["data"]; int iii = 0; foreach (dynamic item in jc) { mess += "<div class=\"messages\"><section><aside><section class=\"js-avatar_tip\" data-sstip_class=\"twt_avatar_tip\">" + "<a class=\"avatar_link view_profile\">" + "<img width=\"54\" height=\"54\" border=\"0\" id=\"" + item["id"] + "\" class=\"avatar\" src=\"http://graph.facebook.com/" + item["from"]["id"] + "/picture?type=small\"><article class=\"message-type-icon\"></article>" + "</a></section><ul></ul></aside><article><div class=\"\"><a class=\"language\" href=\"\"></a></div>" + "<div class=\"message_actions\"><a class=\"gear_small\" href=\"#\"><span title=\"Options\" class=\"ficon\">?</span></a></div><div id=\"messagedescription_" + iii + "\" class=\"message-text font-14\">" + item["message"] + "</div><section class=\"bubble-meta\"><article class=\"threefourth text-overflow\"><section class=\"floatleft\"><a class=\"js-avatar_tip view_profile profile_link\" data-sstip_class=\"twt_avatar_tip\"><span id=\"rowname_" + iii + "\">" + item["from"]["name"] + "</span></a> <a data-msg-time=\"1363926699000\" class=\"time\" target=\"_blank\" title=\"View message on Twitter\">" + item["created_time"] + "</a><span class=\"location\"> </span></section></article><ul class=\"message-buttons quarter clearfix\"></ul></section></article></section></div>"; } Response.Write(mess); } else if (Request.QueryString["op"] == "twittercomments") { Tweet objTwitterMethod = new Tweet(); TwitterAccountRepository objTwtAccRepo = new TwitterAccountRepository(); try { string messid = Request.QueryString["messid"]; string replytext = Request.QueryString["replytext"]; string replyid = Request.QueryString["replyid"]; string userid = Request.QueryString["userid"]; string username = Request.QueryString["username"]; string rowid = Request.QueryString["rowid"]; TwitterAccount objTwtAcc = objTwtAccRepo.getUserInformation(user.Id, userid); TwitterHelper twthelper = new TwitterHelper(); oAuthTwitter OAuthTwt = new oAuthTwitter(); OAuthTwt.AccessToken = objTwtAcc.OAuthToken; OAuthTwt.AccessTokenSecret = objTwtAcc.OAuthSecret; OAuthTwt.TwitterScreenName = objTwtAcc.TwitterScreenName; twthelper.SetCofigDetailsForTwitter(OAuthTwt); Tweet twt = new Tweet(); JArray post = twt.Post_Statuses_Update(OAuthTwt, replytext); } catch (Exception ex) { logger.Error(ex.Message); } } else if (Request.QueryString["op"] == "gpProfile") { GooglePlusAccountRepository objgpAccRepo = new GooglePlusAccountRepository(); GooglePlusAccount objGpAcc = objgpAccRepo.getGooglePlusAccountDetailsById(Request.QueryString["gpid"].ToString(), user.Id); PeopleController obj = new PeopleController(); oAuthToken objgpToken = new oAuthToken(); JArray objProfile = null; try { string strAccess = objgpToken.GetAccessToken(objGpAcc.RefreshToken); if (!strAccess.StartsWith("[")) strAccess = "[" + strAccess + "]"; JArray objArray = JArray.Parse(strAccess); foreach (var itemgp in objArray) { objGpAcc.AccessToken = itemgp["access_token"].ToString(); } objProfile = obj.GetPeopleProfile(Request.QueryString["gpid"].ToString(), objGpAcc.AccessToken); } catch (Exception Err) { logger.Error(Err.Message); Console.Write(Err.Message.ToString()); } string jas = string.Empty; foreach (var item in objProfile) { jas += "<div class=\"modal-small draggable\">"; jas += "<div class=\"modal-content\">"; jas += "<button type=\"button\" class=\"modal-btn button b-close\">"; jas += "<span class=\"icon close-medium\"><span class=\"visuallyhidden\">X</span></span></button>"; jas += "<div class=\"modal-header\"><h3 class=\"modal-title\">Profile summary</h3></div>"; jas += "<div class=\"modal-body profile-modal\">"; jas += "<div class=\"module profile-card component profile-header\">"; jas += "<div style=\"background-image: url('https://pbs.twimg.com/profile_banners/215936249/1371721359');\" class=\"profile-header-inner flex-module clearfix\">"; jas += "<div class=\"profile-header-inner-overlay\"></div>"; jas += "<a href=\"#\" class=\"profile-picture media-thumbnail js-nav\">"; string[] imgurl = item["image"]["url"].ToString().Split('?'); jas += "<img src=\"" + imgurl[0] + " alt=\"" + item["name"]["givenName"] + "\" class=\"avatar size73\"></a>"; jas += "<div class=\"profile-card-inner\">"; jas += "<h1 class=\"fullname editable-group\">"; jas += "<a class=\"js-nav\" href=\"#\">" + item["name"]["givenName"] + "</a>"; jas += "<a href=\"#\" class=\"verified-link js-tooltip\">"; jas += "<span class=\"icon verified verified-large-border\">"; jas += "<span class=\"visuallyhidden\"></span></span></a></h1>"; jas += "<h2 class=\"username\">"; jas += "<a class=\"pretty-link js-nav\" href=\"#\">"; jas += "<span class=\"screen-name\"><s></s>" + item["displayName"] + "</span></a></h2>"; jas += "<div class=\"bio-container editable-group\"><p class=\"bio profile-field\"></p></div>"; jas += "<p class=\"location-and-url\">"; jas += "<span class=\"location-container editable-group\">"; jas += "<span class=\"location profile-field\"></span></span>"; jas += "<span class=\"divider hidden\"></span> "; jas += "<span class=\"url editable-group\"> "; jas += "<span class=\"profile-field\">"; jas += "<a target=\"_blank\" rel=\"me nofollow\" href=\"" + item["url"] + "\" title=\"#\">" + item["url"] + " </a></span></span></p>"; jas += "<div style=\"cursor: pointer; width: 16px; height: 16px; display: inline-block;\"> </div><p></p></div></div>"; jas += "<div class=\"clearfix\"><div class=\"default-footer\">"; jas += "<div class=\"btn-group\"><div class=\"follow_button\"></div></div></div></div>"; jas += "<div class=\"profile-social-proof\">"; jas += "<div class=\"follow-bar\"></div></div></div>"; jas += "<ol class=\"recent-tweets\"><li class=\"\"><div><i class=\"dogear\"></i></div></li></ol>"; jas += "<div class=\"go_to_profile\">"; jas += "<small><a class=\"view_profile\" target=\"_blank\" href=\"" + item["url"] + "\">Go to full profile →</a></small></div></div>"; jas += "<div class=\"loading\"><span class=\"spinner-bigger\"></span></div></div></div>"; } Response.Write(jas); } //else if (Request.QueryString["op"] == "updatedstatus") //{ // try // { // TwitterMessageRepository twtmsgRepo = new TwitterMessageRepository(); // int i = twtmsgRepo.updateMessageStatus(user.Id); // FacebookFeedRepository fbfeedRepo = new FacebookFeedRepository(); // int j = fbfeedRepo.updateMessageStatus(user.Id); // if (i > 0 || j > 0) // { // Session["CountMessages"] = 0; // Session["MessageDataTable"] = null; // DataSet ds = null; // if (Session["MessageDataTable"] == null) // { // clsFeedsAndMessages clsfeedsandmess = new clsFeedsAndMessages(); // ds = clsfeedsandmess.bindMessagesIntoDataTable(user); // FacebookFeedRepository fbFeedRepo = new FacebookFeedRepository(); // Session["MessageDataTable"] = ds; // } // else // { // ds = (DataSet)Session["MessageDataTable"]; // } // } // } // catch (Exception ex) // { // logger.Error(ex.Message); // Console.WriteLine(ex.Message); // } //} else if (Request.QueryString["op"] == "updatedstatus") { try { int i = 0; int j=0; List<TeamMemberProfile> alstprofiles = objTeamMemberProfileRepository.getAllTeamMemberProfilesOfTeam(team.Id); foreach (TeamMemberProfile item in alstprofiles) { if (item.ProfileType == "twitter") { TwitterMessageRepository twtmsgRepo = new TwitterMessageRepository(); i = twtmsgRepo.updateMessageStatus(item.ProfileId); } else if (item.ProfileType == "facebook") { FacebookFeedRepository fbfeedRepo = new FacebookFeedRepository(); j = fbfeedRepo.updateMessageStatus(item.ProfileId); } } if (i > 0 || j > 0) { Session["CountMessages"] = 0; Session["MessageDataTable"] = null; DataSet ds = null; if (Session["MessageDataTable"] == null) { //clsFeedsAndMessages clsfeedsandmess = new clsFeedsAndMessages(); ds = clsfeedsandmess.bindMessagesIntoDataTable(team.Id); FacebookFeedRepository fbFeedRepo = new FacebookFeedRepository(); Session["MessageDataTable"] = ds; } else { ds = (DataSet)Session["MessageDataTable"]; } } } catch (Exception ex) { logger.Error(ex.Message); Console.WriteLine(ex.Message); } } } } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } }
protected void Page_Load(object sender, EventArgs e) { try { System.IO.StreamReader sr; Newtonsoft.Json.Linq.JObject jo; try { if (Request.QueryString["op"].ToString() == "postFBGroupFeeds") { sr = new System.IO.StreamReader(Request.InputStream); string data = ""; data = sr.ReadToEnd(); jo = Newtonsoft.Json.Linq.JObject.Parse(data); gid = Server.UrlDecode((string)jo["gid"]); ack = Server.UrlDecode((string)jo["ack"]); string msg = Server.UrlDecode((string)jo["msg"]); string res = PostFBGroupFeeds(ack, gid, msg); Response.Write(res); return; } else if (Request.QueryString["op"].ToString() == "postonselectedgroup") { try { logger.Error("cod is here"); SocioBoard.Domain.User user = (SocioBoard.Domain.User)Session["LoggedUser"]; ScheduledMessageRepository objScheduledMessageRepository = new ScheduledMessageRepository(); GroupScheduleMessageRepository objGroupScheduleMEssageRepository = new GroupScheduleMessageRepository(); ScheduledMessage schmessage = new ScheduledMessage(); GroupScheduleMessage grpschmessage = new GroupScheduleMessage(); string msg = string.Empty; string title = string.Empty; string intrval = string.Empty; string fbuserid = string.Empty; string linuserid = string.Empty; string clienttime = string.Empty; var SelectedGroupId = Request.Form["gid"].ToString().Split(','); title = Request.Form["title"].ToString(); msg = Request.Form["msg"].ToString(); intrval = Request.Form["intervaltime"].ToString(); fbuserid = Request.Form["fbuserid"].ToString(); linuserid = Request.Form["linuserid"].ToString(); clienttime = Request.Form["clienttime"].ToString(); string time = Request.Form["timeforsch"]; string date = Request.Form["dateforsch"]; var files = Request.Files.Count; var fi = Request.Files["files"]; string file = string.Empty; int intervaltime=0; intervaltime = Convert.ToInt32(intrval); Session["scheduletime"] = null; string filepath=string.Empty; if (Request.Files.Count > 0) { if (fi != null) { var path = Server.MapPath("~/Contents/img/upload"); filepath = path + "/" + fi.FileName; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } fi.SaveAs(filepath); } } foreach (var item in SelectedGroupId) { string[] networkingwithid = item.Split('_'); if (networkingwithid[1] == "lin") { try { string[] arrliusrid = linuserid.Split('_'); string linkuserid = arrliusrid[1]; string groupid = networkingwithid[2]; string profileid = networkingwithid[0]; if (intervaltime != 0) { if(Session["scheduletime"]==null) { string servertime = this.CompareDateWithclient(clienttime, date + " " + time); schmessage.ScheduleTime = Convert.ToDateTime(servertime); DateTime d1 = schmessage.ScheduleTime; DateTime d2 = d1.AddMinutes(intervaltime); Session["scheduletime"] = d2; } else { DateTime d1 = (DateTime)Session["scheduletime"]; schmessage.ScheduleTime = d1; DateTime d2 = d1.AddMinutes(intervaltime); Session["scheduletime"] = d2; } } SocialStream sociostream = new SocialStream(); string message = title + "$%^_^%$" + msg; schmessage.CreateTime = DateTime.Now; schmessage.ProfileType = "linkedingroup"; schmessage.ProfileId = profileid; schmessage.Id = Guid.NewGuid(); if (Request.Files.Count > 0) { // schmessage.PicUrl = ConfigurationManager.AppSettings["MailSenderDomain"] + "Contents/img/upload/" + fi.FileName; var path = System.Configuration.ConfigurationManager.AppSettings["MailSenderDomain"] + "Contents/img/upload"; file = path + "/" + fi.FileName; schmessage.PicUrl = file; } else { schmessage.PicUrl = "Null"; } schmessage.ClientTime = Convert.ToDateTime(clienttime); schmessage.ShareMessage = message; ; schmessage.UserId = user.Id; schmessage.Status = false; logger.Error("cod is befor insert in schedule message"); objScheduledMessageRepository.addNewMessage(schmessage); grpschmessage.Id = Guid.NewGuid(); grpschmessage.ScheduleMessageId = schmessage.Id; grpschmessage.GroupId = groupid; objGroupScheduleMEssageRepository.addNewGroupMessage(grpschmessage); } catch (Exception ex) { logger.Error("cod is in exception"); logger.Error(ex.StackTrace); Console.WriteLine(ex.StackTrace); } } else if (networkingwithid[1] == "fb") { try { string facebookgrouppost = string.Empty; string[] arrfbusrid = fbuserid.Split('_'); string acccesstkn = arrfbusrid[1]; string groupid = networkingwithid[2]; string profileid = networkingwithid[0]; if (intervaltime != 0) { if (Session["scheduletime"] == null) { string servertime = this.CompareDateWithclient(clienttime, date + " " + time); schmessage.ScheduleTime = Convert.ToDateTime(servertime); DateTime d1 = schmessage.ScheduleTime; DateTime d2 = d1.AddMinutes(intervaltime); Session["scheduletime"] = d2; } else { DateTime d1 = (DateTime)Session["scheduletime"]; schmessage.ScheduleTime = d1; DateTime d2 = d1.AddMinutes(intervaltime); Session["scheduletime"] = d2; } } schmessage.CreateTime = DateTime.Now; schmessage.ProfileType = "facebookgroup"; schmessage.ProfileId = profileid; schmessage.Id = Guid.NewGuid(); if (Request.Files.Count > 0) { // schmessage.PicUrl = ConfigurationManager.AppSettings["MailSenderDomain"] + "Contents/img/upload/" + fi.FileName; var path = System.Configuration.ConfigurationManager.AppSettings["MailSenderDomain"] + "Contents/img/upload"; file = path + "/" + fi.FileName; schmessage.PicUrl = file; } else { schmessage.PicUrl = "Null"; } schmessage.ClientTime = Convert.ToDateTime(clienttime); schmessage.ShareMessage = msg; schmessage.UserId = user.Id; schmessage.Status = false; objScheduledMessageRepository.addNewMessage(schmessage); grpschmessage.Id = Guid.NewGuid(); grpschmessage.ScheduleMessageId = schmessage.Id; grpschmessage.GroupId = groupid; objGroupScheduleMEssageRepository.addNewGroupMessage(grpschmessage); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } }//End For Each } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } Response.Write("success"); } else if (Request.QueryString["op"].ToString() == "getlinkedInGroupDetails") { string GroupData = string.Empty; string picurl = string.Empty; string summary = string.Empty; string groupid = Request.QueryString["groupid"].ToString(); string LinkedinUserId = Request.QueryString["linkuserid"].ToString(); LinkedInAccount arrLinkedinAccoount = linAccRepo.getLinkedinAccountDetailsById(LinkedinUserId); oAuthLinkedIn objoAuthLinkedIn = new oAuthLinkedIn(); objoAuthLinkedIn.Token = arrLinkedinAccoount.OAuthToken; objoAuthLinkedIn.Verifier = arrLinkedinAccoount.OAuthVerifier; objoAuthLinkedIn.TokenSecret = arrLinkedinAccoount.OAuthSecret; List<GlobusLinkedinLib.App.Core.LinkedInGroup.Group_Updates> lstlinkedinGroup = GetGroupPostDetail(objoAuthLinkedIn, 50, groupid); try { foreach (var item in lstlinkedinGroup) { picurl = ""; if (string.IsNullOrEmpty(item.pictureurl)) { picurl = "../../Contents/img/blank_img.png"; } else { picurl = item.pictureurl; } if (string.IsNullOrEmpty(item.summary)) { summary = "."; } else { summary = item.summary; } GroupData += "<div id=\"abhay\" class=\"storyContent\"><a class=\"actorPhoto\"><img src=\"" + picurl + "\" alt=\"\" style=\"width:56px;height:56px\"></a>" + "<div class=\"storyInnerContent\"><div class=\"actordescription\"><a class=\"passiveName\">" + item.firstname + " " + item.lastname + " - " + item.headline + "</a></div>" + "<div class=\"messagebody\"><div style=\"color: black;font-size: large;margin-bottom: 15\">" + Server.HtmlEncode(item.title) + "</div>" + summary + "</div>" + "</div>" + "<p style=\"margin-left:60px\">comments(" + item.comments_total + ") likes- " + item.likes_total + "</p><p><span class=\"comment\" onclick=\"FollowPosts('" + groupid + "','" + item.GpPostid + "','" + LinkedinUserId + "','" + item.isFollowing + "')\">" + getfollow(item.isFollowing) + "</span></p>" + "<p><span class=\"comment\" onclick=\"LikePosts('" + groupid + "','" + item.GpPostid + "','" + LinkedinUserId + "','" + item.isLiked + "')\">" + getlike(item.isLiked) + "</span></p>" + "<p><span id=\"commentlin_" + item.GpPostid + "\" class=\"comment\" onclick=\"CommentOnPosts('" + item.GpPostid + "')\">Comment</span></p>" + "<p class=\"commeent_box\"><input id=\"textlin_" + item.GpPostid + "\" type=\"text\" class=\"put_comments\"></p>" + "<p><span onclick=\"commentLin('" + groupid + "','" + item.GpPostid + "','" + LinkedinUserId + "')\" id=\"oklin_" + item.GpPostid + "\" class=\"ok\">ok</span><span id=\"cancellin_" + item.GpPostid + "\" onclick=\"cancelLin('" + item.GpPostid + "');\" class=\"cancel\"> cancel</span></p>" + "</div>"; } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } Response.Write(GroupData); return; } else if (Request.QueryString["op"].ToString() == "linkedCommentOnPost") { try { string message = Request.QueryString["message"].ToString(); string groupid = Request.QueryString["groupid"].ToString(); string LinkedinUserId = (Request.QueryString["LinkedinUserId"]); string GpPostid = (Request.QueryString["GpPostid"]); LinkedInAccount arrLinkedinAccoount = linAccRepo.getLinkedinAccountDetailsById(LinkedinUserId); oAuthLinkedIn objoAuthLinkedIn = new oAuthLinkedIn(); objoAuthLinkedIn.Token = arrLinkedinAccoount.OAuthToken; objoAuthLinkedIn.Verifier = arrLinkedinAccoount.OAuthVerifier; objoAuthLinkedIn.TokenSecret = arrLinkedinAccoount.OAuthSecret; SocialStream sociostream = new SocialStream(); string res = sociostream.SetCommentOnPost(objoAuthLinkedIn, GpPostid, message); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (Request.QueryString["op"].ToString() == "FollowPost") { try { string msg = string.Empty; string postid = Request.QueryString["groupid"].ToString(); string LinkedinUserId = (Request.QueryString["LinkedinUserId"]); int isFollowing = Convert.ToInt16(Request.QueryString["isFollowing"]); if (isFollowing == 1) { msg = "false"; } else { msg = "true"; } LinkedInAccount arrLinkedinAccoount = linAccRepo.getLinkedinAccountDetailsById(LinkedinUserId); oAuthLinkedIn objoAuthLinkedIn = new oAuthLinkedIn(); objoAuthLinkedIn.Token = arrLinkedinAccoount.OAuthToken; objoAuthLinkedIn.Verifier = arrLinkedinAccoount.OAuthVerifier; objoAuthLinkedIn.TokenSecret = arrLinkedinAccoount.OAuthSecret; SocialStream sociostream = new SocialStream(); string res = sociostream.SetFollowCountUpdate(objoAuthLinkedIn, postid, msg); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } else if (Request.QueryString["op"].ToString() == "postLinkedInGroupFeeds") { string result = "success"; try { string groupid = Request.QueryString["groupid"].ToString(); string title = Request.QueryString["title"].ToString(); string LinkedinUserId = Request.QueryString["LinkedinUserId"].ToString(); string msg = Request.QueryString["msg"].ToString(); LinkedInAccount arrLinkedinAccoount = linAccRepo.getLinkedinAccountDetailsById(LinkedinUserId); oAuthLinkedIn objoAuthLinkedIn = new oAuthLinkedIn(); objoAuthLinkedIn.Token = arrLinkedinAccoount.OAuthToken; objoAuthLinkedIn.Verifier = arrLinkedinAccoount.OAuthVerifier; objoAuthLinkedIn.TokenSecret = arrLinkedinAccoount.OAuthSecret; SocialStream sociostream = new SocialStream(); string res = sociostream.SetPostUpdate(objoAuthLinkedIn, groupid, msg, title); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } Response.Write(result); } else if (Request.QueryString["op"].ToString() == "LikePost") { try { string msg = string.Empty; string postid = Request.QueryString["groupid"].ToString(); string LinkedinUserId = (Request.QueryString["LinkedinUserId"]); int isLike = Convert.ToInt16(Request.QueryString["isLike"]); if (isLike == 1) { msg = "false"; } else { msg = "true"; } LinkedInAccount arrLinkedinAccoount = linAccRepo.getLinkedinAccountDetailsById(LinkedinUserId); oAuthLinkedIn objoAuthLinkedIn = new oAuthLinkedIn(); objoAuthLinkedIn.Token = arrLinkedinAccoount.OAuthToken; objoAuthLinkedIn.Verifier = arrLinkedinAccoount.OAuthVerifier; objoAuthLinkedIn.TokenSecret = arrLinkedinAccoount.OAuthSecret; SocialStream sociostream = new SocialStream(); string res = sociostream.SetLikeUpdate(objoAuthLinkedIn, postid, msg); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); } } } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } sr = new System.IO.StreamReader(Request.InputStream); string line = ""; line = sr.ReadToEnd(); jo = Newtonsoft.Json.Linq.JObject.Parse(line); gid = Server.UrlDecode((string)jo["gid"]); ack = Server.UrlDecode((string)jo["ack"]); returndata = fgroupfeeds(ack, gid); Response.Write(returndata); } catch (Exception ex) { Console.WriteLine("Error : " + ex.StackTrace); } }