#sparsh sethi school project
#project to make directory of number of employees in a company


#functions that can be performed:
#add new entries__made
#view all data__made
#count total number of entries__made
#remove entries
#modify entries
#view specific data


print("hello there, this is Sparsh's school computer project..")
password="1234"
answer = 'no'
print("to continue pls enter the password, to exit pls type exit ")

inputpass=input("enter the password to access this file(it is '1234')_ ")
while inputpass!=password:
if inputpass[0].upper()=='E':

break
else:
print("wrong password entered, please try again")
inputpass=input("enter the password to access this file")

print()
if inputpass==password:
print("welcome,!")
print("in this project, we have created a set of programs")
print("that will let you enter and manipulate your data")
answer=input('would you like to start using the interface? ')
print()
ce=0
def view_all():
try:
with open("projectfile1.dat",'rb') as file1:
import pickle
for i in range(0,count_entries):
read1=pickle.load(file1)
print(read1)
except:
print("no data has been enterred as of now")

def add_data():
answer='yes'
with open("projectfile1.dat",'ab') as file1:
while answer[0]=='y' or answer[0]=='Y':
dis={}
name=input("Enter the name of employee-: ")
employee_number=int(input("Enter the employee number of the employee [4digit number]: "))
department=input("Enter the department of employee-: ")
department_role=input("Enter the role of the employee: ")
project_status=input("enter project status, enter 'assigned' or 'free': ")
dis['name']=name
dis['employee_number']=employee_number
dis['department']=department
dis['department_role']=department_role
dis['project_status']=project_status
print()
print("please check your data for errors or mistakes")
check_idkwhy=input("press enter if satisfied with the entries")

import pickle
pickle.dump(dis,file1)
print("employee data has been successfully updated to file database")
print()
answer=input("do you want to enter another entry? ")
def count_entries():
print("number of entries are: ",ce)

while answer[0]=='y' or answer[0]=='Y':
print("currently, three possible functions can be done")
print("those functions are:")
print("(a)dd more data")
print("(v)iew all data")
print("(c)ount total entries")
print("if you do not wish to perform anymore functions,")
print("please type exit.")
print("select the initial of the function you wish to execute")
do_function=input("enter the function from above list that you want to do. ")
if do_function=="a".lower():
add_data()
ce+=1
elif do_function=="c".lower():
count_entries()
elif do_function=="v".lower():
view_all()
print()
answer=input("do you want to do more functions? if you want to exit,type 'exit'.")
print()
else:
print("thank you for using our interface, we hope you enjoyed it")
print("press the cross to exit")