j'ai continué de dev la fonction modif et j'ai juste changer un truc dans ton menu pour que ça aille avec le reste

master
Alexis LAURENT 2 years ago
parent 6c0402ceea
commit 8d53b98524

223
SAE.c

@ -97,7 +97,8 @@ int menuAdminAffiche(void)
{
int choix;
printf("####################################################\n");
printf("\t\tMenu Administrateur\n\n");
printf("\t\t|Menu Administrateur|\n\n");
printf("\t\t---------------------\n\n");
printf("1 - Mise à jour nombre de Places d'un Département d'un IUT\n");
printf("2 - Création d'un département dans un IUT\n");
printf("3 - Suppression d'un département dans un IUT\n");
@ -810,7 +811,7 @@ ListeCandid traiterCandidIUT(ListeCandid l, FILE *flot)
fscanf(flot,"%s",ville);
fscanf(flot, "%d", &nbDept);
printf("%s |%d|\n", ville, nbDept);
tDept = (ChoixDept **)malloc(sizeof(ChoixDept *)*(nbDept + 5));
tDept = (ChoixDept **)malloc(sizeof(ChoixDept *)*(nbDept + 10));
if(tDept == NULL)
{
printf("Pb malloc candidIUt\n");
@ -1008,9 +1009,219 @@ void creationCandid(Candidat **tab, int *nbEle, int *tailleP)
return;
}
void modifCandid(Candidat **tab, int nbEle)
int menuCandid(void)
{
Candidat c;
printf("en construction");
return;
int choix;
printf("####################################################\n");
printf("\t\t|Menu Candidature|\n");
printf("\t\t------------------\n\n");
printf("1 - Créer une Candidature\n");
printf("2 - Supprimer une Candidature\n");
printf("3 - Modifier une Candidature\n");
printf("4 - Afficher une Candidature\n");
printf("5 - Afficher toute les Candidatures\n");
printf("\n\n9 - Connexion mode Administrateur\n");
printf("\n\n10 - Quitter\n");
printf("####################################################\n");
printf("\nSelection : ");
scanf("%d",&choix);
return choix;
}
void gestionCandid(VilleIUT **tiut, int nbIUT, Candidat **tcandid, int *nbCandid, int *taillePCandid)
{
int choix;
while(1)
{
choix = menuCandid();
system("clear");
switch(choix) {
case 1:
creationCandid(tcandid, nbCandid, taillePCandid);
system("clear");
break;
case 2:
suppressionCandid(tab, nbCandid);
system("clear");
break;
case 3:
modifCandid(tiut, nbEle);
system("clear");
break;
case 4:
AffichageNbplaceDeptVille(tiut, nbEle);
clearpage();
break;
case 5:
//modif candid;
clearpage();
break;
case 9:
choix = gestionMenuAdmin(tiut, nbEle);
if (choix == -1)
if (verifQuit()) return;
break;
case 10:
if (verifQuit()) return;
break;
}
}
}
int menuGestionCandid(void)
{
int choix;
printf("####################################################\n");
printf("\t\t|Gestion Candidature|\n");
printf("\t\t---------------------\n\n");
printf("1 - Ajouter un voeux\n");
printf("2 - Supprimer un voeux\n");
printf("\n\n9 - Retour Menu Candidature\n");
printf("####################################################\n");
printf("\nSelection : ");
scanf("%d",&choix);
return choix;
}
ListeCandid recherchecandidIUT(ListeCandid l, char code[])
{
if (l == NULL)
return NULL;
if ((strcmp(code,l->iutCandid)) < 0)
return NULL;
if (strcmp(code,l->iutCandid)==0)
return l;
return recherchecandidIUT(l->suiv, code);
}
int recherchecandidDept(ChoixDept **tab,int nbEle, char code[],int *trouve)
{
int i=0;
while(i < nbEle)
{
if ((strcmp(code,tab[i]->departement)) < 0)
{
*trouve = 0;
return -1;
}
if (strcmp(code,tab[i]->departement)==0)
{
*trouve = 1;
return i;
}
}
*trouve = 0;
return -1;
}
ChoixDept RempTabCandid(char dept[],int deciCandid ,int deciDept)
{
ChoixDept d;
strcpy(d.departement, dept);
d.decisionDept = deciDept;
d.decisionCandid = deciCandid;
return d;
}
void ajouterDept(Candidat **tcandid, int nbCandid, VilleIUT **tiut, int nbIUT, int iCandid)
{
char ville[30], departement[30];
int pos,irech, trouve;
MaillonCandid *aux;
ChoixDept **tDept;
while(1)
{
printf("Dans quel IUT voulez vous candidater : ");
scanf("%s%*c", ville);
pos = rechVille(tiut, nbIUT, ville, &trouve);
if (trouve == 0)
printf("Erreur ! IUT non référencé\n");
if(trouve == 1)
{
while(1)
{
printf("Dans quel Département voulez-vous candidater : ");
scanf("%s%*c", departement);
pos = recherchecandidDept(tiut[pos]->idDept, departement)
if (trouve == 0)
printf("Erreur ! Département non référencé\n");
if (trouve == 1)
{
aux = recherchecandidIUT(tcandid[iCandid]->idCandIUT, ville) == NULL)
{
tDept = (ChoixDept **)malloc(sizeof(ChoixDept *)*(nbDept + 5));
if(tDept == NULL)
{
printf("Pb malloc candidIUt\n");
exit(1);
}
*(tDept[0]) = RempTabCandid(departement, 0, 0);
tcandid[iCandid]->idCandIUT = insererCandid(tcandid[iCandid]->idCandIUT, ville, tDept, 1);
}
else
{
irech = recherchecandidDept(tcandid[iCandid]->idCandIUT->tabDept, tcandid[iCandid]->nbChoix, departement, &trouve);
if (trouve == 0)
{
*(tcandid[iCandid]->idCandIUT->tabDept[tcandid[iCandid]->idCandIUT->nbChoix]) = RempTabCandid(departement, 0, 0);
tcandid[iCandid]->idCandIUT->nbChoix = tcandid[iCandid]->idCandIUT->nbChoix + 1;
printf("Candidature validée !\n");
}
else
printf("vous avez déjà postuler au département %s de cette %s", departement, ville);
}
}
printf("saisie Département\n")
if(verifSelection())
break
}
}
printf("Saisie IUT\n")
if(!verifSelection())
break;
}
}
void supprimerCandidDept(Candidat **tcandid, int nbCandid, VilleIUT **tiut, int nbIUT, int iCandid)
{
char ville[30], departement[30];
int pos, trouve;
MaillonCandid *aux;
while(1)
{
printf("Dans quel IUT voulez-vous supprimer votre candidature : ");
scanf("%s%*c", ville);
aux = rechCandidIUT(tcandid[iCandid]->idCandIUT, ville);
if(aux== NULL)
printf("Aucun voeux formuler dans cette IUT\n");
else
while(1)
{
printf("Dans quel Département voulez-vous supprimer votre candidature\n");
scanf("%s%*c", departement);
pos = recherchecandidDept(aux->tabDept, aux->nbChoix, departement, &trouve);
}
}
}
void modifCandid(Candidat **tcandid, int nbCandid, VilleIUT **tiut, int nbIUT, int iCandid)
{
int choix, iCandid;
while(1)
{
choix = menuGestionCandid();
system("clear");
switch(choix){
case 1:
ajouterDept(tcandid, nbCandid, tiut, nbIUT, iCandid);
case 2:
supprimerCandidDept(tcandid, nbCandid, tiut, nbIUT, iCandid);
case 9:
return;
}
}
}

@ -182,4 +182,8 @@ Candidat **reallocTCandid(Candidat **tab, int *tailleP);
void creationCandid(Candidat **tab, int *nbEle, int *tailleP);
void modifCandid(Candidat **tab, int nbEle);
int menuCandid(void);
void gestionCandid(VilleIUT **tiut, int nbIUT, Candidat **tcandid, int *nbCandid, int *taillePCandid);
int menuGestionCandid(void);

@ -166,7 +166,8 @@ int verifChefDepart(VilleIUT** tiut, int nbEle, char* dept, char* ville, char* n
int menuResponsableAffiche(void) {
int choix;
printf("####################################################\n");
printf("\t\tMenu Responsable\n\n");
printf("\t\t|Menu Responsable|\n\n");
printf("\t\t------------------\n\n");
printf("1 - Traiter les candidatures (output dans des fichiers)\n");
printf("\n\n9 - Repasser en mode Utilisateur");
printf("\n\n10 - Quitter\n");

Loading…
Cancel
Save