/// <summary> /// Adds a new musician to the list of musicians with name nm and age ag who can play the instrument instr /// This new musician will get an idNr that's unique in this musicians agency /// This idNr will be created with the help of the current value of numberOfCreatedMusicians /// </summary> /// <param name="nm">The name of the musician to be added</param> /// <param name="ag">The age of the musician to be added</param> /// <param name="instr">The instrument of the musician to be added</param> /// <returns></returns> public void AddMusician(string nm, int ag, string instr) { // !!!TODO!!! assignment 2b Musician holder = new Musician(nm, ag); numberOfCreatedMusicians++; holder.IdNr = numberOfCreatedMusicians; holder.AddInstrument(instr); this.registeredMusicians.Add(holder); }
/// <summary> /// Adds an instrument (the one selected in cmbMRelevantInstruments) to the musician with /// a certain idNr (the one typed in tbMIdNr) to that musicians list of possible instruments /// Updates all relevant visable parts of this form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btMAddAnInstrumentToMyList_Click(object sender, EventArgs e) { // !!!TODO!!! assignment 3b Musician mu = ma.getMusicianWithIdnr(Convert.ToInt32(tbMIdNr.Text)); if (mu != null) { mu.AddInstrument(cmbMRelevantInstruments.SelectedIndex.ToString()); } //ma.AddMusician(tbMName.Text); }