Esempio n. 1
0
def add(table):
    """
    Asks user for input and adds it into the table.
    Args:
        table (list): table to add new record to
    Returns:
        list: Table with a new record
    """

    # your code
    file_name = "sales/sales.csv"
    new_data_properties = ["Title", "Price (USD)", "Month", "Day", "Year"]
    common.add_item(table, new_data_properties, file_name)

    return table
Esempio n. 2
0
def add(table):
    """
    Asks user for input and adds it into the table.
    Args:
        table (list): table to add new record to
    Returns:
        list: Table with a new record
    """

    # your code
    file_name = "crm/customers.csv"
    new_data_properties = ["Name", "E-mail", "Subscribed to newsletter"]
    common.add_item(table, new_data_properties, file_name)

    return table
Esempio n. 3
0
def add(table):
    """
    Asks user for input and adds it into the table.
    Args:
        table (list): table to add new record to
    Returns:
        list: Table with a new record
    """

    # your code
    file_name = "store/games.csv"
    new_data_properties = ["Title", "Manufacturer", "Price (USD)", "Stock"]
    common.add_item(table, new_data_properties, file_name)

    return table
Esempio n. 4
0
def add(table):
    """
    Asks user for input and adds it into the table.
    Args:
        table (list): table to add new record to
    Returns:
        list: Table with a new record
    """

    # your code
    file_name = "hr/persons.csv"
    new_data_properties = ["Name", "Birth year"]
    common.add_item(table, new_data_properties, file_name)

    return table
Esempio n. 5
0
def add(table):
    """
    Asks user for input and adds it into the table.
    Args:
        table (list): table to add new record to
    Returns:
        list: Table with a new record
    """

    # your code
    file_name = "inventory/inventory.csv"
    new_data_properties = ["Name", "Manufacturer", "Year of purchase", "Durability"]
    common.add_item(table, new_data_properties, file_name)

    return table
Esempio n. 6
0
def add(table):
    """
    Asks user for input and adds it into the table.
    Args:
        table (list): table to add new record to
    Returns:
        list: Table with a new record
    """

    # your code

    file_name = "accounting/items.csv"
    new_data_properties = ["Month", "Day", "Year", "Type", "Amount"]
    common.add_item(table, new_data_properties, file_name)

    return table
Esempio n. 7
0
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    list_options = [
        "show table", "add", "remove", "update", "get lowest price item id",
        "get items sold between"
    ]
    exit_message = "Back to main menu"
    message = "There is no such option"
    title = "sales"
    ui.print_menu(title, list_options, exit_message)
    choice_input = ui.get_inputs(["Choose a special feature:"], "")
    choice = choice_input[0]

    if choice == '1':
        show_table(table)
    elif choice == '2':
        data_manager.write_table_to_file(FILE_NAME_4,
                                         common.add_item(labels, table))
    elif choice == '3':
        id_ = ui.get_inputs(["Please enter an id: "], "")
        data_manager.write_table_to_file(FILE_NAME_4,
                                         common.delete_item(id_, table))
    elif choice == '4':
        id_ = ui.get_inputs(["Please enter an id: "], "")
        common.update(id_, table, labels)
    elif choice == '5':
        get_lowest_price_item_id(table)
    elif choice == '6':
        get_items_sold_between(table, month_from, day_from, year_from,
                               month_to, day_to, year_to)
    elif choice == '0':
        common.menu_back()
    else:
        ui.print_error_message(message)
