Exemplo n.º 1
0
    protected void BtnDelete_Click(object sender, EventArgs e)
    {
        AlbumDataAccess delete = new AlbumDataAccess();

        delete.Delete(int.Parse(Request.QueryString["id"]));
        Response.Redirect("AlbumList.aspx");
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            AlbumDataAccess       albumDA = new AlbumDataAccess();
            MusicDataAccess.Album cur     = albumDA.FindAlbum(int.Parse(Request.QueryString["id"]));

            //fill in the fields, only if they aren't null
            if (cur.AlbumName != null)
            {
                txtAlbumName.Text = cur.AlbumName.ToString();
            }
            if (cur.ArtistName != null)
            {
                txtArtistName.Text = cur.ArtistName.ToString();
            }
            if (cur.Label != null)
            {
                txtLabel.Text = cur.Label.ToString();
            }
            if (cur.Genre != null)
            {
                ddlGenre.SelectedValue = cur.Genre.ToString();
            }
            if (cur.Year != null)
            {
                txtYear.Text = cur.Year.ToString();
            }
            if (cur.Artwork != null)
            {
                txtArtwork.Text = cur.Artwork.ToString();
            }
        }
    }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            AlbumDataAccess albumDA             = new AlbumDataAccess();
            List <MusicDataAccess.Album> albums = albumDA.GetAll();
            //AlbumServiceProxy.AlbumServiceClient albums = new AlbumServiceProxy.AlbumServiceClient();
            //List<MusicDataAccess.Album> albumsList = new List<MusicDataAccess.Album>();
            //albumsList = albums.GetAll();

            //List<Album> a = albums.GetAll();
            Repeater1.DataSource = albums;
            Repeater1.DataBind();
        }
    }
Exemplo n.º 4
0
    protected void BtnModify_Click(object sender, EventArgs e)
    {
        MusicDataAccess.Album updated = new MusicDataAccess.Album();
        updated.AlbumId    = int.Parse(Request.QueryString["id"]);
        updated.AlbumName  = txtAlbumName.Text;
        updated.ArtistName = txtArtistName.Text;
        updated.Label      = txtLabel.Text;
        updated.Genre      = ddlGenre.SelectedValue;
        updated.Year       = Convert.ToInt16(txtYear.Text);
        updated.Artwork    = txtArtwork.Text;

        AlbumDataAccess modify = new AlbumDataAccess();

        modify.Modify(updated);
        Response.Redirect("AlbumList.aspx");
    }
Exemplo n.º 5
0
    protected void FormSubmit(Object sender,
                              EventArgs e)
    {
        if (!requiredAlbum.IsValid)
        {
            EmptyAlbumName.Attributes["style"] = "display: block";
        }

        if (!requiredArtist.IsValid)
        {
            EmptyArtistName.Attributes["style"] = "display: block";
        }

        if (Page.IsValid)
        {
            FormSuccess.Attributes["style"] = "display: block";

            //add to DB
            MusicDataAccess.Album newAlbum = new MusicDataAccess.Album();
            newAlbum.AlbumName  = txtAlbumName.Text;
            newAlbum.ArtistName = txtArtistName.Text;
            newAlbum.Label      = txtLabel.Text;
            newAlbum.Genre      = ddlGenre.SelectedValue;
            newAlbum.Year       = Convert.ToInt16(txtYear.Text);
            //newAlbum.Image =

            AlbumDataAccess add = new AlbumDataAccess();

            add.Add(newAlbum);

            //add album and artist names to the session
            Session["AlbumName"]  = txtAlbumName.Text;
            Session["ArtistName"] = txtArtistName.Text;
            Response.Redirect("album-success.aspx");
        }
    }
        public async Task <Album> UpdateAsync(AlbumUpdateModel album)
        {
            await ArtistGetService.ValidateAsync(album);

            return(await AlbumDataAccess.UpdateAsync(album));
        }
Exemplo n.º 7
0
 public List <Album> GetAll()
 {
     MusicDataAccess.AlbumDataAccess ad = new AlbumDataAccess();
     return(ad.GetAll());
 }