Repository navigation
Expand file tree
/
Copy pathreclamation.cpp
More file actions
62 lines (58 loc) · 1.91 KB
/
Copy pathreclamation.cpp
File metadata and controls
62 lines (58 loc) · 1.91 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
#include "reclamation.h"
reclamation::reclamation()
{
code="";
sujet="";
commentaire="";
date_reclamation="";
}
reclamation::reclamation(QString c, QString s, QString co,QString d)
{
code = c;
sujet=s;
commentaire=co;
date_reclamation=d;
}
bool reclamation::ajouterecl()
{
QSqlQuery qry;
qry.prepare("insert into reclamation (code,sujet,commentaire,date_reclamation) values('"+code+"','"+sujet+"','"+commentaire+"','"+date_reclamation+"')");
return qry.exec();
}
QSqlQueryModel * reclamation::afficherecl()
{
QSqlQueryModel * model=new QSqlQueryModel();
model->setQuery("select * from reclamation");
model->setHeaderData(0,Qt::Horizontal, QObject::tr("code"));
model->setHeaderData(1,Qt::Horizontal, QObject::tr("sujet"));
model->setHeaderData(2,Qt::Horizontal, QObject::tr("commentaire"));
model->setHeaderData(3,Qt::Horizontal, QObject::tr("date reclamation"));
return model;
}
bool reclamation::supprimerecl(QString c)
{
QSqlQuery qry;
QString code=c;
qry.prepare("Delete from reclamation where code='"+code+"'");
return qry.exec();
}
bool reclamation::modifierecl(QString c,QString s,QString co,QString d)
{
QSqlQuery qry;
QString code=c;
QString sujet=s;
QString commentaire=co;
QString date_reclamation=d;
qry.prepare("update reclamation set code='"+code+"',sujet='"+sujet+"',commentaire='"+commentaire+"',date_reclamation='"+date_reclamation+"' where code='"+code+"' ");
return qry.exec();
}
QSqlQueryModel * reclamation::trierecl()
{
QSqlQueryModel * model=new QSqlQueryModel();
model->setQuery("select * from reclamation order by code");
model->setHeaderData(0,Qt::Horizontal, QObject::tr("code"));
model->setHeaderData(1,Qt::Horizontal, QObject::tr("sujet"));
model->setHeaderData(2,Qt::Horizontal, QObject::tr("commentaire"));
model->setHeaderData(3,Qt::Horizontal, QObject::tr("date reclamation"));
return model;
}