Exemplo n.º 1
0
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            decimal fee           = 0;
            bool    feeAcceptable = decimal.TryParse(entryFeeValue.Text, out fee);

            if (!feeAcceptable)
            {
                MessageBox.Show("You need to enter valid entry fee",
                                "Invalid entry fee value",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }

            Tournament tm = new Tournament();

            tm.TournamentName = tournamentNameValue.Text;
            tm.EntryFee       = fee;
            tm.Prizes         = selectedPrizes;
            tm.EnteredTeams   = selectedTeams;

            TournamentLogic.CreateRounds(tm);

            GlobalConfig.Connection.CreateTournament(tm);
            tm.AlertUsersToNewRound();

            TournamentViewerForm form = new TournamentViewerForm(tm);

            form.Show();
            this.Close();
        }
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            //Validate entry fields
            decimal entry         = 0;
            bool    feeAcceptable = decimal.TryParse(entryFeeValue.Text, out entry);

            if (!feeAcceptable)
            {
                MessageBox.Show("Fee is invalid. Try again", "Invalid Fee", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            TournamentModel tour = new TournamentModel();

            tour.TournamentName = tournamentNameValue.Text;
            tour.EntryFee       = entry;
            tour.Prizes         = selectedPrizes;
            tour.EnteredTeams   = selectedTeams;

            GlobalConfig.Connection.CreateTournament(tour);

            //Todo - create matchups
            TournamentLogic.CreateRounds(tour);

            tournamentNameValue.Text = "";
            entryFeeValue.Text       = "";
            WireUpLists();
        }
Exemplo n.º 3
0
        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;

            // TODO: Wire our matchups
            TournamentLogic.CreateRounds(tm);

            // Create Tournament Entry
            // Create all of the prizes entries
            // Create all of team etnries
            GlobalConfig.Connection.CreateTournament(tm);
        }
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            //Create matchups
            if (ValidateForm())
            {
                TournamentModel tournament = new TournamentModel(
                    tournamentNameValue.Text,
                    entryFeeValue.Text,
                    selectedTeams,
                    selectedPrizes);

                //Wire up Matchups
                TournamentLogic.CreateRounds(tournament);



                GlobalConfig.Connection.CreateTournament(tournament);

                callingForm.TournamentComplete(tournament);

                this.Close();
            }
            else
            {
                MessageBox.Show("This form has invalid information. Please check and try again.",
                                "Invalid Information",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
        private void CreateTournamentButton_Click(object sender, EventArgs e)
        {
            // Validate the entry fee data

            bool feeAcceptable = decimal.TryParse(entryFeeValue.Text, out decimal 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
            {
                TournamentName = tournamentNameValue.Text,
                EntryFee       = fee,
                Prizes         = selectedPrizes,
                EnteredTeams   = selectedTeams,
            };

            // Wires our Matchups
            // 1. order our list randomly of teams
            // 2. Check if it is big enough, - if not, add in byes - 2*2*2*2
            // 3. Create our first round of matchups
            // 4. Create every round after that - e.g. - 8 matchups - 4 matchups - 2 matchups - 1 matchup
            TournamentLogic.CreateRounds(tm);
            // Create Tournament entry
            // Create all of the prizes entries
            // Create all of the team entries
            GlobalConfig.Connection.CreateTournament(tm);
        }
Exemplo n.º 6
0
        private void btnCreateTournament_Click(object sender, System.EventArgs e)
        {
            // Validate Data
            bool feeValid = decimal.TryParse(textBoxEntryFee.Text, out decimal fee);

            if (!feeValid)
            {
                MessageBox.Show("Please enter a valid entry fee.",
                                "Invalid Fee",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);

                return;
            }

            if (textBoxTournamentName.Text.Length < 1)
            {
                MessageBox.Show("Please enter a valid tournament name.",
                                "Invalid Name",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);

                return;
            }

            if (selectedTeams.Count < 1)
            {
                MessageBox.Show("At least 1 team must be entered.",
                                "Invalid Teams",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);

                return;
            }

            // Create tournament model
            TournamentModel tm = new TournamentModel();

            tm.TournamentName = textBoxTournamentName.Text;
            tm.EntryFee       = fee;
            tm.Prizes         = selectedPrizes;
            tm.EnteredTeams   = selectedTeams;

            //Wireup / Create Matchups
            TournamentLogic.CreateRounds(tm);

            // Create Tournament Entry
            // Create all of the prizes entries
            // Create all of the team entries
            GlobalConfig.Connection.CreateTournament(tm);

            tm.AlertUsersToNewRound();

            TournamentViewerForm frm = new TournamentViewerForm(tm);

            frm.Show();
            this.Close();
        }
Exemplo n.º 7
0
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            // Validate data

            string tournamentName = tournamentNameValue.Text;

            if (tournamentName == Tournament_Resource.TournamentNamePlaceholder)
            {
                MessageBox.Show(Tournament_Resource.InvalidNameDescription,
                                Tournament_Resource.InvalidNameCaption,
                                MessageBoxButtons.OK, MessageBoxIcon.Error);

                tournamentNameValue.Focus();

                return;
            }

            decimal fee          = 0;
            bool    feeAceptable = decimal.TryParse(entryFeeValue.Text, out fee);

            if (!feeAceptable)
            {
                MessageBox.Show(Tournament_Resource.InvalidFeeDescription,
                                Tournament_Resource.InvalidFeeCaption,
                                MessageBoxButtons.OK, MessageBoxIcon.Error);

                entryFeeValue.Focus();

                return;
            }
            // Create our tournament model
            TournamentModel tm = new TournamentModel();

            tm.TournamentName = tournamentNameValue.Text;
            tm.EntryFee       = fee;

            tm.Prizes       = selectedPrizes;
            tm.EnteredTeams = selectedTeams;

            // Wire our matchups
            TournamentLogic.CreateRounds(tm);


            // Create Tournament entry
            // Create all of the prizes entries
            // Create all of team entries
            GlobalConfig.Connection.CreateTournament(tm);

            tm.AlertUsersToNewRound();

            TournamentViewerForm frm = new TournamentViewerForm(tm);

            frm.Show();
            this.Close();
        }
        private void CreateTournamentButton_Click(object sender, EventArgs e)
        {
            TournamentModel tm = new TournamentModel();

            decimal fee           = 0;
            bool    FeeAccaptable = decimal.TryParse(EntryFeeTextBox.Text, out fee);

            tm.TournamentName = EnterTournamentNameTextBox.Text;
            tm.EntryFee       = fee;
            tm.Prizes         = SelectedPrizes;
            tm.EnterdTeams    = selectedTeams;

            TournamentValidator validation = new TournamentValidator();
            var    result  = validation.Validate(tm);
            string message = "";

            if (!result.IsValid)
            {
                foreach (ValidationFailure res in result.Errors)
                {
                    message += $"{res}\n";
                }
                MessageBox.Show(message,
                                "error",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }
            if (!FeeAccaptable)
            {
                MessageBox
                .Show("entry fee is not a valid number ", "error",
                      MessageBoxButtons.OK,
                      MessageBoxIcon.Error);
                return;
            }



            TournamentLogic.CreateRounds(tm);

            GlobalConfig.Connaction.CreateTournament(tm);

            tm.AlertUsersToNewRound();


            TournamentViewerForm frm = new TournamentViewerForm(tm);

            frm.Show();
            this.Close();
        }
        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;

            if (decimal.TryParse(entryFeeValue.Text, out decimal convFee))
            {
                tm.EntryFee = convFee;
            }
            else
            {
                tm.EntryFee = 0;
            }

            tm.Prizes       = selectedPrizes;
            tm.EnteredTeams = selectedTeams;

            // Wire our matchups
            TournamentLogic.CreateRounds(tm);


            // Create Tournament entry
            // Create all of the prizes entries
            // Create all of the team entries
            GlobalConfig.Connection.CreateTournament(tm);

            tm.AlertUsersToNewRound();

            TournamentViewerForm frm = new TournamentViewerForm(tm);

            frm.Show();
            this.Close();
        }
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            // Validate form data
            decimal fee           = 0;
            bool    feeAcceptable = decimal.TryParse(entryFeeValue.Text, out fee);

            if (!feeAcceptable)
            {
                // TODO: This is a template for the other message boxes
                MessageBox.Show("Entry fee is not a valid number",
                                "Invalid fee",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }

            // Create tournament model
            TournamentModel tm = new TournamentModel();

            tm.TournamentName = tournamentNameValue.Text;
            tm.EntryFee       = fee;

            /* The selectedPrizes is a list and the tm.prizes expects a list
             * a foreach could be used to put everything form one list
             * into the other or ...
             * foreach (PrizeModel prize in selectedPrizes)
             *{
             *    tm.Prizes.Add(prize);
             *}
             * ... just set the list equal to the each other
             */
            tm.Prizes       = selectedPrizes;
            tm.EnteredTeams = selectedTeams;

            // Wire up matchups
            TournamentLogic.CreateRounds(tm);

            // Create Tournament entry
            // Create all of the prize entries
            // Create all of the team entries
            GlobalConfig.Connection.CreateTournament(tm);

            // Email on the creation of the first round
            tm.AlertUsersToNewRound();

            TournamentViewerForm frm = new TournamentViewerForm(tm);

            frm.Show();
            this.Close();
        }
Exemplo n.º 11
0
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            decimal fee = 0;

            bool feeAcceptable = decimal.TryParse(entryFeeValue.Text, out fee);

            if (!feeAcceptable)
            {
                MessageBox.Show("Please enter a valid entry fee",
                                "Invalid Fee",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }

            TournamentModel tm = new TournamentModel();

            tm.TournamentName = tournamentNameValue.Text;
            tm.EntryFee       = fee;
            tm.Prizes         = selectedPrizes;
            tm.EnteredTeams   = selectedTeams;

            // Wire up the matchups
            TournamentLogic.CreateRounds(tm);

            // 1. To create an initial Round, randomize all teams

            // 2. Check if we have enough teams to have an even, 2 teams each, bracket
            // 2, 4, 8, 16, 32.
            // If the we don't have (2, 4, 8, 16 or 32) teams, add in a byeweek or byeteam
            // 14 teams we'll need an additional 2 bye weeks
            // We have the correct number of teams if 2, to the N works

            // 3. Create a 1st round of matchups since it's already from a randomized list of even teams. We already have the information
            // 4. Create every round after the 1st round. We're dividing by 2 now. 8/2 = 4, 4/2 = 2


            // Next we need to save the tournament model or data to a SQL database!
            GlobalConfig.Connection.CreateTournament(tm);

            tm.AlertUsersToNewRound();

            TournamentViewerForm frm = new TournamentViewerForm(tm);

            frm.Show();
            this.Close();
        }
Exemplo n.º 12
0
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            //Validate data

            if (string.IsNullOrWhiteSpace(tournamentNameTextBox.Text))
            {
                MessageBox.Show("Please, enter the tournament name", "Invalid Tournament name.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                tournamentNameTextBox.Focus();
                return;
            }

            decimal fee      = 0;
            bool    validFee = decimal.TryParse(entryFeeTextBox.Text, out fee);

            if (!validFee)
            {
                MessageBox.Show("You need to enter a valid fee.", "Invalid fee.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            //Create our Tournament Model
            TournamentModel tm = new TournamentModel();

            tm.TournamentName = tournamentNameTextBox.Text;
            tm.EntryFee       = fee;
            tm.Prizes         = selectedPrizes;
            tm.EnteredTeams   = selectedTeams;
            tm.Active         = 1;


            TournamentLogic.CreateRounds(tm);


            //Create Tournament Entry
            //Create all of the Prizes Entries
            //Create all of the Team Entries

            GlobalConfig.Connection.CreateTournament(tm);
            tm.AlertUsersToNewRownd();

            MessageBox.Show("Tournament Created.");

            TournamentViewerForm frm = new TournamentViewerForm(tm, _frm);

            frm.Show();

            this.Close();
        }
        private void CreateTournamentButton_Click_1(object sender, EventArgs e)
        {
            //Validate data
            decimal fee = 0;

            bool feeAcceptable = decimal.TryParse(EntryFeeValue.Text, out fee);

            if (fee < 0)
            {
                feeAcceptable = false;
            }
            if (!feeAcceptable)
            {
                MessageBox.Show("You need to enter a valid Entry Fee.",
                                "Invalid Fee",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }

            // Create our Tournament
            TournamentModel tm = new TournamentModel
            {
                TournamentName = TournamentNameValue.Text,
                EntryFee       = fee,
                Prizes         = selectedPrizes,
                EnteredTeams   = selectedTeams
            };


            //Wire up matchups
            TournamentLogic.CreateRounds(tm);

            //create tournament entry
            //create all of the prize entries
            //create all of the team entires
            GlobalConfig.Connection.CreateTournament(tm);
            //TournamentLogic.UpdateTournamentResults(tm);

            tm.AlertUsersToNewRound();

            TournamentViewerForm frm = new TournamentViewerForm(tm);

            frm.Show();
            this.Close();
        }
        private void CreateTournamentButton_Click(object sender, EventArgs e)
        {
            // Validate data
            decimal fee = 0;

            bool feeAcceptable = decimal.TryParse(entryFeeValue.Text, out fee); // send 0 to fee, and returns false, if not valid

            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; //decimal.TryParse(entryFeeValue).Text; // parse might crash the program, if input not valid

            tm.Prizes       = selectedPrizes;
            tm.EnteredTeams = selectedTeams;

            /*
             * foreach(PrizeModel prize in selectedPrizes)
             * {
             *  tm.Prizes.Add(prize);
             * }
             */

            // TODO - Wire our matchups
            TournamentLogic.CreateRounds(tm);

            // Order our list randomly of teams
            // Check if it is big enough - if not, add in byes - 2^n
            // Create our first round of matchups
            // Create every round after that - 8 matchups - 4 matchups - 2 matchups - 1 matchup


            // Create Tournament entry
            // Create all of the prizes entries
            // Create all of team entries
            GlobalConfig.Connection.CreateTournament(tm);
        }
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            //Provjera podataka
            decimal fee           = 0;
            bool    feeAcceptable = decimal.TryParse(entryFeeTextbox.Text, out fee);

            if (!feeAcceptable)
            {
                MessageBox.Show("Unesite validan iznos uloga!",
                                "Netacan iznos uloga",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
                return;
            }

            //Napravi CreateTournament Unos

            TournamentModel tm = new TournamentModel();

            tm.TournamentName = tournamentNameTextbox.Text;
            tm.EntryFee       = fee;

            tm.Prizes       = selectedPrizes;
            tm.EnteredTeams = selectedTeams;

            // Spoji meceve sa bazom
            // Promjesaj listu sa timova
            // Provjerimo da li imamo dovoljan broj timova za kompletnu rundu.
            // 2*2*2*2 = 2^4 => 2^n gdje je n broj rundi datog turnira.
            // Kreiramo za pocetak prvu rundu jer ce da se razlikuje od svih ostalih jer u njoj imamo "prazne" timove.
            // Kreiramo sve ostale runde po sablonu

            TournamentLogic.CreateRounds(tm);

            //Napravi unos za sve nagrade
            //Napravi unos za sve timove
            //Napraviti parove ( Ko sa kim igra)
            GlobalConfig.Connection.CreateTournament(tm);

            tm.AlertUsersToNewRound();

            TournamentViewerForm frm = new TournamentViewerForm(tm);

            frm.Show();
            this.Close();
        }
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            // Validate data
            decimal fee = 0;

            bool feeAcceptable = decimal.TryParse(entryFeeTextBox.Text, out fee);

            if (feeAcceptable == false)
            {
                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 = tournamentNameTextBox.Text;
            tm.EntryFee       = fee;

            tm.Prizes       = selectedPrizes;
            tm.EnteredTeams = selectedTeams;

            // Create our matchups
            // Order our list randomly
            // Check if it is big enough and if not, add in byes
            // Create or first round of matchups
            // Create every round after that - 8 matchups -> 4 matchups -> 2 matchups -> 1 matchup
            TournamentLogic.CreateRounds(tm);


            // Create Tournament Entry
            // Create all of the prizes entries
            // Create all of the team entries
            GlobalConfig.Connection.CreateTournament(tm);

            callingForm.TournamentComplete(tm);

            tm.AlertUsersToNewRound();

            Close();
        }
Exemplo n.º 17
0
        private void createTournamentBtn_Click(object sender, EventArgs e)
        {
            if (Validation())
            {
                TournamentModel model = new TournamentModel(eFeeInput.Text);
                model.TournamentName = trnNameInput.Text;
                model.EnteredTeams   = selectedTeams;
                model.Prizes         = selectedPrizes;

                // Create tournament goes here
                TournamentLogic.CreateRounds(model);
                GlobalConfig.Connections.CreateTournament(model);
                this.Close();
            }
            else
            {
                MessageBox.Show("Invalid");
            }
        }
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            if (DataIsValid())
            {
                TournamentModel tm = new TournamentModel();

                tm.TournamentName = tournamentNameValue.Text;
                tm.EntryFee       = Decimal.Parse(entryFeeValue.Text);
                tm.Teams          = selectedTeams;
                tm.Prizes         = selectedPrizes;

                TournamentLogic.CreateRounds(tm);

                GlobalConfig.Connection.CreateTournament(tm);

                callerForm.TournamentComplete(tm);
                this.Close();
            }
        }
Exemplo n.º 19
0
        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;
            }

            TournamentModel tm = new TournamentModel();

            tm.TournamentName = tournamentNameValue.Text;
            tm.EntryFee       = fee;

            tm.Prizes       = selectedPrizes;
            tm.EnteredTeams = selectedTeams;

            // Create all of the matchups
            TournamentLogic.CreateRounds(tm);
            // Order the list randomly of teams
            // check if it is big enough - if not, add in byes
            // 2^4 teams
            // Create every round after that - 8 matchups - 4 matchups - 1 matchup



            // Create Tournament entry
            // Create all of the prizes entries
            // Create all of the team entries
            GlobalConfig.Connection.CreateTournament(tm);

            tm.AlertUsersToNewRound();


            TournamentViewerForm frm = new TournamentViewerForm(tm);

            frm.Show();
            this.Close();
        }
Exemplo n.º 20
0
        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;
            }

            // 1-Create our Tournament model
            TournamnetModel tm = new TournamnetModel();

            tm.TournamentName = tournamentNameValue.Text;
            tm.EntryFee       = fee;

            //foreach (PrizeModel prize in selectedPrizes)
            //{
            //    tm.Prizes.Add(prize);
            //}
            //instead of for loop
            tm.Prizes       = selectedPrizes;
            tm.EnteredTeams = selectedTeams;

            // 2-Create/wire up our matchups
            TournamentLogic.CreateRounds(tm);

            // 3-Create Tournament entry
            // 4-Create all the prizes entries
            // 5-Create all of team entries
            //the next line will do the previous three tasks
            GlobalConfig.Connection.CreateTournament(tm);

            tm.AlertUsersToNewRound();

            TournamentViewerForm frm = new TournamentViewerForm(tm);

            frm.Show();
            this.Close();
        }
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            // Validate data

            bool feeAcceptable = decimal.TryParse(entryFeeValue.Text, out decimal fee);

            if (!feeAcceptable)
            {
                MessageBox.Show(
                    "Entry fee Invalid",
                    "Invalid fee",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
                return;
            }

            // Create oturnament model
            TournamentModel tm = new TournamentModel();

            tm.TournamentName = tournamentNameValue.Text;
            tm.EntryFee       = fee;

            tm.Prizes       = selectedPrizes;
            tm.EnteredTeams = selectedTeams;

            // TODO - Wire our matchups
            TournamentLogic.CreateRounds(tm);

            // Create tournament ID
            // Create all of the prizes entries
            // Create all of the team entries

            GlobalConfig.Connection.CreateTournament(tm);
            tm.AlertUsersToNewRound();

            callingForm.TournamentComplete();
            TournamentViewerForm frm = new TournamentViewerForm(tm, callingForm);

            frm.Show();
            this.Close();
        }
