-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewmotortransport.cpp
40 lines (35 loc) · 1.12 KB
/
newmotortransport.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "newmotortransport.h"
#include "ui_newmotortransport.h"
#include "motortransport.h"
#include <QSqlQuery>
NewMotorTransport::NewMotorTransport(MotorTransport *motorTransport, QWidget *parent) :
QDialog(parent),
ui(new Ui::NewMotorTransport)
{
ui->setupUi(this);
m_pMotorTransport = motorTransport;
}
NewMotorTransport::~NewMotorTransport()
{
delete ui;
}
void NewMotorTransport::clearDataFormNewMotorTransport()
{
ui->brand->clear();
ui->stateNumber->clear();
ui->speedometer->clear();
}
void NewMotorTransport::addNewMotorTransport()
{
QSqlQuery querySetData;
querySetData.prepare("INSERT INTO MotorTransport(idMotorTransport, brand, stateNumber, speedometer) VALUES(?, ?, ?, ?)");
int count = m_pMotorTransport->searchRowCountMotorTransport();
querySetData.addBindValue(count);
querySetData.addBindValue(ui->brand->text());
querySetData.addBindValue(ui->stateNumber->text());
querySetData.addBindValue(ui->speedometer->text());
querySetData.exec();
m_pMotorTransport->addTableRowMotorTransport(count);
this->clearDataFormNewMotorTransport();
this->close();
}