예제 #1
0
        private void BrowseForm_Load(object sender, EventArgs e)
        {
            MovieList = MovieDB.GetMovies();
            genreList = GenreDB.GetGenres();

            ScrollDisplay(0);
        }
        private void populateGenreNames()
        {
            List <Genre> genres = GenreDB.GetGenres();

            cbGenre.DisplayMember = "Name";
            cbGenre.ValueMember   = "ID";
            cbGenre.DataSource    = genres;
        }
예제 #3
0
 public MovieForm()
 {
     InitializeComponent();
     cmbGenre.DataSource    = GenreDB.GetGenres();
     cmbGenre.DisplayMember = "name";
     cmbGenre.SelectedIndex = -1;
     cmbGenre.Text          = "--Select--";
     cmbMovieRating.Text    = "--Select--";
     cmbRentalDuration.Text = "--Select--";
 }
예제 #4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //Validate the UI
            if (string.IsNullOrEmpty(txtGenreID.Text.Trim()))
            {
                try
                {
                    List <Genre> genreList = new List <Genre>();
                    genreList = GenreDB.GetGenres();
                    int num = 1;
                    foreach (Genre genre in genreList)
                    {
                        if (num <= genre.ID)
                        {
                            num = genre.ID + 1;
                        }
                    }

                    txtGenreID.Text = num.ToString();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }

            if (string.IsNullOrEmpty(txtGenreName.Text.Trim()))
            {
                MessageBox.Show("Please enter a genre name.");
                txtGenreID.Focus();
                return;
            }

            Genre objGenre = new Genre();

            objGenre.ID   = Convert.ToInt32(txtGenreID.Text.Trim());
            objGenre.Name = txtGenreName.Text.Trim();
            try
            {
                bool status = GenreDB.AddGenre(objGenre);
                if (status) //You can use this syntax as well..if (status ==true)
                {
                    Reload_Data();
                    MessageBox.Show("Genre added to the database.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Genre was not added to database.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #5
0
        private void movieForm_Load(object sender, EventArgs e)
        {
            Reload_Data();

            List <Genre> GenreList = GenreDB.GetGenres();

            foreach (Genre genre in GenreList)
            {
                cmbGenre.Items.Add(genre.Name);
            }
        }
예제 #6
0
 private void genre_Load(object sender, EventArgs e)
 {
     try
     {
         List <Genre> genreList = new List <Genre>();
         genreList = GenreDB.GetGenres();
         dataGridView1.DataSource = genreList;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #7
0
 private void Reload_Data()
 {
     try
     {
         List <Genre> genreList = new List <Genre>();
         genreList = GenreDB.GetGenres();
         dataGridView1.DataSource = genreList;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #8
0
 private void PopulateGenreCB()
 {
     try
     {
         List <Genre> genres = GenreDB.GetGenres();
         cbGenre.DisplayMember = "Name";
         cbGenre.ValueMember   = "ID";
         cbGenre.DataSource    = genres;
     }
     catch (Exception)
     {
         throw;
     }
 }
예제 #9
0
 private void btnBrowse_Click(object sender, EventArgs e)
 {
     //Call the GenreDB static class to fill the data grid
     try
     {
         List <Genre> genreList = new List <Genre>();
         genreList = GenreDB.GetGenres();
         dataGridView1.DataSource = genreList;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void btn_Browse_Click(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();
            foreach (Genre g in GenreDB.GetGenres())
            {
                //put each genre object into a datagridview row object
                DataGridViewRow newRow = new DataGridViewRow();

                //creates cells using dataGridView1 as a template
                newRow.CreateCells(dataGridView1);
                newRow.Cells[0].Value = g.id;
                newRow.Cells[1].Value = g.name;

                dataGridView1.Rows.Add(newRow);
            }
        }
        private void MovieDataForm_Load(object sender, EventArgs e)
        {
            cmb_Rating.Items.Add("Select a rating");
            cmb_Rating.Items.Add("★☆☆☆☆");
            cmb_Rating.Items.Add("★★☆☆☆");
            cmb_Rating.Items.Add("★★★☆☆");
            cmb_Rating.Items.Add("★★★★☆");
            cmb_Rating.Items.Add("★★★★★");
            cmb_Rating.SelectedIndex = 0;

            genreList = GenreDB.GetGenres();
            cmb_Genre.Items.Add("Select a Genre");
            foreach (Genre g in genreList)
            {
                cmb_Genre.Items.Add(g.name);
            }
            cmb_Genre.SelectedIndex = 0;
        }
예제 #12
0
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            if (!(validateUI(btnBrowse)))
            {
                return;
            }

            try
            {
                List <Genre> myGenreList = new List <Genre>();
                myGenreList = GenreDB.GetGenres();
                dataGridView1.DataSource = myGenreList;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "MeramecNetFlix", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #13
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            foreach (Control control in this.Controls)
            {
                if (control.GetType() != dataGridView1.GetType())
                {
                    if (string.IsNullOrEmpty(control.Text.Trim()))
                    {
                        MessageBox.Show("Please enter a value for " + control.Name.ToString());
                        control.Focus();
                        return;
                    }
                }
            }

            List <Genre> genreList = GenreDB.GetGenres();

            int genreid = 0;

            foreach (Genre genre in genreList)
            {
                if (genre.Name == cmbGenre.Text.Trim())
                {
                    genreid = genre.ID;
                }
            }



            Movie objMovie = new Movie();

            objMovie.movie_number      = Convert.ToInt32(txtMovieNumber.Text);
            objMovie.movie_title       = txtTitle.Text.ToString();
            objMovie.Description       = txtDescription.Text.ToString();
            objMovie.movie_year_made   = Convert.ToInt32(txtYear.Text);
            objMovie.genre_id          = genreid;
            objMovie.movie_rating      = cmbRating.Text;
            objMovie.media_type        = cmbMediaType.Text;
            objMovie.movie_retail_cost = returnDecimal(txtRetailCost.Text);
            objMovie.movie_rental_cost = returnDecimal(txtRentalCost.Text);
            objMovie.copies_on_hand    = Convert.ToInt32(txtCopies.Text);
            objMovie.image             = txtImage.Text;
            objMovie.trailer           = txtTrailer.Text;

            //if(lblPicture.Text != string.Empty)
            //{
            //    objMember.photo = lblPicture.Text;
            //}


            try
            {
                bool status = MovieDB.AddMovie(objMovie);
                if (status) //You can use this syntax as well..if (status ==true)
                {
                    Reload_Data();
                    MessageBox.Show("Movieadded to the database.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Movie was not added to database.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }