master
Alexis LAURENT 2 years ago
parent f05db1c5fb
commit bab380bb8f

193
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;
}
}

14
SAE.h

@ -247,3 +247,17 @@ 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);
//#######################################################
//#######################################################
//#######################################################
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);
Loading…
Cancel
Save