void currencysViewDialog::getCurrenciesID(){
QModelIndex currensyIndex = ui->currenciesTableView->currentIndex();
int selectedRow = currensyIndex.row();
int selectedColumn = 0;
currensyCurrentID =ui->currenciesTableView->model()->data(ui->currenciesTableView->model()->index(selectedRow,selectedColumn)).toInt();
qDebug() << trUtf8("Current ID:") << currensyCurrentID;
}
void currencysViewDialog::currensiesModify(){
getCurrenciesID();
QSqlQuery *getCurrencies = new QSqlQuery;
getCurrencies->prepare("SELECT "
"currency_id, "
"currency_name, "
"currency_altname, "
"currency_rate, "
"currency_national, "
"currency_code "
"FROM "
"currencies "
"WHERE "
"deleted='false' "
"AND currency_id=:currensyCurrentID");
getCurrencies->bindValue(":currensyCurrentID",currensyCurrentID);
getCurrencies->exec();
// if(getCurrencies->lastError().isValid())
qDebug() << trUtf8("Запрос:") << getCurrencies->executedQuery();
qDebug() << trUtf8("Error:") << getCurrencies->lastError();
while(getCurrencies->next()){
currensyID = getCurrencies->value(0).toInt();
currensyName = getCurrencies->value(1).toString();
currensAltName = getCurrencies->value(2).toString();
currensyRate = getCurrencies->value(3).toDouble();
currensyNational = getCurrencies->value(4).toBool();
currensyCode = getCurrencies->value(5).toInt();
qDebug() << trUtf8("ID:") << currensyID;
qDebug() << trUtf8("Имя валюты:") << currensyName;
qDebug() << trUtf8("AltName:") << currensAltName;
qDebug() << trUtf8("Rate:") << currensyRate;
qDebug() << trUtf8("National:") << currensyNational;
qDebug() << trUtf8("Code:") << currensyCode;
}
currencysChangeDialog dialog(this);
dialog.currensiesEdit(currensyID,currensyName,currensAltName,currensyRate,currensyNational,currensyCode);
dialog.exec();
if(dialog.close())
getCurrenciesList();
}