Exemplo n.º 22
0
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            if (TournamentIsValid() == true)
            {
                // Create Tournament entry
                var tm = new TournamentModel();
                tm.TournamentName = tournamentNameTextBox.Text;
                tm.EntryFee       = decimal.Parse(entryFeeTextBox.Text);
                tm.Prizes         = selectedPrizes;
                tm.EnteredTeams   = selectedTeams;

                // Create our matchups
                TournamentLogic.CreateRounds(tm);

                // Create tournament entry
                // Create all of the prizes entries
                // Create all of team entries
                GlobalConfig.Connection.CreateTournament(tm);
            }
        }
Exemplo n.º 23
0
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            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;
            }
            TournamentModel tm = new TournamentModel();

            tm.TournamentName = tournamentNameValue.Text;
            tm.EntryFree      = fee;
            tm.Prizes         = selectedPrizes;
            tm.EnteredTeams   = selectedTeams;
            TournamentLogic.CreateRounds(tm);
            //TODO : wire up mathcup
            GlobalConfig.Connection.CreateTournament(tm);
        }
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            // validate data
            decimal fee           = 0;
            bool    feeAcceptible = decimal.TryParse(entryFeeValue.Text, out fee);

            if (!feeAcceptible)
            {
                MessageBox.Show("Entry Fee not valid.", "Invalid Fee", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (!IsTournamentValid())
            {
                MessageBox.Show("Entered data not valid.", "Invalid Data", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // Create tournament instance
            TournamentModel tm = new TournamentModel();

            tm.TournamentName = tournamentNameValue.Text;
            tm.EntryFee       = fee;
            tm.Prizes         = selectedPrizes;
            tm.EnteredTeams   = selectedTeams;

            // Create matchups
            TournamentLogic.CreateRounds(tm);

            // Create tournament teams and prizes entries
            GlobalConfig.Connection.CreateTournament(tm);

            tm.AlertUsersToNextRound();

            TournamentViewerForm frm = new TournamentViewerForm(tm);

            frm.Show();
            this.Close();
        }
Exemplo n.º 25
0
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            // Validate data
            bool feeAcceptable = decimal.TryParse(entryFeeValue.Text, out decimal fee);

            if (!feeAcceptable)
            {
                MessageBox.Show("You need to enter a valid fee",
                                "Invalid Fee",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);

                return;
            }

            // Create our Tounrnament mode
            TournamentModel tm = new TournamentModel
            {
                TournamentName = tournamentNameValue.Text,
                EntryFee       = fee,
                Prizes         = selectedPrizes,
                EnteredTeams   = selectedTeams
            };


            // wire up Matchups
            TournamentLogic.CreateRounds(tm);

            // Create Tournament Entry
            // Create all of the PrizesEntrys
            // Create all of the TeamEntrys
            GlobalConfig.Connection.CreateTournament(tm);
            tm.AlertUsersToNewRound();

            TournamentViewerForm frm = new TournamentViewerForm(tm);

            frm.Show();
            this.Close();
        }
        private void createTournamentButton_Click(object sender, RoutedEventArgs 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",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return;
            }

            // Create tournament model
            TournamentModel tm = new TournamentModel();

            tm.TournamentName = tournamentNameValue.Text;
            tm.EntryFee       = fee;

            tm.Prizes       = new List <PrizeModel>(SelectedPrizes);
            tm.EnteredTeams = new List <TeamModel>(SelectedTeams);

            // Wire up matchups
            TournamentLogic.CreateRounds(tm);

            // Create Tournament entry
            // Create all of the prize entries
            // Create all of the team entries
            GlobalConfig.Connection.CreateTournament(tm);

            if (!IsWindowOpen <TournamentDashboardWPF>())
            {
                TournamentDashboardWPF wpf = new TournamentDashboardWPF();
                wpf.Show();
            }
            this.Close();
        }
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            //validate data
            decimal fee           = 0;
            bool    feeAcceptable = decimal.TryParse(entryFeeTextBox.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 = tournamentNameTextBox.Text;
            tm.EntryFee       = fee;

            tm.Prizes       = selectedPrizes;
            tm.EnteredTeams = selectedTeams;

            // setup our matchups
            TournamentLogic.CreateRounds(tm);

            //create Tournament entry
            //create all of the prizes entries
            //create all of team entries
            //todo: save entry doesn;t work
            GlobalConfig.Connection.CreateTournament(tm);
            tournamentStatus.Created(true);
            MessageBox.Show("The tournament: " + tm.TournamentName + " has been created successfully!");

            TournamentViewerForm frm = new TournamentViewerForm(tm);

            frm.Show();
            this.Close();
        }
Exemplo n.º 28
0
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            //Validate data
            decimal fee = 0;

            bool feeAcceptable = decimal.TryParse(entryFeeValue.Text, out fee); //tries to convert value to decimal, returns value as fee variable, if wrong value, fee remains 0 and bool = false

            if (!feeAcceptable)
            {
                MessageBox.Show("Enter a valid amount", "Invalid Fee", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            TournamentModel tm = new TournamentModel();

            tm.TournamentName = tournamentNameValue.Text;
            tm.EntryFee       = fee;

            tm.Prizes       = selectedPrizes;
            tm.EnteredTeams = selectedTeams;

            //Create our matchups
            TournamentLogic.CreateRounds(tm);
            //order list randomly
            //check if it is big enough - if not, add in byes

            //Create tournament: Entry
            //Create all prize entries
            //Create all of the team entries
            GlobalConfig.Connection.CreateTournament(tm);

            tm.AlertUsersToNewRound();

            TournamentViewerForm frm = new TournamentViewerForm(tm);

            frm.Show();
            this.Close();
        }
Exemplo n.º 29
0
        private void createTournamentButton_Click(object sender, EventArgs e)
        {
            // se valideaza datele
            decimal fee = 0;

            bool feeAcceptable = decimal.TryParse(entryFeeValue.Text, out fee);

            if (!feeAcceptable)
            {
                MessageBox.Show("Please enter a valid Entry Fee.", "Invalid Fee", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            // se creaza un tournament model
            TournamentModel tm = new TournamentModel();

            tm.TournamentName = tournamentNameValue.Text;
            tm.EntryFee       = 0;

            tm.Prizes       = selectedPrizes;
            tm.EnteredTeams = selectedTeams;

            // se creaza meciurile (cine joaca cu cine - matchups) :
            TournamentLogic.CreateRounds(tm);

            // se craza un entry pentru turneu
            // se creaza prize entries
            // se creaza team entries
            GlobalConfig.Connection.CreateTournament(tm);

            //atentie la email in app.config
            tm.AlertUsersToNewRound();


            TournamentViewerForm frm = new TournamentViewerForm(tm);

            frm.Show();
            this.Close();
        }
Exemplo n.º 30
0
        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;

            // Create our matchups
            TournamentLogic.CreateRounds(tm); // it will put them right in that tournament model variable, because again we don't have to pass it back and forth we pass it in
                                              // now both have that same address that same location therefore they can go on to the next step

            // Create Tournament entry
            // Create all of the Prizes entries
            // Create all of team entries
            GlobalConfig.Connection.CreateTournament(tm);
            tm.AlterUsersToNewRound(); //send the Email of the first round when the tournament is generate

            TournamentViewerForm frm = new TournamentViewerForm(tm);

            frm.Show();
            this.Close();
        }