Exemple #1
0
        private void AddShowBtn_Click(object sender, EventArgs e)
        {
            MenuForm        menuForm = (MenuForm)this.MdiParent;
            AddEditShowForm form     = new AddEditShowForm(menuForm)
            {
                MdiParent = menuForm,
                Dock      = DockStyle.Fill
            };

            form.Show();
        }
Exemple #2
0
        private async void dgvShows_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                var      showId   = dgvShows.Rows[e.RowIndex].Cells["ShowId"].Value;
                var      action   = dgvShows.Columns[e.ColumnIndex].Name;
                MenuForm menuForm = (MenuForm)this.MdiParent;
                var      show     = await _apiService.GetById <Model.Show>(showId);

                CustomMessageBox messageBox = new CustomMessageBox();

                if (action == "Edit" || action == "Title")
                {
                    AddEditShowForm form = new AddEditShowForm(menuForm, int.Parse(showId.ToString()))
                    {
                        MdiParent = menuForm,
                        Dock      = DockStyle.Fill
                    };
                    form.Show();
                }
                else if (action == "Delete")
                {
                    DialogResult dialogResult = MessageBox.Show($"Are you sure you want to permanently delete '{show.Title}'?", "Delete show?", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        await _apiService.Delete <Model.Show>(showId);

                        foreach (Form frm in menuForm.MdiChildren)
                        {
                            frm.Close();
                        }
                        ShowsForm form = new ShowsForm {
                            MdiParent = menuForm,
                            Dock      = DockStyle.Fill
                        };
                        form.Show();
                        messageBox.Show("Show deleted successfully", "success");
                    }
                }
                else
                {
                    return;
                }
            }
        }