private async Task <IEnumerable <Magazine> > GetMagazinesFromDatabase(string title, string author) { using (var db = new LibraryManagerDatabase()) { return(await db.FindMagazines(title, author)); } }
private IEnumerable <Book> GetUnarchivedBooksFromDatabase(string title, string author) { using (var db = new LibraryManagerDatabase()) { List <Book> books = db.FindBooks(title, author); return(books); } }
private IEnumerable <Member> GetMembersFromDatabase(string firstName, string lastName, string postCode, string city, bool filterByLoan) { using (var db = new LibraryManagerDatabase()) { List <Member> members = db.FindMembers(firstName, lastName, postCode, city, filterByLoan); return(members); } }
private async Task <IEnumerable <Member> > GetMembersFromDatabase(string firstName, string lastName, string postCode, string city, bool filterByLoan) { using (var db = new LibraryManagerDatabase()) { List <Member> members = await db.FindMembers(firstName, lastName, postCode, city); if (filterByLoan) { return(FilterMembersByLoanStatus(members)); } return(members); } }
private void UpdateStatusWithData() { using (var db = new LibraryManagerDatabase()) { Status status = db.GetStatus(); label_BooksInInventory.Text = status.BooksInInventory.ToString(); label_UniqueBooks.Text = status.UniqueBooks.ToString(); label_BooksInStock.Text = status.BooksInStock.ToString(); label_BooksOnLoan.Text = status.BooksOnLoan.ToString(); label_OverdueBooks.Text = status.OverdueBooks.ToString(); label_OutstandingFees.Text = "£" + Math.Round(status.OutstandingFines, 2).ToString(); label_EnrolledMembers.Text = status.EnrolledMembers.ToString(); label_JoinedThisWeek.Text = status.JoinedThisWeek.ToString(); label_DueBackToday.Text = status.DueBackToday.ToString(); label_MostRecentLoan.Text = status.MostRecentLoan.ToString("t"); } }
private void UpdateBookDetails(int bookId) { label_Loading.Visible = true; panel_BookDetails.Visible = false; panel_MemberDetails.Visible = false; Refresh(); using (var db = new LibraryManagerDatabase()) { Book book = db.FindBookById(bookId); label_BookDetailsTitle.Text = book.Title; label_BookDetailsAuthor.Text = book.Author; label_BookDetailsIsbn.Text = book.ISBN; label_BookDetailsCopies.Text = book.BookInstances.Count.ToString(); } panel_BookDetails.Visible = true; label_Loading.Visible = false; }
private void UpdateMemberDetails(int memberId) { label_Loading.Visible = true; panel_BookDetails.Visible = false; panel_MemberDetails.Visible = false; Refresh(); using (var db = new LibraryManagerDatabase()) { Member member = db.FindMemberById(memberId); label_MemberDetailsName.Text = member.FirstName + " " + member.LastName; label_MemberDetailsPhone.Text = member.Phone1; label_MemberDetailsAddress.Text = PrintAddress(member); label_MemberDetailsEmail.Text = member.Email1; pictureBox_MemberDetailsImage.Image = LookupUserImage(memberId); } panel_MemberDetails.Visible = true; label_Loading.Visible = false; }
private void UpdateMagazineDetails(int magazineId) { label_Loading.Visible = true; panel_BookDetails.Visible = false; panel_MemberDetails.Visible = false; Refresh(); using (var db = new LibraryManagerDatabase()) { Magazine magazine = db.FindMagazineById(magazineId); label_BookDetailsTitle.Text = magazine.Title; label_BookDetailsAuthor.Text = magazine.Author; label_BookDetailsIsbn.Text = magazine.ISBN; var random = new Random(); label_BookDetailsCopies.Text = random.Next(0, 4).ToString(); } panel_BookDetails.Visible = true; label_Loading.Visible = false; }
private async void UpdateBookDetails(int bookId) { label_Loading.Visible = true; panel_BookDetails.Visible = false; panel_MemberDetails.Visible = false; Refresh(); using (var db = new LibraryManagerDatabase()) { Book book = await db.FindBookById(bookId); label_BookDetailsTitle.Text = book.Title; label_BookDetailsAuthor.Text = book.Author; label_BookDetailsIsbn.Text = book.ISBN; var random = new Random(); label_BookDetailsCopies.Text = random.Next(0, 4).ToString(); } panel_BookDetails.Visible = true; label_Loading.Visible = false; }