private void btnLoan_Click(object sender, EventArgs e) { try { if (dtmEstimated.Value > dtmLoan.Value) { Editorial editorial = new Editorial(editorialID, editorialName); Author author = new Author(authorID, authorName); Book book = new Book(bookID, ISBN, title, editorial, edition, year, editionYear, author, deterioration); Partner partner = new Partner(partnerID, lastName, firstName, DNI, address, phone); Loan loan = new Loan(loanID, book, partner, loanDate, estimatedDate, devolutionDate); loan.Book = (Book)cmbLoanBook.SelectedItem; loan.Partner = (Partner)cmbLoanPartner.SelectedItem; loan.LoanDate = dtmLoan.Value; loan.EstimatedDate = dtmEstimated.Value; loan.DevolutionDate = default(DateTime); if (loanController.AddLoan(loan) != null) { MessageBox.Show("Se agregó un préstamo con éxito."); } } else { MessageBox.Show("La fecha estimada de devolución es anterior a la fecha de inicio del préstamo."); } updateAll(); } catch (Exception ex) { error = ex.Message; MessageBox.Show(error); } }