public void SocialMediaStat_30() { Api.TwitterAccount.TwitterAccount ApiTwitterAccount = new Api.TwitterAccount.TwitterAccount(); Api.FacebookAccount.FacebookAccount ApiFacebookAccount = new Api.FacebookAccount.FacebookAccount(); Api.InstagramAccount.InstagramAccount ApiInstagramAccount = new Api.InstagramAccount.InstagramAccount(); Api.InboxMessages.InboxMessages ApiInboxMessages = new Api.InboxMessages.InboxMessages(); Api.ScheduledMessage.ScheduledMessage ApiScheduledMessage = new Api.ScheduledMessage.ScheduledMessage(); Api.TwitterDirectMessages.TwitterDirectMessages ApiTwitterDirectMessages = new Api.TwitterDirectMessages.TwitterDirectMessages(); Api.User.User ApiUser = new Api.User.User(); Api.Team.Team ApiTeam = new Api.Team.Team(); Api.Groups.Groups ApiGroups = new Api.Groups.Groups(); Api.GroupReports.GroupReports ApiGroupReports = new Api.GroupReports.GroupReports(); Api.FacebookGroupReport.FacebookGroupReport ApiFacebookGroupReport = new Api.FacebookGroupReport.FacebookGroupReport(); Api.InstagramReports.InstagramReports ApiInstagramReports = new Api.InstagramReports.InstagramReports(); Api.TeamMemberProfile.TeamMemberProfile ApiTeamMemberProfile = new Api.TeamMemberProfile.TeamMemberProfile(); List<Team> lstTeam = (List<Team>)new JavaScriptSerializer().Deserialize(ApiTeam.GetAllActiveTeam(), typeof(List<Team>)); foreach (Team item_team in lstTeam) { SocialStat _SocialStat = new Domain.SocialStat(); Dictionary<TwitterAccount, List<InboxMessages>> lsttwitterfollower = new Dictionary<TwitterAccount, List<InboxMessages>>(); FacebookStat _FacebookStat = new Domain.FacebookStat(); List<FacebookAccount> lstFacebookProfiles = new List<FacebookAccount>(); List<FacebookAccount> lstFacebookPage = new List<FacebookAccount>(); List<InstagramAccount> lstInstagramAccount = new List<InstagramAccount>(); FbPageStat _FbPageStat = new Domain.FbPageStat(); string InboxMessages = string.Empty; string InstagramProfileId = string.Empty; string TwitterProfileId = string.Empty; Groups _Groups = (Groups)new JavaScriptSerializer().Deserialize(ApiGroups.GetGroupDetailsByGroupId(item_team.GroupId.ToString()), typeof(Groups)); double days = DateTime.Now.Subtract(_Groups.EntryDate).TotalDays; int mod = Convert.ToInt32(days) % 30; if (mod == 0) { List<TeamMemberProfile> lstTeamMemberProfile = (List<TeamMemberProfile>)new JavaScriptSerializer().Deserialize(ApiTeamMemberProfile.getAllTeamMemberProfilesOfTeam(item_team.Id.ToString()), typeof(List<TeamMemberProfile>)); foreach (TeamMemberProfile item_TeamMemberProfile in lstTeamMemberProfile) { if (!string.IsNullOrEmpty(item_TeamMemberProfile.ProfileId) && item_TeamMemberProfile.ProfileType == "twitter") { TwitterAccount _TwitterAccount = (TwitterAccount)new JavaScriptSerializer().Deserialize(ApiTwitterAccount.GetTwitterAccountDetailsById(_Groups.UserId.ToString(), item_TeamMemberProfile.ProfileId), typeof(TwitterAccount)); List<InboxMessages> lstfollowers = (List<InboxMessages>)(new JavaScriptSerializer().Deserialize(ApiInboxMessages.GetTwitterFollowers(_Groups.UserId.ToString(), item_TeamMemberProfile.ProfileId, "1"), typeof(List<InboxMessages>))); lsttwitterfollower.Add(_TwitterAccount, lstfollowers); } if (!string.IsNullOrEmpty(item_TeamMemberProfile.ProfileId) && item_TeamMemberProfile.ProfileType == "facebook") { FacebookAccount _FacebookAccount = (FacebookAccount)new JavaScriptSerializer().Deserialize(ApiFacebookAccount.getFacebookAccountDetailsById(_Groups.UserId.ToString(), item_TeamMemberProfile.ProfileId), typeof(FacebookAccount)); lstFacebookProfiles.Add(_FacebookAccount); } if (!string.IsNullOrEmpty(item_TeamMemberProfile.ProfileId) && item_TeamMemberProfile.ProfileType == "facebook_page") { FacebookAccount _FacebookAccount = (FacebookAccount)new JavaScriptSerializer().Deserialize(ApiFacebookAccount.getFacebookAccountDetailsById(_Groups.UserId.ToString(), item_TeamMemberProfile.ProfileId), typeof(FacebookAccount)); if (!string.IsNullOrEmpty(_FacebookAccount.AccessToken)) { lstFacebookPage.Add(_FacebookAccount); } } if (!string.IsNullOrEmpty(item_TeamMemberProfile.ProfileId) && item_TeamMemberProfile.ProfileType == "instagram") { InstagramAccount _InstagramAccount = (InstagramAccount)new JavaScriptSerializer().Deserialize(ApiInstagramAccount.UserInformation(_Groups.UserId.ToString(), item_TeamMemberProfile.ProfileId), typeof(InstagramAccount)); InstagramProfileId += item_TeamMemberProfile.ProfileId + ","; lstInstagramAccount.Add(_InstagramAccount); } try { InstagramProfileId = InstagramProfileId.TrimEnd(','); } catch (Exception ex) { InstagramProfileId = string.Empty; } } GroupReports _GroupReports = (GroupReports)new JavaScriptSerializer().Deserialize(ApiGroupReports.retrievedata(_Groups.Id.ToString()), typeof(GroupReports)); string sexratio = _GroupReports.sexratio; string male = "0"; string female = "0"; string _male = "0"; string _female = "0"; try { male = sexratio.Split(',')[0]; female = sexratio.Split(',')[1]; } catch (Exception ex) { male = "0"; female = "0"; } try { _male = (Int32.Parse(male) / (Int32.Parse(male) + Int32.Parse(female)) * 100).ToString(); } catch (Exception ex) { _male = "0"; } try { if (female != "0") { _female = (100 - Int32.Parse(_male)).ToString(); } else { _female = "0"; } } catch (Exception ex) { _female = "0"; } _SocialStat.male = _male; _SocialStat.female = _female; _SocialStat.Mentions = _GroupReports.twtmentions_30.ToString(); _SocialStat.Retweets = _GroupReports.twtretweets_30.ToString(); _SocialStat.New_Followers = _GroupReports.twitterfollower_30.ToString(); _SocialStat.Messages_Sent = _GroupReports.sent_30.ToString(); _SocialStat.Clicks = ApiScheduledMessage.GetClickCount(_Groups.UserId.ToString(), TwitterProfileId, "30"); _SocialStat.Direct_Message = ApiTwitterDirectMessages.GetTwitterDirectMessageRecievedCount(_Groups.UserId.ToString().ToString(), TwitterProfileId, "30"); _SocialStat.lsttwitterfollower = lsttwitterfollower; FacebookGroupReport_30 _FacebookGroupReport_30 = (FacebookGroupReport_30)new JavaScriptSerializer().Deserialize(ApiFacebookGroupReport.retrieve_30(_Groups.Id.ToString()), typeof(FacebookGroupReport_30)); _FbPageStat.TotalLikes = _FacebookGroupReport_30.TotalLikes; _FbPageStat.TalkingAbout = _FacebookGroupReport_30.TalkingAbout; _FbPageStat.PageLike = _FacebookGroupReport_30.Likes.ToString(); _FbPageStat.PageUnlike = _FacebookGroupReport_30.Unlikes.ToString(); _FbPageStat.PageImpression = _FacebookGroupReport_30.Impression.ToString(); _FbPageStat.lstFacebookAccount = lstFacebookProfiles; _FbPageStat.lstFacebookpage = lstFacebookPage; InstagramStat _InstagramStat = new Domain.InstagramStat(); _InstagramStat.NewFollowers = ApiInboxMessages.GetInstagramFollower(_Groups.UserId.ToString(), InstagramProfileId, "30"); _InstagramStat.NewFollowings = ApiInboxMessages.GetInstagramFollowing(_Groups.UserId.ToString(), InstagramProfileId, "30"); _InstagramStat.ImageCount = ApiInstagramAccount.GetInstagramImageCount(InstagramProfileId, "30"); _InstagramStat.VideoCount = ApiInstagramAccount.GetInstagramVideosCount(InstagramProfileId, "30"); _InstagramStat.LikesCount = ApiInstagramAccount.GetInstagramLikesCount(InstagramProfileId, "30"); _InstagramStat.CommentCount = ApiInstagramAccount.GetInstagramCommentCount(InstagramProfileId, "30"); _InstagramStat.lstInstagramAccount = lstInstagramAccount; string ret = MailSender.SendGroupReporsByDay(_Groups.GroupName, "*****@*****.**", _SocialStat, _FbPageStat, _InstagramStat, 30); } } }
public static string SendGroupReporsByDay(string GroupName, string toEmail, SocialStat _SocialStat, FbPageStat _FacebookStats, InstagramStat _InstagramStat, int days) { string date = DateTime.Now.AddDays(-days).ToString("MMMM dd") + " to " + DateTime.Now.ToString("MMMM dd"); string _GroupName = GroupName; string email = toEmail; int i = 0; string str = "<!DOCTYPE html><html lang=\"en\"><head><title>Socioboard | Group Reports</title><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width\"><link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css\" />" + "<style type=\"text/css\"> #outlook a {padding: 0;}.ReadMsgBody {width: 100%;}.ExternalClass {width: 100%;}.ExternalClass,.ExternalClass p,.ExternalClass span,.ExternalClass font,.ExternalClass td,.ExternalClass div {line-height: 100%;}" + "body,table,td,a {-webkit-text-size-adjust: 100%;-ms-text-size-adjust: 100%;} table,td {mso-table-lspace: 0pt;mso-table-rspace: 0pt;} img {-ms-interpolation-mode: bicubic;}body {margin: 0;padding: 0;}img {border: 0;height: auto;line-height: 100%;outline: none;text-decoration: none;}" + "table {border-collapse: collapse !important;} body {height: 100% !important;margin: 0;padding: 0;width: 100% !important;font-family: segoe UI;}.appleBody a {color: #68440a;text-decoration: none;}.appleFooter a {color: #999999;text-decoration: none;}" + "@media screen and (max-width: 525px) {table[class=\"wrapper\"] {width: 100% !important;}td[class=\"logo\"] {text-align: left;padding: 20px 0 20px 0 !important;}td[class=\"logo\"] img {margin: 0 auto!important;}td[class=\"mobile-hide\"] {display: none;}img[class=\"mobile-hide\"] {display: none !important;}img[class=\"img-max\"] {max-width: 100% !important;height: auto !important;}" + "table[class=\"responsive-table\"] {width: 100%!important;}td[class=\"padding\"] {padding: 10px 5% 15px 5% !important;}td[class=\"padding-copy\"] {padding: 10px 5% 10px 5% !important;text-align: center;}td[class=\"padding-meta\"] {padding: 30px 5% 0px 5% !important;text-align: center;}" + "td[class=\"no-pad\"] {padding: 0 0 20px 0 !important;}td[class=\"no-padding\"] {padding: 0 !important;}td[class=\"section-padding\"] {padding: 50px 15px 50px 15px !important;}td[class=\"section-padding-bottom-image\"] {padding: 50px 15px 0 15px !important;}td[class=\"mobile-wrapper\"] {padding: 10px 5% 15px 5% !important;}table[class=\"mobile-button-container\"] {margin: 0 auto;width: 100% !important;}" + "a[class=\"mobile-button\"] {width: 80% !important;padding: 15px !important;border: 0 !important;font-size: 16px !important;}}</style></head>" + "<body style=\"margin: 0; padding: 0;\"><div class=\"container\"><div class=\"row\"><div class=\"col-md-6 col-md-offset-3\"><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"table-layout: fixed;\"><tr><td bgcolor=\"#ffffff\">" + "<div align=\"center\" style=\"padding: 0px 15px 0px 15px;\"><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"500\" class=\"wrapper\"><tr><td style=\"padding: 20px 0px 30px 0px;\" class=\"logo\"><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">" + "<tr><td bgcolor=\"#ffffff\" width=\"200\" align=\"left\"><a href=\"http://socioboard.com\" target=\"_blank\"><img alt=\"Logo\" src=\"http://i.imgur.com/KyksxOs.png\" width=\"250\" height=\"78\" style=\"display: block; font-family: Helvetica, Arial, sans-serif; color: #666666; font-size: 16px;\" border=\"0\" /></a></td>" + "<td align=\"right\" style=\"padding: 0 0 5px 0; font-size: 14px; font-family: Arial, sans-serif; color: #666666; text-decoration: none; font-weight:bold;\">" + "<a href=\"https://www.socioboard.com/Index/Index?ReturnUrl=%2fHome\" style=\"color: #666666; text-decoration: none;\">LOGIN</a></td></tr></table></td></tr></table></td></tr></table></div></td></tr></table>" + "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"table-layout: fixed;\"><tr><td bgcolor=\"#ffffff\" align=\"center\" style=\"padding: 0px 15px 0px 15px;\" class=\"section-padding\">" + "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"500\" class=\"responsive-table\"><tr><td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">" + "<tr><td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"padding-copy\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">" + "<tr><td style=\"background-color:#F8680D; height:100px; text-align:center;\"><a href=\"#\" target=\"_blank\" style=\"text-align:center; color:#FFF; text-transform:uppercase; text-decoration:none; letter-spacing: 2px; font-size: 28px; font-weight: 700;\">Group Report Summary</a>" + "<br/><a href=\"#\" target=\"_blank\" style=\"text-align:center; color:#FFF; text-transform:uppercase; text-decoration:none; letter-spacing: 2px; font-size: 16px;\">"+days.ToString()+" - Days Digest</a></a></td></tr>" + "<tr><td><a href=\"#\" target=\"_blank\"><img src=\"http://i.imgur.com/RwgxMKl.png\" width=\"500\" height=\"100\" border=\"0\" alt=\"Can an email really be responsive?\" style=\"display: block; padding: 0; color: #666666; text-decoration: none; font-family: Helvetica, arial, sans-serif; font-size: 16px; width: 500px; height: 75px;\" class=\"img-max\">" + "</a></td></tr></table></td></tr></tbody></table></td></tr>" + "<tr><td><table width=\"500\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\" style=\"background-color:#ffffff;line-height:1.6em;font-size:16px\"><tbody>" + "<tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\"><td width=\"500\" style=\"padding-left:50px;padding-right:50px;padding-top:50px;text-align:left\">" + "<h3 style=\"color:#808080;font-weight:700;line-height:13px;font-size:11px;letter-spacing:1px;text-transform:uppercase;margin-top:0;margin-bottom:10px;padding:0;font-family:Helvetica,Arial,sans-serif\">" + "<img width=\"16\" height=\"13\" style=\"padding-right:2px;font-family:Helvetica,Arial,sans-serif\" src=\"http://i.imgur.com/KPEaTAm.png\" />Your Group</h3>" + "<p style=\"color:#F8680D;font-weight:400;line-height:34x;font-size:26px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Helvetica,Arial,sans-serif\">" + _GroupName + "</p>" + "<p style=\"color:#b3b3b3;font-weight:400;line-height:18x;font-size:12px;margin-top:0;margin-bottom:10px;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Helvetica,Arial,sans-serif\">Group associated with <a target=\"_blank\" href=\"mailto:[email protected]\">" + email + "</a></p>" + "<hr style=\"padding-top:0;padding-bottom:0;margin-top:0;margin-bottom:0;background-color:#dddddd;border-bottom:0 solid #ffffff;border-left:0 solid #ffffff;border-right:0 solid #ffffff;border-top:0 solid #ffffff;min-height:1px\">" + "<p style=\"color:#808080;font-weight:700;line-height:18px;font-size:11px;letter-spacing:1px;text-transform:uppercase;margin-top:10px;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Helvetica,Arial,sans-serif\">Report Date Range: <span style=\"color:#4d4d4d;text-transform:none;letter-spacing:0;font-weight:400;font-size:12px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Helvetica,Arial,sans-serif\"><span><span>" + date + "</span></span>" + "</span></span></p><p style=\"color:#b3b3b3;font-weight:400;line-height:18x;font-size:12px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Helvetica,Arial,sans-serif\">Latest data may be missing from summary</p></td></tr></tbody></table></td></tr>" + "<tr><td><table width=\"500\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\" style=\"background-color:#ffffff;line-height:1.6em;color:#808080;font-size:16px\">" + "<tbody><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\"><td width=\"500\" style=\"padding-top:50px;padding-bottom:50px;text-align:left\">" + "<table width=\"500\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\" style=\"background-color:#ffffff;line-height:1.6em;color:#808080;font-size:16px\">" + "<tbody><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\"><th width=\"360\" style=\"text-align:left;border-bottom:3px solid #2caae1\" colspan=\"2\">" + "<h2 style=\"margin-top:0;margin-bottom:5px;padding-top:0;padding-bottom:0;color:#4d4d4d;font-weight:400;font-size:20px;line-height:28px;font-family:Helvetica,Arial,sans-serif\">Twitter Stats</h2></th>" + "<th width=\"140\" style=\"text-align:right;border-bottom:3px solid #2caae1\" colspan=\"2\"> <img width=\"17\" height=\"14\" style=\"padding-right:2px;font-family:Helvetica,Arial,sans-serif\" src=\"http://i.imgur.com/hDNrQdO.png\" class=\"CToWUd\"> </th></tr>" + "<tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"250\" valign=\"middle\" height=\"55\" style=\"text-align:center;color:#00417b;font-weight:400;line-height:32x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:5px;padding-bottom:0;padding-left:10px;padding-right:20px;font-family:Helvetica,Arial,sans-serif\"> <img width=\"10\" height=\"25\" style=\"padding-right:2px;font-family:Helvetica,Arial,sans-serif\" src=\"http://i.imgur.com/QTwQyVL.png\" class=\"CToWUd\"> <span style=\"font-size:32px;font-weight:700\">" + _SocialStat.male + "%</span> Male Followers </td>" + "<td width=\"250\" valign=\"middle\" height=\"55\" style=\"text-align:center;color:#ff9393;font-weight:400;line-height:32x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:5px;padding-bottom:0;padding-left:0;padding-right:10px;font-family:Helvetica,Arial,sans-serif\" colspan=\"3\"> <img width=\"12\" height=\"25\" style=\"padding-right:2px;font-family:Helvetica,Arial,sans-serif\" src=\"http://i.imgur.com/LvOezOQ.png\" class=\"CToWUd\"> <span style=\"font-size:32px;font-weight:700\">" + _SocialStat.female + "%</span> Female Followers </td>" + "</tr><tr style=\"background-color:#eeeeee\" cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"350\" valign=\"middle\" height=\"40\" style=\"text-align:center;color:#b3b3b3;font-weight:400;line-height:20x;font-size:11px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:253px;padding-right:10px;font-family:Helvetica,Arial,sans-serif\" colspan=\"3\">Total </td></tr>" + "<tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\"><td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:left;color:#4d4d4d;font-weight:400;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:10px;padding-right:0;font-family:Segoe UI;\">" + "@Mentions Received </td><td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:center;color:#4d4d4d;font-weight:700;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\" colspan=\"2\">" + _SocialStat.Mentions + "</td>" + "</tr><tr style=\"background-color:#eeeeee\" cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:left;color:#4d4d4d;font-weight:400;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:10px;padding-right:0;font-family:Segoe UI;\">" + "Direct Messages Received </td><td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:center;color:#4d4d4d;font-weight:700;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\" colspan=\"2\">" + _SocialStat.Direct_Message + "</td>" + "</tr><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:left;color:#4d4d4d;font-weight:400;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:10px;padding-right:0;font-family:Segoe UI;\">" + "Messages Sent </td><td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:center;color:#4d4d4d;font-weight:700;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\" colspan=\"2\">" + _SocialStat.Messages_Sent + "</td>" + "</tr><tr style=\"background-color:#eeeeee\" cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:left;color:#4d4d4d;font-weight:400;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:10px;padding-right:0;font-family:Segoe UI;\"> New Followers </td>" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:center;color:#4d4d4d;font-weight:700;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\" colspan=\"2\">" + _SocialStat.New_Followers + "</td>" + "</tr><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:left;color:#4d4d4d;font-weight:400;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:10px;padding-right:0;font-family:Segoe UI;\"> Retweets </td>" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:center;color:#4d4d4d;font-weight:700;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\" colspan=\"2\">" + _SocialStat.Retweets + "</td>" + "</tr><tr style=\"background-color:#eeeeee\" cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:left;color:#4d4d4d;font-weight:400;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:10px;padding-right:0;font-family:Segoe UI;\"> Clicks </td>" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:center;color:#4d4d4d;font-weight:700;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\" colspan=\"2\">" + _SocialStat.Clicks + "</td></tr>" + "<tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"500\" height=\"40\" style=\"text-align:right;background-color:#2caae1\" colspan=\"4\"> <a target=\"_blank\" style=\"font-family:Segoe UI;color:#ffffff;line-height:13px;font-weight:700;font-size:12px;letter-spacing:1.5px;text-transform:uppercase;text-decoration:none;padding-left:0px;padding-right:10px;padding-top:13.5px;padding-bottom:13.5px\" href=\"https://www.socioboard.com/\">View Full Twitter Report <img width=\"4\" height=\"7\" style=\"font-family:Segoe UI;color:#ffffff;line-height:13px;font-weight:700;font-size:12px;letter-spacing:1.5px;text-transform:uppercase;text-decoration:none\" src=\"http://i.imgur.com/Ec4giNS.png\" class=\"CToWUd\"></a> </td>" + "</tr></tbody></table></td></tr></tbody></table></td></tr>" + //connected twitter profiles "<tr><td><table width=\"500\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\" style=\"background-color:#ffffff;line-height:1.6em;color:#535353;font-size:16px\">" + "<tbody><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\"><td width=\"400\" style=\"padding:0 0 10px;text-align:left\">" + "<h3 style=\"color:#808080;font-weight:400;line-height:24px;font-size:14px;text-transform:uppercase;letter-spacing:1px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Helvetica,Arial,sans-serif\">Connected Profiles </h3>" + "</td><td width=\"100\" style=\"padding-left:0;padding-right:50px;padding-top:0;padding-bottom:10px;text-align:right\"><br></td></tr>" + "<tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\"><td width=\"500\" style=\"padding-top:0;text-align:left\" colspan=\"2\">" + "<table width=\"500\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\" style=\"background-color:#ffffff;line-height:1.6em;color:#808080;font-size:16px\">" + "<tbody><tr cellspacing=\"0\" cellpadding=\"0\" width=\"510\">"; if (_SocialStat.lsttwitterfollower.Count > 0) { foreach (var itemtwt in _SocialStat.lsttwitterfollower) { if (i < 4) { str += "<td width=\"112\" valign=\"top\" height=\"155\" style=\"padding-right:10px;text-align:center\" cellspacing=\"0\" cellpadding=\"0\">"; str += "<img width=\"112\" height=\"112\" style=\"font-size:11px;font-weight:700;color:#2caae1;font-family:Helvetica,Arial,sans-serif;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0\" alt=\"" + itemtwt.Key.TwitterScreenName + "\" src=\"" + itemtwt.Key.ProfileImageUrl + "\" class=\"CToWUd\">"; str += "<p style=\"color:#808080;font-weight:400;line-height:14px;font-size:11px;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\"> " + itemtwt.Key.TwitterScreenName + " </p></td>"; } i++; } } else { str += "<tr width=\"250\"><td width=\"250\" height=\"40\" style=\"text-align:center;background-color:#2caae1\">"; str += "<a href=\"https://www.socioboard.com/\" style=\"font-family:Segoe UI;color:#ffffff;line-height:13px;font-weight:700;font-size:12px;letter-spacing:1.5px;text-transform:uppercase;text-decoration:none;padding-left:0px;padding-right:10px;padding-top:13.5px;padding-bottom:13.5px\" target=\"_blank\">Add Twitter Account"; str += "<img width=\"4\" height=\"7\" class=\"CToWUd\" src=\"http://i.imgur.com/Ec4giNS.png\" style=\"font-family:Segoe UI;color:#ffffff;line-height:13px;font-weight:700;font-size:12px;letter-spacing:1.5px;text-transform:uppercase;text-decoration:none\"></a> </td></tr>"; } str += "</tr></tbody></table></td></tr></tbody></table></td></tr>" + "<tr><td><table width=\"500\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\" style=\"background-color:#ffffff;line-height:1.6em;color:#535353;font-size:16px\">" + "<tbody><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\"><td width=\"500\" style=\"padding-top:0;text-align:left;\" colspan=\"2\">" + "<table width=\"500\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\" style=\"background-color:#ffffff;line-height:1.6em;color:#808080;font-size:16px\">" + "<tbody><tr cellspacing=\"0\" cellpadding=\"0\" width=\"510\">"; //twitter profile followers i = 0; foreach (var itemfollower in _SocialStat.lsttwitterfollower) { str += "<td width=\"112\" valign=\"top\" height=\"155\" style=\"padding-right:10px;\" cellspacing=\"0\" cellpadding=\"0\">"; str += "<strong style=\"width:112px;color:#808080;line-height:28px;font-size:11px;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\"> NEW FOLLOWERS </strong>"; if (i < 4) { foreach (var itemfollowers in itemfollower.Value) { str += "<p style=\"width:112px;color:#f8680d;font-weight:500;line-height:14px;font-size:11px;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;padding-top:0;padding-bottom:3%;padding-left:0;padding-right:0;font-family:Segoe UI;text-decoration: underline;\">" + itemfollowers.FromName + "</p>"; } } i++; str += "</td>"; } str += "</tr></tbody></table></td></tr></tbody></table></td></tr>"; //facebook str += "<tr><td><table width=\"500\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\" style=\"background-color:#ffffff;line-height:1.6em;color:#808080;font-size:16px\">" + "<tbody><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\"><td width=\"500\" style=\"padding-top:50px;padding-bottom:50px;text-align:left\">" + "<table width=\"500\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\" style=\"background-color:#ffffff;line-height:1.6em;color:#808080;font-size:16px\">" + "<tbody><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\"><th width=\"360\" style=\"text-align:left;border-bottom:3px solid #3B5998\" colspan=\"2\">" + "<h2 style=\"margin-top:0;margin-bottom:5px;padding-top:0;padding-bottom:0;color:#4d4d4d;font-weight:400;font-size:20px;line-height:28px;font-family:Helvetica,Arial,sans-serif\">Facebook</h2>" + "</th><th width=\"140\" style=\"text-align:right;border-bottom:3px solid #3B5998\" colspan=\"2\"> <img width=\"17\" height=\"14\" style=\"padding-right:2px;font-family:Helvetica,Arial,sans-serif\" src=\"http://i.imgur.com/0zEBmAn.png\" class=\"CToWUd\"> </th>" + "</tr><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"250\" valign=\"middle\" height=\"55\" style=\"text-align:center;color:#00417b;font-weight:400;line-height:32x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:5px;padding-bottom:0;padding-left:10px;padding-right:20px;font-family:Helvetica,Arial,sans-serif\"> </td>" + "<td width=\"250\" valign=\"middle\" height=\"55\" style=\"text-align:center;color:#ff9393;font-weight:400;line-height:32x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:5px;padding-bottom:0;padding-left:0;padding-right:10px;font-family:Helvetica,Arial,sans-serif\" colspan=\"3\"> </td>" + "</tr><tr style=\"background-color:#eeeeee\" cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"350\" valign=\"middle\" height=\"40\" style=\"text-align:center;color:#b3b3b3;font-weight:400;line-height:20x;font-size:11px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:253px;padding-right:10px;font-family:Helvetica,Arial,sans-serif\" colspan=\"3\">" + "Total</td></tr><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:left;color:#4d4d4d;font-weight:400;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:10px;padding-right:0;font-family:Segoe UI;\">" + "Total Likes</td>" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:center;color:#4d4d4d;font-weight:700;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\" colspan=\"2\"> " + _FacebookStats.TotalLikes + " </td>" + "</tr><tr style=\"background-color:#eeeeee\" cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:left;color:#4d4d4d;font-weight:400;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:10px;padding-right:0;font-family:Segoe UI;\">" + "Talking About</td>" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:center;color:#4d4d4d;font-weight:700;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\" colspan=\"2\"> " + _FacebookStats.TalkingAbout + " </td>" + "</tr><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:left;color:#4d4d4d;font-weight:400;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:10px;padding-right:0;font-family:Segoe UI;\">" + "New Like</td>" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:center;color:#4d4d4d;font-weight:700;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\" colspan=\"2\"> " + _FacebookStats.PageLike + " </td>" + "</tr><tr style=\"background-color:#eeeeee\" cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:left;color:#4d4d4d;font-weight:400;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:10px;padding-right:0;font-family:Segoe UI;\"> Impression </td>" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:center;color:#4d4d4d;font-weight:700;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\" colspan=\"2\"> " + _FacebookStats.PageImpression + " </td>" + "</tr><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:left;color:#4d4d4d;font-weight:400;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:10px;padding-right:0;font-family:Segoe UI;\"> Unlike </td>" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:center;color:#4d4d4d;font-weight:700;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\" colspan=\"2\"> " + _FacebookStats.PageUnlike + " </td>" + "</tr><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"500\" height=\"40\" style=\"text-align:right;background-color:#3B5998\" colspan=\"4\"> <a target=\"_blank\" style=\"font-family:Segoe UI;color:#ffffff;line-height:13px;font-weight:700;font-size:12px;letter-spacing:1.5px;text-transform:uppercase;text-decoration:none;padding-left:0px;padding-right:10px;padding-top:13.5px;padding-bottom:13.5px\" href=\"https://www.socioboard.com/\">View Full Facebook Report <img width=\"4\" height=\"7\" style=\"font-family:Segoe UI;color:#ffffff;line-height:13px;font-weight:700;font-size:12px;letter-spacing:1.5px;text-transform:uppercase;text-decoration:none\" src=\"http://i.imgur.com/Ec4giNS.png\" class=\"CToWUd\"></a> </td>" + "</tr></tbody></table></td></tr></tbody></table></td></tr>"; //facebook pages str += "<tr><td><table width=\"500\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\" style=\"background-color:#ffffff;line-height:1.6em;color:#535353;font-size:16px\"><tbody>" + "<tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\"><td width=\"400\" style=\"padding:0 0 10px;text-align:left\">" + "<h3 style=\"color:#808080;font-weight:400;line-height:24px;font-size:14px;text-transform:uppercase;letter-spacing:1px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Helvetica,Arial,sans-serif\">Connected Pages </h3>" + "</td><td width=\"100\" style=\"padding-left:0;padding-right:50px;padding-top:0;padding-bottom:10px;text-align:right\">" + "<br></td></tr><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\"><td width=\"500\" style=\"padding-top:0;text-align:left\" colspan=\"2\">" + "<table width=\"500\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\" style=\"background-color:#ffffff;line-height:1.6em;color:#808080;font-size:16px\">" + "<tbody><tr cellspacing=\"0\" cellpadding=\"0\" width=\"510\">"; i = 0; if (_FacebookStats.lstFacebookpage.Count > 0) { foreach (var itempage in _FacebookStats.lstFacebookpage) { if (i < 4) { str += "<td width=\"112\" valign=\"top\" height=\"155\" style=\"padding-right:10px;text-align:center\" cellspacing=\"0\" cellpadding=\"0\">"; str += "<img width=\"112\" height=\"112\" style=\"font-size:11px;font-weight:700;color:#2caae1;font-family:Helvetica,Arial,sans-serif;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0\" alt=\"" + itempage.FbUserName + "\" src=\"http://graph.facebook.com/" + itempage.FbUserId + "/picture?type=small\" class=\"CToWUd\">"; str += "<p style=\"color:#808080;font-weight:400;line-height:14px;font-size:11px;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\"> " + itempage.FbUserName + " </p>"; str += "</td>"; } i++; } } else { str += "<tr width=\"250\"><td width=\"250\" height=\"40\" style=\"text-align:center;background-color:#3B5998\">"; str += "<a href=\"https://www.socioboard.com\" style=\"font-family:Segoe UI;color:#ffffff;line-height:13px;font-weight:700;font-size:12px;letter-spacing:1.5px;text-transform:uppercase;text-decoration:none;padding-left:0px;padding-right:10px;padding-top:13.5px;padding-bottom:13.5px\" target=\"_blank\">Add Facebook Page"; str += "<img width=\"4\" height=\"7\" class=\"CToWUd\" src=\"http://i.imgur.com/Ec4giNS.png\" style=\"font-family:Segoe UI;color:#ffffff;line-height:13px;font-weight:700;font-size:12px;letter-spacing:1.5px;text-transform:uppercase;text-decoration:none\"></a> </td></tr>"; } str += "</tr></tbody></table></td></tr></tbody></table></td></tr>"; //facebook account str += "<tr><td><table width=\"500\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\" style=\"background-color:#ffffff;line-height:1.6em;color:#535353;font-size:16px\">" + "<tbody><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\"><td width=\"400\" style=\"padding:0 0 10px;text-align:left\">" + "<h3 style=\"color:#808080;font-weight:400;line-height:24px;font-size:14px;text-transform:uppercase;letter-spacing:1px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Helvetica,Arial,sans-serif\">Personal Profiles </h3>" + "</td><td width=\"100\" style=\"padding-left:0;padding-right:50px;padding-top:0;padding-bottom:10px;text-align:right\">" + "<br></td></tr><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\"><td width=\"500\" style=\"padding-top:0;text-align:left\" colspan=\"2\">" + "<table width=\"500\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\" style=\"background-color:#ffffff;line-height:1.6em;color:#808080;font-size:16px\">" + "<tbody><tr cellspacing=\"0\" cellpadding=\"0\" width=\"510\">"; i = 0; if (_FacebookStats.lstFacebookAccount.Count > 0) { foreach (var intemaccount in _FacebookStats.lstFacebookAccount) { if (i < 4) { str += "<td width=\"112\" valign=\"top\" height=\"155\" style=\"padding-right:10px;text-align:center\" cellspacing=\"0\" cellpadding=\"0\">"; str += "<img width=\"112\" height=\"112\" style=\"font-size:11px;font-weight:700;color:#2caae1;font-family:Helvetica,Arial,sans-serif;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0\" alt=\"RamkumaR\" src=\"http://graph.facebook.com/" + intemaccount.FbUserId + "/picture?type=small\" class=\"CToWUd\">"; str += "<p style=\"color:#808080;font-weight:400;line-height:14px;font-size:11px;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\"> " + intemaccount.FbUserName + " </p>"; str += "</td>"; } i++; } } else { str += "<tr width=\"250\"><td width=\"250\" height=\"40\" style=\"text-align:center;background-color:#3B5998\">"; str += "<a href=\"https://www.socioboard.com\" style=\"font-family:Segoe UI;color:#ffffff;line-height:13px;font-weight:700;font-size:12px;letter-spacing:1.5px;text-transform:uppercase;text-decoration:none;padding-left:0px;padding-right:10px;padding-top:13.5px;padding-bottom:13.5px\" target=\"_blank\">Add Facebook Account"; str += "<img width=\"4\" height=\"7\" class=\"CToWUd\" src=\"http://i.imgur.com/Ec4giNS.png\" style=\"font-family:Segoe UI;color:#ffffff;line-height:13px;font-weight:700;font-size:12px;letter-spacing:1.5px;text-transform:uppercase;text-decoration:none\"></a> </td></tr>"; } str += "</tr></tbody></table></td></tr></tbody></table></td></tr>"; //instagram str += "<tr><td><table width=\"500\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\" style=\"background-color:#ffffff;line-height:1.6em;color:#808080;font-size:16px\"><tbody>" + "<tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\"><td width=\"500\" style=\"padding-top:50px;padding-bottom:50px;text-align:left\">" + "<table width=\"500\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\" style=\"background-color:#ffffff;line-height:1.6em;color:#808080;font-size:16px\">" + "<tbody><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\"><th width=\"360\" style=\"text-align:left;border-bottom:3px solid #A97F67\" colspan=\"2\">" + "<h2 style=\"margin-top:0;margin-bottom:5px;padding-top:0;padding-bottom:0;color:#4d4d4d;font-weight:400;font-size:20px;line-height:28px;font-family:Helvetica,Arial,sans-serif\">Instagram</h2>" + "</th><th width=\"140\" style=\"text-align:right;border-bottom:3px solid #A97F67\" colspan=\"2\"> <img width=\"17\" height=\"14\" style=\"padding-right:2px;font-family:Helvetica,Arial,sans-serif\" src=\"http://goo.gl/wQGirq\" class=\"CToWUd\"> </th>" + "</tr><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"250\" valign=\"middle\" height=\"55\" style=\"text-align:center;color:#00417b;font-weight:400;line-height:32x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:5px;padding-bottom:0;padding-left:10px;padding-right:20px;font-family:Helvetica,Arial,sans-serif\"> </td>" + "<td width=\"250\" valign=\"middle\" height=\"55\" style=\"text-align:center;color:#ff9393;font-weight:400;line-height:32x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:5px;padding-bottom:0;padding-left:0;padding-right:10px;font-family:Helvetica,Arial,sans-serif\" colspan=\"3\"> </td>" + "</tr><tr style=\"background-color:#eeeeee\" cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"350\" valign=\"middle\" height=\"40\" style=\"text-align:center;color:#b3b3b3;font-weight:400;line-height:20x;font-size:11px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:253px;padding-right:10px;font-family:Helvetica,Arial,sans-serif\" colspan=\"3\">" + "Total</td></tr><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:left;color:#4d4d4d;font-weight:400;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:10px;padding-right:0;font-family:Segoe UI;\">" + "New Followers</td>" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:center;color:#4d4d4d;font-weight:700;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\" colspan=\"2\"> " + _InstagramStat.LikesCount + " </td>" + "</tr><tr style=\"background-color:#eeeeee\" cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:left;color:#4d4d4d;font-weight:400;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:10px;padding-right:0;font-family:Segoe UI;\">" + "New Followings</td>" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:center;color:#4d4d4d;font-weight:700;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\" colspan=\"2\"> " + _InstagramStat.NewFollowings + " </td>" + "</tr><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:left;color:#4d4d4d;font-weight:400;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:10px;padding-right:0;font-family:Segoe UI;\">" + "Image Count</td>" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:center;color:#4d4d4d;font-weight:700;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\" colspan=\"2\"> " + _InstagramStat.ImageCount + " </td>" + "</tr><tr style=\"background-color:#eeeeee\" cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:left;color:#4d4d4d;font-weight:400;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:10px;padding-right:0;font-family:Segoe UI;\"> Video Count </td>" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:center;color:#4d4d4d;font-weight:700;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\" colspan=\"2\"> " + _InstagramStat.VideoCount + " </td>" + "</tr><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:left;color:#4d4d4d;font-weight:400;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:10px;padding-right:0;font-family:Segoe UI;\"> Likes Count </td>" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:center;color:#4d4d4d;font-weight:700;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\" colspan=\"2\"> " + _InstagramStat.LikesCount + " </td>" + "</tr><tr style=\"background-color:#eeeeee\" cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:left;color:#4d4d4d;font-weight:400;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:10px;padding-right:0;font-family:Segoe UI;\"> Comment Count </td>" + "<td width=\"250\" valign=\"middle\" height=\"40\" style=\"text-align:center;color:#4d4d4d;font-weight:700;line-height:20x;font-size:14px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\" colspan=\"2\"> " + _InstagramStat.CommentCount + " </td>" + "</tr><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\">" + "<td width=\"500\" height=\"40\" style=\"text-align:right;background-color:#A97F67\" colspan=\"4\"> <a target=\"_blank\" style=\"font-family:Segoe UI;color:#ffffff;line-height:13px;font-weight:700;font-size:12px;letter-spacing:1.5px;text-transform:uppercase;text-decoration:none;padding-left:0px;padding-right:10px;padding-top:13.5px;padding-bottom:13.5px\" href=\"https://www.socioboard.com/\">View Full Instagram Report <img width=\"4\" height=\"7\" style=\"font-family:Segoe UI;color:#ffffff;line-height:13px;font-weight:700;font-size:12px;letter-spacing:1.5px;text-transform:uppercase;text-decoration:none\" src=\"http://i.imgur.com/Ec4giNS.png\" class=\"CToWUd\"></a> </td>" + "</tr></tbody></table></td></tr></tbody></table></td></tr>"; //Instagram Account str += "<tr><td><table width=\"500\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\" style=\"background-color:#ffffff;line-height:1.6em;color:#535353;font-size:16px\">" + "<tbody><tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\"><td width=\"400\" style=\"padding:0 0 10px;text-align:left\">" + "<h3 style=\"color:#808080;font-weight:400;line-height:24px;font-size:14px;text-transform:uppercase;letter-spacing:1px;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Helvetica,Arial,sans-serif\">Personal Profiles </h3>" + "</td><td width=\"100\" style=\"padding-left:0;padding-right:50px;padding-top:0;padding-bottom:10px;text-align:right\"><br></td></tr>" + "<tr cellspacing=\"0\" cellpadding=\"0\" width=\"500\"><td width=\"500\" style=\"padding-top:0;text-align:left\" colspan=\"2\">" + "<table width=\"500\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" align=\"center\" style=\"background-color:#ffffff;line-height:1.6em;color:#808080;font-size:16px\">" + "<tbody><tr cellspacing=\"0\" cellpadding=\"0\" width=\"510\">"; if (_InstagramStat.lstInstagramAccount.Count > 0) { foreach (var iteminsta in _InstagramStat.lstInstagramAccount) { str += "<td width=\"112\" valign=\"top\" height=\"155\" style=\"padding-right:10px;text-align:center\" cellspacing=\"0\" cellpadding=\"0\">"; str += "<img width=\"112\" height=\"112\" style=\"font-size:11px;font-weight:700;color:#2caae1;font-family:Helvetica,Arial,sans-serif;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0\" alt=\"" + iteminsta.InsUserName + "\" src=\"" + iteminsta.ProfileUrl + "\" class=\"CToWUd\">"; str += "<p style=\"color:#808080;font-weight:400;line-height:14px;font-size:11px;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;font-family:Segoe UI;\"> " + iteminsta.InsUserName + " </p>"; str += "</td>"; } } else { str += "<tr width=\"250\"><td width=\"250\" height=\"40\" style=\"text-align:center;background-color:#A97F67\">"; str += "<a href=\"https://www.socioboard.com\" style=\"font-family:Segoe UI;color:#ffffff;line-height:13px;font-weight:700;font-size:12px;letter-spacing:1.5px;text-transform:uppercase;text-decoration:none;padding-left:0px;padding-right:10px;padding-top:13.5px;padding-bottom:13.5px\" target=\"_blank\">Add Instagram Account"; str += "<img width=\"4\" height=\"7\" class=\"CToWUd\" src=\"http://i.imgur.com/Ec4giNS.png\" style=\"font-family:Segoe UI;color:#ffffff;line-height:13px;font-weight:700;font-size:12px;letter-spacing:1.5px;text-transform:uppercase;text-decoration:none\"></a> </td></tr>"; } str += "</tr></tbody></table></td></tr></tbody></table></td></tr>"; //footer str += "</table></td></tr></table></td></tr></table><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"table-layout: fixed;\"><tr>" + "<td bgcolor=\"#FA7318\" align=\"center\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\"><tr><td style=\"padding: 20px 0px 20px 0px;\">" + "<table width=\"500\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\" class=\"responsive-table\"><tr><td align=\"center\" valign=\"middle\" style=\"font-size: 12px; line-height: 18px; font-family: Helvetica, Arial, sans-serif; color:#FFF;\">" + "<span class=\"appleFooter\" style=\"color:#FFF;\">Copyright © 2015 <a href=\"#\" style=\"color:#000;\">Socioboard</a>. All rights reserved.</span>" + "<br><a href=\"#\" class=\"original-only\" style=\"color: #FFF;\">Unsubscribe</a><span class=\"original-only\" style=\"font-family: Arial, sans-serif; font-size: 12px; color: #CCC;\"> | </span><a style=\"color: #FFF; text-decoration: none;\">If you do not want to recieve emails from us, you can unsubscribe.</a>" + "</td></tr></table></td></tr></table></td></tr></table></div></div></div></body></html>"; string subject = _GroupName + "'s Social Medial Activity Summary for " + date; string userid = "*****@*****.**"; string password = "******"; //string fromEmail = "*****@*****.**"; //string ret = MailHelper.SendMailBySendGrid(str, subject, userid, password, "Sumit Ghosh", fromEmail, "*****@*****.**"); //string ret = MailHelper.SendMailByMandrill("", 0, "*****@*****.**", "0apEyztJdCzofdx5N7P_5Q", email, subject, str, "Sumit Ghosh"); string ret = MailHelper.SendMailBySmtp(str, subject, userid, password, "*****@*****.**"); return ret; }
public void SocialMediaStat_7() { Api.User.User ApiUser = new Api.User.User(); Api.AdminUserDetails.AdminUserDetails ApiAdminUserDetails = new Api.AdminUserDetails.AdminUserDetails(); Api.TwitterAccount.TwitterAccount ApiTwitterAccount = new Api.TwitterAccount.TwitterAccount(); Api.FacebookAccount.FacebookAccount ApiFacebookAccount = new Api.FacebookAccount.FacebookAccount(); Api.InboxMessages.InboxMessages ApiInboxMessages = new Api.InboxMessages.InboxMessages(); Api.TwitterDirectMessages.TwitterDirectMessages ApiTwitterDirectMessages = new Api.TwitterDirectMessages.TwitterDirectMessages(); Api.ScheduledMessage.ScheduledMessage ApiScheduledMessage = new Api.ScheduledMessage.ScheduledMessage(); Api.TeamMemberProfile.TeamMemberProfile ApiTeamMemberProfile = new Api.TeamMemberProfile.TeamMemberProfile(); Api.Team.Team ApiTeam = new Api.Team.Team(); Api.Groups.Groups ApiGroups = new Api.Groups.Groups(); Api.InstagramAccount.InstagramAccount ApiInstagramAccount = new Api.InstagramAccount.InstagramAccount(); Api.GroupReports.GroupReports ApiGroupReports = new Api.GroupReports.GroupReports(); string email = string.Empty; List<Team> lstTeam = (List<Team>)new JavaScriptSerializer().Deserialize(ApiTeam.GetAllActiveTeam(), typeof(List<Team>)); foreach (Team item_team in lstTeam) { string TwitterProfileId = string.Empty; string FacebookProfileId = string.Empty; string FacebookPageProfileId = string.Empty; string InstagramProfileId = string.Empty; int TotalLikes = 0; int TalkingAbout = 0; int PageLike = 0; int PageUnlike = 0; int PageImpression = 0; int objFacebookAccount = 0; SocialStat _SocialStat = new Domain.SocialStat(); //List<TwitterAccount> lstTwitterAccount =(List<TwitterAccount>)new JavaScriptSerializer().Deserialize(ApiTwitterAccount.getAllTwitterAccountsOfUser(item_user.Id.ToString()), typeof(List<TwitterAccount>)); Groups _Groups = (Groups)new JavaScriptSerializer().Deserialize(ApiGroups.GetGroupDetailsByGroupId(item_team.GroupId.ToString()), typeof(Groups)); double days = DateTime.Now.Subtract(_Groups.EntryDate).TotalDays; int mod = Convert.ToInt32(days) % 7; if (mod == 0) { List<TeamMemberProfile> lstTeamMemberProfile = (List<TeamMemberProfile>)new JavaScriptSerializer().Deserialize(ApiTeamMemberProfile.getAllTeamMemberProfilesOfTeam(item_team.Id.ToString()), typeof(List<TeamMemberProfile>)); Dictionary<TwitterAccount, List<InboxMessages>> lsttwitterfollower = new Dictionary<TwitterAccount, List<InboxMessages>>(); //Dictionary<FacebookAccount, FbPageStat> lstFacebookStats = new Dictionary<FacebookAccount, Domain.FbPageStat>(); //List<FbPageStat> lstFacebookStats = new List<Domain.FbPageStat>(); FacebookStat _FacebookStat = new Domain.FacebookStat(); List<FacebookAccount> lstFacebookProfiles = new List<FacebookAccount>(); List<FacebookAccount> lastFacebookPage = new List<FacebookAccount>(); List<InstagramAccount> lstInstagramAccount = new List<InstagramAccount>(); FbPageStat _FbPageStat = new Domain.FbPageStat(); string FollowerIds = string.Empty; foreach (TeamMemberProfile item_TeamMemberProfile in lstTeamMemberProfile) { if (!string.IsNullOrEmpty(item_TeamMemberProfile.ProfileId) && item_TeamMemberProfile.ProfileType == "twitter") { TwitterProfileId += item_TeamMemberProfile.ProfileId + ","; TwitterAccount _TwitterAccount = (TwitterAccount)new JavaScriptSerializer().Deserialize(ApiTwitterAccount.GetTwitterAccountDetailsById(_Groups.UserId.ToString(), item_TeamMemberProfile.ProfileId), typeof(TwitterAccount)); List<InboxMessages> lstfollowers = (List<InboxMessages>)(new JavaScriptSerializer().Deserialize(ApiInboxMessages.GetTwitterFollowers(_Groups.UserId.ToString(), item_TeamMemberProfile.ProfileId, "1"), typeof(List<InboxMessages>))); foreach (InboxMessages item in lstfollowers) { FollowerIds += item.FromId + ","; } lsttwitterfollower.Add(_TwitterAccount, lstfollowers); } if (!string.IsNullOrEmpty(item_TeamMemberProfile.ProfileId) && item_TeamMemberProfile.ProfileType == "facebook") { FacebookAccount _FacebookAccount = (FacebookAccount)new JavaScriptSerializer().Deserialize(ApiFacebookAccount.getFacebookAccountDetailsById(_Groups.UserId.ToString(), item_TeamMemberProfile.ProfileId), typeof(FacebookAccount)); lstFacebookProfiles.Add(_FacebookAccount); } if (!string.IsNullOrEmpty(item_TeamMemberProfile.ProfileId) && item_TeamMemberProfile.ProfileType == "facebook_page") { FacebookAccount _FacebookAccount = (FacebookAccount)new JavaScriptSerializer().Deserialize(ApiFacebookAccount.getFacebookAccountDetailsById(_Groups.UserId.ToString(), item_TeamMemberProfile.ProfileId), typeof(FacebookAccount)); if (!string.IsNullOrEmpty(_FacebookAccount.AccessToken)) { JObject fbaccountdetails = _FacebookStat.GetFacebookPageDetails(_FacebookAccount.FbUserId, _FacebookAccount.AccessToken); string totalLikes = fbaccountdetails["likes"].ToString(); string talkingAbout = fbaccountdetails["talking_about_count"].ToString(); int fblikers = _FacebookStat.GetFacebookNewLiker(_FacebookAccount.FbUserId, _FacebookAccount.AccessToken, 7); int fbunliker = _FacebookStat.GetFacebookUnliker(_FacebookAccount.FbUserId, _FacebookAccount.AccessToken, 7); int fbimpression = _FacebookStat.GetFacebookImpression(_FacebookAccount.FbUserId, _FacebookAccount.AccessToken, 7); lastFacebookPage.Add(_FacebookAccount); TotalLikes += Int32.Parse(totalLikes); TalkingAbout += Int32.Parse(talkingAbout); PageLike += fblikers; PageUnlike += fbunliker; PageImpression += fbimpression; } } if (!string.IsNullOrEmpty(item_TeamMemberProfile.ProfileId) && item_TeamMemberProfile.ProfileType == "instagram") { InstagramAccount _InstagramAccount = (InstagramAccount)new JavaScriptSerializer().Deserialize(ApiInstagramAccount.UserInformation(_Groups.UserId.ToString(), item_TeamMemberProfile.ProfileId), typeof(InstagramAccount)); InstagramProfileId += item_TeamMemberProfile.ProfileId + ","; lstInstagramAccount.Add(_InstagramAccount); } } try { TwitterProfileId = TwitterProfileId.Substring(0, TwitterProfileId.Length - 1); } catch (Exception e) { TwitterProfileId = string.Empty; Console.WriteLine(e.Message); } try { InstagramProfileId = InstagramProfileId.Substring(0, InstagramProfileId.Length - 1); } catch (Exception e) { InstagramProfileId = string.Empty; Console.WriteLine(e.Message); } try { FollowerIds = FollowerIds.Substring(0, FollowerIds.Length - 1); } catch (Exception ex) { FollowerIds = string.Empty; } string sexratio = ApiGroupReports.GetSexRatio(FollowerIds); string male = "0"; string female = "0"; string _male = "0"; string _female = "0"; try { male = sexratio.Split(',')[0]; female = sexratio.Split(',')[1]; } catch (Exception ex) { male = "0"; female = "0"; } try { _male = (Int32.Parse(male) / (Int32.Parse(male) + Int32.Parse(female)) * 100).ToString(); } catch (Exception ex) { _male = "0"; } try { _female = (Int32.Parse(female) / (Int32.Parse(male) + Int32.Parse(female)) * 100).ToString(); } catch (Exception ex) { _female = "0"; } _FbPageStat.TotalLikes = TotalLikes.ToString(); _FbPageStat.TalkingAbout = TalkingAbout.ToString(); _FbPageStat.PageLike = PageLike.ToString(); _FbPageStat.PageUnlike = PageUnlike.ToString(); _FbPageStat.PageImpression = PageImpression.ToString(); _FbPageStat.lstFacebookAccount = lstFacebookProfiles; _FbPageStat.lstFacebookpage = lastFacebookPage; _SocialStat.male = _male; _SocialStat.female = _female; _SocialStat.Mentions = ApiInboxMessages.GetTwitterMentionCount(_Groups.UserId.ToString(), TwitterProfileId, "7"); _SocialStat.Retweets = ApiInboxMessages.GetTwitterRetweetCount(_Groups.UserId.ToString(), TwitterProfileId, "7"); _SocialStat.New_Followers = ApiInboxMessages.GetTwitterFollowersCount(_Groups.UserId.ToString(), TwitterProfileId, "7"); _SocialStat.Messages_Sent = (Int32.Parse(ApiScheduledMessage.GetSentMessageCount(_Groups.UserId.ToString(), TwitterProfileId, "7")) + Int32.Parse(ApiTwitterDirectMessages.GetTwitterDirectMessageSentCount(_Groups.UserId.ToString(), TwitterProfileId, "7"))).ToString(); _SocialStat.Clicks = ApiScheduledMessage.GetClickCount(_Groups.UserId.ToString(), TwitterProfileId, "7"); _SocialStat.Direct_Message = ApiTwitterDirectMessages.GetTwitterDirectMessageRecievedCount(_Groups.UserId.ToString().ToString(), TwitterProfileId, "7"); _SocialStat.lsttwitterfollower = lsttwitterfollower; InstagramStat _InstagramStat = new Domain.InstagramStat(); _InstagramStat.NewFollowers = ApiInboxMessages.GetInstagramFollower(_Groups.UserId.ToString(), InstagramProfileId, "7"); _InstagramStat.NewFollowings = ApiInboxMessages.GetInstagramFollowing(_Groups.UserId.ToString(), InstagramProfileId, "7"); _InstagramStat.ImageCount = ApiInstagramAccount.GetInstagramImageCount(InstagramProfileId, "7"); _InstagramStat.VideoCount = ApiInstagramAccount.GetInstagramVideosCount(InstagramProfileId, "7"); _InstagramStat.LikesCount = ApiInstagramAccount.GetInstagramLikesCount(InstagramProfileId, "7"); _InstagramStat.CommentCount = ApiInstagramAccount.GetInstagramCommentCount(InstagramProfileId, "7"); _InstagramStat.lstInstagramAccount = lstInstagramAccount; string ret = MailSender.SendGroupReporsByDay(_Groups.GroupName, "*****@*****.**", _SocialStat, _FbPageStat, _InstagramStat, 7); } } }