From bab380bb8faa79432427d0bdfc11a3cc58a33904 Mon Sep 17 00:00:00 2001 From: allaurent13 Date: Fri, 13 Jan 2023 18:16:20 +0000 Subject: [PATCH] Partie 4 --- SAE.c | 193 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- SAE.h | 16 ++++- 2 files changed, 205 insertions(+), 4 deletions(-) diff --git a/SAE.c b/SAE.c index 95b1e5f..1c6ab53 100644 --- a/SAE.c +++ b/SAE.c @@ -117,6 +117,7 @@ void gestionMenu(VilleIUT **tiut, int nbEle, Candidat **tcandid, int *nbCandid, int choix; while(1) { + system("clear"); choix = menuUtilisateurAffiche(); system("clear"); switch(choix) { @@ -1041,6 +1042,8 @@ int menuCandid(void) printf("3 - Modifier une Candidature\n"); printf("4 - Afficher une Candidature\n"); printf("5 - Afficher toute les Candidatures\n"); + printf("6 - Afficher Admission\n"); + printf("7 - Gérer les Admission\n"); printf("\n\n9 - Connexion mode Administrateur\n"); printf("\n\n10 - Quitter\n"); printf("####################################################\n"); @@ -1099,6 +1102,12 @@ void gestionCandid(VilleIUT **tiut, int nbIUT, Candidat **tcandid, int *nbCandid afficherCandid(tcandid, *nbCandid); clearpage(); break; + case 6: + afficherAdmiCandid(tcandid, *nbCandid); + clearpage(); + break; + case 7: + gérerAdmiCandid(tcandid, *nbCandid); case 9: choix = gestionMenuAdmin(tiut, nbIUT); if (choix == -1) @@ -1629,10 +1638,9 @@ int gestionResponsable(VilleIUT **tiut, int nbEle, Candidat **tcandid, int taill char nom[30]; Candidat** tabCandidV; printf("Nom du département concernée : "); - scanf("%s", dept); + scanf("%s%*c", dept); printf("\nNom de la ville concernée : "); - fgets(ville, 30, stdin); - ville[strlen(ville) - 1] = '\0'; + scanf("%s%*c", ville); printf("\nNom du responsable du département : "); fgets(nom, 30, stdin); nom[strlen(nom) - 1] = '\0'; @@ -1776,3 +1784,182 @@ void examinerCandid(Candidat **tabCandid, int nb, char* dept, char* ville) SauvegardeCandidAdmis(tabAdmis, comptAdmis, 1); SauvegardeCandidAdmis(tabEnAttente, comptAttente, 0); } + + +void afficherAdmiCandid(Candidat **tab,int nbCandid) +{ + int id, pos, trouve, i; + MaillonCandid *aux; + while(1) + { + printf("Quel est votre identifiant : "); + scanf("%d", &id); + pos = rechCandid(tab, nbCandid, id, &trouve); + if (trouve == 0) + printf("identifiant absent de la base de donnée\n"); + if (trouve == 1) + { + printf("Admition :\n"); + aux = tab[pos]->idCandIUT; + while(aux != NULL) + { + printf("\t %s :\n", aux->iutCandid); + for (i=0; i < aux->nbChoix; i++) + { + printf("- %s\t", aux->tabDept[i]); + if (aux->tabDept[i]->decisionDept == 0) + printf("Candidature pas encore traité\n"); + if (aux->tabDept[i]->decisionDept == 1) + printf("Candidature Accepter\n"); + if (aux->tabDept[i]->decisionDept == -1) + printf("Candidature refusée\n"); + if (aux->tabDept[i]->decisionDept == 2) + printf("Candidature en fil d'attente\n"); + } + aux = aux->suiv; + } + if(!verifSelection()) + break; + } + + } +} + +void afficher1AdmiCandid(Candidat **tab,int nbCandid, int id, int pos) +{ + int i; + MaillonCandid *aux; + printf("Admition :\n"); + aux = tab[pos]->idCandIUT; + while(aux != NULL) + { + printf("\t %s :\n", aux->iutCandid); + for (i=0; i < aux->nbChoix; i++) + { + printf("- %s\t", aux->tabDept[i]); + if (aux->tabDept[i]->decisionDept == 0) + printf("Candidature pas encore traité\n"); + if (aux->tabDept[i]->decisionDept == 1) + printf("Candidature Accepter\n"); + if (aux->tabDept[i]->decisionDept == -1) + printf("Candidature refusée\n"); + if (aux->tabDept[i]->decisionDept == 2) + printf("Candidature en fil d'attente\n"); + } + aux = aux->suiv; + } +} + +void rejeterVoeux(ListeCandid l, char ville[]) +{ + MaillonCandid *aux; + int i=0; + while(l != NULL) + { + aux = l->suiv; + while(1) + { + if (i >= l->nbChoix) + break; + if (l->tabDept[i]->decisionCandid == 0) + free(l->tabDept[i]); + decalageGaucheDept(l->tabDept, i, l->nbChoix); + l->nbChoix = l->nbChoix; + if (l->nbChoix == 0) + { + suppressionCandid(l, ville, l->tabDept, l->nbChoix); + break; + } + if(l->tabDept[i]->decisionCandid != 0) i = i + 1; + } + l = aux; + } +} + + +int decision(void) +{ + int choix; + printf("1 - Accepté\n"); + printf("2 - Refusé\n"); + printf("3 - Rien\n"); + printf("Choix : "); + scanf("%d", &choix); + return choix; +} + +void gérerAdmiCandid(Candidat **tab, int nbCandid) +{ + int id, pos, trouve, i, irech; + char ville[30], dept[30], choix; + MaillonCandid *aux; + while(1) + { + printf("Quel est votre identifiant : "); + scanf("%d", &id); + pos = rechCandid(tab, nbCandid, id, &trouve); + if (trouve == 0) + printf("identifiant absent de la base de donnée\n"); + if (trouve == 1) + { + while(1) + { + system("clear"); + afficher1AdmiCandid(tab, nbCandid, id, pos); + while(1) + { + printf("Dans quel IUT voulez-vous gérer votre Candidature : "); + scanf("%s%*c", ville); + aux = tab[i]->idCandIUT; + aux = rechCandidIUT(aux, ville); + if (aux == NULL) + printf("Vous n'avez pas candidater dans cette IUT\n"); + if (aux != NULL) + { + while(1) + { + printf("Dans quel Département voulez-vous gérer votre Candidature : "); + scanf("%s%*c", dept); + irech = recherchecandidDept(aux->tabDept, aux->nbChoix, dept, &trouve); + if (trouve == 0) + printf("Vous n'avez pas postuler dans ce département\n"); + if (trouve == 1) + { + while(1) + { + choix = decision(); + if (choix == 1 && aux->tabDept[irech]->decisionDept == 1) + { + printf("Voeux accepter\n"); + aux->tabDept[irech]->decisionCandid = 1; + rejeterVoeux(tab[i]->idCandIUT, ville); + } + if (choix == 2) + { + if(confirmationSup()) + { + free(aux->tabDept[irech]); + decalageGaucheDept(aux->tabDept, irech, aux->nbChoix); + aux->nbChoix = aux->nbChoix; + if (aux->nbChoix == 0) + suppressionCandid(tab[i]->idCandIUT, ville, aux->tabDept, aux->nbChoix); + printf("voeux supprimé !\n"); + } + else break; + } + if (choix == 3) + break; + } + } + } + } + if(!verifSelection()) + break; + } + + } + } + if (!verifSelection()) + break; + } +} \ No newline at end of file diff --git a/SAE.h b/SAE.h index b671ce4..92e7bd1 100644 --- a/SAE.h +++ b/SAE.h @@ -246,4 +246,18 @@ Candidat** candidDept(Candidat** tabCandidat, char* dept, char* ville, int taill void SauvegardeCandidAdmis(Candidat **tab, int nb, int admis); -void examinerCandid(Candidat **tabCandid, int nb, char* dept, char* ville); \ No newline at end of file +void examinerCandid(Candidat **tabCandid, int nb, char* dept, char* ville); + +//####################################################### +//####################################################### +//####################################################### + +void afficherAdmiCandid(Candidat **tab,int nbCandid); + +void afficher1AdmiCandid(Candidat **tab,int nbCandid, int id, int pos); + +void rejeterVoeux(ListeCandid l, char ville[]); + +int decision(void); + +void gérerAdmiCandid(Candidat **tab, int nbCandid); \ No newline at end of file