You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

 int MachineData::GetActiveMachinenID()
{
    int rows,machineid;

    QSqlQueryModel model;
    model.setQuery("SELECT machine_id, ActiveMachine, NoCylinders, NoSensors FROM machine WHERE ActiveMachine = 1");
    rows= model.rowCount();
    if(rows<1)
    {
         QMessageBox::critical(0, trUtf8("Koneasetuksissa virhe,MachineData::GetActiveMachinenID"),
                                        tr("Asetustietokannassa ei ole koneen asetuksia.\n Kone ei toimi!"),
                                         QMessageBox::Close);
    }
    if(rows>1)
    {
         QMessageBox::critical(0, trUtf8("Koneasetuksissa virhe,MachineData::GetActiveMachinenID"),
                                        tr("Asetustietokannassa on useita aktiivisia koneen asetuksia.\n Kone ei toimi!"),
                                         QMessageBox::Close);
    }
    NumberOfSensors= model.record(0).value("NoSensors").toInt();
    NumberOfCylinders= model.record(0).value("NoCylinders").toInt();
    machineid=model.record(0).value("machine_id").toInt();
    return machineid;
}
  • No labels
You must log in to comment.