コード例 #1
0
        private void Reload_Data()
        {
            List <Movie> movieList = new List <Movie>();

            movieList = MovieDB.GetMovie();
            dataGridView1.DataSource = movieList;
        }
コード例 #2
0
        public IActionResult MovieDetails(int id)//shows the details of a perticular movie
        {
            MovieInfo Movie  = MovieDBObj.GetMovie(id);
            int       logged = Convert.ToInt32(HttpContext.Session.GetInt32("Logged"));

            return(View(Movie));
        }
コード例 #3
0
        private void btnFind_Click(object sender, EventArgs e)
        {
            if (!(validateUI(btnFind)))
            {
                return;
            }

            try
            {
                int   movieID  = Convert.ToInt32(txtMovieNumber.Text.Trim());
                Movie objMovie = MovieDB.GetMovie(movieID);
                if (objMovie != null)
                {
                    txtMovieTitle.Text      = objMovie.movie_title;
                    txtMovieNumber.ReadOnly = true;
                }
                else
                {
                    MessageBox.Show($"Movie ID " + txtMovieNumber.Text + "  not found in database.", "MeremacNetflix", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "MeramecNetFlix", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #4
0
ファイル: Movie.aspx.cs プロジェクト: UnderDev/TVI_Cinema
    protected void Page_Load(object sender, EventArgs e)
    {
        //prevents a user from landing on the page without selecting a movie from the ddl/comingsoon.aspx/default.aspx
        if (Session["SelectedMovie"] == null)
        {
            Response.Redirect("Default.aspx", true);
        }

        //MovieCategory seperates currently showing movies from movies that havent released(and lack the data fields that a regular movie has)
        string movieType = (string)Session["MovieCategory"];

        //format the page if the movie type is comingsoon
        if (movieType == "ComingSoon")
        {
            //grabs the movie from the db class
            selected = MovieDB.GetComingSoonMovie((string)Session["SelectedMovie"]);
            odsSingleMovie.SelectMethod = "GetComingSoonMovie";

            //hide irrelevant fields from the details view
            dvMovieInfo.Rows[5].Visible = false;
            dvMovieInfo.Rows[4].Visible = false;
            dvMovieInfo.Rows[3].Visible = false;
            pnlShowtimes.Visible        = false;
            //also hide showtimes
            lblDate.Enabled = false;
            gvTimes.Enabled = false;
        }
        else//movie is currently playing
        {
            selected = MovieDB.GetMovie((string)Session["SelectedMovie"]);

            if (Session["SelectedDate"] != null)
            {
                date = (DateTime)Session["SelectedDate"];
            }
            else
            {
                date = DateTime.Now;
                Session["SelectedDate"] = date;
            }

            //formats the selected day, as grammatically correct as possible
            lblDate.Text = string.Format("{0:dddd} the {0:dd}{1} of {0:MMMM yyyy}", date, ((date.Day % 10 == 1 && date.Day != 11) ? "st"
                                                                                        : (date.Day % 10 == 2 && date.Day != 12) ? "nd"
                                                                                        : (date.Day % 10 == 3 && date.Day != 13) ? "rd"
                                                                                        : "th"));
        }
        lblMovieTitle.Text = selected.Name;

        //converts the binary array storing the poster to a jpg encoded string
        ImgPoster.ImageUrl = "data:image/jpg;base64," + Convert.ToBase64String(selected.Poster);

        //set the trailer url depending on which movie is currently selected
        ifrmTrailerEmbed.Attributes.Add("src", "https://www.youtube.com/embed/" + selected.TrailerURL);
    }
コード例 #5
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            Movie movie = MovieDB.GetMovie(txtTitle.Text.Trim());

            if (movie != null)
            {
                Thread viewMovie = new Thread(() => new ViewMovie(movie, member.number).ShowDialog());
                viewMovie.SetApartmentState(ApartmentState.STA);
                viewMovie.Start();
            }
            else
            {
                MessageBox.Show(txtTitle.Text.Trim() + " not found.", "Uh oh", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #6
0
        public ViewMovie()
        {
            try
            {
                InitializeComponent();
                this.StartPosition = FormStartPosition.CenterScreen;

                movie       = MovieDB.GetMovie(2);
                memberNum   = "1";
                label1.Text = movie.movie_title;
                label2.Text = movie.description;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #7
0
        private void btnFind_Click(object sender, EventArgs e)
        {
            //Validate the UI
            if (string.IsNullOrEmpty(txtMovieNumber.Text.Trim()))
            {
                MessageBox.Show("Please enter a movie id.");
                txtMovieNumber.Focus();
                return;
            }

            Movie objMovie = MovieDB.GetMovie(Convert.ToInt32(txtMovieNumber.Text.Trim()));

            //Step 2: Validate to make sure the Customer object is not null.
            if (objMovie != null)
            {
                //Populate the UI with the object values
                txtMovieNumber.Text   = objMovie.movie_number;
                txtMovieTitle.Text    = objMovie.movie_title;
                txtMovieTitle.Text    = objMovie.movie_title;
                txtDescription.Text   = objMovie.description;
                txtMovieYearMade.Text = objMovie.movie_year_made;
                for (int i = 0; i < cbGenre.Items.Count; i++)
                {
                    if (objMovie.genre_id == ((Genre)cbGenre.Items[i]).ID.ToString())
                    {
                        cbGenre.SelectedIndex = i;
                    }
                }
                cbRating.Text         = objMovie.movie_rating;
                cbMediaType.Text      = objMovie.media_type;
                txtRetailCost.Text    = Math.Round(objMovie.movie_retail_cost, 2).ToString();
                txtCopiesOnHand.Text  = objMovie.copies_on_hand;
                txtImageFilename.Text = objMovie.image;
                txtTrailerLink.Text   = objMovie.trailer;
                //make Movie ID field read-only to be used for updating and deleting records demo
                txtMovieNumber.ReadOnly = true;
            }
            else
            {
                MessageBox.Show("Movie ID " + txtMovieNumber.Text.Trim() + " not found in database.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #8
0
        public RentalDetailsForm(int memberID, int movieID)
        {
            InitializeComponent();
            Member currentMember = MemberDB.GetMember(memberID);
            Movie  currentMovie  = MovieDB.GetMovie(movieID);

            label1.Text       = "Hello " + currentMember.firstname;
            lblTitle.Text     = currentMovie.movie_title;
            lblRating.Text    = currentMovie.movie_rating;
            lblYear.Text      = currentMovie.movie_year_made.ToString();
            richTextBox1.Text = currentMovie.description;
            //axWindowsMediaPlayer1.URL = currentMovie.trailer;
            //this.BackgroundImage = ;
            string html = "<html><head>";

            html += "<meta content='IE=Edge' http-equiv='X-UA-Compatible'/>";
            html += "<iframe id='video' src= " + currentMovie.trailer + " width='400' height='200' frameborder='0' allowfullscreen></iframe>";
            html += "</body></html>";
            webBrowser1.DocumentText = string.Format(html);
            //webBrowser1.Url = new Uri(currentMovie.trailer);
        }
コード例 #9
0
        private void movieClick(object sender, EventArgs e)
        {
            try
            {
                PictureBox pb = sender as PictureBox;

                Thread viewMovie = new Thread(() => new ViewMovie(MovieDB.GetMovie(Convert.ToInt32(pb.Tag)), member.number).ShowDialog());
                viewMovie.SetApartmentState(ApartmentState.STA);
                viewMovie.Start();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            /*
             * stored procedure should be to decrement copies on hand when rental is added
             *
             *
             *
             *
             */
        }
コード例 #10
0
        private void ScrollDisplay(int Pos)
        {
            int numToDisplay = 3;

            if (RentalList.Count - Pos < 3)
            {
                numToDisplay = RentalList.Count - Pos;
            }

            grp_Rental1.Enabled = false;
            grp_Rental2.Enabled = false;
            grp_Rental3.Enabled = false;

            if (numToDisplay >= 1)
            {
                grp_Rental1.Enabled = true;
                try
                {
                    lbl_Title1.Text = MovieDB.GetMovie(int.Parse(RentalList[Pos].movie_number)).movie_title.Trim();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + "\n\n" + ex.StackTrace);
                }
                lbl_date1.Text = RentalList[Pos].media_return_date;

                if (numToDisplay >= 2)
                {
                    grp_Rental2.Enabled = true;
                    lbl_Title2.Text     = MovieDB.GetMovie(int.Parse(RentalList[Pos + 1].movie_number)).movie_title;
                    lbl_date2.Text      = RentalList[Pos + 1].media_return_date;

                    if (numToDisplay >= 3)
                    {
                        grp_Rental3.Enabled = true;
                        lbl_Title3.Text     = MovieDB.GetMovie(int.Parse(RentalList[Pos + 2].movie_number)).movie_title;
                        lbl_date3.Text      = RentalList[Pos + 2].media_return_date;
                    }
                }
            }

            //checks if the up scroll button should be enabled
            if (RentalList.Count - (ScrollPosition + 1) >= 3)
            {
                btn_ScrollDown.Enabled = true;
            }
            else
            {
                btn_ScrollDown.Enabled = false;
            }

            //checks if the down scroll button should be enabled
            if (RentalList.Count - (ScrollPosition - 1) >= 3 && ScrollPosition - 1 >= 0)
            {
                btn_ScrollUp.Enabled = true;
            }
            else
            {
                btn_ScrollUp.Enabled = false;
            }
        }
コード例 #11
0
 public Movie GetMovie(int id)
 {
     return(mDb.GetMovie(id));
 }