from hr import Employee, HRDLHandler, DataLayerError """ It is used to Update an existing Employee data in the DataBase """ try: emp_id = int(input("Enter employee ID : ")) name = input("Enter the name of the Employee : ") designation_code = int(input("Enter the designation code : ")) date = int(input("Enter the date : ")) month = int(input("Enter the month : ")) year = int(input("Enter the Year : ")) salary = float(input("Enter the basic salary : ")) gender = input("Enter Gender : ") indian = int(input("Enter whether the Employee is Indian or not : ")) pan = input("Enter PAN Number : ") aadhar = input("Enter Aadhar Number : ") employee = Employee(emp_id, name, designation_code, date, month, year, salary, gender, indian, pan, aadhar) HRDLHandler.update_employee(employee) print(f"Employee : {name} updated") except DataLayerError as dle: print(dle.message) print(dle.exceptions)
from hr import Designation, HRDLHandler, DataLayerError import sys try: code = int(sys.argv[1]) designation = HRDLHandler.get_designation_by_code(code) print(f"Code : {designation.code} Designation : {designation.title}") except DataLayerError as dle: print(dle.message) print(dle.exceptions)
from hr import Employee, HRDLHandler, DataLayerError """ It is used to Delete a single Employee data from the DataBase """ try: emp_id = int(input("Enter employee ID : ")) HRDLHandler.delete_employee(emp_id) print(f"Employee : {emp_id} deleted") except DataLayerError as dle: print(dle.message) print(dle.exceptions)
from hr import Designation, HRDLHandler, DataLayerError import sys try: title = sys.argv[1] designation = Designation(0, title) HRDLHandler.add_designation(designation) print(f"Designation : {title} added") except DataLayerError as dle: print(dle.message) print(dle.exceptions)
from hr import HRDLHandler, Designation, DataLayerException import sys try: count = HRDLHandler.get_designation_count() print(f"Number of designation records : {count}") except DataLayerException as dle: print(dle.message) print(dle.exceptions)
from hr import Designation, HRDLHandler, DataLayerError import sys try: code = int(sys.argv[1]) HRDLHandler.delete_designation(code) print(f"Designation Code : {code} deleted") except DataLayerError as dle: print(dle.message) print(dle.exceptions)
from hr import Employee, HRDLHandler, DataLayerError """ It is used to Add new Employee data into the DataBase """ try: name = input("Enter the name of the Employee : ") designation_code = int(input("Enter the designation code : ")) date = int(input("Enter the date : ")) month = int(input("Enter the month : ")) year = int(input("Enter the Year : ")) salary = float(input("Enter the basic salary : ")) gender = input("Enter Gender : ") indian = int(input("Enter whether the Employee is Indian or not : ")) pan = input("Enter PAN Number : ") aadhar = input("Enter Aadhar Number : ") employee = Employee(0, name, designation_code, date, month, year, salary, gender, indian, pan, aadhar) HRDLHandler.add_employee(employee) print(f"Employee : {name} added") except DataLayerError as dle: print(dle.message) print(dle.exceptions)
from hr import Designation, HRDLHandler, DataLayerError """ It is used to count the total number of Employees present in the DataBase """ try: count = HRDLHandler.get_employee_count() print(f"Total records in Employee table : {count}") except DataLayerError as dle: print(dle.message) print(dle.exceptions)
from hr import Designation, HRDLHandler, DataLayerError """ It is used to fetch all the Employee data from the DataBase """ try: employees = HRDLHandler.get_employees() for employee in employees: print( f"ID : {employee.emp_id} Name : {employee.name}, Designation : {employee.designation_code}, Gender : {employee.gender}" ) except DataLayerError as dle: print(dle.message) print(dle.exceptions)
from hr import HRDLHandler,DataLayerException,DBConnection import sys try: designations=HRDLHandler.getDesignations() for designation in designations: print(f"Code: {designation.code}, Title: {designation.title}") except DataLayerException as dataLayerException: print(dataLayerException.message) print(dataLayerException.exceptions)
from hr import Designation, HRDLHandler, DataLayerError import sys """ It is used to fetch Employee data by the Employee Id from the DataBase """ try: emp_id = int(sys.argv[1]) employee = HRDLHandler.get_employee_by_id(emp_id) print( f"ID : {employee.emp_id} Name : {employee.name}, Designation : {employee.designation_code}, Gender : {employee.gender}" ) except DataLayerError as dle: print(dle.message) print(dle.exceptions)
from hr import HRDLHandler, DataLayerException, Designation try: designation = Designation(0, "Sports Teacher") HRDLHandler.add(designation) except DataLayerException as dataLayerException: print(dataLayerException.message) print(dataLayerException.exceptions)
from hr import Designation, HRDLHandler, DataLayerError import sys try: title = sys.argv[1] designation = HRDLHandler.get_designation_by_title(title) print(f"Code : {designation.code} Designation : {designation.title}") except DataLayerError as dle: print(dle.message) print(dle.exceptions)
from hr import HRDLHandler,Designation,DataLayerException import sys try: code=int(sys.argv[1]) title=sys.argv[2] designation=Designation(code,title) HRDLHandler.update_designation(designation) print("Designation updated") except DataLayerException as dle: print(dle.message) print(dle.exceptions)
from hr import Designation, HRDLHandler, DataLayerError import sys """ It is used to fetch Employee data by the Employee Name from the DataBase """ try: name = sys.argv[1] employees = HRDLHandler.get_employee_by_name(name) for employee in employees: print(f"ID : {employee.emp_id} Name : {employee.name}, Designation : {employee.designation_code}, Gender : {employee.gender}") except DataLayerError as dle: print(dle.message) print(dle.exceptions)