Browse Source

implement the getNewEmployeeCredentials() function in order for the user to sign up as an employee

remotes/origin/feature/employees-infos-access
fdai7207 2 years ago
parent
commit
7cf0febf28
  1. 2
      build-project.sh
  2. 19
      src/createEmployeeAccount.c
  3. 2
      src/createEmployeeAccount.h
  4. 3
      src/employeeList.txt
  5. 10
      src/mainMenu.c

2
build-project.sh

@ -22,7 +22,7 @@ for file in employeeLogin.c mainMenu.c createEmployeeAccount.c; do
done done
# replace .c with .h in respective files # replace .c with .h in respective files
sed -i 's/employeeLogin.c/employeeLogin.h/g' mainMenu.c
sed -i 's/createEmployeeAccount.c/createEmployeeAccount.h/g' mainMenu.c
sed -i 's/showGeneralInfoEmployee.c/showGeneralInfoEmployee.h/g' employeeLogin.c sed -i 's/showGeneralInfoEmployee.c/showGeneralInfoEmployee.h/g' employeeLogin.c
sed -i 's/mainMenu.c/mainMenu.h/g' employeeLogin.c sed -i 's/mainMenu.c/mainMenu.h/g' employeeLogin.c
sed -i 's/employeeLogin.c/employeeLogin.h/g' createEmployeeAccount.c sed -i 's/employeeLogin.c/employeeLogin.h/g' createEmployeeAccount.c

19
src/createEmployeeAccount.c

@ -36,3 +36,22 @@ bool createNewEmployee(char* employeeId, char* employeePassword)
return checkEmployeeCredentials(employeeId, employeePassword); return checkEmployeeCredentials(employeeId, employeePassword);
} }
void getNewEmployeeCredentials()
{
char newEmployeeId[20];
char newEmployeePassword[20];
printf("please enter your wished Id :");
scanf("%s",newEmployeeId);
printf("please enter your wished Password :");
scanf("%s",newEmployeePassword);
if(createNewEmployee(newEmployeeId,newEmployeePassword))
{
printf("\n\n Account created successfully !\n\n");
}
else
{
printf("\n\n Could not create the Account please contact an employee of clearance 1 !\n\n");
}
}

2
src/createEmployeeAccount.h

@ -9,4 +9,6 @@
bool isValidEmployeeID(char* employee); bool isValidEmployeeID(char* employee);
bool createNewEmployee(char* employeeId, char* employeePassword); bool createNewEmployee(char* employeeId, char* employeePassword);
void getNewEmployeeCredentials();
#endif #endif

3
src/employeeList.txt

@ -10,6 +10,3 @@ Mohamed MDfdai6618
Shivam Schivam007fdlt3781 Shivam Schivam007fdlt3781

10
src/mainMenu.c

@ -1,6 +1,6 @@
#include "mainMenu.h" #include "mainMenu.h"
#include "employeeLogin.c"
#include "employeeLogin.h"
#include "createEmployeeAccount.c"
@ -112,7 +112,10 @@ void menuInput()
case 3 : getEmployeeAccessCode(); case 3 : getEmployeeAccessCode();
break; break;
case 4 : printf("\e[1;1H\e[2J");
case 4 : getNewEmployeeCredentials();
break;
case 5 : printf("\e[1;1H\e[2J");
printf("\nsee you next time !\n\n"); printf("\nsee you next time !\n\n");
break; break;
} }
@ -127,6 +130,7 @@ void showMenu()
printf("\n\n\n\n\t\t\t\t\t\t ->Login as an existing costumer."); printf("\n\n\n\n\t\t\t\t\t\t ->Login as an existing costumer.");
printf("\n\n\t\t\t\t\t\t ->Register as a new costumer."); printf("\n\n\t\t\t\t\t\t ->Register as a new costumer.");
printf("\n\n\t\t\t\t\t\t ->Login as an Employee."); printf("\n\n\t\t\t\t\t\t ->Login as an Employee.");
printf("\n\n\t\t\t\t\t\t ->Register as an Employee.");
printf("\n\n\t\t\t\t\t\t\t\t ->Exit.\n"); printf("\n\n\t\t\t\t\t\t\t\t ->Exit.\n");
printf("\n\n\n\n\n Selection :\n"); printf("\n\n\n\n\n Selection :\n");

Loading…
Cancel
Save