def view_all_customers(): customers = customerTable.get_records() if len(customers) == 0: print("No Record found") else: i = 0 print_header() for customer in customers: i += 1 customer.print_all() if i == NUMBER_OF_RECORDS_PER_PAGE: input("Press any key to continue.")
def show_records(cursor, query): try: cursor.execute(query) records = cursor.fetchall() if cursor.rowcount == 0: print("No Matching Records") return print_header() for record in records: customer = Customer().create_from_record(record) customer.print_all() return records except mysql.connector.Error as err: print(err)
def print_current_list_of_customers(): customers = customerTable.get_records() if len(customers) == 0: print("No customers found") else: results = [] for customer in customers: if customer.checkout_date is None: results.append(customer) if len(results) == 0: print("no matching records") else: print(len(results), " matching customers") print_header() for customer in results: customer.print_all()
def get_and_print_customer_list_by_phone(): customers = customerTable.get_records() results = [] if len(customers) == 0: print("No Records found") else: phone = input("Enter the phone number: ") for customer in customers: if phone in customer.phone: results.append(customer) if len(results) == 0: print("No matching record") else: print(len(results), " matching records") print_header() for customer in results: customer.print_all() return results
def get_customer_list_by_name(): customers = customerTable.get_records() results = [] if len(customers) == 0: print("No Records found") else: name = input("Enter the name: ").lower() words = name.split() for customer in customers: for word in words: if word in customer.name.lower(): results.append(customer) if len(results) == 0: print("No matching record") else: print(len(results), " matching records") print_header() for customer in results: customer.print_all() return results
def print_customer_list_by_check_in(): customers = customerTable.get_records() if len(customers) == 0: print("No customers found") else: print("Enter the date: ") day = int(input("day of month: ")) month = int(input("month: ")) year = int(input("year: ")) check_in = datetime(year, month, day) results = [] for customer in customers: if customer.entry_date.date() == check_in.date(): results.append(customer) if len(results) == 0: print("no matching records") else: print(len(results), " matching customers") print_header() for customer in results: customer.print_all()