Esempio n. 1
0
 private void btn_Issue_Click(object sender, EventArgs e)
 {
     BooksDao.getNumberOfIssuedBooks();
     if (GUIController.numberOfIssuedBooks == true)
     {
         BookIssued bookissued = new BookIssued();
         bookissued.Author        = book.Author;
         bookissued.BookName      = book.BookName;
         bookissued.Fullname      = GUIController.getFullName;
         bookissued.Language      = book.Language;
         bookissued.NumberOfPages = book.NumberOfPages;
         bookissued.DateAdded     = book.DateAdded;
         var date = DateTime.Now.ToString("yyyy.MM.dd");
         bookissued.DateIssued = Convert.ToDateTime(date);
         try
         {
             BooksDao.issueBook(bookissued);
         }
         catch (Exception exp)
         {
             MessageBox.Show("Nicio carte selectata", "Atentionare", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         if (GUIController.checkBookIssueSuccess == true)
         {
             BooksDao.deleteBook(book);
             dataBooksView.DataSource = BooksDao.showBooksTable();
         }
     }
     else
     {
         MessageBox.Show("Prea multe carti imprumutate", "Atentionare", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Esempio n. 2
0
 private void btn_Delete_Click(object sender, EventArgs e)
 {
     try
     {
         BooksDao.deleteBook(book);
         if (GUIController.checkDeleteBookSuccess == true)
         {
             dataBooksView.DataSource = BooksDao.showBooksTable();
         }
     }
     catch (Exception exp)
     {
         MessageBox.Show("Nu s-a reusit stergerea", "Atentionare", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }