예제 #1
0
        public static SONG[] GetSongsByGenre(int num, string genre)
        {
            List <SONG> ret = new List <SONG>();

            using (var context = new MusicEntities())
            {
                var sql = "SELECT song_rated, NEWGUID() AS guid, song_rated.song " +
                          "FROM song_rated " +
                          "JOIN ARTIST as artist " +
                          "ON artist.NAME = song_rated.song.artist " +
                          "WHERE song_rated.song.GENRE LIKE 'Ambient%' ";

                sql = sql + " ORDER BY guid";

                var results = context.CreateQuery <DbDataRecord>(sql);
                results.Parameters.Add(new ObjectParameter("num", num));

                foreach (var currentResult in results)
                {
                    SONG_RATED songRated = (SONG_RATED)currentResult[0];
                    SONG       song      = songRated.SONG;
                    ret.Add(song);
                }
            }

            return(ret.ToArray());
        }
예제 #2
0
        /// <summary>
        /// Create a new SONG object.
        /// </summary>
        /// <param name="tITLE">Initial value of the TITLE property.</param>
        /// <param name="rATING">Initial value of the RATING property.</param>
        /// <param name="id">Initial value of the ID property.</param>
        /// <param name="uPLOADED">Initial value of the UPLOADED property.</param>
        public static SONG CreateSONG(global::System.String tITLE, global::System.Int32 rATING, global::System.Int32 id, global::System.Boolean uPLOADED)
        {
            SONG sONG = new SONG();

            sONG.TITLE    = tITLE;
            sONG.RATING   = rATING;
            sONG.ID       = id;
            sONG.UPLOADED = uPLOADED;
            return(sONG);
        }
예제 #3
0
        public static SONG[] GetMellowSongs(int num)
        {
            List <SONG> ret = new List <SONG>();

            using (var context = new MusicEntities())
            {
                var qStr = "SELECT TOP (@num) song_rated, NEWGUID() AS guid, song_rated.song " +
                           "FROM song_rated " +
                           "JOIN ARTIST as artist " +
                           "ON artist.NAME = song_rated.song.artist " +
                           "WHERE song_rated.song.GENRE IN {'Acid House'," +
                           "'Acid Jazz'," +
                           "'Ambient'," +
                           "'Ambient Breakbeat'," +
                           "'Ambient Downtempo Abstract'," +
                           "'Ambient Downtempo'," +
                           "'Ambient Dub'," +
                           "'Ambient House'," +
                           "'Ambient Space'," +
                           "'Ambient Techno'," +
                           "'Ambient / Chillout'," +
                           "'Beats & Breaks'," +
                           "'Beats and Breaks'," +
                           "'Big Beat'," +
                           "'Boom Bap'," +
                           "'Breaks & Beats'," +
                           "'Breaks and Beats'," +
                           "'Chill Out'," +
                           "'Chill-Out'," +
                           "'Chillout'," +
                           "'Cut & Paste'," +
                           "'Dance'," +
                           "'Deep House'," +
                           "'Down Tempo'," +
                           "'Downbeat'," +
                           "'Downtemp'," +
                           "'Downtempo'," +
                           "'drum ''n'' bass'," +
                           "'Dub'," +
                           "'Dubstep'," +
                           "'Electro-Funk'," +
                           "'Electroclash'," +
                           "'Electronic'," +
                           "'Electronica'," +
                           "'Electronica & Dance'," +
                           "'ElectroPop'," +
                           "'Environmental Music'," +
                           "'Ethnic Fusion'," +
                           "'Experimental'," +
                           "'Experimental Hip-Hop'," +
                           "'Experimental Rap'," +
                           "'Film Score'," +
                           "'Freestyle'," +
                           "'Funky House'," +
                           "'General Electronic'," +
                           "'General Techno'," +
                           "'Global House'," +
                           "'Grime'," +
                           "'Hardcore Electronic'," +
                           "'House'," +
                           "'Illbient'," +
                           "'Instrumental Hip-Hop'," +
                           "'Intelligent'," +
                           "'Jungle'," +
                           "'Laptronic'," +
                           "'Laptronica'," +
                           "'Leftfield'," +
                           "'Leftfield/IDM'," +
                           "'Minimal'," +
                           "'Minimalism'," +
                           "'New Age Electronic'," +
                           "'Plunderphonic'," +
                           "'Psytrance'," +
                           "'Rave'," +
                           "'Remix'," +
                           "'Techno'," +
                           "'Techno Tribal'," +
                           "'Trance'," +
                           "'Trip Hop'," +
                           "'Trip-Hop'," +
                           "'Turntabalism'," +
                           "'Turntablism'," +
                           "'World Beats'," +
                           "'World Dance'," +
                           "'World Reggae'," +
                           "'Worldbeat'} " +

                           "AND (artist.Radio is null)";

                qStr = qStr + " ORDER BY guid";

                var results = context.CreateQuery <DbDataRecord>(qStr);
                results.Parameters.Add(new ObjectParameter("num", num));

                foreach (var currentResult in results)
                {
                    SONG_RATED songRated = (SONG_RATED)currentResult[0];
                    SONG       song      = songRated.SONG;
                    ret.Add(song);
                }
            }

            return(ret.ToArray());
        }
예제 #4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the SONG EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSONG(SONG sONG)
 {
     base.AddObject("SONG", sONG);
 }
예제 #5
0
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        //[TestMethod]
        //public void DownloadBlobsWithNoSongRecords()
        //{
        //    String folderName = "e:\\music";

        //    SongDownloader songDownloader = new SongDownloader();
        //    songDownloader.OnSongFound += DownloadSong;
        //    songDownloader.OnSongNotFound += songDownloader.DownloadBlob;
        //    songDownloader.DownloadSongs(folderName);
        //}

        public void DownloadSong(SqlAzureData.SONG song, String folderName)
        {
        }