Ejemplo n.º 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());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a new SONG_RATED object.
        /// </summary>
        /// <param name="id">Initial value of the ID property.</param>
        /// <param name="sONG_ID">Initial value of the SONG_ID property.</param>
        public static SONG_RATED CreateSONG_RATED(global::System.Int32 id, global::System.Int32 sONG_ID)
        {
            SONG_RATED sONG_RATED = new SONG_RATED();

            sONG_RATED.ID      = id;
            sONG_RATED.SONG_ID = sONG_ID;
            return(sONG_RATED);
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the SONG_RATED EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSONG_RATED(SONG_RATED sONG_RATED)
 {
     base.AddObject("SONG_RATED", sONG_RATED);
 }