Пример #1
0
    protected void GridViewReviews_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        RatingService ratingService = new RatingService();

        localMoviesWebService.MoviesWebService moviesWeb = new localMoviesWebService.MoviesWebService();


        try
        {
            string username = (string)Session["Username"];
            int    movieID  = moviesWeb.GetIDbyName(GridViewReviews.Rows[e.RowIndex].Cells[0].Text);
            int    rating   = int.Parse(((TextBox)(GridViewReviews.Rows[e.RowIndex].Cells[2].Controls[0])).Text);
            string review   = ((TextBox)(GridViewReviews.Rows[e.RowIndex].Cells[3].Controls[0])).Text;

            int beforeRating = ratingService.GetSpecificRating(username, movieID);
            moviesWeb.UpdateMovieRating(rating - beforeRating, movieID, 0);

            ratingService.UpdateRating(username, movieID, rating, review);
            GridViewReviews.EditIndex = -1;
            PopulateGrid();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Пример #2
0
    private DataSet GetData()
    {
        DataSet Movies = new DataSet();

        localMoviesWebService.MoviesWebService movies = new localMoviesWebService.MoviesWebService();

        return(movies.GetAllMovies());
    }
Пример #3
0
    protected void submit_Click(object sender, EventArgs e)
    {
        localMoviesWebService.MoviesDetails movie = new localMoviesWebService.MoviesDetails();

        string MovieName   = movieName.Text;
        string Director    = director.Text;
        string Genre       = genres.SelectedValue;
        string Description = description.Text;
        string actorsList  = actors.Text;
        string Duration    = duration.Text;
        string Image       = image.Text;
        string Trailer     = trailer.Text;

        movie.MovieName   = MovieName;
        movie.Director    = Director;
        movie.MovieGenre  = Genre;
        movie.Description = Description;
        movie.Duration    = Duration;
        movie.ImgURL      = Image;
        movie.TrailerURL  = Trailer;

        localMoviesWebService.MoviesWebService moviesWeb = new localMoviesWebService.MoviesWebService();

        moviesWeb.InsertMovie(movie);

        string[] arrActorString = actorsList.Split(','); //Split Actors By ','
        localMoviesWebService.ActorsDetails[] arrActors = new localMoviesWebService.ActorsDetails[arrActorString.Length];
        for (int i = 0; i < arrActors.Length; i++)
        {
            arrActors[i]      = new localMoviesWebService.ActorsDetails();
            arrActors[i].Name = arrActorString[i];
            arrActors[i].Name.Trim();

            if (moviesWeb.ActorGetIDbyName(arrActors[i].Name) == -1)
            {
                moviesWeb.InsertActor(arrActors[i]);
            }
        }

        int movieID      = moviesWeb.GetIDbyName(movie.MovieName);
        int firstActorID = moviesWeb.ActorGetIDbyName(arrActors[0].Name);

        for (int i = 0; i < arrActors.Length; i++)
        {
            moviesWeb.InsertActorInMovie(movieID, firstActorID + i);
        }
        userMsg.Attributes.Add("class", "alert alert-success");
        msg = "You Added A Movie";
    }
Пример #4
0
    protected void submitSort_Click(object sender, EventArgs e)
    {
        int sortExpression   = int.Parse(RatingExpression.SelectedValue);
        int ratingExpression = int.Parse(RatingDropDown.SelectedValue);

        DataSet Movies = new DataSet();

        localMoviesWebService.MoviesWebService moviesWeb = new localMoviesWebService.MoviesWebService();



        GridViewMovies.DataSource = moviesWeb.GetAllMoviesFiltered(sortExpression, ratingExpression);

        GridViewMovies.DataBind();
    }
Пример #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string movieName = "";

        if (Request.QueryString["MovieName"] != null)
        {
            movieName = Request.QueryString["MovieName"].ToString();
        }
        if (movieName != "")
        {
            localMoviesWebService.MoviesWebService movies = new localMoviesWebService.MoviesWebService();
            GridViewMovies.DataSource = movies.SearchMovie(movieName);
            GridViewMovies.DataBind();
        }
        else if (!Page.IsPostBack)
        {
            PopulateGrid();
        }
    }
Пример #6
0
    protected void rating5_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            localMoviesWebService.MoviesWebService moviesWeb = new localMoviesWebService.MoviesWebService();
            RatingService ratingService = new RatingService();
            int           id            = moviesWeb.GetIDbyName(movieName);
            ratingService.InsertUserRateMovie((string)Session["Username"], id, 5, DateTime.Now, review.Text);
            if (moviesWeb.GetMovieByID(id).NumberOfUsers == -1)
            {
                moviesWeb.UpdateMovieRating(5, id, 2);
            }
            else
            {
                moviesWeb.UpdateMovieRating(5, id, 1);
            }

            rating.Visible = false;
        }
    }
Пример #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            movieName = Request.QueryString["getMovieName"].ToString(); //קבלת קוד המשחק דרך GET
        }
        catch
        {
            Response.Redirect("Home.aspx");
        }
        if (!Page.IsPostBack)
        {
            MoviesService movieService = new MoviesService();
            ActorsService actorService = new ActorsService();
            localMoviesWebService.MoviesWebService moviesWeb = new localMoviesWebService.MoviesWebService();

            movieID = moviesWeb.GetIDbyName(movieName);
            actors  = moviesWeb.ActorsInMovie(movieID);
            PopulatePage(moviesWeb.GetMovieByID(movieID));
        }
        PopulateRating();
    }