def select_by_phone(self, key): connect = Connect() connect.sql_execute('select * from customer where phone = \'' + str(key) + '\'') row = connect.cur.fetchone() customer = Customer() customer.set_values_from_row(row) return customer
def select_by_ntd_num_and_hold_num(self, key, hold_num): connect = Connect() connect.sql_execute('select * from item where ntd# = ' + "'" + str(key) + "' and hold# = " + "'" + hold_num + "'") row = connect.cur.fetchone() item = Item() item.set_values_from_row(row) return item
def select_by_hold_number(self, key): connect = Connect() connect.sql_execute('select * from customer_order where hold# = ' + "'" + str(key) + "'") row = connect.cur.fetchone() customer_order = CustomerOrder() customer_order.set_values_from_row(row) return customer_order
def select_by_ntd_num(self,key): connect = Connect() connect.sql_execute('select * from product where ntd# = ' + "'" +str(key) + "'") row = connect.cur.fetchone() product = Product() product.set_values_from_row(row) return product
def select_all(self): connect = Connect() connect.sql_execute('select * from item') item_list = [] for row in connect.cur: item = Item() item.set_values_from_row(row) item_list.append(item) return item_list
def select_all(self): connect = Connect() connect.sql_execute('select * from customer_order') customer_order_list = [] for row in connect.cur: customer_order = CustomerOrder() customer_order.set_values_from_row(row) customer_order_list.append(customer_order) return customer_order_list
def select_by_salesperson_num(self, key): connect = Connect() connect.sql_execute('select * from employee where salesperson# = ' + str(key) + '') row = connect.cur.fetchone() employee = Employee() employee.set_values_from_row(row) return employee
def select_by_customer_phone(self, key): connect = Connect() connect.sql_execute('select * from customer_order where phone# = ' + "'" + str(key) + "'") customer_order_list = [] for row in connect.cur: customer_order = CustomerOrder() customer_order.set_values_from_row(row) customer_order_list.append(customer_order) return customer_order_list
def select_by_hold_num(self,key): connect = Connect() connect.sql_execute('select * from item where hold# = ' + "'" + str(key) + "'") item_list = [] for row in connect.cur: item = Item() item.set_values_from_row(row) item_list.append(item) return item_list
def select_all(self): connect = Connect() connect.sql_execute('select * from product') product_list = [] for row in connect.cur: product = Product() product.set_values_from_row(row) product_list.append(product) return product_list
def select_all(self): connect = Connect() connect.sql_execute('select * from employee') employee_list = [] for row in connect.cur: employee = Employee() employee.set_values_from_row(row) employee_list.append(employee) return employee_list
def update(self, employee): connect = Connect() connect.sql_execute("update employee set " + "fname = '" + employee.get_fname() + "'," + "lname = '" + employee.get_lname() + "'," + "salesperson# = '" + employee.get_salesperson_num() + "' " + "where salesperson# = '" + employee.get_salesperson_num() + "'") connect.commit()
def update(self, itemObject): connect = Connect() connect.sql_execute("update item set " + "ntd# = '" + itemObject.get_ntd_num() + "'," + "quantity = " + str(itemObject.get_quantity()) + "," + "total_cost = " + str(itemObject.get_total_cost()) + "," + "hold# = '" + itemObject.get_hold_num() + "' " + "where ntd# = '" + itemObject.get_ntd_num() + "' and hold# = '" + itemObject.get_hold_num() + "'") connect.commit()
def update(self, customerObject): connect = Connect() connect.sql_execute("update customer set " + "fname = '" + customerObject.get_fname() + "'," + "lname = '" + customerObject.get_lname() + "'," + "city = '" + customerObject.get_city() + "'," + "zip = '" + customerObject.get_zip() + "'," + "state = '" + customerObject.get_state() + "'," + "email = '" + customerObject.get_email() + "'," + "phone = '" + customerObject.get_phone() + "'," + "street_address = '" + customerObject.get_saddress() + "' "+ "where phone = '" + customerObject.get_phone() + "'") connect.commit()
def update(self, customerOrderObject): connect = Connect() connect.sql_execute("update customer_order set " + "date_made = '" + customerOrderObject.get_date_made() + "'," + "total_cost = " + str(customerOrderObject.get_total_cost()) + "," + "hold# = '" + customerOrderObject.get_hold_num() + "', " + "delivery_address = '" + customerOrderObject.get_delivery_address() + "', " + "phone# = '" + customerOrderObject.get_phone_num() + "' " + "where hold# = '" + customerOrderObject.get_hold_num() + "'") connect.commit()
def update(self, product): connect = Connect() connect.sql_execute("update product set " + "dye_lot = '" + product.get_dye_lot() + "'," + "color = '" + product.get_color() + "'," + "location = '" + product.get_location() + "'," + "mfg# = '" + product.get_mfg_num() + "'," + "buying_price = " + str(product.get_buying_price()) + "," + "amt_in_stock = " + str(product.get_amt_in_stock()) + "," + "ntd_description = '" + product.get_ntd_description() + "' ," + "cost_per_sf = " + str(product.get_cost_per_sf()) + "," + "sf_per_carton = " + str(product.get_sf_per_carton()) + "," + "carton_count = " + str(product.get_carton_count()) + ", " + "size_of_product = " + str(product.get_size_of_product()) + "," + "piece_count = " + str(product.get_piece_count()) + " , " + "ntd# = '" + product.get_ntd_num() + "' " + "where ntd# = '" + product.get_ntd_num() + "'") connect.commit()
def delete_customer_order_by_hold_num(self, hold_num): connect = Connect() connect.sql_execute("delete from customer_order where hold# = " + "'" + hold_num + "'") connect.commit()
def insert_item(self, itemObject): connect = Connect() connect.sql_execute('Insert into Item values ( ' + itemObject.get_value_string()) connect.commit()
class RedeSocialDb(object): def __init__(self): self.db = Connect('rede_social.db') def close_connection(self): self.db.close_db()
def __init__(self): Connect.__init__(self)
def __init__(self): self.db = Connect('rede_social.db')
def insert_customer_order(self, customerOrderObject): connect = Connect() connect.sql_execute('Insert into customer_order values ( ' + customerOrderObject.get_value_string()) connect.commit()
def delete_customer_by_phone_number(self, phone): connect = Connect() connect.sql_execute('delete from customer where phone = ' + "'" + str(phone) + "'") connect.commit()
def insert_product(self,product): connect = Connect() connect.cur.execute('insert into product values( ' + product.get_values_string()) connect.commit()
def insert_employee(self, employee): connect = Connect() connect.cur.execute('insert into employee values( ' + employee.get_values_string()) connect.commit()
def delete_employee(self, key): connect = Connect() connect.cur.execute('delete from employee where salesperson# = ' + "'" + str(key) + "'") connect.commit()
def delete_product(self,key): connect = Connect() connect.cur.execute('delete from product where ntd# = ' + "'" + str(key) + "'") connect.commit()
def delete_item_using_hold_num(self, key): connect = Connect() connect.sql_execute("delete from item where hold# = " + "'" + key + "'") connect.commit()
def delete_item(self, ntd_num, hold_num): connect = Connect() connect.sql_execute("delete from item where ntd# = " + "'" + ntd_num + "' and hold# = " + "'" + hold_num + "'") connect.commit()