Esempio n. 1
0
        private void AddMovieBtn_Click(object sender, EventArgs e)
        {
            MenuForm            menuForm = (MenuForm)this.MdiParent;
            AddEditRotationForm form     = new AddEditRotationForm(menuForm)
            {
            };

            _helper.ShowForm(form, 15);
        }
Esempio n. 2
0
        private async void dgvRotations_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                var              rotationId = dgvRotations.Rows[e.RowIndex].Cells["RotationId"].Value;
                var              action     = dgvRotations.Columns[e.ColumnIndex].Name;
                MenuForm         menuForm   = (MenuForm)this.MdiParent;
                CustomMessageBox messageBox = new CustomMessageBox();

                if (action == "Edit")
                {
                    AddEditRotationForm form = new AddEditRotationForm(menuForm, int.Parse(rotationId.ToString()))
                    {
                    };
                    _helper.ShowForm(form, 15);
                }
                else if (action == "Delete")
                {
                    DialogResult dialogResult = MessageBox.Show($"Are you sure you want to permanently delete this rotation?", "Delete rotation?", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        await _apiService.Delete <Model.Rotation>(rotationId);

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