示例#1
0
        private void scoreButton_Click(object sender, EventArgs e)
        {
            MatchupModel selectedMatchup = (MatchupModel)MatchupListBox.SelectedItem;

            //Validate Scores Entered
            if (ValidateScoring(selectedMatchup))
            {
                //Add Score to the matchup entry models
                selectedMatchup.Entries.First().Score = double.Parse(teamOneScoreValue.Text);
                selectedMatchup.Entries.Last().Score  = double.Parse(teamTwoScoreValue.Text);

                if (selectedMatchup.Entries.First().Score > selectedMatchup.Entries.Last().Score)
                {
                    selectedMatchup.Winner = selectedMatchup.Entries.First().TeamCompeting;
                }
                else
                {
                    selectedMatchup.Winner = selectedMatchup.Entries.Last().TeamCompeting;
                }
                WireUpMatchupList();
            }
            else
            {
                MessageBox.Show("The scoring is invalid. Please check and try again.");
            }
            if (TournamentLogic.RoundCompleteCheck(tournament))
            {
                TournamentLogic.GenerateNextRound(tournament);
                WireUpMatchupList();
            }


            //Determine if it is the last matchup in the round
            //If it is the last in the round generate the next round
            //Save data to the dbs
        }