def departments(): st.header('DEPARTMENTS') option_list = ['', 'Add department', 'Update department', 'Delete department', 'Show complete department record', 'Search department', 'Show doctors of a particular department'] option = st.sidebar.selectbox('Select function', option_list) d = Department() if (option == option_list[1] or option == option_list[2] or option == option_list[3]) and verify_edit_mode_password(): if option == option_list[1]: st.subheader('ADD DEPARTMENT') d.add_department() elif option == option_list[2]: st.subheader('UPDATE DEPARTMENT') d.update_department() elif option == option_list[3]: st.subheader('DELETE DEPARTMENT') try: d.delete_department() except sql.IntegrityError: # handles foreign key constraint failure issue (due to integrity error) st.error('This entry cannot be deleted as other records are using it.') elif option == option_list[4]: st.subheader('COMPLETE DEPARTMENT RECORD') d.show_all_departments() elif option == option_list[5]: st.subheader('SEARCH DEPARTMENT') d.search_department() elif option == option_list[6]: st.subheader('DOCTORS OF A PARTICULAR DEPARTMENT') d.list_dept_doctors()
else: print("Wrong Choice") else: print("You have Entered Wrong Password") elif key == "2": password = input("Enter the password for Updating Database of Department") if password == "dept123": d = Department() name = input("Enter name of the department") project = input("Enter the name of the project") deptid = input("Enter the Department ID") d.add_department(name, project, deptid) else: print("You have Entered Wrong Password") elif key == "3": password = input("Enter the password for Updating Database of coordinator") if password == "cod123": c = Coordinator() name = input("Enter Name of the Coordinator") cid = input("Enter your Coordinator Id") c.add_yourself(name, cid) else: print("Wrong Password Entered")