Ejemplo n.º 1
0
        public void ReturnBook(int idbook)
        {
            Book book = DAO.GetBookTable().GetElement(idbook);

            if (book.status.id != 2)
            {
                throw new TakingTakenBookExceptino();
            }
            book.status = DAO.GetBookStatusTable().GetElement(1);
            DAO.GetBookTable().UpdateElementInDB(book);
        }
Ejemplo n.º 2
0
        public ObservableCollection <Book> getSearchedList(string quarry, bool isForName)
        {
            ObservableCollection <Book> list;

            if (isForName == true)
            {
                list = new ObservableCollection <Book>(DAO.GetBookTable().GetBooksByName(quarry));
            }
            else
            {
                list = new ObservableCollection <Book>(DAO.GetBookTable().GetBooksByAuthor(quarry));
            }

            return(list);
        }
Ejemplo n.º 3
0
        public void GiveBook(int idbook, int idclient)
        {
            Book book = DAO.GetBookTable().GetElement(idbook);

            if (book.status.id != 1)
            {
                throw new GivingGivenBookException();
            }
            Profile profile = DAO.GetProfileTable().GetElement(idclient);

            book.recipient = profile;
            book.issueDate = DateTime.Now;
            book.status    = DAO.GetBookStatusTable().GetElement(2);
            DAO.GetBookTable().UpdateElementInDB(book);
        }
Ejemplo n.º 4
0
        public ObservableCollection <BookRow> Startup()
        {
            ObservableCollection <BookRow> bookRowlist = new ObservableCollection <BookRow>(DAO.GetBookTable().GetRowsOfBooksInuseByRecipient(Main.Instance.client.id));

            return(bookRowlist);
        }
Ejemplo n.º 5
0
        public ObservableCollection <BookRow> createTable()
        {
            ObservableCollection <BookRow> bookRowlist = new ObservableCollection <BookRow>(DAO.GetBookTable().GetRowsOfBooksInuseByRecipient(Main.Instance.worker.id));

            return(bookRowlist);
        }