コード例 #1
0
        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();
        }
コード例 #2
0
        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;
        }
コード例 #3
0
        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;
        }
コード例 #4
0
        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 = "";
        }
コード例 #5
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     context = new MovieRentalContext();
     resetForm();
 }