protected void btnfinalizar_Click(object sender, EventArgs e)
        {
            string titulo       = txttitulo.Text.Trim();
            string fecha        = campo_oculto_fecha_publicacion.Value;
            string reseña       = txtreseña.Text.Trim();
            string foto_portada = Imagen_album.ImageUrl;
            int    artista      = Convert.ToInt16(Session["Artista"]);

            if (this.canciones.Count < 1)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alertIns", "alert('El album debe tener almenos una cancion');", true);
            }
            else
            {
                AlbumControlador nuevo_album = new AlbumControlador();
                nuevo_album.almacenar(titulo, fecha, reseña, foto_portada, artista);
                DataSet datos_Album = nuevo_album.buscar();
                int     id_album    = Convert.ToInt16(datos_Album.Tables["ALBUM"].Rows[0]["id_album"]);
                for (int i = 0; i < this.canciones.Count; i++)
                {
                    CancionControlador nueva = new CancionControlador();
                    nueva.almacenar(canciones[i].Nombre_cancion, canciones[i].Duracion, id_album, canciones[i].Url_cancion);
                }
                Session["canciones"] = null;
                string pagina = "album";
                Response.Redirect("Registro_album.aspx?id_artista=" + artista + "&pagina=" + pagina);
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     id_album  = Convert.ToInt16(Request.QueryString["id_album"]);
     canciones = new List <CancionModelo>();
     if (Request.QueryString["id_album"] != null)
     {
         AlbumControlador album = new AlbumControlador();
         //int id_album = Convert.ToInt16(Request.QueryString["id_album"]);
         DataSet datos_album = album.buscarporid(id_album);
         txttitulo.Text        = Convert.ToString(datos_album.Tables["ALBUM"].Rows[0]["titulo"]);
         Imagen_album.ImageUrl = Convert.ToString(datos_album.Tables["ALBUM"].Rows[0]["foto_portada"]);
         txtreseña.Text        = Convert.ToString(datos_album.Tables["ALBUM"].Rows[0]["reseña"]);
         campo_oculto_fecha_publicacion.Value = Convert.ToString(datos_album.Tables["ALBUM"].Rows[0]["fecha"]);
         CancionControlador canciones0 = new CancionControlador();
         DataSet            canciones1 = canciones0.buscarcanciones(id_album);
         for (int i = 0; i < canciones1.Tables["CANCION"].Rows.Count; i++)
         {
             CancionModelo cancion = new CancionModelo();
             cancion.Nombre_cancion = Convert.ToString(canciones1.Tables["CANCION"].Rows[i]["nombre_cancion"]);
             cancion.Url_cancion    = Convert.ToString(canciones1.Tables["CANCION"].Rows[i]["url_cancion"]);
             this.canciones.Add(cancion);
             Session["canciones"] = canciones;
             TableRow tRow = new TableRow();
             tabla_canciones.Rows.Add(tRow);
             TableCell numero = new TableCell();
             numero.Text = Convert.ToString(i + 1);
             tRow.Cells.Add(numero);
             TableCell nombre_Cancion = new TableCell();
             nombre_Cancion.Text = Convert.ToString(canciones1.Tables["CANCION"].Rows[i]["nombre_cancion"]);
             tRow.Cells.Add(nombre_Cancion);
             TableCell duracion = new TableCell();
             duracion.Text = Convert.ToString(canciones1.Tables["CANCION"].Rows[i]["duracion"]);
             tRow.Cells.Add(duracion);
             TableCell acciones = new TableCell();
             acciones.Text = "acciones";
             tRow.Cells.Add(acciones);
         }
     }
     else
     {
         //canciones = (List<CancionModelo>)Session["canciones"];
         for (int i = 0; i < canciones.Count; i++)
         {
             TableRow tRow = new TableRow();
             tabla_canciones.Rows.Add(tRow);
             TableCell numero = new TableCell();
             numero.Text = Convert.ToString(i + 1);
             tRow.Cells.Add(numero);
             TableCell nombre_Cancion = new TableCell();
             nombre_Cancion.Text = canciones[i].Nombre_cancion;
             tRow.Cells.Add(nombre_Cancion);
             TableCell duracion = new TableCell();
             duracion.Text = canciones[i].Duracion;
             tRow.Cells.Add(duracion);
             TableCell acciones = new TableCell();
             acciones.Text = "acciones";
             tRow.Cells.Add(acciones);
         }
     }
 }
        protected void btneliminar_Click(object sender, EventArgs e)
        {
            AlbumControlador album_b        = new AlbumControlador();
            DataSet          albumes_borrar = album_b.buscar(id_artista);

            for (int i = 0; i < albumes_borrar.Tables["ALBUM"].Rows.Count; i++)
            {
                CancionControlador cancion_b      = new CancionControlador();
                DataSet            cancion_borrar = cancion_b.buscarcanciones(Convert.ToInt16(albumes_borrar.Tables["ALBUM"].Rows[i]["id_Album"]));
                for (int j = 0; j < cancion_borrar.Tables["CANCION"].Rows.Count; j++)
                {
                    cancion_b.eliminar_cancion(Convert.ToInt16(cancion_borrar.Tables["CANCION"].Rows[j]["id_cancion"]));
                }
                album_b.Eliminar_album(Convert.ToInt16(albumes_borrar.Tables["ALBUM"].Rows[i]["id_album"]));
            }
            ArtistaControlador artista_b = new ArtistaControlador();

            artista_b.eliminar_artista(id_artista);
            UsuarioControlador usuario_c = new UsuarioControlador();

            usuario_c.Actualizar(Convert.ToInt16(Session["Usuario"]), 3);
            Session["Artista"]      = null;
            Session["Tipo_usuario"] = 3;
            Response.Redirect("Inicio.aspx");
        }
