Skip to content

Commit

Permalink
Waiting for push
Browse files Browse the repository at this point in the history
  • Loading branch information
miladbarooni committed Jan 23, 2020
2 parents 8d9f4b3 + ba9e0d9 commit 003be9a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def restaurantsPage(self):

def showRestaurants():
def make_address_str(address_id):
address_info = mydb.show
address_info = mydb.showAddre

address_id = -1
for variable in all_variables:
Expand Down
29 changes: 25 additions & 4 deletions snapFood.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@ def updateUserProfile(self, user_id, f_name = "", l_name = "", phone_number = ""
self._mydb.commit()
return "DONE"

def showAddress(self, user_id) :
self._mycursor.execute("SELECT ADDRESS.* FROM ADDRESS WHERE USERuserid = \'{}\'".format(user_id))
def showUserAddress(self, user_id) :
self._mycursor.execute("SELECT CITY.name, ADDRESS.* FROM ADDRESS JOIN CITY ON ADDRESS.CITYcityid = CITY.cityid WHERE ADDRESS.USERuserid = \'{}\'".format(user_id))
return self._mycursor.fetchall()

def showAddress(self, address_id):
self._mycursor.execute("SELECT CITY.name, ADDRESS.* FROM ADDRESS JOIN CITY ON ADDRESS.CITYcityid = CITY.cityid WHERE addressid = \'{}\'".format(address_id))
return self._mycursor.fetchall()

def showAllCity(self):
Expand Down Expand Up @@ -121,7 +125,7 @@ def showCategoryOfShop(self, shop_id): #NOT CHECKED
return self._mycursor.fetchall()

def addShopAndAdmin(self, user_name, password, city_id, x, y, shop_name = "", shop_about = "", shop_bill_value = "",
street = "", alley = "", plaque = "", address = ""): #NOT CHECKED
street = "", alley = "", plaque = "", address = ""):
address_id = self.addAddress(x, y, "", city_id, street=street, alley=alley, plaque=plaque, address_text=address)
self._mycursor.execute("INSERT INTO SHOP(name, `about-text`, `minimum-bill-value`, ADDRESSaddressid) VALUES (\'{}\', \'{}\', \'{}\', \'{}\');"
.format(shop_name, shop_about, shop_bill_value, address_id))
Expand Down Expand Up @@ -245,8 +249,25 @@ def searchShop(self, city_id = None, name = None, min_bill_val = -1): #NOT CHEC
self._mycursor.execute(sql)
return self._mycursor.fetchall()

def searchCategory(self, name = None):
def searchCategory(self, name = None): #NOT CHECKED
sql = "SELECT "
return

def addFood(self, price, about, name, discount, category_id, shop_id, image = ""):
self._mycursor.execute("""INSERT INTO FOOD(price, about, name, discount, image, CATEGORYcategoryid, SHOPshopid)
VALUES (\'{}\', \'{}\', \'{}\', \'{}\', \'{}\', \'{}\', \'{}\');"""
.format(price, about, name, discount, image, category_id, shop_id))
self._mydb.commit()
return self._mycursor.lastrowid

def addCategory(self, name):
self._mycursor.execute("INSERT INTO CATEGORY(name) VALUES (\'{}\');".format(name))
self._mydb.commit()
return self._mycursor.lastrowid

def close(self):
self._mydb.close()

db = SnapFoodDB()
print(db.showAddress(8))
db.close()

0 comments on commit 003be9a

Please sign in to comment.