protected void DeleteAlbum_Click(object sender, EventArgs e)
    {
        //any other business rules
        if (string.IsNullOrEmpty(AlbumID.Text))
        {
            MessageUserControl2.ShowInfo("Missing Data", "Missing Album Id. Use Find to locate the album you wish to maintain.");
        }
        else
        {
            int albumid = 0;
            if (int.TryParse(AlbumID.Text, out albumid))
            {
                MessageUserControl2.TryRun(() =>
                {
                    AlbumController sysmgr = new AlbumController();


                    sysmgr.Albums_Delete(albumid);
                }, "Delete Album", "Album has been successfully delete from the database.");
            }
            else
            {
                MessageUserControl2.ShowInfo("Invalid Data", "Album Id. Use Find to locate the album you wish to maintain.");
            }
        }
    }
    protected void UpdateAlbum_Click(object sender, EventArgs e)
    {
        if (IsValid)
        {
            //any other business rules
            if (string.IsNullOrEmpty(AlbumID.Text))
            {
                MessageUserControl2.ShowInfo("Missing Data", "Missing Album Id. Use Find to locate the album you wish to maintain.");
            }
            else
            {
                int albumid = 0;
                if (int.TryParse(AlbumID.Text, out albumid))
                {
                    MessageUserControl2.TryRun(() =>
                    {
                        AlbumController sysmgr = new AlbumController();
                        Album newalbum         = new Album();
                        newalbum.AlbumId       = albumid;
                        newalbum.Title         = AlbumTitle.Text;
                        newalbum.ArtistId      = int.Parse(ArtistList.SelectedValue);
                        newalbum.ReleaseYear   = int.Parse(AlbumReleaseYear.Text);
                        newalbum.ReleaseLabel  = string.IsNullOrEmpty(AlbumReleaseLabel.Text) ? null : AlbumReleaseYear.Text;

                        sysmgr.Albums_Update(newalbum);
                    }, "Update Album", "Album has been successfully update on the database.");
                }
                else
                {
                    MessageUserControl2.ShowInfo("Invalid Data", "Album Id. Use Find to locate the album you wish to maintain.");
                }
            }
        }
    }
Exemplo n.º 3
0
    protected void DeleteAlbum_Click(object sender, EventArgs e)
    {
        //retest the validation of the incoming data via the Validation controls

        //any other business rules
        if (string.IsNullOrEmpty(AlbumID.Text))
        {
            MessageUserControl2.ShowInfo("Missing Data", "Missing Album Id, Use find to lcation the album you wish to update");
        }
        else
        {
            int albumid = 0;
            if (int.TryParse(AlbumID.Text, out albumid))
            {
                MessageUserControl2.TryRun(() =>
                {
                    AlbumController sysmgr = new AlbumController();

                    sysmgr.Album_Delete(albumid);
                }, "Add Album", "Album has been sucessfully updated to the database");
            }
            else
            {
                MessageUserControl2.ShowInfo("Invalid Data", "Album Id, Use find to lcation the album you wish to update");
            }
        }
    }
 protected void AddAlbum_Click(object sender, EventArgs e)
 {
     //Re test the validation of the incoming data via the validation controls.
     if (IsValid)
     {
         //Any other business rules
         MessageUserControl2.TryRun(() =>
         {
             AlbumController sysmgr = new AlbumController();
             Album newalbum         = new Album();
             newalbum.Title         = AlbumTitle.Text;
             newalbum.ArtistId      = int.Parse(ArtistList.SelectedValue);
             newalbum.ReleaseYear   = int.Parse(AlbumReleaseYear.Text);
             newalbum.ReleaseLabel  = string.IsNullOrEmpty(AlbumReleaseLabel.Text) ? null : AlbumReleaseLabel.Text;
             sysmgr.Albums_Add(newalbum);
         }, "Add Album", "Album has been succesfully add!!");
     }
 }