private void closeBtn_Click(object sender, EventArgs e) { _helper.CloseForm(this, 15); CinemaDayMovieForm form = new CinemaDayMovieForm(_scheduleForm, _schedule, _menuForm, _airingDayId, _date, _day); _helper.ShowForm(form, 15); }
private async void saveBtn_Click(object sender, EventArgs e) { var movieId = (select.SelectedItem as dynamic).Value; var Object = new Model.CinemaDayMovie() { AiringDaysOfCinemaId = _airingDayId, MovieId = movieId }; APIService cdmService = new APIService("cinemaDayMovie"); await cdmService.Insert <Model.CinemaDayMovie>(Object); this.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); CinemaDayMovieForm form = new CinemaDayMovieForm(sch, schedule, _menuForm, _airingDayId, _date, _day); sch.Show(); _helper.ShowForm(form, 15); var messageBox = new CustomMessageBox(); messageBox.Show("Movie added successfully", "success"); }
public AppointmentsForm(ScheduleForm scheduleForm, Model.Requests.CinemasScheduleRequest schedule, MenuForm menuForm, int airingDayId, DateTime date, string day, int cinemaDayMovieId, int movieId, CinemaDayMovieForm cinemaDayMovieForm) { InitializeComponent(); this.StartPosition = FormStartPosition.Manual; this.Location = new Point(Screen.PrimaryScreen.Bounds.Width - 20 - this.Width, Screen.PrimaryScreen.Bounds.Height - this.Height - AddAppBtn.Height - 20); _scheduleForm = scheduleForm; _schedule = schedule; _airingDayId = airingDayId; _menuForm = menuForm; _date = date; _day = day; _cinemaDayMovieId = cinemaDayMovieId; _movieId = movieId; _cinemaDayMovieForm = cinemaDayMovieForm; }
private async void dgvScheduledMovies_CellContentClick_1(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { var cinemaDayMovieId = dgvScheduledMovies.Rows[e.RowIndex].Cells["CinemaDayMovieId"].Value; var movieId = dgvScheduledMovies.Rows[e.RowIndex].Cells["MovieId"].Value; var action = dgvScheduledMovies.Columns[e.ColumnIndex].Name; var cdmApi = new APIService("cinemaDayMovie"); var movieApi = new APIService("movies"); var cdm = await cdmApi.GetById <Model.CinemaDayMovie>(cinemaDayMovieId); var movie = await movieApi.GetById <Model.Movie>(cdm.MovieId); CustomMessageBox messageBox = new CustomMessageBox(); if (action == "Delete") { DialogResult dialogResult = MessageBox.Show($"Are you sure you want to permanently delete '{movie.Title}' on the {DateTime.Parse(_date.ToString()).ToShortDateString()}, {_day}?", "Delete movie?", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { await cdmApi.Delete <Model.CinemaDayMovie>(cinemaDayMovieId); this.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); CinemaDayMovieForm form = new CinemaDayMovieForm(sch, schedule, _menuForm, _airingDayId, _date, _day); sch.Show(); _helper.ShowForm(form, 15); messageBox.Show("Movie deleted successfully", "success"); } } else if (action == "Apps") { AppointmentsForm form = new AppointmentsForm(_scheduleForm, _schedule, _menuForm, _airingDayId, _date, _day, int.Parse(cinemaDayMovieId.ToString()), int.Parse(movieId.ToString()), this); _helper.CloseForm(this, 15); _helper.ShowForm(form, 15); } } }
public AddEditAppointmentForm(AppointmentsForm appointmentsForm, ScheduleForm scheduleForm, Model.Requests.CinemasScheduleRequest schedule, MenuForm menuForm, int airingDayId, DateTime date, string day, int cinemaDayMovieId, int movieId, CinemaDayMovieForm cinemaDayMovieForm, int?appointmentId = null) { InitializeComponent(); this.StartPosition = FormStartPosition.Manual; this.Location = new Point(Screen.PrimaryScreen.Bounds.Width - 20 - this.Width, Screen.PrimaryScreen.Bounds.Height - this.Height - saveBtn.Height - 20); _scheduleForm = scheduleForm; _schedule = schedule; _airingDayId = airingDayId; _menuForm = menuForm; _date = date; _day = day; _cinemaDayMovieId = cinemaDayMovieId; _movieId = movieId; _appointmentId = appointmentId; _cinemaDayMovieForm = cinemaDayMovieForm; _appointmentsForm = appointmentsForm; StartsAt.Format = DateTimePickerFormat.Custom; StartsAt.CustomFormat = "HH:mm"; StartsAt.ShowUpDown = true; }
private async void dgvSchedule_CellContentClick_1(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0) { var airingDayOfCinemaId = dgvSchedule.Rows[e.RowIndex].Cells["AiringDaysOfCinemasId"].Value; var action = dgvSchedule.Columns[e.ColumnIndex].Name; var date = dgvSchedule.Rows[e.RowIndex].Cells["Date"].Value; var day = dgvSchedule.Rows[e.RowIndex].Cells["Day"].Value; CustomMessageBox messageBox = new CustomMessageBox(); var adocApi = new APIService("airingdaysofcinema"); if (action == "Edit") { var form = new AddEditDayOfCinemaForm(this, _schedule, _menuForm, int.Parse(airingDayOfCinemaId.ToString())); _helper.ShowForm(form, 15); } else if (action == "Delete") { DialogResult dialogResult = MessageBox.Show($"Are you sure you want to permanently delete {day} on the {DateTime.Parse(date.ToString()).ToShortDateString()}?", "Delete day?", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { await adocApi.Delete <Model.AiringDaysOfCinema>(airingDayOfCinemaId); this.Close(); ScheduleForm form = new ScheduleForm(_schedule.Cinema.CinemaId, _menuForm) { MdiParent = _menuForm, Dock = DockStyle.Fill }; form.Show(); messageBox.Show("Day deleted successfully", "success"); } } else if (action == "MoviesBtn") { var form = new CinemaDayMovieForm(this, _schedule, _menuForm, int.Parse(airingDayOfCinemaId.ToString()), (DateTime)date, day.ToString()); _helper.ShowForm(form, 15); } } }