Esempio n. 1
0
    def SetCabinCrew(self):
        ''' set new cabin crew '''
        ssn = input('Social security number: ')
        valid_ssn = LL_API().checkIfValidssn(ssn)
        if valid_ssn == None:
            print(":: Not a valid social security number ::")
        else:
            name = input('Full name: ').title()
            firstname = name.split()
            role = 'Cabincrew'
            print("\n{:^44}".format('Choose rank'))
            print("."*44) 
            print("1: Flight Attendant")
            print("2: Flight Service Manager")
            print("_"*44)
            rank_input = int(input('Rank: '))   
            if rank_input == 1:
                rank = "Flight Attendant"
            elif rank_input == 2:
                rank = "Flight Service Manager"
            pilot_license = 'N/A'
            address = input('Address: ')
            try:
                phone = int(input('Phone: '))
            except ValueError:
                print("\n:: Invalid phone ::\n")
                phone = input('Phone: ')
            email = firstname[0] + "@nan.is"

            employee = Model_Employee(ssn, name, role, rank, pilot_license, address, phone, email)
            LL_API().createEmployee(employee)
        
            print("\n:: {} has been added to Cabin crew ::".format(name))
Esempio n. 2
0
    def changeEmployeeInfo(self):
        ''' change employee information '''
        input_name = input('Full name: ').title()
        emp_info_list = LL_Employee().getOneEmployeeName(input_name)

        if len(emp_info_list) == 0:
            print(":: No user with that name ::")

        else:
            for elem in emp_info_list:
                ssn = elem.ssn
                name = input_name
                firstname = input_name.split()
                role = input('Role: ')
                rank = input('Rank: ')
                pilot_license = input('Pilot license: ')
                address = input('Address: ')
                try:
                    phone = int(input('Phone: '))
                except ValueError:
                    print("\n:: Invalid phone ::\n")
                    phone = input('Phone: ')
                email = firstname[0] + "@nan.is" 

                employee = Model_Employee(ssn, name, role, rank, pilot_license, address, phone, email)
                LL_Employee().change_Employee(employee)
            
            print("\n:: Information on {} has been updated ::".format(input_name))
    def get_emp_from_file(self):
        ''' Returns All Employees from file '''

        with open("Crew.csv", "r", encoding="utf-8") as crew_file:
            all_lines = crew_file.readlines()
            all_emps = []
            
            for line in all_lines[1:]:
                line = line.split(',')
                emp = Model_Employee(line[0], line[1], line[2], line[3], line[4], line[5], line[6], line[7])
                all_emps.append(emp)

        return all_emps
Esempio n. 4
0
    def changePilotInfo(self):
        ''' change employee information '''
        print("\n{:^44}".format('Fill in the information below'))
        print("."*44) 
        input_name = input('\nFull name: ').title()
        emp_info_list = LL_API().getOneEmployeeName(input_name)
        aircraftType_list = LL_API().get_aircraftType_list()

        if len(emp_info_list) == 0:
            print(":: No user with that name ::")

        else:
            for elem in emp_info_list:
                if elem.role == "Pilot":
                    ssn = elem.ssn
                    name = input_name
                    firstname = name.split()
                    role = 'Pilot'   
                    print("\n{:^44}".format('Captain or Copilot?'))
                    print("."*44) 
                    print("1: Captain")
                    print("2: Copilot")
                    print("_"*44)
                    rank_input = int(input('Rank: '))   
                    if rank_input == 1:
                        rank = "Captain"
                    elif rank_input == 2:
                        rank = "Copilot"
                    print("\n{:^44}".format('Choose aircraft license'))
                    print("."*44) 
                    for num, elem in enumerate(aircraftType_list):
                        print('{}: {}'.format(num+1, elem.planeTypeId))
                    print("_"*44)
                    pilotlicense_inp = int(input('Pilot license: '))
                    plicense = aircraftType_list[pilotlicense_inp-1]
                    pilot_license = plicense.planeTypeId
                    address = input('\nAddress: ')
                    try:
                        phone = int(input('Phone: '))
                    except ValueError:
                        print("\n:: Invalid phone ::\n")
                        phone = input('Phone: ')
                    email = firstname[0] + "@nan.is"

                    employee = Model_Employee(ssn, name, role, rank, pilot_license, address, phone, email)
                    LL_API().change_Employee(employee)
                    print("\n:: Information on {} has been updated ::".format(input_name))

                else:
                    print("\n:: Employee not a pilot::")
