-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask.cpp
More file actions
131 lines (118 loc) · 3.35 KB
/
Copy pathtask.cpp
File metadata and controls
131 lines (118 loc) · 3.35 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#include "task.h"
#include <QSqlQuery>
#include<QtDebug>
#include <QObject>
task::task()
{
}
task::task(int id_task,int cin_perso,QString disc,QString com1,QString com2,QString com3){
this->id_task=id_task;
this->cin_perso=cin_perso;
this->disc=disc;
this->com1=com1;
this->com2=com2;
this->com3=com3;
}
int task::get_id_task(){
return id_task;
}
int task::get_cin_peros(){
return cin_perso;
}
QString task::get_disc(){
return disc;
}
QDate task::get_date(){
return date_limite;
}
QString task::get_com1(){
return com1;
}
QString task::get_com2(){
return com2;
}
QString task::get_com3(){
return com3;
}
void task::set_id_task(int id_task){
this->id_task=id_task;
}
void task::set_cin_perso(int cin){
this->cin_perso=cin;
}
void task::set_disc(QString disc){
this->disc=disc;
}
void task::set_date(QDate d){
this->date_limite=d;
}
void task::set_com1(QString com1){
this->com1=com1;
}
void task::set_com2(QString com2){
this->com2=com2;
}
void task::set_com3(QString com3){
this->com3=com3;
}
bool task::ajouter_task(){
QSqlQuery query;
query.prepare("INSERT INTO task (id_task,cin_pers,date_limite,description,com1,com2,com3) "
"VALUES (:id_task,:cin_pers,:date_limite,:description,:com1,:com2,:com3)");
query.bindValue(":id_task",id_task);
query.bindValue(":cin_pers",cin_perso);
query.bindValue(":date_limite",date_limite);
query.bindValue("::description",disc);
query.bindValue(":com1",com1);
query.bindValue(":com2",com2);
query.bindValue(":com3",com3);
return query.exec();
}
QSqlQueryModel* task::afficher(const QString &nom)
{
QSqlQueryModel *model = new QSqlQueryModel();
QString query = "SELECT cin_pers,date_limite,description,com1,com2,com3 FROM task WHERE cin_pers LIKE '%" + nom + "%'"
" OR date_limite LIKE '%" + nom + "%'"
" OR description LIKE '%" + nom + "%'";
model->setQuery(query);
model->setHeaderData(0, Qt::Horizontal, QObject::tr("CIN"));
model->setHeaderData(1, Qt::Horizontal, QObject::tr("dedline"));
model->setHeaderData(2, Qt::Horizontal, QObject::tr("descriptione"));
model->setHeaderData(3, Qt::Horizontal, QObject::tr("com1"));
return model;
}
bool task::delete_task(int id_t){
QSqlQuery query;
query.prepare("DELETE FROM TASK WHERE ID=:id");
query.bindValue(":id",id_t);
return query.exec();
}
bool task::mod_task(int j){
QSqlQuery query;
query.prepare("UPDATE task SET date_limite=:date_l,description=:description WHERE id=:id");
query.bindValue(":id",j);
query.bindValue(":date_l",date_limite);
query.bindValue(":description",disc);
return query.exec();
}
bool task::comentaire1(int j){
QSqlQuery query;
query.prepare("UPDATE task SET COM1=:com WHERE id=:id");
query.bindValue(":id",j);
query.bindValue(":com",com1);
return query.exec();
}
bool task::comentaire2(int j){
QSqlQuery query;
query.prepare("UPDATE task SET COM2=:com WHERE id=:id");
query.bindValue(":id",j);
query.bindValue(":com",com2);
return query.exec();
}
bool task::comentaire3(int j){
QSqlQuery query;
query.prepare("UPDATE task SET COM3=:com WHERE id=:id");
query.bindValue(":id",j);
query.bindValue(":com",com3);
return query.exec();
}