Nu skickar vi mail till deltagarna !
This commit is contained in:
@ -154,9 +154,44 @@ namespace TrackerUI
|
||||
LoadMatchups((int)roundDropDown.SelectedItem);
|
||||
}
|
||||
|
||||
private string ValidateData()
|
||||
{
|
||||
string output = "";
|
||||
double teamOneScore = 0;
|
||||
double teamTwoScore = 0;
|
||||
|
||||
bool scoreOneValid = double.TryParse(teamOneScoreValue.Text, out teamOneScore);
|
||||
bool scoreTwoValid = double.TryParse(teamTwoScoreValue.Text, out teamTwoScore);
|
||||
|
||||
if (!scoreOneValid )
|
||||
{
|
||||
output = "The score One is not a valid number.";
|
||||
}
|
||||
else if (!scoreTwoValid)
|
||||
{
|
||||
output = "The score Tow is not a valid number.";
|
||||
}
|
||||
else if (teamOneScore == 0 && teamTwoScore == 0)
|
||||
{
|
||||
output = "You did not enter a score for either team.";
|
||||
}
|
||||
else if (teamOneScore == teamTwoScore)
|
||||
{
|
||||
output = "We do not allow ties in this application.";
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
private void scoreButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var errorMessage = ValidateData();
|
||||
if (errorMessage.Length>0)
|
||||
{
|
||||
MessageBox.Show($"Input Error: {errorMessage}");
|
||||
return;
|
||||
}
|
||||
|
||||
MatchupModel m = (MatchupModel)MatchUpListBox.SelectedItem;
|
||||
double teamOneScore = 0;
|
||||
double teamTwoScore = 0;
|
||||
@ -199,8 +234,16 @@ namespace TrackerUI
|
||||
}
|
||||
}
|
||||
|
||||
TournamentLogic.UpdateTournamentResults(tournament);
|
||||
try
|
||||
{
|
||||
TournamentLogic.UpdateTournamentResults(tournament);
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"The application had the following error :{ex.Message}");
|
||||
return;
|
||||
}
|
||||
LoadMatchups((int)roundDropDown.SelectedItem);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user