public bool AddShelf(int shelfNumber)
        {
            var avaibleShelf = shelfManager.GetShelfByShelfNumber(shelfNumber);

            if (avaibleShelf != null)
            {
                return(false);
            }
            shelfManager.AddShelf(shelfNumber);
            return(true);
        }
        public ShelfStatusCodes AddShelf(int shelfNumber, int aisleNumber)
        {
            var existingShelf = shelfManager.GetShelfByShelfNumber(shelfNumber, aisleNumber);
            var newAisle      = aisleManager.GetAisleByAisleNumber(aisleNumber);

            if (existingShelf != null)
            {
                return(ShelfStatusCodes.ShelfAlreadyExistInAisle);
            }
            if (newAisle == null)
            {
                return(ShelfStatusCodes.NoSuchAisle);
            }
            shelfManager.AddShelf(shelfNumber, aisleNumber);
            return(ShelfStatusCodes.Ok);
        }
Exemple #3
0
        public ErrorCodesAddShelf AddShelf(int shelfNumber, int pathID)
        {
            var exsitingShelf = shelfManager.GetShelfByShelfNumber(shelfNumber, pathID);
            var existingPath  = pathManager.GetPathByPathID(pathID);

            if (exsitingShelf != null)
            {
                return(ErrorCodesAddShelf.ShelfAlreadyExist);
            }
            if (existingPath == null)
            {
                return(ErrorCodesAddShelf.PathDoesNotExist);
            }
            shelfManager.AddShelf(shelfNumber, pathID);
            return(ErrorCodesAddShelf.Ok);
        }
Exemple #4
0
        public ShelfErrorCodes AddShelf(int hallID, int shelfNumber)
        {
            var existingHall = hallManager.GetHall(hallID);

            if (existingHall == null)
            {
                return(ShelfErrorCodes.NoSuchHall);
            }
            else
            {
                var existingShelf = shelfManager.GetShelfByShelfNumber(hallID, shelfNumber);
                if (existingShelf != null)
                {
                    return(ShelfErrorCodes.ShelfNumberOccupied);
                }
                shelfManager.AddShelf(hallID, shelfNumber);
                return(ShelfErrorCodes.ok);
            }
        }
        public ErrorCodesAddBook AddBook(string bookTitle, string authorOfBook, string isbn, int purchaseYear, int conditionOfBook, int purchasePrice, int bookNumber, bool activeLoan, int shelfNumber, int pathID)
        {
            var exsitingBook   = bookManager.GetBookByBookNumber(bookNumber);
            var exsistingShelf = shelfManager.GetShelfByShelfNumber(shelfNumber, pathID);

            if (exsitingBook != null)
            {
                return(ErrorCodesAddBook.BookAlreadyExsist);
            }
            if (isbn.Length != 13)
            {
                return(ErrorCodesAddBook.InvalidISBN);
            }
            if (exsistingShelf == null)
            {
                return(ErrorCodesAddBook.BookNeedsAShelf);
            }
            bookManager.AddBook(bookTitle, authorOfBook, isbn, purchaseYear, conditionOfBook, purchasePrice, bookNumber, activeLoan, shelfNumber, pathID);
            return(ErrorCodesAddBook.Ok);
        }
        public MoveBookError MoveBook(string bookName, int shelfID)
        {
            var newbook = bookManager.GetBookByBookName(bookName);

            if (newbook == null)
            {
                return(MoveBookError.NoSuckBook);
            }
            var newShelf = shelfManager.GetShelfByShelfNumber(shelfID);

            if (newShelf == null)
            {
                return(MoveBookError.NoSuckBook);
            }
            bookManager.MoveBook(newbook.BookID, newShelf.ShelfID);
            return(MoveBookError.Ok);
        }
        public BookStatusCodes MoveBook(string bookTitle, int shelfNumber, int aisleNumber)
        {
            var newShelf = shelfManager.GetShelfByShelfNumber(shelfNumber, aisleNumber);

            if (newShelf == null)
            {
                return(BookStatusCodes.NoSuchShelf);
            }
            var book = bookManager.GetBookByBookTitle(bookTitle);

            if (book == null)
            {
                return(BookStatusCodes.NoSuchBook);
            }
            if (book.Shelf.ShelfNumber == shelfNumber)
            {
                return(BookStatusCodes.BookAlreadyExistInShelf);
            }
            bookManager.MoveBook(book.BookID, newShelf.ShelfID);
            return(BookStatusCodes.Ok);
        }
Exemple #8
0
        public GetScrapListCodes GetScrapList(int sectionNumber, int shelfNumber,
                                              string bookName, bool inLibrary, int bookCondition)
        {
            var newSection = sectionManager.GetSectionBySectionNumber(sectionNumber);

            if (newSection == null)
            {
                return(GetScrapListCodes.HasNoSections);
            }

            var newShelf = shelfManager.GetShelfByShelfNumber(shelfNumber);

            if (newShelf == null)
            {
                return(GetScrapListCodes.HasNoShelfs);
            }

            var newBook = bookManager.GetBookByName(bookName, inLibrary, bookCondition);

            if (newBook == null)
            {
                return(GetScrapListCodes.HasNoBooks);
            }

            if (newBook.BookCondition > 1)
            {
                return(GetScrapListCodes.BookConditionIsTooHigh);
            }

            if (newBook.InLibrary == false)
            {
                return(GetScrapListCodes.BookIsBorrowed);
            }

            sectionManager.GetScrapList();
            return(GetScrapListCodes.Ok);
        }