Example #1
0
 public void addContributor(Contributor contributor)
 {
     if (contributor == null)
     {
         throw new ArgumentNullException("In abstract class MusicSelection, method addContributor(). Argument cannot be null.");
     }
     if (this.Contributors.Exists(c => c.Role == contributor.Role && c.getFullName() == contributor.getFullName()))
     {
         return;
     }
     this.Contributors.Add(contributor);
 }
Example #2
0
 public void setComposer(Contributor composer)
 {
     if (composer == null)
     {
         throw new ArgumentNullException("In abstract class MusicSelection, method setComposer().  Argument composer cannot be null.");
     }
     if (composer.Role_LowerCase != "composer")
     {
         throw new ArgumentException("In abstract class MusicSelection, method setComposer(). The argument, of type Contributor, did not have its role set to composer.");
     }
     this.Composer = composer;
 }
Example #3
0
 public void removeContributor(Contributor contributor)
 {
     if (contributor == null)
     {
         throw new ArgumentNullException("In abstract class MusicSelection, method removeContributor(). Argument cannot be null.");
     }
     if (this.Contributors.Exists(c => c.Role == contributor.Role && c.getFullName() == contributor.getFullName()))
     {
         this.Contributors.RemoveAt
         (
             this.Contributors.FindIndex(c => c.Role == contributor.Role &&
                                         c.getFullName() == contributor.getFullName())
         );
     }
     else
     {
         throw new ArgumentException("In class MusicSelection, method removeContributor(). Unable to remove contributor that does not exist in the list.");
     }
 }
Example #4
0
        public override bool Equals(Object obj)
        {
            // If parameter is null return false.
            if (obj == null)
            {
                return(false);
            }

            // If parameter cannot be cast to Contributor return false.
            Contributor con = obj as Contributor;

            if ((System.Object)con == null)
            {
                return(false);
            }

            // Return true if the fields match:
            return((this.ContributorName.Equals(con.ContributorName)) &&
                   (this.Role == con.Role) &&
                   (this.Role_LowerCase == con.Role_LowerCase));
        }
Example #5
0
        public MusicSelection(String id, String institution_Id, String title, Contributor composer)
        {
            try
            {
                ErrorChecking.CheckStringForNullEmptyOrWhiteSpace_ThrowException(id);
                ErrorChecking.CheckStringForNullEmptyOrWhiteSpace_ThrowException(institution_Id);
                ErrorChecking.CheckStringForNullEmptyOrWhiteSpace_ThrowException(title);
                ErrorChecking.CheckObjectForNull(composer);

                this._id                       = id;
                this.Institution_id            = institution_Id;
                this.Title                     = title.Trim();
                this.Title_LowerCase           = title.Trim().ToLower();
                this.Composer                  = composer;
                this.Publisher                 = "";
                this.Publisher_LowerCase       = "";
                this.ItemNumber                = "";
                this.ItemNumber_LowerCase      = "";
                this.Notes                     = "";
                this.PerformanceNotes          = "";
                this.PerformanceNotesArePublic = false;
                this.IsLendable                = false;
                this.DifficultyLevel           = "";
                this.DifficultyLevel_LowerCase = "";
                this.Genre                     = "";
                this.Genre_LowerCase           = "";
                this.Instrumentation           = "";
                this.Instrumentation_LowerCase = "";
                this.Tags                      = new List <Tag>();
                this.Contributors              = new List <Contributor>();
            }
            catch (ArgumentNullException ex)
            {
                throw new ArgumentNullException("In class Music selection, constructor with _id. " + ex.Message);
            }
            catch (ArgumentException ex)
            {
                throw new ArgumentException("In class Music selection, constructor with _id. " + ex.Message);
            }
        }
 public ChoralMusicSelection(String institution_Id, String title, Contributor composer, Boolean isSacred)
     : base(institution_Id, title, composer)
 {
     this.IsSacred        = isSacred;
     this.InstrumentParts = new List <ChoralInstrumentPart>();
 }