protected override void OnLoad(EventArgs e) { base.OnLoad(e); context = new MovieRentalContext(); //Loading categories from DB context.Movies.Load(); //bingding the data to the source this.movieBindingSource.DataSource = context.Movies.Local.ToBindingList(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); context = new MovieRentalContext(); // Loading categories from DB context.Genres.Load(); // Bingding the data to the source this.genreBindingSource.DataSource = context.Genres.Local.ToBindingList(); // Fit Images to PictureBox pbxMoviePoster.SizeMode = PictureBoxSizeMode.StretchImage; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); context = new MovieRentalContext(); this.overDueDate = DateTime.Today.AddDays(-overDueAfterThisManyDays); // Find the records (in the borrowHistory table) related to movies that were borrowed by this user but never returned (return date is 1900) List <BorrowHistory> tempList = context.BorrowHistories.Where(b => DateTime.Compare(b.BorrowDate, overDueDate) < 0 && DateTime.Compare(b.ReturnDate, new DateTime(1910, 1, 1, 0, 0, 0)) < 0).ToList(); foreach (BorrowHistory bh in tempList) // convert the normal list to an observable list { bhList.Add(bh); } // bingding the data to the control in form this.OverDueMoviesDataGridView.DataSource = bhList; OverDueMoviesDataGridView.Columns[5].Visible = false; OverDueMoviesDataGridView.Columns[6].Visible = false; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); context = new MovieRentalContext(); //Loading context.Genres.Load(); context.Users.Load(); context.Movies.Load(); // Bingding the data to the source this.genreBindingSource.DataSource = context.Genres.Local.ToBindingList(); this.userBindingSource.DataSource = context.Users.Local.ToBindingList(); // Fill the Genre ComboBox comboGenre.Items.Clear(); List <Genre> gettingGenres = context.Genres.ToList(); this.comboGenre.Items.Add("All"); foreach (Genre genre in gettingGenres) { this.comboGenre.Items.Add(genre.Name); } // Find All Available Movies List <BorrowHistory> unAvailableBorrowHistoryList = context.BorrowHistories.Where(b => DateTime.Compare(b.ReturnDate, new DateTime(1910, 1, 1, 0, 0, 0)) < 0).ToList(); List <Movie> allMovieList = context.Movies.ToList(); foreach (BorrowHistory unAvailableBorrowHistory in unAvailableBorrowHistoryList) { int movieIndex = allMovieList.IndexOf(unAvailableBorrowHistory.Movie); allMovieList.RemoveAt(movieIndex); } this.movieDataGridView.DataSource = allMovieList; emailTextBox.Text = ""; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); context = new MovieRentalContext(); resetForm(); }