Exemple #1
0
 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()
Exemple #2
0
 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
Exemple #3
0
 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
Exemple #4
0
 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()
Exemple #5
0
 def get_product(self):
     db = DBconnection()
     session = db.getConnection_parameters()
     productId = self.pid
     product = session.query(Product).get(productId)
     session.close()
     return product
Exemple #6
0
 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()
Exemple #7
0
 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
Exemple #9
0
 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()
Exemple #11
0
 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()
Exemple #12
0
 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()
Exemple #14
0
 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()
Exemple #15
0
 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()
Exemple #16
0
def get_all_product():
    db = DBconnection()
    session = db.getConnection_parameters()
    productList = session.query(Product).all()
    session.close()
    return productList
Exemple #17
0
 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()
Exemple #20
0
def get_all_customers():
    db = DBconnection()
    session = db.getConnection_parameters()
    customer_list = session.query(Customer).all()
    session.close()
    return customer_list