forked from IPP-Projekt/Uczelnia_z_bibloteka_klas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dodaj_grupe_dialog.cpp
34 lines (30 loc) · 931 Bytes
/
dodaj_grupe_dialog.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
#include "dodaj_grupe_dialog.h"
#include "ui_dodaj_grupe_dialog.h"
#include <QSqlTableModel>
#include <QSqlRecord>
#include <QSqlField>
Dodaj_grupe_Dialog::Dodaj_grupe_Dialog(UczelniaDB* uczelniaPointer, QWidget *parent) :
QDialog(parent),
ui(new Ui::Dodaj_grupe_Dialog)
{
setUczelnia(uczelniaPointer);
ui->setupUi(this);
}
Dodaj_grupe_Dialog::~Dodaj_grupe_Dialog()
{
delete ui;
}
void Dodaj_grupe_Dialog::nowyrekord()
{
QString tekstNazwa = ui->txtbox_Nazwa->text();
QString tekstKierunek = ui->txtbox_Kierunek->text();
QSqlRecord rekord = uczelnia->getModel(1)->record();
rekord.setValue("Id",DatabaseLibrary::cGenerateIndex(uczelnia->getModel(1)));
rekord.setValue("Nazwa",tekstNazwa);
rekord.setValue("Kierunek",tekstKierunek);
qDebug() << DatabaseLibrary::cInsertRecord(uczelnia->getModel(1),rekord);
}
void Dodaj_grupe_Dialog::on_buttonBox_accepted()
{
nowyrekord();
}