private void FilmScreeningsLB_SelectedIndexChanged(object sender, EventArgs e) { EditScreening _selectedItem = FilmScreeningsLB.SelectedItem as EditScreening; _selectedFilmShow = filmScreeningsDb.FilmShows.ElementAt(_selectedItem.FilmScreeningId - 1); RefreshFilmScreeningsPanel(_selectedItem); }
private void RefreshFilmScreeningsListBox() { List <Movie> movies = new List <Movie>(); movies = new MoviesDb("Movies.txt").Movies; filmScreeningsDb = new FilmScreeningsDb("FilmShows.txt", movies); List <object> newestScreenings = new List <object>(); foreach (FilmShow fs in filmScreeningsDb.FilmShows) { EditScreening es = new EditScreening { FilmName = movies.ElementAt(fs.MovieId - 1).Name, FilmDate = fs.Date, FilmScreeningId = fs.Id, }; newestScreenings.Add(es); } ListFilmShowsLb.DataSource = newestScreenings; if (newestScreenings.Count == 0) { EditBtn.Enabled = false; } else { EditBtn.Enabled = true; } }
private void RefreshFilmScreeningsPanel(EditScreening selectedItem) { Movie movie = movies.ElementAt(filmScreeningsDb.FilmShows.ElementAt(selectedItem.FilmScreeningId - 1).MovieId - 1); MovieNameTB.Text = movie.Name; TicketPriceTB.Text = (movie.Price * Count == 0? movie.Price : movie.Price * Count).ToString(); DateTB.Text = selectedItem.FilmDate.ToString(); RoomPlaceTB.Text = HallTB.Text + " " + PlaceTb.Text; }
private void RefreshFilmScreeningsListBox() { movies = new List <Movie>(); movies = new MoviesDb("Movies.txt").Movies; filmScreeningsDb = new FilmScreeningsDb("FilmShows.txt", movies); List <object> newestScreenings = new List <object>(); foreach (FilmShow fs in filmScreeningsDb.FilmShows) { EditScreening es = new EditScreening { FilmName = movies.ElementAt(fs.MovieId - 1).Name, FilmDate = fs.Date, FilmScreeningId = fs.Id, }; newestScreenings.Add(es); } FilmScreeningsLB.DataSource = newestScreenings; }
private void ChoosePlaceBTN_Click(object sender, EventArgs e) { SeatingManagementForm.isNew = true; SeatingManagementForm.roomName = ""; SeatingManagementForm.registeredSeats = null; PlaceTb.Text = ""; RoomPlaceTB.Text = ""; SeatingManagementForm seatingManagementForm = new SeatingManagementForm(); seatingManagementForm.ShowDialog(this); Count = seatingManagementForm.count; places = seatingManagementForm.places; EditScreening _selectedItem = FilmScreeningsLB.SelectedItem as EditScreening; RefreshFilmScreeningsPanel(_selectedItem); int z = 5; }
private void RefreshFilmScreeningsPanel(EditScreening selectedItem) { MoviesLB.SelectedIndex = filmScreeningsDb.FilmShows.ElementAt(selectedItem.FilmScreeningId - 1).MovieId - 1; MovieIDTb.Text = (MoviesLB.SelectedIndex + 1).ToString(); }