Exemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="firstName"></param>
 /// <param name="middleName"></param>
 /// <param name="lastName"></param>
 public void SetArtistName(string firstName, string middleName, string lastName)
 {
     Musician =
         new MusicArtist(string.Format("{0}{1} {2}{3} {4}",
                                       lastName,
                                       DELIMETER,
                                       firstName,
                                       DELIMETER,
                                       middleName));
 }
Exemplo n.º 2
0
        /// <summary>
        /// Add a music artist to the list.
        /// </summary>
        /// <param name="artist">The artist to be added to the list.</param>
        public static void AddMusicArtist(MusicArtist artist)
        {
            if (IsInitialized() && !MusicArtists.Contains(artist))
            {
                MusicArtists.Add(artist);
            }

            //If the artist is not in thge list, then he/she is probably
            // not in the database either, so add him/her.
            AddMusicianToDatabase(artist);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Adds a new artist data row to the data table.
 /// </summary>
 /// <param name="artist">The music artist to be added to the database.</param>
 /// <returns></returns>
 private static void AddMusicianToDatabase(MusicArtist artist)
 {
     using (InventoryControlDataSet.tbl_MusicArtistDataTable musiciansDataTable =
                new InventoryControlDataSet.tbl_MusicArtistDataTable())
     {
         using (InventoryControlDataSetTableAdapters.tbl_MusicArtistTableAdapter adapter =
                    new InventoryControlDataSetTableAdapters.tbl_MusicArtistTableAdapter())
         {
             DataRow row = musiciansDataTable.NewRow();
             row["FirstName"]  = artist.FirstName;
             row["MiddleName"] = artist.MiddleName;
             row["LastName"]   = artist.LastName;
             row["BirthDate"]  = artist.BirthDate.ToShortDateString();
             row["DeathDate"]  = artist.DeathDate.ToShortDateString();
             musiciansDataTable.Rows.Add(row);
             //Call the adapter to update the data table.
             adapter.Update(musiciansDataTable);
         }
     }
 }