Хранилища Subversion OpenInventory

Редакция

Содержимое файла | Последнее изменение | Открыть журнал | RSS

Редакция Автор № строки Строка
6 pingvin 1
#include "addsysblockform.h"
2
#include "mainwindowimpl.h"
3
// place your code here
4
 
5
 
6
addsysblockForm::addsysblockForm()
7
        : QDialog(){
8
                setupUi(this);
9
                connect(buttonBox, SIGNAL(accepted()), this, SLOT(addNewSysBlockSlot()));
10
        }
11
 
12
void addsysblockForm::closeEvent ( QCloseEvent * event )  {
13
        emit formClose();
14
}
15
 
16
void addsysblockForm::addNewSysBlockSlot(){
17
        int i;
18
        i++;
19
        //test cvs
20
        QDate data_p;
21
        QSqlQuery q;
22
        QString sqltext;
23
        int field_fio, field_identifikator, field_inventar_num;
24
        QString serial_num, inventar_num, data_str, garant_str, id, fio, id_otdela;
25
        bool ok;
26
        if (lineEdit_2->text()==""){
27
                                QMessageBox::critical( //     .
28
                                                                                this,                      //  .
29
                                                                                QObject::tr("     "),   // .  
30
                                                                                tr("      !"));          //  .
31
                                return;
32
                         }
33
 
34
 
35
        sqltext = tr("select * from system_blocks where system_blocks._ = \"");
36
        sqltext.append(lineEdit_2->text());
37
        sqltext.append(tr("\""));
38
        q.prepare(sqltext);
39
        ok = q.exec();
40
        field_inventar_num = q.record().indexOf(tr("_"));
41
if (q.next()) {
42
                                QMessageBox::critical( //     .
43
                                                                                this,                      //  .
44
                                                                                QObject::tr("     !"),   // .  
45
                                                                                tr("          !"));          //  .
46
                                return;
47
                         }
48
        else {
49
                q.clear();
50
                data_p = dateEdit->date();
51
                data_str = data_p.toString(tr("yyyy-MM-dd"));
52
                garant_str = QVariant(spinBox->value()).toString();
53
                q.prepare(tr("insert into system_blocks (_, _, _, _, __) "
54
                                        "values (:ser_num, :inv_num, :date, :garant, :id_otv_lica)"));
55
                q.bindValue(tr(":ser_num"), lineEdit->text());
56
                q.bindValue(tr(":inv_num"), lineEdit_2->text());
57
                q.bindValue(tr(":date"), data_str);
58
                q.bindValue(tr(":garant"), garant_str);
59
                q.bindValue(tr(":id_otv_lica"), tr("1"));
60
                ok = q.exec();
61
                emit componentAdd();
62
                close();
63
                }
64
 
65
 
66
}
67