-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnewotherworker.cpp
49 lines (44 loc) · 1.65 KB
/
newotherworker.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
41
42
43
44
45
46
47
48
49
#include "newotherworker.h"
#include "ui_newotherworker.h"
#include "otherworkers.h"
#include <QSqlQuery>
NewOtherWorker::NewOtherWorker(OtherWorkers *otherWorkers, QWidget *parent) :
QDialog(parent),
ui(new Ui::NewOtherWorker)
{
ui->setupUi(this);
m_pOtherWorkers = otherWorkers;
}
NewOtherWorker::~NewOtherWorker()
{
delete ui;
}
void NewOtherWorker::clearDataFormNewOtherWorker()
{
ui->personalNumber->clear();
ui->lastName->clear();
ui->name->clear();
ui->middleName->clear();
ui->passportSeries->clear();
ui->passportNumber->clear();
ui->post->clear();
}
void NewOtherWorker::addNewOtherWorker()
{
QSqlQuery querySetDataOtherWorkers;
querySetDataOtherWorkers.prepare("INSERT INTO OtherWorkers(idOtherWorker, personalNumber, lastName, name, middleName, dateOfBirth, passportNumber, post) "
"VALUES(?, ?, ?, ?, ?, ?, ?, ?)");
int count = m_pOtherWorkers->searchRowCountOtherWorkers();
querySetDataOtherWorkers.addBindValue(count);
querySetDataOtherWorkers.addBindValue(ui->personalNumber->text());
querySetDataOtherWorkers.addBindValue(ui->lastName->text());
querySetDataOtherWorkers.addBindValue(ui->name->text());
querySetDataOtherWorkers.addBindValue(ui->middleName->text());
querySetDataOtherWorkers.addBindValue(ui->dateOfBirth->date());
querySetDataOtherWorkers.addBindValue(ui->passportSeries->text() + ui->passportNumber->text());
querySetDataOtherWorkers.addBindValue(ui->post->text());
querySetDataOtherWorkers.exec();
m_pOtherWorkers->addTableRowOtherWorkers(count);
this->clearDataFormNewOtherWorker();
this->close();
}