コード例 #1
0
 public bool DeleteBorrowedBook (BorrowedBook borrowed)
 {
     if (BorrowedBookDAOMySql.Instance().deleteBorrowedBook(borrowed))
     {
         this.refreshList();
         BooksContainer.Instance().refreshList();
         MembersContainer.Instance().refreshList();
         return true;
     }
     return false;
 }
コード例 #2
0
 //Fill Texts ----------------------------------------------
 private void fillTexts(BorrowedBook borrowed)
 {
     borrowedSsnTB.Text = borrowed.member.ssn;
     borrowedNameTB.Text = borrowed.member.name;
     borrowedEmailTB.Text = borrowed.member.email;
     borrowedPhoneTB.Text = borrowed.member.phone;
     borrowedRegisteredTB.Text = borrowed.member.registered;
     borrowedAddressTB.Text = borrowed.member.address;
     borrowedIsbnTB.Text = borrowed.book.isbn;
     borrowedTitleTB.Text = borrowed.book.title;
     borrowedAuthorTB.Text = borrowed.book.author;
     borrowedSubjectTB.Text = borrowed.book.subject;
     if (borrowed.book.is_available) borrowedStateTB.Text = "In Library";
     else if (!borrowed.book.is_available) borrowedStateTB.Text = "Not Available";
     borrowedDescriptionTB.Text = borrowed.book.description;
     borrowedGivenTB.Text = borrowed.given_date;
     borrowedDueTB.Text = borrowed.due_date;
     if (borrowed.returned) borrowedReturnedTB.Text = "Returned";
     else if (!borrowed.returned) borrowedReturnedTB.Text = "Not Returned";
     borrowedReturnTB.Text = borrowed.return_date;
 }
コード例 #3
0
 //SAVE -------------------------------------------------------------------
 private void saveBtn_Click(object sender, EventArgs e)
 {
     BorrowedBook borrowed = new BorrowedBook(ssnTB.Text,
                                              isbnTB.Text,
                                              givenDTP.Value.ToString("yyyy-MM-dd HH:mm:ss"),
                                              givenDTP.Value.AddDays(21).ToString("yyyy-MM-dd HH:mm:ss"),
                                              false,
                                              "0000-00-00 00:00:00");
     bool is_added = BorrowedBooksContainer.Instance().AddBorrowedBook(borrowed);
     if (is_added)
     {
         this.Close();
     }
 }