def changeCustomerEmail(): customerDao = CustomerDAO() while True: print( "Enter the Phone# of a customer who's email you would like to change" ) phone_num = input() customer_exists = verifyPhoneNum(phone_num) if customer_exists == True: customer = customerDao.select_by_phone(phone_num) print("Enter the new email") email = input() customer.set_email(email) customerDao.update(customer) print("Email changed") print("") break else: print( "Phone# does not match an existing customer, please try again") print("")
def changeCustomerStreetAddress(): customerDao = CustomerDAO() while True: print( "Enter the Phone# of a customer who's street address you would like to change" ) phone_num = input() customer_exists = verifyPhoneNum(phone_num) if customer_exists == True: customer = customerDao.select_by_phone(phone_num) print("Enter the new street address") saddress = input() customer.set_saddress(saddress) customerDao.update(customer) print("Street address changed") print("") break else: print( "Phone# does not match an existing customer, please try again") print("")
def changeCustomerCity(): customerDao = CustomerDAO() while True: print( "Enter the Phone# of a customer who's city you would like to change" ) phone_num = input() customer_exists = verifyPhoneNum(phone_num) if customer_exists == True: customer = customerDao.select_by_phone(phone_num) print("Enter the new city") city = input() customer.set_city(city) customerDao.update(customer) print("City changed") print("") break else: print( "Phone# does not match an existing customer, please try again") print("")
def changeCustomerZip(): customerDao = CustomerDAO() while True: print( "Enter the Phone# of a customer who's zip code you would like to change" ) phone_num = input() customer_exists = verifyPhoneNum(phone_num) if customer_exists == True: customer = customerDao.select_by_phone(phone_num) print("Enter the new zip code") zip = input() customer.set_zip(zip) customerDao.update(customer) print("Zip code changed") print("") break else: print( "Phone# does not match an existing customer, please try again") print("")
def changeCustomerLname(): customerDao = CustomerDAO() while True: print( "Enter the Phone# of a customer who's last name you would like to change" ) phone_num = input() customer_exists = verifyPhoneNum(phone_num) if customer_exists == True: customer = customerDao.select_by_phone(phone_num) print("Enter the new last name") lname = input() customer.set_lname(lname) customerDao.update(customer) print("Last name changed") print("") break else: print( "Phone# does not match an existing customer, please try again") print("")
def create_new_customer(): customer = Customer() print("Pleas enter the following information: ") print("Customer first name") customer.set_fname(input()) print("Customer last name") customer.set_lname(input()) print("Customer street address") customer.set_saddress(input()) print("Customer city") customer.set_city(input()) print("Customer zip code") customer.set_zip(input()) print("Customer state") customer.set_state(input()) print("Customer phone number") customer.set_phone(input()) print("Customer email") customer.set_email(input()) customer_dao = CustomerDAO() customer_dao.insert_customer(customer) print("|------------------------|") print("| Create Order |") print("|------------------------|") print("") create_order()
def verifyPhoneNum(phone_num): customer_exists = False customerDao = CustomerDAO() customer_list = customerDao.select_all() for customer in customer_list: if customer.get_phone() == phone_num: customer_exists = True break return customer_exists
def viewCustomers(): customerDao = CustomerDAO() customer_list = customerDao.select_all() for customer in customer_list: print("First name: " + customer.get_fname()) print("Last name: " + customer.get_lname()) print("City: " + customer.get_city()) print("State: " + customer.get_state()) print("Zip: " + customer.get_zip()) print("Street Address: " + customer.get_saddress()) print("Email: " + customer.get_email()) print("Phone: " + customer.get_phone()) print("") print("")
def addCustomer(): customerDao = CustomerDAO() while True: print("Enter the Phone# of a customer you would like to add") phone_num = input() customer_exists = verifyPhoneNum(phone_num) if customer_exists == True: print( "A customer with that phone# already exists, please try again") print("") else: customer = Customer() print("Enter customer's first name") fname = input() print("Enter customer's last name") lname = input() print("Enter customer's city") city = input() print("Enter customer's state") state = input() print("Enter customer's zip code") zip = input() print("Enter customer's street address") saddress = input() print("Enter customer's email") email = input() customer.set_fname(fname) customer.set_lname(lname) customer.set_city(city) customer.set_state(state) customer.set_zip(zip) customer.set_saddress(saddress) customer.set_email(email) customer.set_phone(phone_num) customerDao.insert_customer(customer) break
def deleteCustomer(): while True: print( "Enter the Phone# of a customer you would like to delete or press 1 to quit" ) phone_num = input() if phone_num == "1": break customer_exists = verifyPhoneNum(phone_num) if customer_exists == False: print( "A customer with that phone# does not exist, please try again") print("") else: order_exists = checkForCustomerOrder(phone_num) if order_exists == True: print( "That customer already has orders placed. Delete the orders before deleting the customer" ) print("") else: customerDao = CustomerDAO() customerDao.delete_customer_by_phone_number(phone_num) print("Customer deleted") print("") break
from database.CustomerOrderDAO import CustomerOrderDAO from database.CustomerDAO import CustomerDAO from database.ItemDAO import ItemDAO from database.ProductDAO import ProductDAO from database.Item import Item import math from colorama import Fore, Back, Style customerOrderDAO = CustomerOrderDAO() customerDAO = CustomerDAO() itemDAO = ItemDAO() productDAO = ProductDAO() def deleteCustomerOrderPickUp(): while True: print("Press 1 to enter hold#") print("Press 2 to quit") choice = input() if choice == "1": print("Enter hold#") hold_num = input() valid_hold_num = varifyHoldNum(hold_num) if valid_hold_num == False:
def create_order(): print("Connecting to database...") customer_dao = CustomerDAO() customer_order_dao = CustomerOrderDAO() customer_order = CustomerOrder() product_dao = ProductDAO() item_dao = ItemDAO() employee_dao = EmployeeDAO() found = False list_of_employees = employee_dao.select_all() salesperson_num = 0 while not found: print("Enter in salesperson number") salesperson_num = input() for emp in list_of_employees: if emp.get_salesperson_num() == salesperson_num: found = True if not found: print("No employee with that salesperson number") print("Please enter customer phone number ") phone_num = input() customer = customer_dao.select_by_phone(str(phone_num)) customer_order.set_phone_num(customer.get_phone()) customer_order.set_salesperson_num(salesperson_num) print("Please enter today's date ") date = input() customer_order.set_date_made(date) hold_num = generate_hold_num() customer_order.set_hold_num(hold_num) print("Please enter description of where tile will be located ") customer_order.set_description(input()) print("Please enter delivery address") customer_order.set_delivery_address(input()) customer_order.set_total_cost( 0.00) #Initialize to 0 we will manipulate this after customer_order_dao.insert_customer_order(customer_order) list_of_products = product_dao.select_all() done = True total_cost = 0 while done: found = False item = Item() while not found: print("Enter product NTD number") ntd_num = input() for x in list_of_products: if x.get_ntd_num() == ntd_num: item.set_ntd_num(ntd_num) found = True if not found: print("Wrong NTD number") while True: print( "Enter desired quantity of product, if grout enter number of bags, if tile enter square footage" ) desired_quantity = input() if float(desired_quantity) > float( product_dao.select_by_ntd_num(ntd_num).get_amt_in_stock()): print("Not enough quantity in warehouse!") else: break item.set_quantity(desired_quantity) cost = float(item.get_quantity()) * float( product_dao.select_by_ntd_num( item.get_ntd_num()).get_cost_per_sf()) total_cost = float(total_cost) + float(cost) item.set_total_cost(str(cost)) item.set_hold_num(hold_num) item_dao.insert_item(item) product = product_dao.select_by_ntd_num(item.get_ntd_num()) newSquareFootage = float(product.get_amt_in_stock()) - float( item.get_quantity()) newCartonCount = int( float(newSquareFootage) / float(product.get_sf_per_carton())) newPieceCount = int( (float(newSquareFootage) % float(product.get_sf_per_carton())) / float(product.get_size_of_product())) product.set_amt_in_stock(str(newSquareFootage)) product.set_carton_count(str(newCartonCount)) product.set_piece_count(str(newPieceCount)) product_dao.update(product) print("Enter another product?\n" "Press 1 for yes\n" "Press 2 to complete the order") choice = input() if choice == "2": customerOrder = customer_order_dao.select_by_hold_number( customer_order.get_hold_num()) customerOrder.set_total_cost(total_cost) customer_order_dao.update(customerOrder) print("Customer's order hold number is " + str(hold_num)) done = False