Esempio n. 1
0
    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);
    }
Esempio n. 2
0
    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);
    }
Esempio n. 3
0
    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");
    }
Esempio n. 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);
    }
Esempio n. 5
0
    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);
    }
Esempio n. 6
0
    public static List <Transaction> GetAllTransactionByUserId(int UserId)
    {
        if (UserId <= 0)
        {
            throw new ArgumentException("El UserId debe ser mayor a 1");
        }
        List <Transaction> listTransaction = new List <Transaction>();
        //Obtieniendo Compras por UserID
        CompraTableAdapter adapterCompra = new CompraTableAdapter();

        Compra_DS.CompraDataTable tableCompra = adapterCompra.GetComprasByUserID(UserId);
        Transaction tempTransaction;
        UserCLI     tempUser;
        Pelicula    tempMovie;

        foreach (var row in tableCompra)
        {
            if (row.estado)
            {
                tempTransaction                  = new Transaction();
                tempTransaction.TotalPago        = row.totalPago;
                tempTransaction.FechaTransaction = row.fecha;
                tempTransaction.UserId           = row.UserId;
                tempUser = UserCLI_BRL.getUserById(row.UserId);
                tempTransaction.UserName       = tempUser.Nombre;
                tempTransaction.EmailUser      = tempUser.Email;
                tempTransaction.TarjetaCredito = row.tarjetaCredito;
                tempTransaction.CodigoTarjeta  = row.codigoTarjeta;
                tempTransaction.PeliculaId     = row.peliculaId;
                tempMovie = Pelicula_BRL.GetPeliculaByID(row.peliculaId);
                tempTransaction.NombrePelicula = tempMovie.Nombre;
                tempTransaction.Foto           = tempMovie.Foto;
                tempTransaction.Description    = tempMovie.Descripcion;
                tempTransaction.Director       = tempMovie.Director;
                tempTransaction.Elenco         = tempMovie.Elenco;
                tempTransaction.Label          = "<span class='label label-default pull-right'" +
                                                 "style='border-radius:3px; background-color:#5cb85c; color:#fff; padding: 6px 3px'" +
                                                 ">Venta</span>";


                listTransaction.Add(tempTransaction);
            }
        }

        AlquilerTableAdapter adapterAlquiler = new AlquilerTableAdapter();

        Alquiler_DS.AlquilerDataTable tableAlquiler = adapterAlquiler.GetAlquileresByUserID(UserId);

        foreach (var row in tableAlquiler)
        {
            if (row.estado)
            {
                TimeSpan ts        = DateTime.Now - row.fechaDevol;
                int      diference = ts.Days;
                if (diference > 0)
                {
                    Alquiler_BRL.DeleteAlquiler(row.AlquilerId);
                }
                else
                {
                    tempTransaction                  = new Transaction();
                    tempTransaction.TotalPago        = row.totalPago;
                    tempTransaction.FechaTransaction = row.fechaAlqui;
                    tempTransaction.UserId           = row.UserId;
                    tempUser = UserCLI_BRL.getUserById(row.UserId);
                    tempTransaction.UserName       = tempUser.Nombre;
                    tempTransaction.EmailUser      = tempUser.Email;
                    tempTransaction.TarjetaCredito = row.tarjetaCredito;
                    tempTransaction.CodigoTarjeta  = row.codigoTarjeta;
                    tempTransaction.PeliculaId     = row.peliculaId;
                    tempMovie = Pelicula_BRL.GetPeliculaByID(row.peliculaId);
                    tempTransaction.NombrePelicula = tempMovie.Nombre;
                    tempTransaction.Foto           = tempMovie.Foto;
                    tempTransaction.Description    = tempMovie.Descripcion;
                    tempTransaction.Director       = tempMovie.Director;
                    tempTransaction.Elenco         = tempMovie.Elenco;
                    tempTransaction.Label          = "<span class='label label-default pull-right'" +
                                                     "style='border-radius:3px; background-color:#777; color:#fff; padding: 6px 3px'" +
                                                     ">Alquiler</span>";


                    listTransaction.Add(tempTransaction);
                }
            }
        }

        return(listTransaction);
    }
Esempio n. 7
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 btnSaveChange_Click(object sender, EventArgs e)
    {
        lbValidator.Text = "";

        string nombre   = txtNewNombre.Text;
        string apellido = txtNewApellido.Text;
        string email    = txtNewEmail.Text;

        lbValidator.ForeColor = System.Drawing.Color.Red;

        if (String.IsNullOrEmpty(nombre.Trim()))
        {
            lbValidator.Text    = "Falla al Editar Perfil por que se dejo el campo Nombre Vacío";
            txtNombre.Visible   = true;
            txtApellido.Visible = true;
            txtEmail.Visible    = true;

            txtNewNombre.Visible   = false;
            txtNewApellido.Visible = false;
            txtNewEmail.Visible    = false;

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

        if (String.IsNullOrEmpty(apellido.Trim()))
        {
            lbValidator.Text    = "Falla al Editar Perfil por que se dejo el campo Apellido Vacío";
            txtNombre.Visible   = true;
            txtApellido.Visible = true;
            txtEmail.Visible    = true;

            txtNewNombre.Visible   = false;
            txtNewApellido.Visible = false;
            txtNewEmail.Visible    = false;

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

        if (String.IsNullOrEmpty(email.Trim()))
        {
            lbValidator.Text    = "Falla al Editar Perfil por que se dejo el campo Email Vacío";
            txtNombre.Visible   = true;
            txtApellido.Visible = true;
            txtEmail.Visible    = true;

            txtNewNombre.Visible   = false;
            txtNewApellido.Visible = false;
            txtNewEmail.Visible    = false;

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

        if (!txtConfirmPass.Text.Equals(usuarioLogeado.Password.Trim()))
        {
            lbValidator.Text    = "Falla al Editar Perfil por que la Contraseña es Incorrecta";
            txtNombre.Visible   = true;
            txtApellido.Visible = true;
            txtEmail.Visible    = true;

            txtNewNombre.Visible   = false;
            txtNewApellido.Visible = false;
            txtNewEmail.Visible    = false;

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


        usuarioLogeado.Nombre   = nombre;
        usuarioLogeado.Apellido = apellido;
        usuarioLogeado.Email    = email;

        UserCLI_BRL.updateUserCLI(usuarioLogeado);

        lbValidator.ForeColor = System.Drawing.Color.Green;
        lbValidator.Text      = "Perfil Editado Correctamente";

        Response.Redirect("~/JoyanaUSER/UserPerfil.aspx");
        txtNombre.Text   = usuarioLogeado.Nombre;
        txtApellido.Text = usuarioLogeado.Apellido;
        txtEmail.Text    = usuarioLogeado.Email;

        txtNombre.Visible   = true;
        txtApellido.Visible = true;
        txtEmail.Visible    = true;

        txtNewNombre.Visible   = false;
        txtNewApellido.Visible = false;
        txtNewEmail.Visible    = false;

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