コード例 #1
0
 public abstract bool RemoveAlbum(Album album);
コード例 #2
0
 public abstract bool AddAlbum(Album album);
コード例 #3
0
 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;
 }
コード例 #4
0
        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;
        }
コード例 #5
0
 public int Compare(Album one, Album two)
 {
     return one.Name.ToLower ().CompareTo (two.Name.ToLower ());
 }
コード例 #6
0
 public static int Compare(Album one, Album two)
 {
     return new SimpleAlbumComparer ().Compare (one, two);
 }