-
Notifications
You must be signed in to change notification settings - Fork 0
/
GestionClient.cpp
55 lines (48 loc) · 1.91 KB
/
GestionClient.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "GestionClient.h"
namespace Services {
GestionClient::GestionClient(void) {
this->initGestion();
this->_client = gcnew Composants::MapClient();
}
GestionClient::GestionClient(String^ nom, String^ prenom) {
this->initGestion();
this->_client = gcnew Composants::MapClient(nom, prenom);
}
GestionClient::GestionClient(String^ nom, String^ prenom, DateTime^ dateNaissance, Adresse^ adresse) {
this->initGestion();
this->_client = gcnew Composants::MapClient(nom, prenom, dateNaissance, adresse);
}
DataSet^ GestionClient::liste(int choix) {
this->_ds = gcnew DataSet();
this->_ds = this->_cad->getRows(this->_client->SELECT(choix), "client");
return this->_ds;
}
void GestionClient::ajouter(void) {
if (this->_cad->actionRowsID("SELECT * FROM client WHERE client.nom = '" + this->_client->get_nom() + "' AND client.prenom = '" + this->_client->get_prenom() + "'") != 0) {
this->_cad->actionRows(this->_client->INSERT(1));
throw gcnew bool(1);
}
this->_cad->actionRows(this->_client->INSERT(0));
if (this->_cad->actionRowsID("SELECT * FROM client WHERE client.nom = '" + this->_client->get_nom() + "' AND client.prenom = '" + this->_client->get_prenom() + "'") != 0) {
throw gcnew bool(1);
}
else {
throw gcnew bool(0);
}
}
void GestionClient::supprimer(void) {
if (this->_cad->actionRowsID("SELECT * FROM client WHERE client.nom = '" + this->_client->get_nom() + "' AND client.prenom = '" + this->_client->get_prenom() + "'") == 0) {
throw gcnew String("Ce client n\'existe pas !");
}
this->_cad->actionRows(this->_client->DELETE());
if (this->_cad->actionRowsID("SELECT * FROM client WHERE client.nom = '" + this->_client->get_nom() + "' AND client.prenom = '" + this->_client->get_prenom() + "'") == 0) {
throw gcnew bool(1);
}
else {
throw gcnew bool(0);
}
}
void GestionClient::modifier(String^ id) {
this->_cad->actionRows(this->_client->UPDATE(id));
}
}