Пример #1
0
 def insertCart(p_name, user_name, quantity):
     price = dbManager.fetch(
         "SELECT price FROM products WHERE p_name='%s'" % p_name)[0][0]
     dbManager.commit(
         "INSERT INTO cart (p_name, user_name, quantity, price) VALUES ('%s', '%s', '%s', '%s')"
         % (p_name, user_name, quantity, int(price)))
     return True
Пример #2
0
 def insertProductsToOrders(p_name, quantity):
     query1 = dbManager.fetch("SELECT * FROM orders")
     order_id = len(query1) + 1
     dbManager.commit(
         "INSERT INTO products_in_order (p_name,order_id, quantity) VALUES ('%s', '%s', '%s')"
         % (p_name, order_id, quantity))
     return True
Пример #3
0
 def moveFromCartToOrder(user_name, order_id):
     cart = dbManager.fetch("SELECT * FROM cart WHERE user_name='%s'" %
                            user_name)
     for c in cart:
         dbManager.commit(
             "INSERT INTO products_in_order (p_name,order_id, quantity, price) VALUES ('%s', '%s', '%s', '%s')"
             % (c.p_name, order_id, c.quantity, c.price))
     return True
Пример #4
0
 def createNewCart(user_name, datetime):
     user_email = UserManager.getUserEmail(user_name)
     dbManager.commit(
         "INSERT INTO orders (email, date) VALUES ('%s', '%s')" %
         (user_email, datetime.now()))
     order_id = dbManager.fetch(
         "SELECT order_id FROM orders WHERE email='%s' AND finished=0" %
         user_email)
     return order_id
Пример #5
0
 def createNewOrder(user_name, first_name, last_name, email, cc, cvv):
     amount = ShopManager.calculateAmount(user_name)
     query1 = dbManager.fetch("SELECT * FROM orders")
     order_id = 1
     if len(query1) > 0:
         order_id = len(query1) + 1
     dbManager.commit(
         "INSERT INTO orders (order_id, first_name, last_name, email, cc, cvv , amount) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s')"
         % (order_id, first_name, last_name, email, cc, cvv, amount))
     return order_id
Пример #6
0
 def addAppointment(full_name, phone, email, description, date):
     query2 = dbManager.fetch("SELECT * FROM appointments")
     app_id = len(query2) + 1
     query_result = dbManager.commit(
         "insert into appointments(app_id,full_name, phone, email, description) VALUES ('%s', '%s', '%s', '%s', '%s')"
         % (app_id, full_name, phone, email, description))
     return query_result
Пример #7
0
 def addContactReq(first_name, last_name, email, massage):
     query_result = dbManager.commit(
         "insert into contact_massages(first_name, last_name, email, massage) VALUES ('%s', '%s', '%s', '%s')"
         % (first_name, last_name, email, massage))
     return query_result
Пример #8
0
 def insertNewUser(first_name, last_name, user_name, email, password):
     dbManager.commit("INSERT INTO users(first_name, last_name, user_name, email, password) "
                      "VALUES ('%s', '%s', '%s', '%s', '%s')"
                      % (first_name, last_name, user_name, email, password))
     return True
Пример #9
0
 def updateUser(first_name, last_name, user_name, password, email):
     query_result = dbManager.commit(
         'update users set  first_Name=%s, last_Name=%s, user_name=%s, password=%s where email=%s',
         (first_name, last_name, user_name, password, email))
     return query_result
Пример #10
0
 def deleteCart(user_name):
     return dbManager.commit("DELETE FROM cart WHERE user_name='%s'" %
                             (user_name))
Пример #11
0
 def updateProductQuantity(p_name, user_name, quantity):
     dbManager.commit(
         "UPDATE cart SET quantity='%s' WHERE p_name='%s' AND user_name='%s'"
         % (quantity, p_name, user_name))
     return True
Пример #12
0
 def removeProductsFromCart(p_name, user_name):
     return dbManager.commit(
         "DELETE FROM cart WHERE p_name='%s' AND user_name='%s'" %
         (p_name, user_name))