예제 #1
0
        private void FormAddTeam_FormClosed(object sender, FormClosedEventArgs e)
        {
            FormPlayerTeam formPlayerTeam = (FormPlayerTeam)this.Owner;

            formPlayerTeam.FormPlayerTeam_Load(formPlayerTeam, e);
            this.Close();
        }
예제 #2
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            try
            {
                // Get selected team
                Teams team = (Teams)comboBoxTeam.SelectedItem;

                // Create new player
                Players p = new Players(int.Parse(textBoxPlayerId.Text), textBoxPlayerName.Text, textBoxPlayerEmail.Text, team);

                // Edit player and change to the new player object
                Players.EditPlayer(p);

                // Confirmation
                MessageBox.Show("Player has been changed", "Information");

                // Refresh datagridview on FormPlayerTeam
                FormPlayerTeam formPlayerTeam = (FormPlayerTeam)this.Owner;
                formPlayerTeam.FormPlayerTeam_Load(buttonEdit, e);

                // Close form
                this.Close();
            }
            catch (Exception ex)
            {
                // Fail confirmation message
                MessageBox.Show("Player cannot be saved. Error Message: " + ex.Message, "Error");
            }
        }
        private void FormAddPlayer_FormClosed(object sender, FormClosedEventArgs e)
        {
            FormPlayerTeam frm = (FormPlayerTeam)this.Owner;

            frm.FormPlayerTeam_Load(buttonAdd, e);
            this.Close();
        }
예제 #4
0
        private void teamAndPlayerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormPlayerTeam form = new FormPlayerTeam();

            form.Owner = this;
            this.Hide();
            form.ShowDialog();
        }
예제 #5
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            try
            {
                Teams   team = (Teams)comboBoxTeam.SelectedItem;
                Players p    = new Players(int.Parse(textBoxPlayerId.Text), textBoxPlayerName.Text, textBoxPlayerEmail.Text, team);
                Players.EditPlayer(p);
                MessageBox.Show("Player has been changed", "Information");

                FormPlayerTeam formPlayerTeam = (FormPlayerTeam)this.Owner;
                formPlayerTeam.FormPlayerTeam_Load(buttonEdit, e);
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Player cannot be saved. Error Message: " + ex.Message, "Error");
            }
        }