コード例 #1
0
    public void cargarFavoritas()
    {
        List <Favoritos> listFavoritos = Like_BRL.GetFavoritos();

        GridFavoritos.DataSource = listFavoritos;
        GridFavoritos.DataBind();
    }
コード例 #2
0
    protected void btnLike_Click(object sender, EventArgs e)
    {
        if (tempLike == null) //Si nunca le dio like
        {
            tempLike = new Like()
            {
                IsLike     = true,
                UserID     = userLogeado.UserId,
                PeliculaID = objSelected.PeliculaId
            };

            Like_BRL.InsertLike(tempLike);
        }
        else                     //Si ya le doy like antes
        {
            if (tempLike.IsLike) //Si es like eliminar
            {
                Like_BRL.DeleteLike(tempLike.LikeID);
                tempLike = null;
            }
            else   //Si ya le habian dado dislike pues actualizo y lo vuelvo like
            {
                tempLike.IsLike = true;
                Like_BRL.UpdateLike(tempLike);
            }
        }
        Response.Redirect("DetallePelicula.aspx?Id=" + objSelected.PeliculaId);
    }
コード例 #3
0
    protected void btnDislike_Click(object sender, EventArgs e)
    {
        if (tempLike == null)
        {
            tempLike = new Like()
            {
                IsLike     = false,
                UserID     = userLogeado.UserId,
                PeliculaID = objSelected.PeliculaId
            };
            Like_BRL.InsertLike(tempLike);
        }
        else
        {
            if (tempLike.IsLike)
            {
                tempLike.IsLike = false;
                Like_BRL.UpdateLike(tempLike);
            }
            else
            {
                Like_BRL.DeleteLike(tempLike.LikeID);
                tempLike = null;
            }
        }

        Response.Redirect("DetallePelicula.aspx?Id=" + objSelected.PeliculaId);
    }
コード例 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        userLogeado = (UserCLI)Session["User"];

        LikeIcon.Text    = "<i class='fa fa-thumbs-o-up'></i>";   //No selected
        DislikeIcon.Text = "<i class='fa fa-thumbs-o-down'></i>"; //No selected
        if (!IsPostBack)
        {
            objSelected  = null;
            tempCompra   = null;
            tempAlquiler = null;
            Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache);
            Response.Cache.SetAllowResponseInBrowserHistory(false);
            Response.Cache.SetNoStore();
        }


        string cadPeliculaId = Request.Params["Id"];

        if (String.IsNullOrEmpty(cadPeliculaId))
        {
            lbNombrePeli.InnerText = "Error 404 Not Found";
            return;
        }

        int idPelicula = Convert.ToInt32(cadPeliculaId);

        objSelected = Pelicula_BRL.GetPeliculaByID(idPelicula);
        cargarComentarios();

        lbCantLikes.Text    = Like_BRL.GetCantLikes(objSelected.PeliculaId) + " ";
        lbCantDislikes.Text = Like_BRL.GetCantDisLikes(objSelected.PeliculaId) + "";

        Youtube.Src                 = "https://www.youtube.com/embed/" + objSelected.TrailerCode;
        lbNombrePeli.InnerText      = objSelected.Nombre;
        txtDecripcion.InnerText     = objSelected.Descripcion;
        txtDirector.InnerText       = objSelected.Director;
        txtElenco.InnerText         = objSelected.Elenco;
        txtPrecioVenta.InnerText    = objSelected.PrecioVenta + " BS";
        txtPrecioAlquiler.InnerText = objSelected.PrecioAlquiler + " BS";
        if (userLogeado == null)
        {
            btnLike.Enabled        = false;
            btnDislike.Enabled     = false;
            btnAlquilarSel.Visible = false;
            btnComprarSel.Visible  = false;
            FormComent.Visible     = false;
            btnVerPelicula.Visible = false;
            return;
        }

        //CODE THE LIKE VALIDATION

        btnLike.Enabled    = true;
        btnDislike.Enabled = true;

        tempLike = Like_BRL.GetLikeByUserPeliculaID(userLogeado.UserId, objSelected.PeliculaId);

        if (tempLike == null)
        {
            LikeIcon.Text    = "<i class='fa fa-thumbs-o-up'></i>";   //No selected
            DislikeIcon.Text = "<i class='fa fa-thumbs-o-down'></i>"; //No selected
        }
        else
        {
            if (tempLike.IsLike)
            {
                LikeIcon.Text    = "<i class='fa fa-thumbs-up'></i>";     //SELECTED
                DislikeIcon.Text = "<i class='fa fa-thumbs-o-down'></i>"; //No selected
            }
            else
            {
                LikeIcon.Text    = "<i class='fa fa-thumbs-o-up'></i>"; //No selected
                DislikeIcon.Text = "<i class='fa fa-thumbs-down'></i>"; //SELECCIONADO
            }
        }

        FormComent.Visible = true;

        tempCompra = Compra_BRL.GetTransaction(userLogeado.UserId, objSelected.PeliculaId);
        if (tempCompra != null)
        {
            if (tempCompra.Estado)
            {
                btnAlquilarSel.Visible = false;
                btnComprarSel.Visible  = false;
                btnVerPelicula.Visible = true;
            }
        }

        tempAlquiler = Alquiler_BRL.GetTransactionAlq(userLogeado.UserId, objSelected.PeliculaId);
        if (tempAlquiler != null)
        {
            if (tempAlquiler.Estado)
            {
                btnAlquilarSel.Visible = false;
                btnComprarSel.Visible  = false;
                btnVerPelicula.Visible = true;
            }
        }

        txtNombrePropie.Text       = userLogeado.Nombre + " " + userLogeado.Apellido;
        alq_txtNomPropie.Text      = userLogeado.Nombre + " " + userLogeado.Apellido;
        alq_txtCostoAlquixDia.Text = objSelected.PrecioAlquiler + " BS";
    }