diff --git a/TrackerLibrary/SMSLogic.cs b/TrackerLibrary/SMSLogic.cs
new file mode 100644
index 0000000..4c93245
--- /dev/null
+++ b/TrackerLibrary/SMSLogic.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Twilio;
+using Twilio.Rest.Api.V2010.Account;
+using Twilio.Types;
+
+namespace TrackerLibrary
+{
+ public class SMSLogic
+ {
+ public static void SendSMSMessage(string to, string textMessage)
+ {
+ string accountSid = GlobalConfig.AppKeyLookup("smsAccountSid");
+ string authToken = GlobalConfig.AppKeyLookup("smsAuthToken");
+ string fromPhoneNumber = GlobalConfig.AppKeyLookup("smsFromPhoneNumber");
+
+ TwilioClient.Init(accountSid, authToken);
+
+ var message = MessageResource.Create(
+ to: new PhoneNumber(to),
+ from: new PhoneNumber(fromPhoneNumber),
+ body: textMessage
+ );
+ }
+ }
+}
diff --git a/TrackerLibrary/TournamentLogic.cs b/TrackerLibrary/TournamentLogic.cs
index 526bf7a..f8258da 100644
--- a/TrackerLibrary/TournamentLogic.cs
+++ b/TrackerLibrary/TournamentLogic.cs
@@ -73,38 +73,43 @@ namespace TrackerLibrary
private static void AlertPersonToNewRound(PersonModel p, string teamName, MatchupEntryModel competitor)
{
- if (p.EmailAddress.Length == 0)
+ if (p.EmailAddress.Length > 0)
{
- return;
+ string subject;
+ StringBuilder body = new StringBuilder();
+
+ if (competitor != null)
+ {
+ subject = $"You have a new matchup with {competitor.TeamCompeting.TeamName}";
+
+ body.AppendLine("
You Have a new matchup
");
+ body.Append("Competitor: ");
+ body.Append(competitor.TeamCompeting.TeamName);
+ body.AppendLine();
+ body.AppendLine();
+ body.AppendLine("Have a great time!");
+ body.AppendLine("~Tournament Tracker");
+ }
+ else
+ {
+ subject = "You have a bye week this round";
+
+ body.AppendLine("Enjoy your round off!");
+ body.AppendLine("~Tournament Tracker");
+ }
+
+ string to = p.EmailAddress;
+
+
+ EmailLogic.SendEmail(to, subject, body.ToString());
}
- string subject;
- StringBuilder body = new StringBuilder();
- if (competitor != null)
+
+ if (p.CellPhoneNumber.Length > 0)
{
- subject = $"You have a new matchup with {competitor.TeamCompeting.TeamName}";
-
- body.AppendLine("You Have a new matchup
");
- body.Append("Competitor: ");
- body.Append(competitor.TeamCompeting.TeamName);
- body.AppendLine();
- body.AppendLine();
- body.AppendLine("Have a great time!");
- body.AppendLine("~Tournament Tracker");
+ SMSLogic.SendSMSMessage(p.CellPhoneNumber, $"You have a new matchup with {competitor.TeamCompeting.TeamName}");
}
- else
- {
- subject = "You have a bye week this round";
-
- body.AppendLine("Enjoy your round off!");
- body.AppendLine("~Tournament Tracker");
- }
-
- string to = p.EmailAddress;
-
-
- EmailLogic.SendEmail(to, subject, body.ToString()); ;
}
private static int CheckCurrentRound(this TournamentModel model)
diff --git a/TrackerLibrary/TrackerLibrary.csproj b/TrackerLibrary/TrackerLibrary.csproj
index 5c34207..553058a 100644
--- a/TrackerLibrary/TrackerLibrary.csproj
+++ b/TrackerLibrary/TrackerLibrary.csproj
@@ -37,15 +37,31 @@
..\packages\Dapper.2.0.30\lib\net461\Dapper.dll
+
+ ..\packages\Microsoft.IdentityModel.Logging.1.1.2\lib\net451\Microsoft.IdentityModel.Logging.dll
+
+
+ ..\packages\Microsoft.IdentityModel.Tokens.5.1.2\lib\net451\Microsoft.IdentityModel.Tokens.dll
+
+
+ ..\packages\Newtonsoft.Json.10.0.1\lib\net45\Newtonsoft.Json.dll
+
+
+ ..\packages\System.IdentityModel.Tokens.Jwt.5.1.2\lib\net451\System.IdentityModel.Tokens.Jwt.dll
+
+
+
+ ..\packages\Twilio.5.39.1\lib\net451\Twilio.dll
+
@@ -62,9 +78,11 @@
+
+
diff --git a/TrackerLibrary/app.config b/TrackerLibrary/app.config
new file mode 100644
index 0000000..dde2c3c
--- /dev/null
+++ b/TrackerLibrary/app.config
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/TrackerLibrary/packages.config b/TrackerLibrary/packages.config
index e1845fe..54f047e 100644
--- a/TrackerLibrary/packages.config
+++ b/TrackerLibrary/packages.config
@@ -2,4 +2,9 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/TrackerUI/App.config b/TrackerUI/App.config
index 071a665..7631f09 100644
--- a/TrackerUI/App.config
+++ b/TrackerUI/App.config
@@ -1,25 +1,36 @@
-
+
-
+
-
-
-
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file