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 TCustomer::testName () { Customer c; c.setName (tName); QVERIFY (c.getName () == tName); }
void UserServices::updateCustomerDetails(int userID, string details[]){ enum {NAME, ADDRESS, PHONE}; Customer *update = dynamic_cast<Customer*>(_ds->getUser(userID)); update->setName(details[NAME]); update->setAddress(details[ADDRESS]); update->setPhoneNumber(details[PHONE]); }
MenuResult EditCustomerName::handle() { cout << endl; Customer * customer = readCustomerId(store); cin.clear(); cin.ignore(INT64_MAX, '\n'); cout << "\nInsert the new name: "; string name; getline(cin, name); customer->setName(name); store.writeCustomers(); cout << "The customer's name has been changed to: " << name << ".\n"; pause(); return CONTINUE; }
/** Runs a simple test of the functionality. * The integrity of the tree is verified after a number of simple operations: * - insert * - find * - erase * - clear */ void functionality_test() { // Validate the empty list printlist("Start"); // Inserting elements (new CustomerDefault())->setName("alfa"); printlist("insert alfa"); (new CustomerDefault())->setName("beta"); printlist("insert beta"); (new CustomerDefault())->setName("alfa1"); printlist("insert alfa1"); (new CustomerDefault())->setName("gamma"); printlist("insert gamma"); (new CustomerDefault())->setName("delta"); printlist("insert delta"); (new CustomerDefault())->setName("omega"); printlist("insert omega"); // Searching for some existing names string s("delta"); logger << "Find " << s << ": " << (Customer::find(s) ? "OK" : "NOK") << endl; s = "omega"; logger << "Find " << s << ": " << (Customer::find(s) ? "OK" : "NOK") << endl; // Searching for nonexistent name s = "hamburger"; logger << "Find " << s << ": " << (Customer::find(s) ? "OK" : "NOK") << endl; printlist("searches"); // Erasing some existing elements delete Customer::find("delta"); printlist("erase delta"); delete Customer::find("gamma"); printlist("erase gamma"); // Erasing some existing elements delete Customer::find("hamburger"); printlist("erase hamburger"); // Inserting a duplicate (new CustomerDefault())->setName("alfa2"); printlist("insert alfa2"); (new CustomerDefault())->setName("alfa4"); printlist("insert alfa4"); (new CustomerDefault())->setName("alfa x"); printlist("insert alfa x"); (new CustomerDefault())->setName("alfa y"); printlist("insert alfa y"); (new CustomerDefault())->setName("alfa z"); printlist("insert alfa z"); (new CustomerDefault())->setName("delta"); printlist("insert delta"); (new CustomerDefault())->setName("phi"); printlist("insert phi"); // Inserting an already existing element Customer * k = new CustomerDefault(); k->setName("alfa2"); logger << k->getName() << endl; printlist("duplicate insert alfa2"); delete k; // Clearing the list Customer::clear(); printlist("clear"); }