Esempio n. 1
0
        private async void AddHallBtn_Click(object sender, EventArgs e)
        {
            AddEditHallForm form = new AddEditHallForm(_menuForm, this, _cinemaName, _cinemaLoactin, _cinemaId)
            {
            };

            form.Show();

            form.Opacity = 0;
            while (form.Opacity < 1.0)
            {
                await Task.Delay(15);

                form.Opacity += 0.05;
            }
            form.Opacity = 1;
        }
Esempio n. 2
0
        private async void dgvHalls_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                var hallId  = dgvHalls.Rows[e.RowIndex].Cells["HallId"].Value;
                var action  = dgvHalls.Columns[e.ColumnIndex].Name;
                var hallApi = new APIService("halls");
                var hall    = await hallApi.GetById <Model.Hall>(hallId);

                CustomMessageBox messageBox = new CustomMessageBox();
                if (action == "Edit")
                {
                    AddEditHallForm form = new AddEditHallForm(_menuForm, this, _cinemaName, _cinemaLoactin, _cinemaId, int.Parse(hallId.ToString()))
                    {
                    };
                    form.Show();

                    form.Opacity = 0;
                    while (form.Opacity < 1.0)
                    {
                        await Task.Delay(15);

                        form.Opacity += 0.05;
                    }
                    form.Opacity = 1;
                }
                else if (action == "Delete")
                {
                    DialogResult dialogResult = MessageBox.Show($"Are you sure you want to delete the hall '{hall.HallName} {hall.HallNumber}' in '{_cinemaName}'?", "Delete hall", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        Helper helper = new Helper();
                        await hallApi.Delete <Model.Hall>(hallId);

                        helper.CloseForm(this, 15);
                        CinemasHallsForm form = new CinemasHallsForm(_menuForm, _cinemaId, _cinemaName, _cinemaLoactin);
                        helper.ShowForm(form, 15);
                        messageBox.Show("Hall deleted successfully", "success");
                    }
                }
            }
        }