Exemplo n.º 1
0
        private void AddAppBtn_Click(object sender, EventArgs e)
        {
            var form = new AddEditAppointmentForm(this, _scheduleForm, _schedule, _menuForm, _airingDayId, _date, _day, _cinemaDayMovieId, _movieId, _cinemaDayMovieForm);

            _helper.CloseForm(this, 15);
            _helper.ShowForm(form, 15);
        }
Exemplo n.º 2
0
        private async void dgvAppointments_CellContentClick_1(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                var appointmentId           = dgvAppointments.Rows[e.RowIndex].Cells["AppointmentId"].Value;
                var action                  = dgvAppointments.Columns[e.ColumnIndex].Name;
                CustomMessageBox messageBox = new CustomMessageBox();
                var appApi                  = new APIService("appointments");
                var movieApi                = new APIService("movies");
                var movie = await movieApi.GetById <Model.Movie>(_movieId);

                if (action == "Edit")
                {
                    var form = new AddEditAppointmentForm(this, _scheduleForm, _schedule, _menuForm, _airingDayId, _date, _day, _cinemaDayMovieId, _movieId, _cinemaDayMovieForm, int.Parse(appointmentId.ToString()));
                    _helper.CloseForm(this, 15);
                    _helper.ShowForm(form, 15);
                }
                else if (action == "Delete")
                {
                    DialogResult dialogResult = MessageBox.Show($"Are you sure you want to permanently delete the appointment for '{movie.Title}' on the {DateTime.Parse(_date.ToString()).ToShortDateString()}, {_day}?", "Delete appointment?", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        await appApi.Delete <Model.Appointments>(appointmentId);

                        this.Close();
                        _cinemaDayMovieForm.Close();
                        _scheduleForm.Close();
                        ScheduleForm sch = new ScheduleForm(_schedule.Cinema.CinemaId, _menuForm)
                        {
                            MdiParent = _menuForm,
                            Dock      = DockStyle.Fill
                        };
                        var schedule = await _apiService.CustomGet <Model.Requests.CinemasScheduleRequest>("GetCinemasSchedule", _schedule.Cinema.CinemaId);

                        AppointmentsForm form = new AppointmentsForm(sch, schedule, _menuForm, _airingDayId, _date, _day, _cinemaDayMovieId, _movieId, _cinemaDayMovieForm);

                        sch.Show();
                        _helper.ShowForm(form, 15);
                        messageBox.Show("Appointment deleted successfully", "success");
                    }
                }
            }
        }