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

            //ArtistsInAlbum = new List<Artist>();
            //   CompositionsInAlbum = new List<Composition>();
            this.SaveToDB();
        }
Example #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();
        }
 public void CreateArtist(string LastName, string FirstName)
 {
     Artist Artist = new Artist(LastName, FirstName);
 }
 public void CreateArtist()
 {
     Artist Artist = new Artist();
 }
 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();
 }
 public void CreateArtist(string lastname, string firstname)
 {
     Artist Artist = new Artist(lastname, firstname);
 }
 public void EditArtist(Artist SelectedArtist, string NewFirstName, string NewLastName)
 {
     SelectedArtist.Update(new Artist() { FirstName = NewFirstName, LastName = NewLastName });
 }
Example #9
0
 public Album(Artist artist, string title, DateTime daterelease)
 {
     this.Artist = artist;
     this.Title = title;
     // this.DateReleased = daterelease;
     this.Save();
 }
Example #10
0
 public Album()
 {
     this.Title = "";
     //this.DateReleased = DateTime.Now;
     this.Artist = null;
 }
Example #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;
                }
            }
        }
Example #12
0
 public Album(string title, Artist artist)
 {
     this.Id = Guid.NewGuid();
     this.Artist = artist;
     this.Title = title;
     this.Save();
 }
 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();
 }
Example #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;
         }
     }
 }
Example #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;
                }
            }
        }
 public void CreateAlbum(string Name, Artist SelectedArtist)
 {
     Album alb = new Album(Name, SelectedArtist);
 }
  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);
  }
Example #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;
                }
            }
        }
 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
     });
 }
 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();
 }