void main_dlg::onDateTimeAsyncFinished() { if (! m_pDateTimeAsync || ! m_pDateTimeAsync->getService()) { return; } updateLastTransactionLog(m_pDateTimeAsync->getService()->getTransaction()); m_pDateTimeAsync.reset(); }
void main_dlg::onClickBtnDateTime() { QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); // Create service and call method to retrieve current server date-time server_infos service; service.get_current_date_time(); // Update transaction log updateLastTransactionLog(service.getTransaction()); QApplication::restoreOverrideCursor(); }
void main_dlg::onClickBtnRemoveAllUsers() { QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); // Create service to call user_service service; service.remove_all(); // Update transaction log updateLastTransactionLog(service.getTransaction()); QApplication::restoreOverrideCursor(); }
void main_dlg::onClickBtnGetAllUsers() { QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); // Create service to call user_service service; service.fetch_all(); // If transaction is ok => display in a message box the number of users fetched from database list_of_users_ptr output = (service.isValidWithOutput() ? service.getOutputParameter()->list_of_users : list_of_users_ptr()); if (output) { QMessageBox::information(this, "qxClient - get all users", "database contains '" + QString::number(output->size()) + "' user(s)."); } // Update transaction log updateLastTransactionLog(service.getTransaction()); QApplication::restoreOverrideCursor(); }
void main_dlg::onClickBtnRemoveUser() { QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); // Create input parameters with user id to remove user_service_input_ptr input = user_service_input_ptr(new user_service_input()); input->id = txtId->text().toLong(); // Create service to call and set input parameters user_service service; service.setInputParameter(input); service.remove(); // Update transaction log updateLastTransactionLog(service.getTransaction()); QApplication::restoreOverrideCursor(); }
void main_dlg::onClickBtnUpdateUser() { QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); // Create input parameters with user to update user_service_input_ptr input = user_service_input_ptr(new user_service_input()); input->user = fileUser(); // Create service to call and set input parameters user_service service; service.setInputParameter(input); service.update(); // Update transaction log updateLastTransactionLog(service.getTransaction()); QApplication::restoreOverrideCursor(); }
void main_dlg::onClickBtnFetchUser() { QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); // Create input parameters with user id to fetch user_service_input_ptr input = user_service_input_ptr(new user_service_input()); input->id = txtId->text().toLong(); // Create service to call and set input parameters user_service service; service.setInputParameter(input); service.fetch_by_id(); // If transaction is ok => display user fetched on GUI user_ptr output = (service.isValidWithOutput() ? service.getOutputParameter()->user : user_ptr()); if (output) { fillUser(output); } // Update transaction log updateLastTransactionLog(service.getTransaction()); QApplication::restoreOverrideCursor(); }
void main_dlg::onClickBtnAddUser() { QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); // Create input parameters with user to add user_service_input_ptr input = user_service_input_ptr(new user_service_input()); input->user = fileUser(); // Create service to call and set input parameters user_service service; service.setInputParameter(input); service.insert(); // If transaction is ok => display user with new id added to database user_ptr output = (service.isValidWithOutput() ? service.getOutputParameter()->user : user_ptr()); if (output) { fillUser(output); } // Update transaction log updateLastTransactionLog(service.getTransaction()); QApplication::restoreOverrideCursor(); }
void main_dlg::onClickBtnSearchUsers() { QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); // Create criteria to search users user_search_ptr criteria = user_search_ptr(new user_search()); criteria->first_name = txtFirstName->text(); criteria->last_name = txtLastName->text(); criteria->birth_date = QDateTime::fromString(txtBirthDate->text(), QX_CLIENT_BIRTHDATE_QDATETIME_FORMAT); // Create input parameters with criteria to search users user_service_input_ptr input = user_service_input_ptr(new user_service_input()); input->criteria = criteria; // Create service to call and set input parameters user_service service; service.setInputParameter(input); service.get_by_criteria(); // If transaction is ok => display in a message box the number of users fetched from database list_of_users_ptr output = (service.isValidWithOutput() ? service.getOutputParameter()->list_of_users : list_of_users_ptr()); if (output) { QMessageBox::information(this, "qxClient - search users", "database contains '" + QString::number(output->size()) + "' user(s) with input criteria."); } // Update transaction log updateLastTransactionLog(service.getTransaction()); QApplication::restoreOverrideCursor(); }