public static List <Compra> GetAllCompras()
    {
        CompraTableAdapter adapter = new CompraTableAdapter();

        Compra_DS.CompraDataTable table = adapter.GetCompras();

        List <Compra> result = new List <Compra>();
        Compra        temp;

        foreach (var row in table)
        {
            temp                = new Compra();
            temp.CompraId       = row.CompraId;
            temp.Fecha          = row.fecha;
            temp.TotalPago      = row.totalPago;
            temp.TarjetaCredito = row.tarjetaCredito;
            temp.CodigoTarjeta  = row.codigoTarjeta;
            temp.Estado         = row.estado;
            temp.UserId         = row.UserId;
            UserCLI userTemp = UserCLI_BRL.getUserById(row.UserId);
            temp.Email      = userTemp.Email;
            temp.PeliculaId = row.peliculaId;
            Pelicula moviesTemp = Pelicula_BRL.GetPeliculaByID(row.peliculaId);
            temp.NombrePelicula = moviesTemp.Nombre;

            result.Add(temp);
        }

        return(result);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        lbValidator.Text = "";
        UserCLI obj = (UserCLI)Session["User"];

        if (obj == null)
        {
            Response.Redirect("~/JoyanaUSER/LoginUser.aspx");
            return;
        }

        usuarioLogeado = obj;

        txtNombre.Text   = obj.Nombre;
        txtApellido.Text = obj.Apellido;
        txtEmail.Text    = obj.Email;

        lbValidator.Text    = "";
        txtNombre.Enabled   = false;
        txtApellido.Enabled = false;
        txtEmail.Enabled    = false;

        pnCurrentPassword.Visible  = false;
        PnBtnOptions.Visible       = true;
        PnBtnConrfirmation.Visible = false;

        if (!IsPostBack)
        {
            Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache);
            Response.Cache.SetAllowResponseInBrowserHistory(false);
            Response.Cache.SetNoStore();
            return;
        }
    }
    public static List <Compra> GetComprasByUserID(int UserId)
    {
        if (UserId <= 0)
        {
            throw new ArgumentException("El UserId no debe ser menor igual a 0");
        }

        CompraTableAdapter adapter = new CompraTableAdapter();

        Compra_DS.CompraDataTable table  = adapter.GetComprasByUserID(UserId);
        List <Compra>             result = new List <Compra>();
        Compra temp;

        foreach (var row in table)
        {
            temp                = new Compra();
            temp.CompraId       = row.CompraId;
            temp.Fecha          = row.fecha;
            temp.TotalPago      = row.totalPago;
            temp.TarjetaCredito = row.tarjetaCredito;
            temp.CodigoTarjeta  = row.codigoTarjeta;
            temp.Estado         = row.estado;
            temp.UserId         = row.UserId;
            UserCLI userTemp = UserCLI_BRL.getUserById(row.UserId);
            temp.Email      = userTemp.Email;
            temp.PeliculaId = row.peliculaId;
            Pelicula moviesTemp = Pelicula_BRL.GetPeliculaByID(row.peliculaId);
            temp.NombrePelicula = moviesTemp.Nombre;

            result.Add(temp);
        }

        return(result);
    }
Exemple #4
0
    public static List <Alquiler> GetAllAlquileres()
    {
        AlquilerTableAdapter adapter = new AlquilerTableAdapter();

        Alquiler_DS.AlquilerDataTable table = adapter.GetAlquileres();

        List <Alquiler> result = new List <Alquiler>();
        Alquiler        temp;

        foreach (var row in table)
        {
            temp                = new Alquiler();
            temp.AlquilerId     = row.AlquilerId;
            temp.TotalPago      = row.totalPago;
            temp.FechaAlqui     = row.fechaAlqui;
            temp.FechaDevol     = row.fechaDevol;
            temp.TarjetaCredito = row.tarjetaCredito;
            temp.CodigoTarjeta  = row.codigoTarjeta;
            temp.Estado         = row.estado;
            temp.UserId         = row.UserId;
            UserCLI userTemp = UserCLI_BRL.getUserById(row.UserId);
            temp.Email      = userTemp.Email;
            temp.PeliculaId = row.peliculaId;
            Pelicula moviesTemp = Pelicula_BRL.GetPeliculaByID(row.peliculaId);
            temp.NombrePelicula = moviesTemp.Nombre;
            result.Add(temp);
        }

        return(result);
    }
    protected void btnIngresar_Click(object sender, EventArgs e)
    {
        string email    = txtEmail.Text;
        string password = txtPassword.Text;

        if (String.IsNullOrEmpty(email))
        {
            lbValidator.Text = "El campo Email no debe estar Vacío";
            return;
        }

        if (String.IsNullOrEmpty(password))
        {
            lbValidator.Text = "El campo Contraseña no debe estar Vacío";
            return;
        }

        UserCLI obj = UserCLI_BRL.getUserByEmail(email);

        if (obj == null)
        {
            lbValidator.Text = "El email no se encuentra registrado en el Sistema";
            return;
        }
        if (!password.Equals(obj.Password.Trim()))
        {
            lbValidator.Text = "Contraseña Incorrecta";
            return;
        }

        Session["User"] = obj;

        Response.Redirect("~/JoyanaUSER/Home.aspx");
    }
Exemple #6
0
    public static void updateUserCLI(UserCLI obj)
    {
        if (obj == null)
        {
            throw new ArgumentException("El objeto no debe ser nul");
        }

        UserCLITableAdapter adapter = new UserCLITableAdapter();

        adapter.Update(obj.Nombre, obj.Apellido, obj.Email, obj.UserId);
    }
