protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { MovieServices listmovie = new MovieServices(); MoviePeopleServices castlist = new MoviePeopleServices(); List<MovieModelDTO> ListOfAllMovies = new List<MovieModelDTO>(); ListOfAllMovies = listmovie.GetAllMovies(); ddlTitleMovie.DataSource = ListOfAllMovies; ddlTitleMovie.DataBind(); ddlTitleMovie.Items.Insert(0, new ListItem("<-Choose Movie->", "0")); //------------------------------------------------------------------------- List<MovieModelDTO>ListOfYears = listmovie.GetAllYears(); List<string> Years = new List<string>(); foreach (var item in ListOfYears) { string year = item.Year; Years.Add(year); } ddlYearMovie.DataSource = Years.ToList().Distinct(); ddlYearMovie.DataBind(); ddlYearMovie.Items.Insert(0, new ListItem("<-Choose Year->", "0")); //----------------------------- List<MoviePersonDTO> ListOfAcotrs = castlist.GetActors(); ddlActorMovie.DataTextField = "FirstName"; ddlActorMovie.DataValueField = "LastName"; ddlActorMovie.DataSource = ListOfAcotrs; ddlActorMovie.DataBind(); ddlActorMovie.Items.Insert(0, new ListItem("<-Choose Actor->", "0")); //---------------------------------------------- List<MoviePersonDTO> ListOfProducers = castlist.GetProducers(); ddlProducerMovie.DataTextField = "FirstName"; ddlProducerMovie.DataValueField = "LastName"; ddlProducerMovie.DataSource = ListOfProducers; ddlProducerMovie.DataBind(); ddlProducerMovie.Items.Insert(0, new ListItem("<-Choose Producer->", "0")); //------------------------------------------------------- //genre to bind ddlGenreMovie.DataSource = listmovie.GetAllGenres(); ddlGenreMovie.DataBind(); ddlGenreMovie.Items.Insert(0,new ListItem("<-Choose Genre->","0")); //repeater to bind List<MovieModelDTO> ListOfMovies = new List<MovieModelDTO>(); ListOfMovies = listmovie.GetAllMovies(); RepeaterMovie.DataSource = ListOfMovies; RepeaterMovie.DataBind(); } }
public void ProcessRequest(HttpContext context) { int movieID = Convert.ToInt32(context.Request.QueryString["MovieID"]); MovieServices MovieServices = new MovieServices(); byte[] photo = MovieServices.GetPhoto(movieID); if (photo == null) { return; } context.Response.ContentType = "image/jpeg"; context.Response.BinaryWrite(photo); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { MainMoviePeople1.SetLabelText("Search Actors by Movie Title", "Search Actor by Name"); } MovieServices movieList = new MovieServices(); GridView MovieGrid = new GridView(); MovieGrid = MainMoviePeople1.GridMovieList; MovieGrid.DataSource = movieList.GetAllMovies(); MovieGrid.DataBind(); GetAppropriateView(MovieGrid); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["MovieID"] != null) { string selectedMovieID = Request.QueryString["MovieID"]; int movieID; bool isInt = int.TryParse(selectedMovieID, out movieID); if (isInt) { string pathToImage = string.Format("~/ContentPages/Movies/MoviePhotoHandler.ashx?MovieID={0}", selectedMovieID); imgMoviePicture.ImageUrl = pathToImage; MovieModelDTO SelectedMovie = new MovieModelDTO(); MovieServices MovieServices = new MovieServices(); SelectedMovie = MovieServices.GetMovieByID(movieID); lblGenreType.Text = SelectedMovie.GenreName; lblMovieTitle.Text = SelectedMovie.Title; blYear.Text = SelectedMovie.Year; lblDescriptionDetails.Text = SelectedMovie.Description; } } }