Esempio n. 1
0
 public Album()
 {
     this.Title = "";
     this.DateReleased = DateTime.Now;
     this.Artist = null;
     //ArtistsInAlbum = new List<Artist>();
     //  CompositionsInAlbum = new List<Composition>();
 }
Esempio n. 2
0
        public Album(string title, Artist artist)
        {
            this.Artist = artist;
            this.Title = title;

            //ArtistsInAlbum = new List<Artist>();
            //   CompositionsInAlbum = new List<Composition>();
            this.SaveToDB();
        }
Esempio n. 3
0
        public Album(Artist artist, string title, DateTime daterelease)
        {
            this.Artist = artist;
            this.Title = title;
            this.DateReleased = daterelease;

            //ArtistsInAlbum = new List<Artist>();
            //  CompositionsInAlbum = new List<Composition>();
            this.SaveToDB();
        }
Esempio n. 4
0
 public void CreateArtist(string LastName, string FirstName)
 {
     Artist Artist = new Artist(LastName, FirstName);
 }
Esempio n. 5
0
 public void CreateArtist()
 {
     Artist Artist = new Artist();
 }
Esempio n. 6
0
 public void DeleteArtist(Artist SelectedArtist)
 {
     ICollection<Album> Albs = new List<Album>();
     foreach (Album alb in Album.Load())
     {
         if (alb.Artist.Id == SelectedArtist.Id)
             Albs.Add(alb);
     }
     if (Albs.Count == 0)
         SelectedArtist.Delete();
 }
Esempio n. 7
0
 public void CreateArtist(string lastname, string firstname)
 {
     Artist Artist = new Artist(lastname, firstname);
 }
Esempio n. 8
0
 public void EditArtist(Artist SelectedArtist, string NewFirstName, string NewLastName)
 {
     SelectedArtist.Update(new Artist() { FirstName = NewFirstName, LastName = NewLastName });
 }
Esempio n. 9
0
 public Album(Artist artist, string title, DateTime daterelease)
 {
     this.Artist = artist;
     this.Title = title;
     // this.DateReleased = daterelease;
     this.Save();
 }
Esempio n. 10
0
 public Album()
 {
     this.Title = "";
     //this.DateReleased = DateTime.Now;
     this.Artist = null;
 }
Esempio n. 11
0
        /*    public static Album FindThisInstanceInDB(DateTime date_released)
            {
                using (SqlCommand sqlcmd = new SqlCommand())
                {
                    Album Album = null;
                    sqlcmd.Connection = new System.Data.SqlClient.SqlConnection(ConnectionString);
                    sqlcmd.CommandText = "SELECT * FROM Albums WHERE DateReleased=@date_released";
                    sqlcmd.Parameters.AddWithValue("@date_released", date_released);
                    sqlcmd.Connection.Open();
                    using (var sqlreader = sqlcmd.ExecuteReader())
                    {

                        if (sqlreader.HasRows)
                        {
                            sqlreader.Read();
                            Album = new Album();
                            Album.Id = (Guid)sqlreader[0];
                            Album.Title = (string)sqlreader[1];
                            Album.DateReleased = (DateTime)sqlreader[2];

                        }
                        sqlcmd.Connection.Close();
                        return Album;
                    }
                }*/
        //  }

        
        /// <summary>
        /// Loading of all instances from database
        /// </summary>
        /// <returns></returns>
        public static List<Album> Load()
        {
            using (SqlCommand sqlcmd = new SqlCommand())
            {
                List<Album> ListAlbums = new List<Album>();
                sqlcmd.Connection = new System.Data.SqlClient.SqlConnection(ConnectionString);
                sqlcmd.CommandText = "SELECT * FROM Albums";
                sqlcmd.Connection.Open();
                using (var sqlreader = sqlcmd.ExecuteReader())
                {
                    if (sqlreader.HasRows)
                    {
                        while (sqlreader.Read())
                        {
                            var Album = new Album();
                            Album.Id = (Guid)sqlreader[0];
                            Album.Title = (string)sqlreader[1];
                            Album.Artist = (Artist)Artist.FindThisInstanceInDB((Guid)sqlreader[2]);
                            //album.DateReleased = Convert.ToDateTime((string)sqlreader[2]);
                            ListAlbums.Add(Album);
                        }
                    }
                    sqlcmd.Connection.Close();
                    return ListAlbums;
                }
            }
        }
Esempio n. 12
0
 public Album(string title, Artist artist)
 {
     this.Id = Guid.NewGuid();
     this.Artist = artist;
     this.Title = title;
     this.Save();
 }
Esempio n. 13
0
 public Composition(string title, string subtitle, string words, string music, string tabs, string copyright, string notice, Album album, Artist artist)//, DateTime datecreated)
 {
     this.Title = title;
     this.Subtitle = subtitle;
     this.Words = words;
     this.Music = music;
     this.Tabs = tabs;
     this.Copyright = copyright;
     this.Notice = notice;
     //this.DateCreated = datecreated;
     this.Album = album;
     this.Artist = artist;
     ArtistsOfComposition = new List<Artist>();
     //CompositionInAlbums = new List<Album>();
     this.SaveToDB();
 }
