Esempio n. 1
0
        private void AddCinemaButton_Click(object sender, EventArgs e)
        {
            MenuForm          menuForm = (MenuForm)this.MdiParent;
            AddEditCinemaForm form     = new AddEditCinemaForm(menuForm)
            {
                MdiParent = menuForm,
                Dock      = DockStyle.Fill
            };

            form.Show();
        }
Esempio n. 2
0
        private async void dgvCinemas_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                var cinemaId = dgvCinemas.Rows[e.RowIndex].Cells["CinemaId"].Value;
                var action   = dgvCinemas.Columns[e.ColumnIndex].Name;
                var cinema   = await _apiService.GetById <Model.Cinema>(cinemaId);

                CustomMessageBox messageBox = new CustomMessageBox();
                MenuForm         menuForm   = (MenuForm)this.MdiParent;

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

                        foreach (Form frm in menuForm.MdiChildren)
                        {
                            frm.Close();
                        }
                        CinemasForm form = new CinemasForm {
                            MdiParent = menuForm,
                            Dock      = DockStyle.Fill
                        };
                        form.Show();
                        messageBox.Show("Cinema deleted successfully", "success");
                    }
                }
                else if (action == "Halls")
                {
                    var cinemaName     = dgvCinemas.Rows[e.RowIndex].Cells["Cinema"].Value;
                    var cinemaLocation = dgvCinemas.Rows[e.RowIndex].Cells["Location"].Value;

                    CinemasHallsForm cinemasHallsForm = new CinemasHallsForm(menuForm, int.Parse(cinemaId.ToString()), cinemaName.ToString(), cinemaLocation.ToString())
                    {
                    };

                    _helper.ShowForm(cinemasHallsForm, 18);
                }
                else if (action == "Schedule")
                {
                    ScheduleForm scheduleForm = new ScheduleForm(int.Parse(cinemaId.ToString()), menuForm)
                    {
                        MdiParent = menuForm,
                        Dock      = DockStyle.Fill
                    };
                    scheduleForm.Show();
                }
                else if (action == "Products")
                {
                    var cinemaName = dgvCinemas.Rows[e.RowIndex].Cells["Cinema"].Value;
                    CinemasProductsForm cinemasProductsForm = new CinemasProductsForm(menuForm, int.Parse(cinemaId.ToString()), cinemaName.ToString());
                    _helper.ShowForm(cinemasProductsForm, 18);
                }
                else
                {
                    return;
                }
            }
        }