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 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"); }
protected void Page_Load(object sender, EventArgs e) { ImageButton imagen; Label nombre_A; Table tabla_A; int id_artista = Convert.ToInt16(Session["Artista"]); AlbumControlador albumes = new AlbumControlador(); DataSet todos_albumes = albumes.buscar(id_artista); for (int i = 0; i < todos_albumes.Tables["ALBUM"].Rows.Count; i++) { if (Convert.ToString(todos_albumes.Tables["ALBUM"].Rows[i]["estado"]) == "1") { tabla_A = new Table(); TableRow tRow1 = new TableRow(); TableCell etiqueta = new TableCell(); nombre_A = new Label(); nombre_A.Text = Convert.ToString(todos_albumes.Tables["ALBUM"].Rows[i]["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(); imagen = new ImageButton(); imagen.ID = Convert.ToString(todos_albumes.Tables["ALBUM"].Rows[i]["id_album"]); imagen.Click += Imagen_Click; imagen.Visible = true; imagen.Width = 640 / 3; imagen.Height = 480 / 3; imagen.ImageUrl = Convert.ToString(todos_albumes.Tables["ALBUM"].Rows[i]["foto_portada"]); portada.Controls.Add(imagen); tRow2.Cells.Add(portada); tabla_A.Rows.Add(tRow2); Contenedor_Album.Controls.Add(tabla_A); } } }
protected void Page_Load(object sender, EventArgs e) { ImageButton imagen; Label nombre_a; Table tabla_a; int id_artista = Convert.ToInt16(Request.QueryString["id_artista"]); AlbumControlador album_artista = new AlbumControlador(); DataSet datos_album = album_artista.buscar(id_artista); for (int i = 0; i < datos_album.Tables["ALBUM"].Rows.Count; i++) { //# tabla_a = new Table(); TableRow tRow1 = new TableRow(); TableCell etiqueta = new TableCell(); nombre_a = new Label(); nombre_a.Text = Convert.ToString(datos_album.Tables["ALBUM"].Rows[i]["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(); imagen = new ImageButton(); imagen.ID = Convert.ToString(datos_album.Tables["ALBUM"].Rows[i]["id_album"]); imagen.Click += Imagen_Click; imagen.Visible = true; imagen.Width = 640 / 3; imagen.Height = 480 / 3; imagen.ImageUrl = Convert.ToString(datos_album.Tables["ALBUM"].Rows[i]["foto_portada"]); portada.Controls.Add(imagen); tRow2.Cells.Add(portada); tabla_a.Rows.Add(tRow2); Contenedor_Albumes.Controls.Add(tabla_a); //# } }