Untitled 1
Untitled 1
import sys
def fetchcsv(file_path):
try:
df = pd.read_csv(file_path)
print(df)
return df
except FileNotFoundError:
print(f"File {file_path} not found.")
return pd.DataFrame()
print('-------------------')
print(' Menu')
print('-------------------')
print('1. To Add new Staff')
print('2. To Display All the staff')
print('3. To remove a record')
print('4. Update Record')
print('5. Search a staff member')
print('6. View Welcome Message') # New option to view the welcome message
print("7. Logout")
print("8. Reset Password")
print('10. Exit')
x = int(input("Enter your choice:"))
if x == 1:
addrecord(df, file_path)
elif x == 2:
df = fetchcsv(file_path)
elif x==3:
removerecord(df, file_path)
elif x==4:
updaterecord(df, file_path)
elif x==5:
searchrecord(df)
elif x == 6:
view_welcome_message()
elif x == 7:
df = logout()
elif x == 8:
reset_password(df, file_path)
else:
sys.exit()
menu(df, file_path)
def logout():
print("Logging out...")
# Add any additional logout logic if needed
print("Logout successful.")
return pd.DataFrame()
def view_welcome_message():
username = input("Enter your username to view the welcome message: ")
welcome_message(username)
def searchrecord(df):
emp_id_to_search = input("Enter the Emp_ID to search:")
print(df)
Empid=int(input("Enter your ID:"))
Name = input("Enter your name:")
Age = int(input("Enter your age:"))
Department = input("Enter the name of your Department:")
Salary = int(input("Enter your Salary:"))
print(df)
writecsv(df, file_path)
x = input('Press y to continue or n to go back to menu:')
if x == 'y' or x == 'Y':
addrecord(df, file_path)
else:
menu(df, file_path)
print(df)
emp_id_to_remove = input("Enter the Emp_ID to remove:")
print(df)
emp_id_to_update = input("Enter the Emp_ID to update:")
try:
df = pd.read_csv(file_path, encoding='utf-8')
except FileNotFoundError:
print(f"Login file {file_path} not found.")
return pd.DataFrame()
df = df.loc[df["Username"] == un]
if df.empty:
print("Invalid Username")
return pd.DataFrame()
else:
df = df.loc[df["Password"] == pw]
if df.empty:
print("Invalid Password")
return pd.DataFrame()
else:
print("Login Successful")
print("----------------------------------")
print("Unacco School Khongman")
print("----------------------------------")
print("Created by:")
print("Mangaleiba and Rajlakshmi")
return df
print(df)
username_to_reset = input("Enter the username to reset password: ")
import pandas as pd
data={'Emp_ID':[1,2,3,4,5,],
'Name':['Amy','Raj','Mangal','Zukov','Ray'],
'Age':[21,22,23,24,25],
'Department':['Salesmen','Analyst','Manager','Supervisor','Guard'],
'Salary':[15000,20000,25000,30000,15000]}
df=pd.DataFrame(data)
df.to_csv("Hotel_Staff.csv")