Хранилища Subversion OpenInventory

Редакция

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

Редакция Автор № строки Строка
6 pingvin 1
#include "addotdelform.h"
2
#include "mainwindowimpl.h"
3
// place your code here
4
 
5
addotdelForm::addotdelForm()
6
        : QDialog()
7
{
8
//      QStringList proizv_list; //  
9
        setupUi(this);
10
//      proizv_list = getManufacturiesList();
11
//      comboBox->addItems(proizv_list);
12
        // TODO
13
                connect(buttonBox, SIGNAL(accepted()), this, SLOT(addNemOtdelSlot()));
14
 
15
}
16
 
17
 
18
 
19
void addotdelForm::closeEvent ( QCloseEvent * event )  {
20
        emit formClose();
21
}
22
 
23
void addotdelForm::addNemOtdelSlot(){
24
        QSqlQuery q;
25
        QString sqltext;
26
        int field_identifikator, field_nazvanie, field_spravka;
27
        QString identifikator, nazvanie, spravka;
28
        bool ok;
29
        if (lineEdit->text()==""){
30
                                QMessageBox::critical( //     .
31
                                                                                this,                      //  .
32
                                                                                QObject::tr("  "),   // .  
33
                                                                                tr("    !"));          //  .
34
                                return;
35
                         }
36
 
37
 
38
        sqltext = tr("select * from otdeli where otdeli. = \"");
39
        sqltext.append(lineEdit->text());
40
        sqltext.append(tr("\""));
41
        q.prepare(sqltext);
42
        ok = q.exec();
43
        field_nazvanie = q.record().indexOf(tr(""));
44
        if (q.next()) {
45
                                QMessageBox::critical( //     .
46
                                                                                this,                      //  .
47
                                                                                QObject::tr("  "),   // .  
48
                                                                                tr("    !"));          //  .
49
                                return;
50
                         }
51
        else {
52
                q.clear();
53
                q.prepare(tr("insert into otdeli (, ) "
54
                                        "values (:name, :comment)"));
55
        q.bindValue(tr(":name"), lineEdit->text());
56
        q.bindValue(tr(":comment"), lineEdit_2->text());
57
        ok = q.exec();
58
        emit componentAdd();
59
        close();}
60
 
61
}