Esempio n. 14
0
 /// <summary>
 /// Loading of all instances from database
 /// </summary>
 /// <returns></returns>
 public static List<Artist> LoadAllFromDB()
 {
     using (SqlCommand sqlcmd = new SqlCommand())
     {
         List<Artist> ListArtists = new List<Artist>();
         sqlcmd.Connection = new System.Data.SqlClient.SqlConnection(ConnectionString);
         sqlcmd.CommandText = "SELECT * FROM Artists";
         sqlcmd.Connection.Open();
         using (var sqlreader = sqlcmd.ExecuteReader())
         {
             if (sqlreader.HasRows)
             {
                 while (sqlreader.Read())
                 {
                     var artist = new Artist();
                     artist.Id = (Guid)sqlreader[0];
                     artist.LastName = (string)sqlreader[1];
                     artist.FirstName = (string)sqlreader[2];
                     ListArtists.Add(artist);
                 }
             }
             sqlcmd.Connection.Close();
             return ListArtists;
         }
     }
 }
Esempio n. 15
0
        /// <summary>
        /// Search by Id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Artist FindThisInstanceInDB(Guid id)
        {
            using (SqlCommand sqlcmd = new SqlCommand())
            {
                Artist Artist = null;
                sqlcmd.Connection = new System.Data.SqlClient.SqlConnection(ConnectionString);
                sqlcmd.CommandText = "SELECT * FROM Artists WHERE Id=@id";
                sqlcmd.Parameters.AddWithValue("@id", id);
                sqlcmd.Connection.Open();
                using (var sqlreader = sqlcmd.ExecuteReader())
                {

                    if (sqlreader.HasRows)
                    {
                        sqlreader.Read();
                        Artist = new Artist();
                        Artist.Id = (Guid)sqlreader[0];
                        Artist.LastName = (string)sqlreader[1];
                        Artist.FirstName = (string)sqlreader[2];

                    }
                    sqlcmd.Connection.Close();
                    return Artist;
                }
            }
        }
Esempio n. 16
0
 public void CreateAlbum(string Name, Artist SelectedArtist)
 {
     Album alb = new Album(Name, SelectedArtist);
 }
Esempio n. 17
0
  public void CreateComposition(string Title, string Subtitle, string Words, string Music, string Tabs, string Copyright, string Notice, Album SelectedAlbum, Artist SelectedArtist, User SelectedAuthor)
  {
      Composition Composition = new Composition(Title, Subtitle, Words, Music, Tabs, Copyright, Notice, SelectedAlbum, SelectedArtist, SelectedAuthor);
 //     UserComposition UserComposition = new UserComposition(SelectedAuthor, Composition);
  }
Esempio n. 18
0
        /// <summary>
        /// Search by Id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Album FindThisInstanceInDB(Guid id)
        {
            using (SqlCommand sqlcmd = new SqlCommand())
            {
                Album Album = null;
                sqlcmd.Connection = new System.Data.SqlClient.SqlConnection(ConnectionString);
                sqlcmd.CommandText = "SELECT * FROM Albums WHERE Id=@id";
                sqlcmd.Parameters.AddWithValue("@id", id);
                sqlcmd.Connection.Open();
                using (var sqlreader = sqlcmd.ExecuteReader())
                {

                    if (sqlreader.HasRows)
                    {
                        sqlreader.Read();
                        Album = new Album();
                        Album.Id = (Guid)sqlreader[0];
                        Album.Artist = (Artist)Artist.FindThisInstanceInDB((Guid)sqlreader[1]);
                        Album.Title = (string)sqlreader[2];

                        //Album.DateReleased = (DateTime)sqlreader[2];

                    }
                    sqlcmd.Connection.Close();
                    return Album;
                }
            }
        }
Esempio n. 19
0
 public void EditComposition(Composition SelectedComposition, string NewTitle, string NewSubtitle, string NewWords, string NewMusic, string NewTabs, string NewCopyright, string NewNotice, Album NewSelectedAlbum, Artist NewSelectedArtist, User NewAuthor)
 {
     SelectedComposition.Update(
         new Composition()
     {
         Title = NewTitle,
         Subtitle = NewSubtitle,
         Words = NewWords,
         Music = NewMusic,
         Tabs = NewTabs,
         Copyright = NewCopyright,
         Notice = NewNotice,
         Album = NewSelectedAlbum,
         Artist = NewSelectedArtist,
         Author = NewAuthor
     });
 }
Esempio n. 20
0
 public Composition(string title, string subtitle, string words, string music, string tabs, string copyright, string notice, Album album, Artist artist, User author)//, DateTime datecreated)
 {
     this.Id = Guid.NewGuid();
     this.Title = title;
     this.Subtitle = subtitle;
     this.Words = words;
     this.Music = music;
     this.Tabs = tabs;
     this.Copyright = copyright;
     this.Notice = notice;
     //this.DateCreated = datecreated;
     this.Album = album;
     this.Artist = artist;
     this.Author = author;
     this.Save();
 }