Esempio n. 1
0
//
// Lend
//
void Book::Lend( const Borrower& borrower )
{
    // The book is out.
    status      = Status::Out;

    // Set the due date to now + 14 days.
    dueDate     = QDate::currentDate();
    dueDate.addDays( borrowingTime );

    // This is who borrowed it.
    borrowerID = borrower.GetID();
}
Esempio n. 2
0
//
// BorrowerEntry
//
BorrowerEntry::BorrowerEntry( DatabaseManager* manager, const Borrower& borrower, QWidget *parent ) : QWidget(parent), ui(new Ui::BorrowerEntry)
{
    ui->setupUi(this);

    this->manager       = manager;
    this->borrower      = borrower;

    // Set the line edits to initial values.
    ui->idLineEdit->setText( borrower.GetID() );
    ui->nameLineEdit->setText( borrower.GetName() );
    ui->addressLineEdit->setText( borrower.GetAddress() );
    ui->feeTotalLineEdit->setText( QString::number( borrower.GetFeeTotal() ) );
    ui->feeHistoryLineEdit->setText( QString::number( borrower.GetFeeHistory() ) );

    // Set up the numbers scroll area.
    ui->scrollArea->setWidget( ui->scrollAreaWidgetContents );
    ui->scrollAreaWidgetContents->setLayout( new QVBoxLayout() );
    for( const BorrowerNumber& number : borrower.GetPhoneNumbers() )
    {
        ui->scrollAreaWidgetContents->layout()->addWidget( new PhoneNumberEntry( number, manager ) );
    }
}