Beispiel #1
0
        private void metroButton3_Click(object sender, EventArgs e)
        {
            DialogResult res = MetroMessageBox.Show(this, "Do you really want to remove this league?", "Remove league.",
                                                    MessageBoxButtons.YesNo, MessageBoxIcon.Error);

            if (res == DialogResult.Yes)
            {
                int    row     = leaguesGrid.CurrentCell.RowIndex;
                var    ID      = Int32.Parse(leaguesGrid[leaguesGrid.ColumnCount - 1, row].Value.ToString());
                League handler = repo.GetById(ID);
                try
                {
                    repo.Delete(handler);
                }
                catch (Exception)
                {
                    MetroMessageBox.Show(this,
                                         "We are sorry but you can't delete element which other elements depend on. Please remove all elements depending on this one and then try again.",
                                         "Whoops!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                update();
            }
        }