def delete_address(self): db = DBconnection() session = db.getConnection_parameters() customer_id = self.cid session.query(Address).filter(Address.cid == customer_id).delete() session.commit() session.close()
def get_product_category(self): db = DBconnection() session = db.getConnection_parameters() catId = self.cat_id productCategory = session.query(ProductCategory).get(catId) session.close() return productCategory
def get_customer(self): db = DBconnection() session = db.getConnection_parameters() customer_id = self.cid fetchedCustomer = session.query(Customer).get(customer_id) session.close() return fetchedCustomer
def delete_product_category(self): categoryId = self.cat_id db = DBconnection() session = db.getConnection_parameters() session.query(ProductCategory).filter(ProductCategory.cat_id == categoryId).delete() session.commit() session.close()
def get_product(self): db = DBconnection() session = db.getConnection_parameters() productId = self.pid product = session.query(Product).get(productId) session.close() return product
def delete_product(self): productId = self.pid db = DBconnection() session = db.getConnection_parameters() session.query(Product).filter(Product.pid == productId).delete() session.commit() session.close()
def get_address(self): db = DBconnection() session = db.getConnection_parameters() customer_id = self.cid result = session.query(Address).filter(Address.cid == customer_id) session.close() return result
def get_customer_order(self): db = DBconnection() session = db.getConnection_parameters() customerOrderId = self.oid customerOrder = session.query(CustomerOrder).get(customerOrderId) session.close() return customerOrder
def update_product_category(self): categoryId = self.cat_id db = DBconnection() session = db.getConnection_parameters() existing_productCategory = session.query(ProductCategory).get(categoryId) existing_productCategory.catname = self.catname session.commit() session.close()
def delete_customer_order(self): customerOrderId = self.oid db = DBconnection() session = db.getConnection_parameters() session.query(CustomerOrder).filter( CustomerOrder.oid == customerOrderId).delete() session.commit() session.close()
def delete_customer(self): customerId = self.cid address = Address(cid=customerId) address.delete_address() db = DBconnection() session = db.getConnection_parameters() existingCustomer = session.query(Customer).get(customerId) session.delete(existingCustomer) session.commit() session.close()
def update_product(self): productId = self.pid db = DBconnection() session = db.getConnection_parameters() existing_product = session.query(Product).get(productId) existing_product.catid = self.catid existing_product.product_name = self.product_name existing_product.quantity = self.quantity session.commit() session.close()
def update_customer_order(self): customerOrderId = self.oid db = DBconnection() session = db.getConnection_parameters() existing_customer_order = session.query(CustomerOrder).get( customerOrderId) existing_customer_order.cid = self.cid existing_customer_order.pid = self.pid existing_customer_order.order_date = self.order_date existing_customer_order.status = self.status session.commit() session.close()
def update_address(self): db = DBconnection() session = db.getConnection_parameters() addressId = self.aid existingAddress = session.query(Address).get(addressId) existingAddress.cid = self.cid existingAddress.description = self.description existingAddress.state = self.state existingAddress.district = self.district existingAddress.pin_no = self.pin_no session.commit() session.close()
def update_customer(self): db = DBconnection() session = db.getConnection_parameters() customerId = self.cid existingCustomer = session.query(Customer).get(customerId) existingCustomer.firstname = self.firstname existingCustomer.surname = self.surname existingCustomer.email = self.email existingCustomer.password = self.password existingCustomer.dob = self.dob existingCustomer.mobile_number = self.mobile_number session.commit() session.close()
def get_all_product(): db = DBconnection() session = db.getConnection_parameters() productList = session.query(Product).all() session.close() return productList
def add_product(self): db = DBconnection() session = db.getConnection_parameters() session.add(self) session.commit() session.close()
def get_all_customer_order(): db = DBconnection() session = db.getConnection_parameters() productList = session.query(CustomerOrder).all() session.close() return productList
def add_customer_order(self): db = DBconnection() session = db.getConnection_parameters() session.add(self) session.commit() session.close()
def get_all_customers(): db = DBconnection() session = db.getConnection_parameters() customer_list = session.query(Customer).all() session.close() return customer_list