예제 #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)
 {
     if (Session["user"] != null)
     {
         Customer       user     = (Customer)Session["user"];
         List <Booking> bookings = Booking.getBookingsByCustomerID(user.Id);
         foreach (Booking b in bookings)
         {
             WebControlGenerator.addBookingToPanel(null, b, mainContent, false);
         }
     }
 }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            route = Route.getRouteByID(int.Parse(Request.QueryString["routeID"]));
            WebControlGenerator.showInfo(route, infoPanel, false);

            List <TimeOfWeek> schedule = TimeOfWeek.getTimesByRouteIDAsList(route.Id);

            foreach (TimeOfWeek t in schedule)
            {
                t.setNextOperations();
                WebControlGenerator.addTimesToPanel(route, t, timesPanel, true);
            }
        }
예제 #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.QueryString["departureCountry"] != null)
     {
         DepartureCountryTextbox.Text = Request.QueryString["departureCountry"];
         search = true;
     }
     if (Request.QueryString["departureTown"] != null)
     {
         DepartureTownTextbox.Text = Request.QueryString["departureTown"];
         search = true;
     }
     if (Request.QueryString["destinationCountry"] != null)
     {
         DestinationCountryTextbox.Text = Request.QueryString["destinationCountry"];
         search = true;
     }
     if (Request.QueryString["destinationTown"] != null)
     {
         DestinationTownTextbox.Text = Request.QueryString["destinationTown"];
         search = true;
     }
     if (Request.QueryString["dateOfJourney"] != null)
     {
         DateTime date = DateTime.Parse(Request.QueryString["dateOfJourney"]);
         DateOfDepartureCalendar.SelectedDate = date;
         search = true;
     }
     if (Request.QueryString["numberOfPassengers"] != null)
     {
         NumberOfPassengersTextbox.Text = Request.QueryString["numberOfPassengers"];
         search = true;
     }
     if (!Search)
     {
         Routes = Route.getAllRoutesAsList();
     }
     else
     {
         int passengers = 0;
         int.TryParse(NumberOfPassengersTextbox.Text, out passengers);
         Routes = Route.getRoutesBySearchCriteria(DepartureCountryTextbox.Text, DepartureTownTextbox.Text, DestinationCountryTextbox.Text, DestinationTownTextbox.Text, DateOfDepartureCalendar.SelectedDate, passengers);
     }
     foreach (Route r in Routes)
     {
         WebControlGenerator.addRouteToPanel(r, routesPanel, true);
     }
 }
예제 #6
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);
            }
        }
예제 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            foreach (Control c in mainContent.Controls)
            {
                mainContent.Controls.Remove(c);
            }
            if (Session["user"] != null)
            {
                Panel infoPanel = new Panel();
                j         = Journey.getJourneyByID(int.Parse(Request.QueryString["journeyID"]));
                r         = Route.getRouteByID(j.RouteID);
                c         = Coach.getCoachByID(j.CoachID);
                operation = DateTime.Parse(Request.QueryString["operation"]);
                WebControlGenerator.showInfo(r, operation, c, j, infoPanel, false);
                mainContent.Controls.Add(infoPanel);

                Label breakLine = new Label();
                breakLine.Text = "<br />";
                mainContent.Controls.Add(breakLine);
                mainContent.Controls.Add(breakLine);

                Label bookingAmountLabel = new Label();
                bookingAmountLabel.Text     = "Number of seats to be reserved: ";
                bookingAmountLabel.CssClass = "FormLabel";
                mainContent.Controls.Add(bookingAmountLabel);

                bookingAmountTextbox          = new TextBox();
                bookingAmountTextbox.TextMode = TextBoxMode.Number;
                mainContent.Controls.Add(bookingAmountTextbox);

                mainContent.Controls.Add(breakLine);

                Button confirmBookingButton = new Button();
                confirmBookingButton.Text   = "Confirm booking!";
                confirmBookingButton.Click += confirmBookingButton_Click;
                mainContent.Controls.Add(confirmBookingButton);
            }
            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);
            }
        }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            timeID    = int.Parse(Request.QueryString["timeID"]);
            operation = DateTime.Parse(Request.QueryString["operation"]);
            route     = Route.getRouteByID(int.Parse(Request.QueryString["routeID"]));
            WebControlGenerator.showInfo(route, operation, infoPanel, false);

            List <Coach> coaches = Coach.getCoachesByRouteAndTimeIDAsList(route.Id, timeID);

            foreach (Coach c in coaches)
            {
                Journey j = new Journey(route.Id, timeID, c.Id);
                j.findIDFromDb();
                if (c.Capacity > j.getSeatsTaken(operation))
                {
                    WebControlGenerator.addCoachAndSeatInfoToPanel(operation, c, j, coachPanel, true);
                }
            }
        }