public abstract bool RemoveAlbum(Album album);
public abstract bool AddAlbum(Album album);
public bool RemoveAlbum(Album album) { SqliteCommand cmd = new SqliteCommand (); cmd.Connection = conn; cmd.CommandText = String.Format ("REMOVE FROM albums WHERE id = {0}", album.GetHashCode ()); int res = cmd.ExecuteNonQuery (); if (res > 0) return true; return false; }
public bool AddAlbum(Album album) { string songs = ArrayToSqlString (album.Songs); string artists = ArrayToSqlString (album.Artists); string performers = ArrayToSqlString (album.Performers); SqliteCommand cmd = new SqliteCommand (); cmd.Connection = conn; cmd.CommandText = String.Format ("INSERT INTO albums (id, name, songs, artists, performers, year) VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}')", album.GetHashCode (), album.Name, songs, artists, performers, album.Year); int res = cmd.ExecuteNonQuery (); if (res > 0) return true; return false; }
public int Compare(Album one, Album two) { return one.Name.ToLower ().CompareTo (two.Name.ToLower ()); }
public static int Compare(Album one, Album two) { return new SimpleAlbumComparer ().Compare (one, two); }