예제 #1
0
        private void btnEndLoan_Click(object sender, EventArgs e)
        {
            try
            {
                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.LoanID         = ((Loan)cmbLoan.SelectedItem).LoanID;
                loan.Book           = ((Loan)cmbLoan.SelectedItem).Book;
                loan.Partner        = ((Loan)cmbLoan.SelectedItem).Partner;
                loan.LoanDate       = ((Loan)cmbLoan.SelectedItem).LoanDate;
                loan.EstimatedDate  = ((Loan)cmbLoan.SelectedItem).EstimatedDate;
                loan.DevolutionDate = dtmDevolution.Value;

                if (loanController.EditLoan(loan) != null)
                {
                    MessageBox.Show("Finalizó un préstamo con éxito.");
                }

                updateAll();
            }
            catch (Exception ex)
            {
                error = ex.Message;
                MessageBox.Show(error);
            }
        }