Exemplo n.º 1
0
def create_application(filename, filename_2, filename_3):
    table = file_handling.import_data(filename)  #import position table
    table_2 = file_handling.import_data(filename_2)  #import company table
    table_3 = file_handling.import_data(filename_3)  #import company table
    students_list = []
    for record in table_2:
        students_list.append(record[0])
    positions_list = []
    for record in table_3:
        positions_list.append(record[0])
    data = ui.user_input("Please give me the position's data",
                         ["Accepted: "])  # user input
    while True:
        temp_student_id = ui.user_input("", ["Student ID: "])
        if temp_student_id[0] in students_list:
            break
        ui.print_message("Wrong Student ID")
    while True:
        temp_position_id = ui.user_input("", ["Postition ID: "])
        if temp_position_id[0] in positions_list:
            break
        ui.print_message("Wrong Position_ID")
    data.append(temp_student_id[0])
    data.append(temp_position_id[0])
    id = misc.generate_random(table)  # generate id
    new_table = misc.append_table(table,
                                  misc.build_record(id,
                                                    data))  # making new table
    file_handling.export_data(new_table, filename, "w")  # saving the new table
Exemplo n.º 2
0
def init():
    while True:
        ui.print_program_menu(["Create company", "Show company", "Show all companies", "Update company", "Delete company"])
        try:
            if menu_options_companys() == False:
                break
        except KeyError as err:
            ui.print_message(str(err))           
Exemplo n.º 3
0
def init():
    while True:
        ui.print_program_menu(
            ["Create application", "Update application", "Delete application"])
        try:
            if menu_options_applications() == False:
                break
        except KeyError as err:
            ui.print_message(str(err))
Exemplo n.º 4
0
def main():

    while True:
        ui.print_program_menu(
            ["Students", "Companies", "Positions", "Applications"])
        try:
            menu_options()
        except KeyError as err:
            ui.print_message(str(err))
Exemplo n.º 5
0
def init():
    while True:
        ui.print_program_menu([
            "Create Student", "Show student", "Show all students",
            "Update student", "Activate/Deactivate student", "Delete student"
        ])
        try:
            if menu_options_students() == False:
                break
        except KeyError as err:
            ui.print_message(str(err))
Exemplo n.º 6
0
def init():
    while True:
        ui.print_program_menu([
            "Create position", "Show position", "Show all positions",
            "Update position", "Activate/Deactivate position",
            "Delete position"
        ])
        try:
            if menu_options_positions() == False:
                break
        except KeyError as err:
            ui.print_message(str(err))
Exemplo n.º 7
0
def create_position(filename, filename_2):
    table = file_handling.import_data(filename)  #import position table
    table_2 = file_handling.import_data(filename_2)  #import company table
    comp_list = []
    for record in table_2:
        comp_list.append(record[0])
    data = ui.user_input("Please give me the position's data",
                         ["Description: ", "Number of seats: "])  # user input
    while True:
        temp_company_id = ui.user_input("", ["Company ID: "])
        if temp_company_id[0] in comp_list:
            break
        ui.print_message("Wrong ID")
    data.append(temp_company_id[0])
    id = misc.generate_random(table)  # generate id
    new_table = misc.append_table(table,
                                  misc.build_record(id,
                                                    data))  # making new table
    file_handling.export_data(new_table, filename, "w")  # saving the new table
Exemplo n.º 8
0
def delete_student(st_file, app_file):
    st_table = file_handling.import_data(st_file)  #import table
    app_table = file_handling.import_data(app_file)  #import table
    app_list = []
    for record in app_table:
        app_list.append(record[2])
    while True:
        id = ui.user_input("Please give me the student's ID",
                           ["ID: "])  # user input, ID
        if id[0] in app_list:
            ui.print_message(
                "This student has an application, You can't delete it!")
        else:
            break
    for index in range(
            len(st_table)):  # deleting an element from the table by index
        if st_table[index][0] == id[0]:
            del st_table[index]
            break
    file_handling.export_data(st_table, st_file, "w")