コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            LoadMovies();
            Movie            movie;
            LinkedListDouble movies     = (LinkedListDouble)Session["movies"];
            Pila             watchLater = (Pila)Session["watchLater"];
            Cola             myList     = (Cola)Session["myList"];

            movies.iniciarPrimero();
            while (movies.getActual() != null)
            {
                movie = (Movie)movies.getActual();
                if (movie.Category == "TV para niños")
                {
                    String movieName = movie.Name;
                    if (movieName.Length > 32)
                    {
                        movieName = movieName.Substring(0, 33) + "...";
                    }
                    String search = "";
                    if (Request.QueryString["search"] != null)
                    {
                        search = Request.QueryString["search"].ToLower();
                    }
                    if (search == "" || (search != "" && movieName.ToLower().Contains(search)))
                    {
                        tvForChildren += "<div class='item'><a href='Views/Title.aspx?name=" + movieName + "&category=" + movie.Category + "&boton=0'><img src='" + movie.Picture + "' width='280' height='150' /></a><span title='" + movie.Name + "'><center><b>" + movieName + "</b></center></span></div>";
                    }
                }
                else if (movie.Category == "Drama")
                {
                    String movieName = movie.Name;
                    if (movieName.Length > 32)
                    {
                        movieName = movieName.Substring(0, 33) + "...";
                    }
                    String search = "";
                    if (Request.QueryString["search"] != null)
                    {
                        search = Request.QueryString["search"].ToLower();
                    }
                    if (search == "" || (search != "" && movieName.ToLower().Contains(search)))
                    {
                        drama += "<div class='item'><a href='Views/Title.aspx?name=" + movieName + "&category=" + movie.Category + "&boton=0'><img src='" + movie.Picture + "' width='280' height='150' /></a><span title='" + movie.Name + "'><center><b>" + movieName + "</b></center></span></div>";
                    }
                }
                else if (movie.Category == "Acción y Aventura")
                {
                    String movieName = movie.Name;
                    if (movieName.Length > 32)
                    {
                        movieName = movieName.Substring(0, 33) + "...";
                    }
                    String search = "";
                    if (Request.QueryString["search"] != null)
                    {
                        search = Request.QueryString["search"].ToLower();
                    }
                    if (search == "" || (search != "" && movieName.ToLower().Contains(search)))
                    {
                        actionNAdventure += "<div class='item'><a href='Views/Title.aspx?name=" + movieName + "&category=" + movie.Category + "&boton=0'><img src='" + movie.Picture + "' width='280' height='150' /></a><span title='" + movie.Name + "'><center><b>" + movieName + "</b></center></span></div>";
                    }
                }
                movies.next();
            }


            //Mostrar peliculas de Continuar viendo
            try
            {
                Pila watchLaterMovies = watchLater.Clone();
                while (watchLaterMovies.getPrimero() != null)
                {
                    movie = (Movie)watchLaterMovies.getPrimero();
                    String movieName = movie.Name;
                    if (movieName.Length > 32)
                    {
                        movieName = movieName.Substring(0, 33) + "...";
                    }
                    String search = "";
                    if (Request.QueryString["search"] != null)
                    {
                        search = Request.QueryString["search"].ToLower();
                    }
                    if (search == "" || (search != "" && movieName.ToLower().Contains(search)))
                    {
                        strWatchLater += "<div class='item'><a href='Views/Title.aspx?name=" + movieName + "&category=" + movie.Category + "&boton=2'><img src='" + movie.Picture + "' width='280' height='150' /></a><span title='" + movie.Name + "'><center><b>" + movieName + "</b></center></span></div>";
                    }
                    watchLaterMovies.pop();
                }
            }
            catch (Exception)
            {
            }


            //Mostrar Peliculas de Mi lista
            try
            {
                Cola myListMovies = myList.Clone();
                while (myListMovies.getPrimero() != null)
                {
                    movie = (Movie)myListMovies.getPrimero();
                    String movieName = movie.Name;
                    if (movieName.Length > 32)
                    {
                        movieName = movieName.Substring(0, 33) + "...";
                    }
                    String search = "";
                    if (Request.QueryString["search"] != null)
                    {
                        search = Request.QueryString["search"].ToLower();
                    }
                    if (search == "" || (search != "" && movieName.ToLower().Contains(search)))
                    {
                        strMyList += "<div class='item'><a href='Views/Title.aspx?name=" + movieName + "&category=" + movie.Category + "'&boton=0><img src='" + movie.Picture + "' width='280' height='150' /></a><span title='" + movie.Name + "'><center><b>" + movieName + "</b></center></span></div>";
                    }
                    myListMovies.pop();
                }
            }
            catch (Exception)
            {
            }
        }
コード例 #2
0
        protected Movie getMovieActual()
        {
            String name = Request.QueryString["name"];

            try
            {
                movies     = (LinkedListDouble)Session["movies"];
                watchLater = (Pila)Session["watchLater"];
                myList     = (Cola)Session["myList"];
            }
            catch (Exception)
            {
            }
            if (name.Length > 0)
            {
                //Colocar si existe en Mi Lista
                try
                {
                    Cola myList2 = myList.Clone();
                    while (myList2.getPrimero() != null)
                    {
                        Movie  primero     = (Movie)myList2.pop();
                        String currentName = primero.Name;
                        if (name == currentName)
                        {
                            isInMyList = true;
                            break;
                        }
                    }
                }
                catch (Exception)
                {
                }
                //Colocar si existe en ver mas tarde
                try
                {
                    Pila watchLaterList = watchLater.Clone();
                    while (watchLaterList.getPrimero() != null)
                    {
                        Movie  primero     = (Movie)watchLaterList.pop();
                        String currentName = primero.Name;
                        if (name == currentName)
                        {
                            isInWatchLater = true;
                            break;
                        }
                    }
                }
                catch (Exception)
                {
                }
                // Obtener la pelicula Actual
                try
                {
                    movies.iniciarPrimero();
                    while (movies.getActual() != null)
                    {
                        Movie movie;
                        movie = (Movie)movies.getActual();

                        String movieName = movie.Name;
                        if (movieName == name)
                        {
                            return(movie);
                        }
                        movies.next();
                    }
                }
                catch (Exception)
                {
                }
            }

            return(null);
        }