protected void Page_Load(object sender, EventArgs e) { movieId = Convert.ToInt32(Request.QueryString["id"]); List<Movie> allMoviesWithScreening = (List<Movie>)Session["allMoviesWithScreening"]; movie = allMoviesWithScreening.FirstOrDefault(m => m.MovieId == movieId); movieWithScreenings = allMoviesWithScreening.Where(m => m.MovieId == movieId).Take(3).ToList(); FillMovieDetails(); FillScreeningButtons(); }
public Movie GetMovie(int movieId) { Movie movie = new Movie(); string sql = "select m.MovieID, m.Title, m.Length, m.FSK, m.Description, m.PictureUrl, g.GenreID, g.Name as Genre" + " from [Movie] as m" + " left join [Genre] as g" + " on m.GenreID = g.GenreID" + " where MovieID = @movieId"; SqlCommand cmd = new SqlCommand(); cmd.CommandText = sql; cmd.Connection = Main.GetConnection(); cmd.Parameters.Add(new SqlParameter("@movieId", movieId)); var reader = cmd.ExecuteReader(); while (reader.Read()) { movie = CreateMovie(reader); } return movie; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List<int[]> seats = new List<int[]>(); chosenScreening = (Movie) Session["chosenScreening"]; loggedUser = (User) Session["loggedUser"]; userId = loggedUser.UserId; newOrder = new Order(chosenScreening.MovieScreeningId, userId); _seats = new List<int[]>(); lblMovieTitle.Text = chosenScreening.Title; lblMovieTime.Text = chosenScreening.Date.Day.ToString().PadLeft(2, '0') + "." + chosenScreening.Date.Month.ToString().PadLeft(2, '0') + "." + chosenScreening.Date.Year + ", " + chosenScreening.Time.Hour.ToString().PadLeft(2, '0') + ":" + chosenScreening.Time.Minute.ToString().PadLeft(2, '0'); CreateDropDowns(); } }