Before implementing save to textfiles

This commit is contained in:
2020-04-06 23:50:25 +02:00
parent d6f251c822
commit 137d012ab3
7 changed files with 123 additions and 8 deletions

View File

@ -41,7 +41,7 @@ namespace TrackerUI
private void addTeamButton_Click(object sender, EventArgs e)
{
TeamModel t = (TeamModel)selectTeamDropDown.SelectedItem;
if(t != null)
if (t != null)
{
availableTeams.Remove(t);
selectedTeams.Add(t);
@ -104,6 +104,32 @@ namespace TrackerUI
private void createTournamentButton_Click(object sender, EventArgs e)
{
//Validate data
decimal fee = 0;
bool feeAcceptable = decimal.TryParse(entryFeeValue.Text, out fee);
if (!feeAcceptable)
{
MessageBox.Show("You need to enter a valid Entry Fee.",
"Invalid Fee",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
return;
}
// Create our tournament model
TournamentModel tm = new TournamentModel();
tm.TournamentName = tournamentNameValue.Text;
tm.EntryFee = fee;
tm.Prizes = selectedPrizes;
tm.EnteredTeams = selectedTeams;
// Wireup our matchups
// Finally create the tournament entry
// Create all of the prizes entries
// Create all of team entries
GlobalConfig.Connection.CreateTournament(tm);
}
}