void TCustomer::testId () { Customer c; c.setId (tId); QVERIFY (c.getId () == tId); }
void MainWindow::on_SaveCustomer_clicked() { if("" == ui->FindName->text() || "" == ui->FindSurname->text() || "" == ui->FindGroupID->text()) { QMessageBox::about(0,Title,NotAllCustomerData); ui->FindName->setFocus(); } else { Customer customer; customer.setId( ui->FindID->text() ); customer.setName( ui->FindName->text()); customer.setSurname( ui->FindSurname->text()); customer.setGroupId( ui->FindGroupID->text().toInt()); CM.editCustomer(customer); ui->FindID->setText(""); ui->FindGroupID->setText(""); ui->FindName->setText(""); ui->FindSurname->setText(""); ui->FindID->setFocus(); CustomerTableView(); } }
void MainWindow::on_DeleteCustomer_clicked() { if("" == ui->CustomerIDDelete->text()) { QMessageBox::about(0,Title,NoCustomerID); ui->CustomerIDDelete->setFocus(); } else { Customer customer; customer.setId(ui->CustomerIDDelete->text()); CM.deleteCustomer(customer); ui->CustomerIDDelete->setText(""); ui->CustomerIDDelete->setFocus(); CustomerTableView(); } }
void MainWindow::on_NewReservation_clicked() { if("" == ui->CustomerIdReservation->text() || "" == ui->RoomNumberReservation->text()) { QMessageBox::about(0,Title,EmptyRes); ui->CustomerIdReservation->setFocus(); } else { if(ui->CheckInDate->date() < QDate::currentDate()) { QMessageBox::about(0,Title,DateBeforeCurrentDate); ui->CheckInDate->setDate(QDate(QDate::currentDate())); } else if(ui->CheckOutDate->date() < ui->CheckInDate->date()) { QMessageBox::about(0,Title,CheckOutBeforeCheckIn); ui->CheckOutDate->setDate(ui->CheckInDate->date()); } else { Room room; Customer customer; customer.setId(ui->CustomerIdReservation->text()); room.setRoomNumber(ui->RoomNumberReservation->text().toInt()); ResM.roomReservation(ui->CheckInDate->date(),ui->CheckOutDate->date(),room,customer); ui->CheckInDate->setDate(QDate(QDate::currentDate())); ui->CheckOutDate->setDate(QDate(QDate::currentDate())); ui->CustomerIdReservation->setText(""); ui->RoomNumberReservation->setText(""); ui->CustomerIdReservation->setFocus(); showRoomGrid(); } } }