From 1d1a951ea4ee287d255950252f4c2fd88aca053b Mon Sep 17 00:00:00 2001 From: "yann.champeau" Date: Mon, 26 Dec 2022 19:00:07 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20la=20fonction=20modifNomResponsabl?= =?UTF-8?q?e()=20permettant=20de=20modifier=20le=20nom=20du=20responsable?= =?UTF-8?q?=20d'un=20d=C3=A9partement.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/partie1/saeP1.c | 116 +++++++++++++++++++++++++++++--------------- src/partie1/saeP1.h | 8 ++- 2 files changed, 79 insertions(+), 45 deletions(-) diff --git a/src/partie1/saeP1.c b/src/partie1/saeP1.c index 0545ea5..e40fe32 100644 --- a/src/partie1/saeP1.c +++ b/src/partie1/saeP1.c @@ -3,6 +3,7 @@ #include #include "saeP1.h" #include "../annexe/saeAnnexe.h" +#include "../partie2/saeP2.h" //Partie Consultant. @@ -105,46 +106,53 @@ void SearchIUTFromDep(VilleIUT* lvIUT[],int tlogi) //Partie Administrateur. void menuAdmin(VilleIUT* tiut[],int tlogi){ - printf("#--------------------------------------------------------------------#\n"); - printf("| |\n"); - printf("| SAE S1.02 |\n"); - printf("| |\n"); - printf("#--------------------------------------------------------------------#\n\n"); - printf("Codes correspondant aux différentes actions :\n\n"); - printf("1 : Modifier le nombre de places dans un département.\n"); - printf("2 : Créer un département dans un IUT.\n"); - printf("3 : Supprimer un département d’un IUT.\n"); - printf("4 : Lancer et arrêter la phase de candidature.\n"); - printf("5 : Modifier le nom d'un responsable de département.\n"); - printf("9 : Revenir à l'écran de sélection du profil.\n\n"); - printf("#--------------------------------------------------------------------#\n\n"); - printf("Choisissez l'action que vous voulez exécuter : "); - int act; - scanf("%d",&act); - switch(act){ - case 1: - modifPlaces(tiut,int tlogi); - reset(); - break; - case 2: - creerDep(VilleIUT* tiut{},int tlogi); - reset(); - break; - case 3: - reset(); - break; - case 4: - reset(); - break; - case 5: - reset(); - break; - case 6: - reset(); - } + int quit=0; + while(!quit){ + printf("#--------------------------------------------------------------------#\n"); + printf("| |\n"); + printf("| SAE S1.02 |\n"); + printf("| |\n"); + printf("#--------------------------------------------------------------------#\n\n"); + printf("Codes correspondant aux différentes actions :\n\n"); + printf("1 : Modifier le nombre de places dans un département.\n"); + printf("2 : Créer un département dans un IUT.\n"); + printf("3 : Supprimer un département d’un IUT.\n"); + printf("4 : Lancer et arrêter la phase de candidature.\n"); + printf("5 : Modifier le nom d'un responsable de département.\n"); + printf("9 : Revenir à l'écran de sélection du profil.\n\n"); + printf("#--------------------------------------------------------------------#\n\n"); + printf("Choisissez l'action que vous voulez exécuter : "); + int act; + scanf("%d",&act); + switch(act){ + case 1: + modifPlaces(tiut,tlogi); + reset(); + break; + case 2: + creerDep(tiut,tlogi); + reset(); + break; + case 3: + supprimerDep(tiut,tlogi); + reset(); + break; + case 4: + //gestionPhaseCandidatures(); A Faire (Partie 2). + reset(); + break; + case 5: + modifNomResponsable(tiut,tlogi) + reset(); + break; + case 9: + quit=1 + reset(); + } + } } -void modifPlaces(VilleIUT* tiut{},int tlogi){ +void modifPlaces(VilleIUT* tiut[],int tlogi){ printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner):"); char* ville[31]; scanf("%*c%s",&ville); @@ -172,7 +180,7 @@ void modifPlaces(VilleIUT* tiut{},int tlogi){ return; } -void creerDep(VilleIUT* tiut{},int tlogi){ +void creerDep(VilleIUT* tiut[],int tlogi){ printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner):"); char* ville[31]; scanf("%*c%s",&ville); @@ -205,7 +213,7 @@ void creerDep(VilleIUT* tiut{},int tlogi){ return; } -void supprimerDep(VilleIUT* tiut{},int tlogi){ +void supprimerDep(VilleIUT* tiut[],int tlogi){ printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner):"); char* ville[31]; scanf("%*c%s",&ville); @@ -242,4 +250,32 @@ void supprimerDep(VilleIUT* tiut{},int tlogi){ } printf("\n\nLe département %s de l'IUT de %s a bien été supprimé.\n",dep,ville); return; +} + +void modifNomResponsable(VilleIUT* tiut[],int tlogi){ + printf("\nEntrez la ville correspondant à l'IUT à modifier (Q pour abandonner):"); + char* ville[31]; + scanf("%*c%s",&ville); + if(ville=="Q") return; + int noVille=rechercheTabPtVilleIUT(tiut,tlogi,ville); + if(noVille<=0){ + fprintf(stderr,"\nVille non existante !\n"); + return; + } + VilleIUT* v=tiut[noVille]; + printf("\n\nEntrez le département à modifier:"); + char dep[31]; + scanf("%*c%s",&dep); + if(!existe(tiut->ldept,dep)){ + fprintf(stderr,"\nDépartement non existant !\n"); + return; + } + MaillonDep* m=v->ldept + while(m->departement!=dep) m=m->suivant; + printf("\n\nLe responsable du département %s de l'IUT de la ville de %s est actuellement %s. Quel est le nom du nouveau responsable ?\n\n",m->departement,v->Ville,m->resp); + int nom; + scanf("%d",&nom); + m->resp=nom; + printf("\n\nLe nom du responsable du département %s de l'IUT de %s a bien été changé pour %s.\n",dep,ville,nom); + return; } \ No newline at end of file diff --git a/src/partie1/saeP1.h b/src/partie1/saeP1.h index 0bc96db..eb25961 100644 --- a/src/partie1/saeP1.h +++ b/src/partie1/saeP1.h @@ -32,10 +32,8 @@ void menuAdmin(VilleIUT* tiut[],int tlogi); void modifPlaces(VilleIUT* tiut[],int tlogi); -void creerDep(VilleIUT* tiut{},int tlogi); +void creerDep(VilleIUT* tiut[],int tlogi); -void supprimerDep(VilleIUT* tiut{},int tlogi); +void supprimerDep(VilleIUT* tiut[],int tlogi); -//void gestionPhaseCandidatures(); - -//void modifNomResponsable(); \ No newline at end of file +void modifNomResponsable(VilleIUT* tiut[],int tlogi); \ No newline at end of file