Esempio n. 4
0
        private void Play_c_Click(object sender, ImageClickEventArgs e)
        {
            ImageButton        clickedButton  = (ImageButton)sender;
            string             id_cancion     = Convert.ToString(clickedButton.ID).Replace('x', ' ');
            int                numero_cancion = Convert.ToInt16(id_cancion.Trim());
            CancionControlador cancion        = new CancionControlador();
            DataSet            datos_Cancion  = cancion.buscarporId(numero_cancion);
            string             nombre         = Convert.ToString(datos_Cancion.Tables["CANCION"].Rows[0]["url_cancion"]);

            Response.Redirect(nombre);
        }
        protected void btneliminar_Click(object sender, EventArgs e)
        {
            AlbumControlador eliminar = new AlbumControlador();

            eliminar.Eliminar_album(id_album);
            if (Session["canciones"] != null)
            {
                Session["canciones"] = null;
            }
            CancionControlador canciones_borrar = new CancionControlador();
            DataSet            datos_canciones  = canciones_borrar.buscarcanciones(id_album);

            for (int i = 0; i < datos_canciones.Tables["CANCION"].Rows.Count; i++)
            {
                canciones_borrar.eliminar_cancion(Convert.ToInt16(datos_canciones.Tables["CANCION"].Rows[i]["id_cancion"]));
            }
            string artista = Convert.ToString(Session["Artista"]);
            string pagina  = "album";

            Response.Redirect("Registro_album.aspx?id_artista=" + artista + "&pagina=" + pagina);
        }
