Beispiel #1
0
 // Precondition:  theCopyrightYear >= 0 and theLoanPeriod >= 0 and
 //                theMedium from { DVD, BLURAY, VHS } and theDuration >= 0
 // Postcondition: A library movie has been created with the specified
 //                values for title, publisher, copyright year, loan period,
 //                call number, duration, director, medium, and rating. The
 //                item is not checked out.
 //                The movie has been added to the Library.
 public void AddLibraryMovie(String theTitle, String thePublisher, int theCopyrightYear,
                             int theLoanPeriod, String theCallNumber, double theDuration, String theDirector,
                             LibraryMediaItem.MediaType theMedium, LibraryMovie.MPAARatings theRating)
 {
     _items.Add(new LibraryMovie(theTitle, thePublisher, theCopyrightYear, theLoanPeriod,
                                 theCallNumber, theDuration, theDirector, theMedium, theRating));
 }
Beispiel #2
0
        // Precondition:  theCopyrightYear >= 0 and theLoanPeriod >= 0 and
        //                theMedium from { DVD, BLURAY, VHS } and theDuration >= 0
        // Postcondition: A library movie has been created with the specified
        //                values for title, publisher, copyright year, loan period,
        //                call number, duration, director, medium, and rating. The
        //                item is not checked out.
        //                The movie has been added to the Library.
        public bool AddLibraryMovie(String theTitle, String thePublisher, int theCopyrightYear,
                                    int theLoanPeriod, String theCallNumber, double theDuration, String theDirector,
                                    LibraryMediaItem.MediaType theMedium, LibraryMovie.MPAARatings theRating)
        {
            // create the new movie object
            LibraryMovie newMovie = new LibraryMovie(theTitle, thePublisher, theCopyrightYear,
                                                     theLoanPeriod, theCallNumber, theDuration, theDirector,
                                                     theMedium, theRating);

            // does the callnum exist already?
            if (!libraryItems.ContainsKey(theCallNumber))
            {
                // add the movie to the dict
                libraryItems.Add(theCallNumber, newMovie);

                _items.Add(new LibraryMovie(theTitle, thePublisher, theCopyrightYear, theLoanPeriod,
                                            theCallNumber, theDuration, theDirector, theMedium, theRating));

                return(SUCCESSFUL_ADD);
            }
            else
            {
                return(FAILED_ADD);
            }
        }
Beispiel #3
0
        // Precondition:  theCopyrightYear >= 0 and theLoanPeriod >= 0 and
        //                theMedium from { CD, SACD, VINYL } and theDuration >= 0 and
        //                theNumTracks >= 0
        // Postcondition: A library music item has been created with the specified
        //                values for title, publisher, copyright year, loan period,
        //                call number, duration, director, medium, and rating. The
        //                item is not checked out.
        //                The music item has been added to the Library.
        public bool AddLibraryMusic(String theTitle, String thePublisher, int theCopyrightYear,
                                    int theLoanPeriod, String theCallNumber, double theDuration, String theArtist,
                                    LibraryMediaItem.MediaType theMedium, int theNumTracks)
        {
            // new music object
            LibraryMusic newMusic = new LibraryMusic(theTitle, thePublisher, theCopyrightYear,
                                                     theLoanPeriod, theCallNumber, theDuration, theArtist,
                                                     theMedium, theNumTracks);

            // does the callnum not exist yet?
            if (!libraryItems.ContainsKey(theCallNumber))
            {
                // add to dict
                libraryItems.Add(theCallNumber, newMusic);

                _items.Add(new LibraryMusic(theTitle, thePublisher, theCopyrightYear,
                                            theLoanPeriod, theCallNumber, theDuration, theArtist,
                                            theMedium, theNumTracks));

                return(SUCCESSFUL_ADD);
            }
            else
            {
                return(FAILED_ADD);
            }
        }
Beispiel #4
0
 // Precondition:  theCopyrightYear >= 0 and theLoanPeriod >= 0 and
 //                theMedium from { CD, SACD, VINYL } and theDuration >= 0 and
 //                theNumTracks >= 0
 // Postcondition: A library music item has been created with the specified
 //                values for title, publisher, copyright year, loan period,
 //                call number, duration, director, medium, and rating. The
 //                item is not checked out.
 //                The music item has been added to the Library.
 public void AddLibraryMusic(String theTitle, String thePublisher, int theCopyrightYear,
                             int theLoanPeriod, String theCallNumber, double theDuration, String theArtist,
                             LibraryMediaItem.MediaType theMedium, int theNumTracks)
 {
     _items.Add(new LibraryMusic(theTitle, thePublisher, theCopyrightYear,
                                 theLoanPeriod, theCallNumber, theDuration, theArtist,
                                 theMedium, theNumTracks));
 }
 // Precondition:  theCopyrightYear >= 0 and theLoanPeriod >= 0 and
 //                theMedium from { DVD, BLURAY, VHS } and theDuration >= 0
 // Postcondition: A library movie has been created with the specified
 //                values for title, publisher, copyright year, loan period,
 //                call number, duration, director, medium, and rating. The
 //                item is not checked out.
 //                The movie has been added to the Library.
 public bool AddLibraryMovie(String theTitle, String thePublisher, int theCopyrightYear,
                             int theLoanPeriod, String theCallNumber, double theDuration, String theDirector,
                             LibraryMediaItem.MediaType theMedium, LibraryMovie.MPAARatings theRating)
 {
     if (_itemDict.ContainsKey(theCallNumber) == false)
     {
         _itemDict.Add(theCallNumber, new LibraryMovie(theTitle, thePublisher, theCopyrightYear, theLoanPeriod,
                                                       theCallNumber, theDuration, theDirector, theMedium, theRating));
         return(true);
     }
     else
     {
         return(false);
     }
 }
 // Precondition:  theCopyrightYear >= 0 and theLoanPeriod >= 0 and
 //                theMedium from { CD, SACD, VINYL } and theDuration >= 0 and
 //                theNumTracks >= 0
 // Postcondition: A library music item has been created with the specified
 //                values for title, publisher, copyright year, loan period,
 //                call number, duration, director, medium, and rating. The
 //                item is not checked out.
 //                The music item has been added to the Library.
 public bool AddLibraryMusic(String theTitle, String thePublisher, int theCopyrightYear,
                             int theLoanPeriod, String theCallNumber, double theDuration, String theArtist,
                             LibraryMediaItem.MediaType theMedium, int theNumTracks)
 {
     if (_itemDict.ContainsKey(theCallNumber) == false)
     {
         _itemDict.Add(theCallNumber, new LibraryMusic(theTitle, thePublisher, theCopyrightYear, theLoanPeriod,
                                                       theCallNumber, theDuration, theArtist, theMedium, theNumTracks));
         return(true);
     }
     else
     {
         return(false);
     }
 }