Esempio n. 8
0
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    title = "HR"
    list_options = [
        "show table", "add", "remove", "update", "get_the oldest person",
        "get the person closest to the average"
    ]
    exit_message = "Back to main menu"
    ui.print_menu(title, list_options, exit_message)
    message = "There is no such option"

    choice_input = ui.get_inputs(["Choose a special feature:"], "")
    choice = choice_input[0]
    if choice == '1':
        show_table(table)
    elif choice == '2':
        data_manager.write_table_to_file(FILE_NAME_1,
                                         common.add_item(labels, table))
    elif choice == '3':
        id_ = ui.get_inputs(["Please enter an id: "], "")
        data_manager.write_table_to_file(FILE_NAME_1,
                                         common.delete_item(id_, table))
    elif choice == '4':
        id_ = ui.get_inputs(["Please enter an id: "], "")
        common.update(id_, table, labels)
    elif choice == '5':
        get_oldest_person
    elif choice == '6':
        get_persons_closest_to_average
    elif choice == '0':
        common.menu_back()
    else:
        ui.print_error_message(message)
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    special_features = [
        "show table", "add record", "remove record", "update",
        "which year max", "avg amount"
    ]
    ui.print_menu("Accounting", special_features, "Back to main menu")
    message = "There is no such option"

    choice_input = ui.get_inputs(["Choose a special feature:"], "")
    choice = choice_input[0]
    if choice == '1':
        show_table(table)
    elif choice == '2':
        #table = add(table)
        data_manager.write_table_to_file(FILE_NAME,
                                         common.add_item(labels, table))
    elif choice == '3':
        id_ = ui.get_inputs(["Please enter an id: "], "")
        data_manager.write_table_to_file(FILE_NAME,
                                         common.delete_item(id_, table))
    elif choice == '4':
        id_ = ui.get_inputs(["Please enter an id: "], "")
        common.update(id_, table, labels)
    elif choice == '5':
        which_yearmax(table, id_)
    elif choice == '6':
        avg_amount(table, year)
    elif choice == '0':
        common.menu_back()
    else:
        ui.print_error_message(message)
Esempio n. 10
0
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    special_features = [
        "show table", "add record", "remove record", "update",
        "get longest name id", "get subscribed emails"
    ]
    ui.print_menu("CRM", special_features, "Back to main menu")
    message = "There is no such option"
    choice_input = ui.get_inputs(["Choose a special feature:"], "")
    choice = choice_input[0]

    if choice == '1':
        show_table(table)
    elif choice == '2':
        data_manager.write_table_to_file(FILE_NAME_2,
                                         common.add_item(labels, table))
    elif choice == '3':
        id_ = ui.get_inputs(["Please enter an id: "], "")
        data_manager.write_table_to_file(FILE_NAME_2,
                                         common.delete_item(id_, table))
    elif choice == "4":
        id_ = ui.get_inputs(["Please enter an id: "], "")
        common.update(id_, table, labels)
    elif choice == '5':
        get_longest_name_id()
    elif choice == '6':
        get_subscribed_emails()
    elif choice == '0':
        common.menu_back()
    else:
        ui.print_error_message(message)
Esempio n. 11
0
def start_module():
    """
    Starts this module and displays its menu.
     * User can access default special features from here.
     * User can go back to main menu from here.

    Returns:
        None
    """

    special_features = [
        "show table", "add record", "remove record", "update",
        "get counts by manufacturers", "get average by manufacturers"
    ]
    ui.print_menu("Store", special_features, "Back to main menu")
    message = "There is no such option"

    choice_input = ui.get_inputs(["Choose a special feature:"], "")
    choice = choice_input[0]
    if choice == '1':
        show_table(table)
    elif choice == '2':
        data_manager.write_table_to_file(FILE_NAME_5,
                                         common.add_item(labels, table))
    elif choice == '3':
        id_ = ui.get_inputs(["Please enter an id: "], "")
        data_manager.write_table_to_file(FILE_NAME_5,
                                         common.delete_item(id_, table))
    elif choice == '4':
        id_ = ui.get_inputs(["Please enter an id: "], "")
        common.update(id_, table, labels)
    elif choice == '5':
        get_counts_by_manufacturers()
    elif choice == '6':
        get_average_by_manufacturer()
    elif choice == '0':
        common.menu_back()
    else:
        ui.print_error_message(message)