src/EditYeastPack.cpp

changeset 481
8a25dbe682eb
parent 480
94b3def5d778
equal deleted inserted replaced
480:94b3def5d778 481:8a25dbe682eb
120 120
121 if (this->textIsChanged) { 121 if (this->textIsChanged) {
122 if (this->recno == -1) { 122 if (this->recno == -1) {
123 query.prepare("INSERT INTO inventory_yeastpack SET laboratory=:laboratory, form=:form, " 123 query.prepare("INSERT INTO inventory_yeastpack SET laboratory=:laboratory, form=:form, "
124 "package=:package, notes=:notes, cells=:cells, viability=:viability, max=:max, " 124 "package=:package, notes=:notes, cells=:cells, viability=:viability, max=:max, "
125 "size=:size, used='0', uuid = :uuid"); 125 "size=:size, used='0', valid='1', uuid = :uuid");
126 } else { 126 } else {
127 query.prepare("UPDATE inventory_yeastpack SET laboratory=:laboratory, form=:form, " 127 query.prepare("UPDATE inventory_yeastpack SET laboratory=:laboratory, form=:form, "
128 "package=:package, notes=:notes, cells=:cells, viability=:viability, max=:max, " 128 "package=:package, notes=:notes, cells=:cells, viability=:viability, max=:max, "
129 "size=:size WHERE record = :recno"); 129 "size=:size, valid='1' WHERE record = :recno");
130 } 130 }
131 query.bindValue(":laboratory", ui->laboratoryEdit->text()); 131 query.bindValue(":laboratory", ui->laboratoryEdit->text());
132 query.bindValue(":form", ui->formEdit->currentIndex()); 132 query.bindValue(":form", ui->formEdit->currentIndex());
133 query.bindValue(":package", ui->packageEdit->text()); 133 query.bindValue(":package", ui->packageEdit->text());
134 query.bindValue(":notes", ui->notesEdit->toPlainText()); 134 query.bindValue(":notes", ui->notesEdit->toPlainText());
163 void EditYeastPack::on_cloneButton_clicked() 163 void EditYeastPack::on_cloneButton_clicked()
164 { 164 {
165 QSqlQuery query; 165 QSqlQuery query;
166 query.prepare("INSERT INTO inventory_yeastpack SET laboratory=:laboratory, form=:form, " 166 query.prepare("INSERT INTO inventory_yeastpack SET laboratory=:laboratory, form=:form, "
167 "package=:package, notes=:notes, cells=:cells, viability=:viability, max=:max, " 167 "package=:package, notes=:notes, cells=:cells, viability=:viability, max=:max, "
168 "size=:size, used=:used, uuid=:uuid"); 168 "size=:size, used=:used, valid='0', uuid=:uuid");
169 query.bindValue(":laboratory", ui->laboratoryEdit->text()); 169 query.bindValue(":laboratory", ui->laboratoryEdit->text());
170 query.bindValue(":form", ui->formEdit->currentIndex()); 170 query.bindValue(":form", ui->formEdit->currentIndex());
171 query.bindValue(":package", ui->packageEdit->text() + " [copy]"); 171 query.bindValue(":package", ui->packageEdit->text() + " [copy]");
172 query.bindValue(":notes", ui->notesEdit->toPlainText()); 172 query.bindValue(":notes", ui->notesEdit->toPlainText());
173 query.bindValue(":cells", QString("%1").arg(ui->cellsEdit->value() * 1000000000, 1, 'f', 0, '0')); 173 query.bindValue(":cells", QString("%1").arg(ui->cellsEdit->value() * 1000000000, 1, 'f', 0, '0'));

mercurial