Beispiel #1
0
        public static void test()
        {
            Database.DatabaseOperations datOp = new Database.DatabaseOperations();

            //datOp.LoadFromCSV("C:/File export/database.csv");

            Guid bandId1  = datOp.AddBand("Amon Amarth");
            Guid bandId2  = datOp.AddBand("Alestorm");
            Guid albumId1 = datOp.AddAlbum("Berserker");
            Guid albumId2 = datOp.AddAlbum("Curse of the Crystal Coconut");

            datOp.AddBandAlbumSong(bandId1, albumId1, datOp.AddSong("Fafner's Gold"));
            datOp.AddBandAlbumSong(bandId1, albumId1, datOp.AddSong("Crack the Sky"));
            datOp.AddBandAlbumSong(bandId1, albumId1, datOp.AddSong("Shield Wall"));
            datOp.AddBandAlbumSong(bandId1, null, datOp.AddSong("Burning Creation"));
            datOp.AddBandAlbumSong(bandId1, null, datOp.AddSong("The Arrival of the Fimbul Winter"));
            datOp.AddBandAlbumSong(bandId2, albumId2, datOp.AddSong("Tortuga"));
            datOp.AddBandAlbumSong(bandId2, null, datOp.AddSong("Big Ship Little Ship"));

            var a = datOp.GetAlbumsForBand(bandId1);
            var b = datOp.GetSinglesForBand(bandId1);
            var c = datOp.GetSongsForAlbum(albumId1);
            var d = datOp.GetBandsForKeyword("");
            var e = datOp.GetSongsForKeyword("t");

            //datOp.SaveToCSV("C:/File export/database.csv");
        }
Beispiel #2
0
        //public void Band(string band)
        //{
        //    List<Database.Band> bands = datOp.GetBandsForKeyword(band).ToList();
        //    bandObj = bands[0];
        //    BandLabel.Content = bandObj.BandName;
        //    FoundationYearLabel.Content = "Foundation year:     " + bandObj.FoundationYear;
        //    List<Database.Album> albums = datOp.GetAlbumsForBand(bandObj.IdBand).ToList();
        //    foreach (var album in albums)
        //    {
        //        Albums.Items.Add(album.AlbumName);
        //    }
        //}


        //private void Albums_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        //{
        //    if (Albums.SelectedItem != null)
        //    {
        //        Songs.Items.Clear();
        //        List<Database.Album> albums = datOp.GetAlbumsForKeyword(Albums.SelectedItem.ToString()).ToList();
        //        albumObj = albums[0];
        //        List<Database.Song> songs = datOp.GetSongsForAlbum(albumObj.IdAlbum).ToList();
        //        foreach (var song in songs)
        //        {
        //            Songs.Items.Add(song.SongName);
        //        }
        //    }
        //}

        private void AddAlbumButton_Click(object sender, RoutedEventArgs e)
        {
            if (AlbumNameBox != null)
            {
                Songs.Items.Clear();
                datOp.AddAlbum(AlbumNameBox.Text);
                Songs.Items.Clear();
                List <Database.Song> songs = datOp.GetSongsForAlbum(albumObj.IdAlbum).ToList();
                Songs.Items.Clear();
                foreach (var song in songs)
                {
                    Songs.Items.Add(song.SongName);
                }
                Albums.Items.Add(AlbumNameBox.Text);
                Albums.SelectedIndex = Albums.Items.Count - 1;
                AlbumsLabel.Content  = ("Albums:     " + Albums.Items.Count);
                AlbumNameBox.Text    = "AlbumName";
            }
        }