SMS-utskick har lagts till

This commit is contained in:
2020-04-22 23:00:34 +02:00
parent ac1d5371f2
commit f7d8e2a049
6 changed files with 112 additions and 33 deletions

View File

@ -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("<h1>You Have a new matchup</h1>");
body.Append("<strong>Competitor: </strong>");
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("<h1>You Have a new matchup</h1>");
body.Append("<strong>Competitor: </strong>");
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)