|
|
@ -5,7 +5,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
#include "main.h"
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
|
|
|
|
void chargeDonnees(int *tLogArticle, int *tLogClient,int reference[], float weight[], float volume[], float unitPrice[], int clientID[], float cagnotte[], int suspended[], int isAdmin[])
|
|
|
|
void chargeDonnees(int *tLogArticle, int *tLogClient,int reference[], float weight[], float volume[], float unitPrice[], int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
Chargement des données des articles et clients de fichiers vers des tableaux
|
|
|
|
Chargement des données des articles et clients de fichiers vers des tableaux
|
|
|
@ -21,7 +21,7 @@ void chargeDonnees(int *tLogArticle, int *tLogClient,int reference[], float weig
|
|
|
|
+param suspended: tableau de l'état du compte des clients
|
|
|
|
+param suspended: tableau de l'état du compte des clients
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
*tLogArticle = chargeArticles(reference, weight, volume, unitPrice);
|
|
|
|
*tLogArticle = chargeArticles(reference, weight, volume, unitPrice);
|
|
|
|
*tLogClient = chargeClients(clientID, cagnotte, suspended, isAdmin);
|
|
|
|
*tLogClient = chargeClients(clientID, clientPassword, cagnotte, suspended, isAdmin);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int chargeArticles(int reference[], float weight[], float volume[], float unitPrice[])
|
|
|
|
int chargeArticles(int reference[], float weight[], float volume[], float unitPrice[])
|
|
|
@ -77,7 +77,7 @@ int chargeArticles(int reference[], float weight[], float volume[], float unitPr
|
|
|
|
return tL;
|
|
|
|
return tL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int chargeClients(int clientID[], float cagnotte[], int suspended[], int isAdmin[])
|
|
|
|
int chargeClients(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
Chargement des données des clients d'un fichier vers des tableaux
|
|
|
|
Chargement des données des clients d'un fichier vers des tableaux
|
|
|
@ -102,10 +102,10 @@ int chargeClients(int clientID[], float cagnotte[], int suspended[], int isAdmin
|
|
|
|
exit(1);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int id, sus, tL=0, adm;
|
|
|
|
int id, passwd, sus, tL=0, adm;
|
|
|
|
float cag;
|
|
|
|
float cag;
|
|
|
|
|
|
|
|
|
|
|
|
fscanf(client, "%d %f %d %d", &id, &cag, &sus, &adm);
|
|
|
|
fscanf(client, "%d %d %f %d %d", &id, &passwd, &cag, &sus, &adm);
|
|
|
|
while(!feof(client))
|
|
|
|
while(!feof(client))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(tL == tmaxArticles)
|
|
|
|
if(tL == tmaxArticles)
|
|
|
@ -115,20 +115,21 @@ int chargeClients(int clientID[], float cagnotte[], int suspended[], int isAdmin
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
clientID[tL] = id;
|
|
|
|
clientID[tL] = id;
|
|
|
|
|
|
|
|
clientPassword[tL] = passwd;
|
|
|
|
cagnotte[tL] = cag;
|
|
|
|
cagnotte[tL] = cag;
|
|
|
|
suspended[tL] = sus;
|
|
|
|
suspended[tL] = sus;
|
|
|
|
isAdmin[tL] = adm;
|
|
|
|
isAdmin[tL] = adm;
|
|
|
|
|
|
|
|
|
|
|
|
tL++;
|
|
|
|
tL++;
|
|
|
|
|
|
|
|
|
|
|
|
fscanf(client, "%d %f %d", &id, &cag, &sus, &adm);
|
|
|
|
fscanf(client, "%d %d %f %d %d", &id, &passwd, &cag, &sus, &adm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fclose(client);
|
|
|
|
fclose(client);
|
|
|
|
return tL;
|
|
|
|
return tL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void sauvegardeDonnees(int tLogArticle, int tLogClient, int reference[], float weight[], float volume[], float unitPrice[], int clientID[], float cagnotte[], int suspended[], int isAdmin[])
|
|
|
|
void sauvegardeDonnees(int tLogArticle, int tLogClient, int reference[], float weight[], float volume[], float unitPrice[], int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[])
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
Sauvegarde des données des articles et clients de tableaux vers des fichiers
|
|
|
|
Sauvegarde des données des articles et clients de tableaux vers des fichiers
|
|
|
@ -144,7 +145,7 @@ void sauvegardeDonnees(int tLogArticle, int tLogClient, int reference[], float w
|
|
|
|
+param suspended: tableau de l'état du compte des clients
|
|
|
|
+param suspended: tableau de l'état du compte des clients
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
sauvegardeArticles(reference, weight, volume, unitPrice, tLogArticle);
|
|
|
|
sauvegardeArticles(reference, weight, volume, unitPrice, tLogArticle);
|
|
|
|
sauvegardeClients(clientID, cagnotte, suspended, isAdmin, tLogClient);
|
|
|
|
sauvegardeClients(clientID, clientPassword, cagnotte, suspended, isAdmin, tLogClient);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void sauvegardeArticles(int reference[], float weight[], float volume[], float unitPrice[], int tLogArticle)
|
|
|
|
void sauvegardeArticles(int reference[], float weight[], float volume[], float unitPrice[], int tLogArticle)
|
|
|
@ -178,7 +179,7 @@ void sauvegardeArticles(int reference[], float weight[], float volume[], float u
|
|
|
|
fclose(article);
|
|
|
|
fclose(article);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void sauvegardeClients(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int tLogClient)
|
|
|
|
void sauvegardeClients(int clientID[], int clientPassword[], float cagnotte[], int suspended[], int isAdmin[], int tLogClient)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
Sauvegarde des données des articles de tableaux vers le fichier des articles
|
|
|
|
Sauvegarde des données des articles de tableaux vers le fichier des articles
|
|
|
@ -202,7 +203,7 @@ void sauvegardeClients(int clientID[], float cagnotte[], int suspended[], int is
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
for(i=0; i<tLogClient; i++)
|
|
|
|
for(i=0; i<tLogClient; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
fprintf(client, "%d %f %d %d\n", clientID[i], cagnotte[i], suspended[i], isAdmin[i]);
|
|
|
|
fprintf(client, "%d %d %f %d %d\n", clientID[i], clientPassword[i], cagnotte[i], suspended[i], isAdmin[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fclose(client);
|
|
|
|
fclose(client);
|
|
|
|