Esempio n. 5
0
    def SetPilot(self):
        ''' set new pilot '''
        ssn = input('Social security number: ')
        valid_ssn = LL_API().checkIfValidssn(ssn)
        aircraftType_list = LL_API().get_aircraftType_list()
        if valid_ssn == None:
            print(":: Not a valid social security number ::")
        else:
            ssn = valid_ssn
            name = input('Full name: ').title()
            firstname = name.split()
            role = 'Pilot'   

            print("\n{:^44}".format('Captain or Copilot?'))
            print("."*44) 
            print("1: Captain")
            print("2: Copilot")
            print("_"*44)
            rank_input = int(input('Rank: '))   
            if rank_input == 1:
                rank = "Captain"
            elif rank_input == 2:
                rank = "Copilot"

            print("\n{:^44}".format('Choose aircraft license'))
            print("."*44) 
            for num, elem in enumerate(aircraftType_list):
                print('{}: {}'.format(num+1, elem.planeTypeId))
            print("_"*44)
            pilotlicense_inp = int(input('Pilot license: '))
            plicense = aircraftType_list[pilotlicense_inp-1]
            pilot_license = plicense.planeTypeId
            address = input('\nAddress: ')
            try:
                phone = int(input('Phone: '))
            except ValueError:
                print("\n:: Invalid phone ::\n")
                phone = input('Phone: ')
            email = firstname[0] + "@nan.is"

            employee = Model_Employee(ssn, name, role, rank, pilot_license, address, phone, email)
            LL_API().createEmployee(employee)

            print("\n:: {} has been added as a Pilot ::".format(name))
Esempio n. 6
0
    def SetPilot(self):
        ''' set new pilot '''
        ssn = input('Social security number: ')
        valid_ssn = LL_Employee().checkIfValidssn(ssn)
        if valid_ssn == None:
            print(":: Not a valid social security number ::")
        else:
            ssn = valid_ssn
            name = input('Full name: ').title()
            firstname = name.split()
            role = 'Pilot'    
            print("1: Captain")
            print("2: Copilot")
            rank_input = input('Rank: ')   
            if rank_input == 1:
                rank = "Captain"
            elif rank_input == 2:
                rank = "Copilot"



            planetypeID_list = LL_Aircrafts().planetypeID_list()
            for num, elem in enumerate(planetypeID_list):
                print(num+1, ': ', elem)
            pilotlicense_inp = input('Pilot license: ')
            if pilotlicense_inp == elem:
                pilot_license = pilotlicense_inp[pilotlicense_inp-1]





            address = input('Address: ')
            try:
                phone = int(input('Phone: '))
            except ValueError:
                print("\n:: Invalid phone ::\n")
                phone = input('Phone: ')
            email = firstname[0] + "@nan.is"

            employee = Model_Employee(ssn, name, role, rank, pilot_license, address, phone, email)
            LL_Employee().createEmployee(employee)

            print("\n:: {} has been added as a Pilot ::".format(name))
Esempio n. 7
0
    def SetPilot(self):
        ssn = input('Social security number: ')

        name = input('Full name: ')

        role = input('Role: ') 

        rank = input('Rank: ')     

        pilot_license = input('Pilot license: ')

        address = input('Address: ')

        phone = input('Phone: ')

        email = input('Email address: ') 

        employee = Model_Employee(ssn, name, role, rank, pilot_license, address, phone, email)
        LL_Set_Employee().createEmployee(employee)
Esempio n. 8
0
    def changeCabincrewInfo(self):
        ''' change cabincrew information '''
        print("\n{:^44}".format('Fill in the information below'))
        print("."*44) 
        input_name = input('\nFull name: ').title()
        emp_info_list = LL_API().getOneEmployeeName(input_name)

        if len(emp_info_list) == 0:
            print(":: No user with that name ::")
        
        else:
            for elem in emp_info_list:
                if elem.role == "Cabincrew":
                    ssn = elem.ssn
                    name = input_name
                    firstname = name.split()
                    role = 'Cabincrew'
                    print("\n{:^44}".format('Choose rank'))
                    print("."*44) 
                    print("1: Flight Attendant")
                    print("2: Flight Service Manager")
                    print("_"*44)
                    rank_input = int(input('Rank: '))   
                    if rank_input == 1:
                        rank = "Flight Attendant"
                    elif rank_input == 2:
                        rank = "Flight Service Manager"
                    pilot_license = 'N/A'
                    address = input('\nAddress: ')
                    try:
                        phone = int(input('Phone: '))
                    except ValueError:
                        print("\n:: Invalid phone ::\n")
                        phone = input('Phone: ')
                    email = firstname[0] + "@nan.is"

                    employee = Model_Employee(ssn, name, role, rank, pilot_license, address, phone, email)
                    LL_API().change_Employee(employee)
                    print("\n:: Information on {} has been updated ::".format(input_name))

                else:
                    print("\n:: Employee not in Cabin crew ::")
Esempio n. 9
0
    def SetCabinCrew(self):
        ''' set new cabin crew '''
        ssn = input('Social security number: ')
        valid_ssn = LL_Employee().checkIfValidssn(ssn)
        if valid_ssn == None:
            print(":: Not a valid social security number ::")
        else:
            name = input('Full name: ').title()
            firstname = name.split()
            role = 'Cabincrew'
            rank = input('Rank: ') 
            pilot_license = 'N/A'
            address = input('Address: ')
            try:
                phone = int(input('Phone: '))
            except ValueError:
                print("\n:: Invalid phone ::\n")
                phone = input('Phone: ')
            email = firstname[0] + "@nan.is"

            employee = Model_Employee(ssn, name, role, rank, pilot_license, address, phone, email)
            LL_Employee().createEmployee(employee)
        
            print("\n:: {} has been added to Cabin crew ::".format(name))