This repository has been archived by the owner on Apr 3, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
fenetreeditionclient.cpp
58 lines (44 loc) · 1.66 KB
/
fenetreeditionclient.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
56
57
#include "fenetreeditionclient.h"
#include "ui_fenetreeditionclient.h"
FenetreEditionClient::FenetreEditionClient( int id, QWidget *parent) :
QDialog(parent),
ui(new Ui::FenetreEditionClient)
{
ui->setupUi(this);
client = CGestionBDD::getClient( id );
ui->nomLineEdit->setFocus();
ui->nomLineEdit->setText( client.getNom() );
ui->prenomLineEdit->setText( client.getPrenom() );
ui->promoComboBox->addItems( Settings::getTablist() );
int match = 0;
for( int i = 0; i < ui->promoComboBox->count(); i++ )
{
ui->promoComboBox->setCurrentIndex( i );
if( ui->promoComboBox->currentText() == client.getPromo() )
{
match = i;
}
}
ui->promoComboBox->setCurrentIndex( match );
connect( ui->boutonOK, SIGNAL(clicked()), this, SLOT( edition() ) );
connect( ui->boutonAnnuler, SIGNAL(clicked()), this, SLOT(close()) );
}
FenetreEditionClient::~FenetreEditionClient()
{
delete ui;
}
void FenetreEditionClient::edition()
{
if( ui->nomLineEdit->text() != "" && ui->prenomLineEdit->text() != "" )
{
CClient client1( client.getID(), ui->nomLineEdit->text(), ui->prenomLineEdit->text(), client.getDette(), ui->promoComboBox->currentText(), "none" );
CLog::ecrire( "Edition d'un client : " + client.getNom() + " -> " + client1.getNom() + " | " + client.getPrenom()
+ " -> " + client1.getPrenom() + " | " + client.getPromo() + " -> " + client1.getPromo() );
CGestionBDD::updateClient( client1 );
close();
}
else
{
QMessageBox::warning( this, "KFet", "Veuillez remplir correctement les champs nom et prénom." );
}
}