public string Output() { WinFormOutputAuthoredItem output = new WinFormOutputAuthoredItem(); SetItem bookSetter = new SetItem(); return(output.ListOutput(BookList.GetBookList(bookSetter).GenerateList()).ToString()); }
public void InitializeList() { AbstractSerialize serializeObj = new FileHandling(); BookList bookListObj = BookList.GetBookList(); serializeObj.ReadBookList(); Book.BookCount = bookListObj.ListOfBooks.Count; }
public override void WriteBookList() { using (FileStream fs = new FileStream(FILE_PATH_BOOK, FileMode.OpenOrCreate, FileAccess.Write)) { BinaryFormatter bf = new BinaryFormatter(); BookList BookListObj = BookList.GetBookList(); bf.Serialize(fs, BookListObj.ListOfBooks); } }
public override void ReadBookList() { using (FileStream fs = new FileStream(FILE_PATH_BOOK, FileMode.OpenOrCreate, FileAccess.Read)) { BinaryFormatter bf = new BinaryFormatter(); BookList BookListObj = BookList.GetBookList(); BookListObj.ListOfBooks = (List <Book>)bf.Deserialize(fs); } }
public bool ReturnBook(Book bk) { try { BookList bookListObj = BookList.GetBookList(); bookListObj.ReturnBook(bk); AbstractSerialize serializeObj = new FileHandling(); serializeObj.WriteBookList(); return(true); } catch (Exception ex) { return(false); } }
public LocalDataSource() { var booksSource = new BookList(); var existingBooks = booksSource.GetBookList(); _books = new List <IBook>(); foreach (var book in existingBooks) { _books.Add(book); } _users = new List <IUser>(); }
public bool AddNewBook(string bookName, string bookAuthor) { AbstractSerialize serializeObj = new FileHandling(); BookList bookListObj = BookList.GetBookList(); serializeObj.ReadBookList(); Book.BookCount = bookListObj.ListOfBooks.Count; if (bookListObj.AddBook(bookName, bookAuthor)) { serializeObj.WriteBookList(); return(true); } else { return(false); } }
public Library() { InitializeComponent(); var bookListFromFile = new BookList(); var mTakenBookPresenter = new TakenBookPresenter (new BookRepository(StaticDataSource.DataSource)); var books = bookListFromFile.GetBookList(); var takenBooks = mTakenBookPresenter.GetTakenBooks(); foreach (var book in takenBooks) { if (book.TakenByUser == StaticDataSource.CurrUser) { var book1 = books.First(item => item.Code == book.Code); bookListBox.Items.Add(book1.Author + book1.Title + " RETURN ON " + book.HasToBeReturned); } } }
public Book GetBook(int id) { BookList bookListObj = BookList.GetBookList(); return(bookListObj.GetBook(id)); }