Exemple #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        UserCLI obj = (UserCLI)Session["User"];

        if (obj == null)
        {
            return;
        }
        if (!IsPostBack)
        {
            cargarPeliculas(obj.UserId);
            Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache);
            Response.Cache.SetAllowResponseInBrowserHistory(false);
            Response.Cache.SetNoStore();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            return;
        }
        string query = Request.Params["Name"];

        if (!string.IsNullOrEmpty(query))
        {
            txtSearch.Text = query;
        }

        UserCLI obj = (UserCLI)Session["User"];

        if (obj == null)
        {
            itemLogout.Visible = false;
            itemPerfil.Visible = false;

            itemIngresar.Visible  = true;
            itemRegistrar.Visible = true;
        }
        else
        {
            itemLogout.Visible  = true;
            itemPerfil.Visible  = true;
            txtPerfil.InnerText = obj.Nombre;

            itemIngresar.Visible  = false;
            itemRegistrar.Visible = false;
        }

        List <Genero> listGeneros = Genero_BRL.GetGeneros();
        string        cad         = "";

        for (int i = 0; i < listGeneros.Count; i++)
        {
            cad = cad + "<li> <a href='CatalogoPelicula.aspx?Id=" + listGeneros[i].GeneroId + "'>" + listGeneros[i].Nombre + "</a> </li> ";
        }

        LitCategories.Text = cad;
    }
Exemple #9
0
    public static int insertUserCLI(UserCLI obj)
    {
        if (obj == null)
        {
            throw new ArgumentException("El objeto no debe ser nul");
        }

        int?userCLI_ID = null;
        UserCLITableAdapter adapter = new UserCLITableAdapter();

        adapter.Insert(obj.Nombre, obj.Apellido, obj.Email, obj.Password, ref userCLI_ID);

        if (userCLI_ID == null || userCLI_ID.Value <= 0)
        {
            throw new ArgumentException("La llave primaria no se generó correctamente");
        }

        return(userCLI_ID.Value);
    }
    public static Compra GetCompraByID(int CompraId)
    {
        if (CompraId <= 0)
        {
            throw new ArgumentException("La CompraID debe ser mayor a 0");
        }

        CompraTableAdapter adapter = new CompraTableAdapter();

        Compra_DS.CompraDataTable table = adapter.GetCompraByID(CompraId);
        if (table.Rows.Count == 0)
        {
            return(null);
        }

        Compra_DS.CompraRow row = table[0];

        Compra obj = new Compra();

        obj.CompraId       = row.CompraId;
        obj.Fecha          = row.fecha;
        obj.TotalPago      = row.totalPago;
        obj.TarjetaCredito = row.tarjetaCredito;
        obj.CodigoTarjeta  = row.codigoTarjeta;
        obj.Estado         = row.estado;
        obj.UserId         = row.UserId;
        UserCLI userTemp = UserCLI_BRL.getUserById(row.UserId);

        obj.Email      = userTemp.Email;
        obj.PeliculaId = row.peliculaId;
        Pelicula movieTemp = Pelicula_BRL.GetPeliculaByID(row.peliculaId);

        obj.NombrePelicula = movieTemp.Nombre;



        return(obj);
    }
Exemple #11
0
    public static UserCLI getUserByEmail(string email)
    {
        UserCLITableAdapter adapter = new UserCLITableAdapter();

        UserCLI_DS.UserCLIDataTable table = adapter.GetUserCLIByEmail(email);

        if (table.Rows.Count == 0)
        {
            return(null);
        }

        UserCLI_DS.UserCLIRow row = table[0];
        UserCLI obj = new UserCLI()
        {
            UserId   = row.UserId,
            Nombre   = row.nombre,
            Apellido = row.apellido,
            Email    = row.email,
            Password = row.password
        };

        return(obj);
    }
Exemple #12
0
    protected void btnRegistrar_Click(object sender, EventArgs e)
    {
        lbValidator.Text = "";
        string nombre     = txtNombre.Text;
        string apellido   = txtApellido.Text;
        string email      = txtEmail.Text;
        string password   = txtPassword.Text;
        string rePassword = txtRePassword.Text;

        if (String.IsNullOrEmpty(nombre))
        {
            lbValidator.Text = "La casilla Nombre no puede estar vacía";
            return;
        }

        if (String.IsNullOrEmpty(apellido))
        {
            lbValidator.Text = "La casilla Apellido no puede estar vacía";
            return;
        }

        if (String.IsNullOrEmpty(email))
        {
            lbValidator.Text = "La casilla Email no puede estar vacía";
            return;
        }

        if (String.IsNullOrEmpty(password))
        {
            lbValidator.Text = "La casilla Contraseña no puede estar vacía";
            return;
        }

        if (!password.Equals(rePassword))
        {
            lbValidator.Text = "Las casillas de Contraseña no coinciden";
            return;
        }

        UserCLI objTemp = UserCLI_BRL.getUserByEmail(email);

        if (objTemp != null)
        {
            lbValidator.Text = "Ya existe un Usuario con esa dirección de Email";
            return;
        }

        UserCLI obj = new UserCLI()
        {
            Nombre   = nombre,
            Apellido = apellido,
            Email    = email,
            Password = password
        };

        UserCLI_BRL.insertUserCLI(obj);
        lbValidator.Text = "";

        Session["User"] = obj;
        Response.Redirect("~/JoyanaUSER/Home.aspx");
    }
    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";
    }