コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            movie = Movie.getMovieByID(int.Parse(Request.QueryString["movieID"]));

            if (Session["user"] != null)
            {
                Label helpText = new Label();
                helpText.Text = "Check below and confirm the booking.";
                mainContent.Controls.Add(helpText);
                Panel moviePanel = new Panel();
                mainContent.Controls.Add(moviePanel);
                WebControlGenerator.addMovieToPanel(movie, moviePanel, false);

                Customer user = (Customer)Session["user"];
                booking = Booking.getBookingByID(int.Parse(Request.QueryString["bookingID"].ToString()));
                Panel bookingPanel = new Panel();
                mainContent.Controls.Add(bookingPanel);
                WebControlGenerator.addBookingToPanel(movie, booking, bookingPanel, false);

                Button confirm = new Button();
                confirm.Text   = "Confirm rental";
                confirm.Click += confirm_Click;
                mainContent.Controls.Add(confirm);
            }
            else
            {
                Label logInPrompt = new Label();
                logInPrompt.Text = "To complete your booking, please use the log in control at the top of the page in order to authenticate your identity.";
                mainContent.Controls.Add(logInPrompt);
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            m = Movie.getMovieByID(int.Parse(Request.QueryString["movieID"]));
            if (Session["user"] != null)
            {
                Label helpText = new Label();
                helpText.Text = "Now that you have selected a movie, please select one of your bookings to attach it to. Please note that movie rentals are an additional £4 per movie.";
                summaryPanel.Controls.Add(helpText);
                WebControlGenerator.addMovieToPanel(m, infoPanel, false);

                Customer       user     = (Customer)Session["user"];
                List <Booking> bookings = Booking.getBookingsByCustomerID(user.Id);
                foreach (Booking b in bookings)
                {
                    WebControlGenerator.addBookingToPanel(m, b, mainContent, true);
                }
            }
            else
            {
                infoPanel.Visible     = false;
                infoLinkPanel.Visible = false;
                Label logInPrompt = new Label();
                logInPrompt.Text = "To complete your booking, please use the log in control at the top of the page in order to authenticate your identity.";
                mainContent.Controls.Add(logInPrompt);
            }
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            search = (Request.QueryString["movieTitle"] != null);
            if (search)
            {
                movies = Movie.getMoviesByTitle(Request.QueryString["movieTitle"]);
            }
            else
            {
                movies = Movie.getAllMoviesAsList();
            }

            foreach (Movie m in movies)
            {
                WebControlGenerator.addMovieToPanel(m, moviesPanel, true);
            }
        }