Ejemplo n.º 1
0
        public static void FilterArtistsByAlbum(Album album)
        {
            //This method is used by the AddSong subwindow to assist the user in selecting Albums and Artists.
            int artistID = album.ArtistID;

            subWindowArtistList.Clear();
            subWindowArtistList = CDCatalogManager.GetArtists().Where(art => art.ArtistID.Equals(artistID)).ToList();
            subWindowAlbumList.Clear();
            subWindowAlbumList = CDCatalogManager.GetAlbums().Where(alb => alb.ArtistID.Equals(artistID)).ToList();
        }
Ejemplo n.º 2
0
        public static bool addAlbumGo(string albumTitle, Artist artist, int albumRating, string year, List <TrackInfo> tracks, out string message)
        {
            //Verify Album input fields, then add the Album and all associated tracks to the model.
            bool isValid = true;

            message = "";
            int yr             = 0;
            int doesAlbumExist = CDCatalogManager.GetAlbums().Where(a => a.AlbumTitle.Equals(albumTitle)).Where(a => a.ArtistID.Equals(artist.ArtistID)).Count();

            if (!(doesAlbumExist == 0))
            {
                isValid  = false;
                message += "An album by this artist with this title already exists in the database.\n";
            }
            if (!int.TryParse(year, out yr))
            {
                isValid  = false;
                message += "Year must be an integer.\n";
            }

            if (isValid)
            {
                Song  song  = new Song();
                Album album = new Album();
                album.AlbumTitle = albumTitle;
                album.ArtistID   = artist.ArtistID;
                album.Rating     = albumRating;
                album.Year       = yr;
                CDCatalogManager.AddAlbum(album);

                foreach (TrackInfo t in tracks)
                {
                    song             = new Song();
                    song.AlbumID     = album.AlbumID;
                    song.ArtistID    = t.artist.ArtistID;
                    song.GenreID     = t.genreID;
                    song.Rating      = t.rating;
                    song.SongTitle   = t.title;
                    song.TrackLength = t.tracklength;
                    song.TrackNumber = t.tracknum;
                    CDCatalogManager.AddSong(song);
                }
            }

            return(isValid);
        }
Ejemplo n.º 3
0
 //The GetAll* methods are just local wrappers for the DB layer, to save the developer
 //from having to type "CDCatalogManager." over and over again.
 public static void GetAllAlbums()
 {
     filterAlbumList = CDCatalogManager.GetAlbums();
 }
Ejemplo n.º 4
0
 public static void AddSongsFillAlbums()
 {
     //Populate the Song list for subwindows.
     subWindowAlbumList.Clear();
     subWindowAlbumList = CDCatalogManager.GetAlbums();
 }