Esempio n. 6
0
        //int contador;
        //CheckBox check;

        protected void Page_Load(object sender, EventArgs e)
        {
            lista = new CheckBoxList();
            CancionControlador cancion   = new CancionControlador();
            DataSet            canciones = cancion.mostrar(1);

            lista.Visible    = true;
            lista.DataSource = canciones.Tables["CANCION"].DefaultView;
            //lista.DataTextField = "nombre_cancion";
            lista.DataValueField = "id_cancion";
            lista.DataBind();
            int contador = 0;

            foreach (ListItem li in lista.Items)
            {
                string numero   = Convert.ToString(contador + 1);
                string nombre   = Convert.ToString(canciones.Tables["CANCION"].Rows[contador]["nombre_cancion"]);
                string duracion = Convert.ToString(canciones.Tables["CANCION"].Rows[contador]["duracion"]);
                li.Text   = numero + nombre + duracion;
                contador += 1;
            }
            lista.Visible = true;
            Canciones.Controls.Add(lista);
        }
Esempio n. 7
0
        /*
         * Nota: algunos de los id de los componentes tienen agregadas las letras a,b,c,x,y,z
         * esto es aproposito para que no haya conflictos de id
         * al momento de hacer click el usuario en cada uno de los componentes se les debe
         * quitar esas letras agregadas...
         */

        protected void Page_Load(object sender, EventArgs e)
        {
            //#################################Imagen de Album con sus botones###########################################
            ImageButton      imagen;
            Label            nombre_a;
            Table            tabla_a;
            ImageButton      play;
            ImageButton      like;
            ImageButton      fav;
            int              id_album    = Convert.ToInt16(Request.QueryString["id_album"]);
            int              id_play     = id_album;
            int              id_like     = id_album;
            int              id_fav      = id_album;
            AlbumControlador album       = new AlbumControlador();
            DataSet          datos_album = album.buscarporid(id_album);

            tabla_a = new Table();
            TableRow  tRow1    = new TableRow();
            TableCell etiqueta = new TableCell();

            etiqueta.ColumnSpan = 3;
            nombre_a            = new Label();
            nombre_a.Text       = Convert.ToString(datos_album.Tables["ALBUM"].Rows[0]["titulo"]);
            nombre_a.Visible    = true;
            etiqueta.Controls.Add(nombre_a);
            tRow1.Cells.Add(etiqueta);
            tabla_a.Rows.Add(tRow1);

            TableRow  tRow2   = new TableRow();
            TableCell portada = new TableCell();

            portada.ColumnSpan = 3;
            imagen             = new ImageButton();
            imagen.ID          = Convert.ToString(datos_album.Tables["ALBUM"].Rows[0]["id_album"]);
            imagen.Visible     = true;
            imagen.Width       = 640 / 3;
            imagen.Height      = 480 / 3;
            imagen.ImageUrl    = Convert.ToString(datos_album.Tables["ALBUM"].Rows[0]["foto_portada"]);
            portada.Controls.Add(imagen);
            tRow2.Cells.Add(portada);
            tabla_a.Rows.Add(tRow2);
            //#
            TableRow Acciones = new TableRow();


            TableCell acciones_play = new TableCell();
            TableCell acciones_like = new TableCell();
            TableCell acciones_fav  = new TableCell();

            play          = new ImageButton();
            play.ID       = Convert.ToString(id_play) + "a";
            play.Visible  = true;
            play.Width    = 100 / 3;
            play.Height   = 100 / 3;
            play.ImageUrl = "~/Vistas/images/play.jpg";
            play.Click   += Play_Click;

            acciones_play.Controls.Add(play);
            Acciones.Controls.Add(acciones_play);

            like          = new ImageButton();
            like.ID       = Convert.ToString(id_like) + "b";
            like.Visible  = true;
            like.Width    = 100 / 3;
            like.Height   = 100 / 3;
            like.ImageUrl = "~/Vistas/images/me_gusta.jpg";
            like.Click   += Like_Click;

            acciones_like.Controls.Add(like);
            Acciones.Controls.Add(acciones_like);

            fav          = new ImageButton();
            fav.ID       = Convert.ToString(id_fav) + "c";
            fav.Visible  = true;
            fav.Width    = 100 / 3;
            fav.Height   = 100 / 3;
            fav.ImageUrl = "~/Vistas/images/favorito.jpg";
            fav.Click   += Fav_Click;

            acciones_fav.Controls.Add(fav);
            Acciones.Controls.Add(acciones_fav);
            //#
            tabla_a.Rows.Add(Acciones);
            Contenedor_Album.Controls.Add(tabla_a);
            //########################################Imagen de Album con sus Botones#########################################
            CancionControlador canciones       = new CancionControlador();
            DataSet            datos_canciones = canciones.buscarcanciones(id_album);

            for (int i = 0; i < datos_canciones.Tables["CANCION"].Rows.Count; i++)
            {
                TableRow  can      = new TableRow();
                TableCell nombre_c = new TableCell();
                nombre_c.Text = Convert.ToString(datos_canciones.Tables["CANCION"].Rows[i]["nombre_cancion"]);
                can.Controls.Add(nombre_c);
                int         id_cancion = Convert.ToInt16(datos_canciones.Tables["CANCION"].Rows[i]["id_cancion"]);
                ImageButton play_c;
                ImageButton like_c;
                ImageButton fav_c;

                int id_play_c = id_cancion;
                int id_like_c = id_cancion;
                int id_fav_c  = id_cancion;

                TableCell acciones_play_c = new TableCell();
                TableCell acciones_like_c = new TableCell();
                TableCell acciones_fav_c  = new TableCell();

                play_c          = new ImageButton();
                play_c.ID       = Convert.ToString(id_play_c) + "x";
                play_c.Visible  = true;
                play_c.Width    = 100 / 3;
                play_c.Height   = 100 / 3;
                play_c.ImageUrl = "~/Vistas/images/play.jpg";
                play_c.Click   += Play_c_Click;

                acciones_play_c.Controls.Add(play_c);
                can.Controls.Add(acciones_play_c);

                like_c          = new ImageButton();
                like_c.ID       = Convert.ToString(id_like_c) + "y";
                like_c.Visible  = true;
                like_c.Width    = 100 / 3;
                like_c.Height   = 100 / 3;
                like_c.ImageUrl = "~/Vistas/images/me_gusta.jpg";
                like_c.Click   += Like_c_Click;

                acciones_like_c.Controls.Add(like_c);
                can.Controls.Add(acciones_like_c);

                fav_c          = new ImageButton();
                fav_c.ID       = Convert.ToString(id_fav_c) + "z";
                fav_c.Visible  = true;
                fav_c.Width    = 100 / 3;
                fav_c.Height   = 100 / 3;
                fav_c.ImageUrl = "~/Vistas/images/favorito.jpg";
                fav_c.Click   += Fav_c_Click;

                acciones_fav_c.Controls.Add(fav_c);
                can.Controls.Add(acciones_fav_c);

                tabla_canciones.Rows.Add(can);
            }
            ComentariosControlador comen = new ComentariosControlador();
            DataSet comens = comen.mostrar(id_album);
            TextBox caja;
            Label   nombre;

            for (int j = 0; j < comens.Tables["COMENTARIOS"].Rows.Count; j++)
            {
                caja      = new  TextBox();
                caja.Text = Convert.ToString(comens.Tables["COMENTARIOS"].Rows[j]["comentario"]);
                nombre    = new Label();
                UsuarioControlador usuario      = new UsuarioControlador();
                DataSet            datosusuario = usuario.buscar(Convert.ToInt16(comens.Tables["COMENTARIOS"].Rows[j]["usuario"]), 1);
                if (datosusuario.Tables["USUARIO"].Rows.Count > 0)
                {
                    nombre.Text = Convert.ToString(datosusuario.Tables["USUARIO"].Rows[0]["nombre_usuario"]);
                }
                else
                {
                    nombre.Text = "Eliminado";
                }
                Contenedor_Comentarios.Controls.Add(nombre);
                Contenedor_Comentarios.Controls.Add(caja);
            }
        }