private void mnuEditTeam_Click(object sender, EventArgs e)
        {
            frmEditTeam nextForm = new frmEditTeam(this);

            this.Hide();
            nextForm.Show();
        }
Example #2
0
        private void btnEditTeam_Click(object sender, EventArgs e)
        {
            String teamName        = txtTeamName.Text;
            String manager         = txtManager.Text;
            String stadium         = txtStadium.Text;
            String stadiumCapacity = txtStadiumCapacity.Text;
            String location        = txtLocation.Text;
            int    capacity        = Int32.Parse(txtStadiumCapacity.Text);

            DialogResult dialog1 = MessageBox.Show("Are you sure you wish to update these details?", "Confirm",
                                                   MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dialog1 == DialogResult.Yes)
            {
                if (!string.IsNullOrEmpty(teamName) && !string.IsNullOrEmpty(manager) && !string.IsNullOrEmpty(stadium) && !string.IsNullOrEmpty(stadiumCapacity) && !string.IsNullOrEmpty(location))
                {
                    if (txtTeamName.Text != "Manchester United")
                    {
                        if (txtManager.Text != "Pep Guardiola")
                        {
                            if (capacity > 5000)
                            {
                                MessageBox.Show(teamName + " details successfully edited! Returning to team selection screen!");
                                frmEditTeam form2 = new frmEditTeam();
                                this.Hide();
                                form2.ShowDialog();
                            }
                            else
                            {
                                MessageBox.Show("Stadium capacity must be larger than 5000 due to Premier League restrictions!");
                                txtStadiumCapacity.Clear();
                            }
                        }
                        else
                        {
                            MessageBox.Show("This manager already exists in the Premier League!");
                            txtManager.Clear();
                        }
                    }
                    else
                    {
                        MessageBox.Show("This team already exists in the Premier League!");
                        txtTeamName.Clear();
                    }
                }
                else
                {
                    MessageBox.Show("All fields must be filled!");
                }
            }
        }