Beispiel #1
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            listTeams = new List <Teams>();

            // Confirm
            DialogResult konfirmasi = MessageBox.Show("Data player akan terhapus , Apakah anda yakin?", "Konfirmasi", MessageBoxButtons.YesNo);

            // Confirm yes
            if (konfirmasi == System.Windows.Forms.DialogResult.Yes)
            {
                Teams team = (Teams)comboBoxTeam.SelectedItem;

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

                bool success = Players.DeletePlayer(p, out string exceptionMessage);

                if (success)
                {
                    MessageBox.Show("Player has been deleted.", "information");
                    FormPlayerTeam frm = (FormPlayerTeam)this.Owner;
                    frm.FormPlayerTeam_Load(buttonDelete, e);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Player Failed to deleted. Message error: " + exceptionMessage);
                }
            }
        }
Beispiel #2
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            try
            {
                Teams t = new Teams(int.Parse(textBoxTeamId.Text), textBoxTeamName.Text);
                Teams.EditTeams(t);
                MessageBox.Show("Teams has been edited.", "information");

                FormPlayerTeam formPlayerTeam = (FormPlayerTeam)this.Owner;
                formPlayerTeam.FormPlayerTeam_Load(buttonEdit, e);
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to edited. Message Error: " + ex.Message, "error");
            }
        }
Beispiel #3
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            DialogResult confirm = MessageBox.Show("Team will be deleted. Are you sure?", "Confirm", MessageBoxButtons.YesNo);

            if (confirm == System.Windows.Forms.DialogResult.Yes)
            {
                bool delete = Teams.DeleteTeams(selectedTeamId, out string errorMessage);

                if (delete)
                {
                    MessageBox.Show("Team has been deleted.", "information");
                }
                else
                {
                    MessageBox.Show("Team Failed to deleted. Message error: " + errorMessage);
                }

                // Open form playerteam and close form delete team
                FormPlayerTeam formPlayerTeam = (FormPlayerTeam)this.Owner;
                formPlayerTeam.FormPlayerTeam_Load(buttonDelete, e);
                this.Close();
            }
        }
Beispiel #4
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            DialogResult confirm = MessageBox.Show("Team has been Deleted. Are you sure ?", "confirm", MessageBoxButtons.YesNo);

            if (confirm == System.Windows.Forms.DialogResult.Yes)
            {
                Teams  t   = new Teams(int.Parse(textBoxTeamId.Text), textBoxTeamName.Text);
                string add = Teams.DeleteTeams(t);

                if (add == "1")
                {
                    MessageBox.Show("Team has been deleted.", "information");
                }
                else
                {
                    MessageBox.Show("Team Failed to deleted. Message error: ", add);
                }

                FormPlayerTeam formPlayerTeam = (FormPlayerTeam)this.Owner;
                formPlayerTeam.FormPlayerTeam_Load(buttonDelete, e);
                this.Close();
            }
        }