public SearchResult Find(string query, int maxResults, int page) { // Find songs DataSet tracksResult = MakeDataSet("SELECT * FROM track,artist, release WHERE artist.id = track.artist AND track.album = release.id AND (track.title LIKE '%" + query + "%' OR track.title LIKE '%%') AND (release.title LIKE '%" + query + "%' OR release.title LIKE '%%') AND (artist.title LIKE '%" + query + "%' OR artist.title = '%%')"); SearchResult sr = new SearchResult(this); sr.Tracks = new TrackCollection(this, sr, new List <Track>()); foreach (DataRow dr in tracksResult.Tables[0].Rows) { sr.Tracks.Add(TrackFromDataRow(dr)); } // Find artists DataSet artistsResult = MakeDataSet("SELECT * FROM artist WHERE title LIKE '%" + query + "%'"); ArtistCollection ac = new ArtistCollection(this, new List <Artist>()); foreach (DataRow dr in artistsResult.Tables[0].Rows) { ac.Add(ArtistFromDataSet(dr)); } sr.Artists = ac; // Find albums DataSet albumsResult = MakeDataSet("SELECT * FROM release, artist WHERE artist.id = release.artist AND release.title LIKE '%" + query + "%'"); ReleaseCollection rc = new ReleaseCollection(this, new List <Release>()); foreach (DataRow dr in albumsResult.Tables[0].Rows) { rc.Add(ReleaseFromDataRow(dr)); } sr.Albums = rc; return(sr); }
public SearchResult GetCollection(string type, int page) { switch (type) { case "home": { SearchResult sr = new SearchResult(this); ReleaseCollection RC = new ReleaseCollection(this, new List <Release>()); DataSet DS = MakeDataSet("SELECT * FROM artist, release, whatsnew WHERE whatsnew.release_id = release.id AND release.artist = artist.id ORDER BY release.release_date DESC"); foreach (DataRow dr in DS.Tables[0].Rows) { Release t = ReleaseFromDataRow(dr); RC.Add(t); } sr.Albums = RC; return(sr); } } return(null); }
public SearchResult Find(string query, int maxResults, int page) { // Find songs DataSet tracksResult = MakeDataSet("SELECT * FROM track,artist, release WHERE artist.id = track.artist AND track.album = release.id AND (track.title LIKE '%" + query + "%' OR track.title LIKE '%%') AND (release.title LIKE '%" + query + "%' OR release.title LIKE '%%') AND (artist.title LIKE '%" + query + "%' OR artist.title = '%%')"); SearchResult sr = new SearchResult(this); sr.Tracks = new TrackCollection(this, sr, new List<Track>()); foreach (DataRow dr in tracksResult.Tables[0].Rows) { sr.Tracks.Add(TrackFromDataRow(dr)); } // Find artists DataSet artistsResult = MakeDataSet("SELECT * FROM artist WHERE title LIKE '%" + query + "%'"); ArtistCollection ac = new ArtistCollection(this, new List<Artist>()); foreach (DataRow dr in artistsResult.Tables[0].Rows) { ac.Add(ArtistFromDataSet(dr)); } sr.Artists = ac; // Find albums DataSet albumsResult = MakeDataSet("SELECT * FROM release, artist WHERE artist.id = release.artist AND release.title LIKE '%" + query + "%'"); ReleaseCollection rc = new ReleaseCollection(this, new List<Release>()); foreach (DataRow dr in albumsResult.Tables[0].Rows) { rc.Add(ReleaseFromDataRow(dr)); } sr.Albums = rc; return sr; }
public SearchResult GetCollection(string type, int page) { switch (type) { case "home": { SearchResult sr = new SearchResult(this); ReleaseCollection RC = new ReleaseCollection(this, new List<Release>()); DataSet DS = MakeDataSet("SELECT * FROM artist, release, whatsnew WHERE whatsnew.release_id = release.id AND release.artist = artist.id ORDER BY release.release_date DESC"); foreach (DataRow dr in DS.Tables[0].Rows) { Release t = ReleaseFromDataRow(dr); RC.Add(t); } sr.Albums = RC; return sr; } } return null; }