c12 Cs Websupport Project Foodorderingsystem

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

FOOD ORDERING SYSTEM

PROGRAM
import os

import platform

import mysql.connector

mydb=mysql.connector. Connect(host="localhost", user="root",

passwd ="",database="food")

mycursor=mydb.cursor()

def Customer():

L=[]

c_id=int(input("Enter the Customer ID: "))

L.append(c_id)

name=input("Enter the Customer Name: ")

L.append(name)

cphone=input("Enter Customer Phone Number : ")

L.append(cphone)

payment=int(input("Enter Payment Method ((1)Credit Card/(2)Debit Card:) "))

L.append(payment)

pstatus=input("Enter the Payment Status : ")

L.append(pstatus)

email=input("Enter the Email ID:")

L.append(email)

OrderF_id=int(input("Enter the Order Food ID:"))

L.append(OrderF_id)

date=input("Enter the Date: ")

L.append(date)

cust=(L)

sql="insert into customer


(c_id,name,cphone,payment,pstatus,email,OrderF_id,date) values
(%s,%s,%s,%s,%s,%s,%s,%s)"

mycursor.execute(sql,cust)

mydb.commit()

def Employee():

L=[]
Emp_id=int(input("Enter the Employee ID: "))

L.append(Emp_id)

ename=input("Enter the Employee Name: ")

L.append(ename)

emp_g=input("Enter the Employee Gender : ")

L.append(emp_g)

eage=int(input("Enter the Employee Age:"))

L.append(eage)

emp_phone=int(input("Enter the Employee Phone Number: "))

L.append(emp_phone)

pwd=input("Enter the Password: ")

L.append(pwd)

EMP=(L)

sql="insert into Employee (Emp_id,ename,emp_g,eage,emp_phone,pwd) values


(%s,%s,%s,%s,%s,%s)"

mycursor.execute(sql,EMP)

mydb.commit()

def Food():

L=[]

Food_id=int(input("Enter the Food ID: "))

L.append(Food_id)

Foodname=input("Enter the Food Name: ")

L.append(Foodname)

Food_size=input("Enter the Food size : ")

L.append(Food_size)

price=int(input("Enter the Price of Food:"))

L.append(price)

Food=(L)

sql="insert into Food (Food_id,Foodname,Food_size,price ) values


(%s,%s,%s,%s)"

mycursor.execute(sql,Food)

mydb.commit()

def OrderFood():

L=[]

OrderF_id=int(input("Enter the Food Order ID : "))


L.append(OrderF_id)

C_id=input("Enter the Customer ID : ")

L.append(C_id)

Emp_id=input("Enter the Employee ID: ")

L.append(Emp_id)

Food_id=int(input("Enter the Food ID:"))

L.append(Food_id)

Food_qty=input("Enter the Quantity:")

L.append(Food_qty)

Total_price=input("Enter the TotalPrice:")

L.append(Total_price)

OrderFood=(L)

sql="insert into OrderFood (OrderF_id,C_id,Emp_id,Food_id,Food_qty,Total_price


) values (%s,%s,%s,%s,%s,%s)"

mycursor.execute(sql,OrderFood)

mydb.commit()

def View():

print("Select the search criteria : ")

print("1. Employee")

print("2. Customer")

print("3. Food")

print("4. Ordered Food")

ch=int(input("Enter the choice 1 to 4 : "))

if ch==1:

s=int(input("Enter the Employee ID:"))

rl=(s,)

sql="select * from Employee where Emp_id=%s"

mycursor.execute(sql,rl)

res=mycursor.fetchall()

for x in res:

print(x)

elif ch==2:

s=input("Enter the Customer Name : ")

rl=(s,)
sql="select * from Customer where cname=%s"

mycursor.execute(sql,rl)

res=mycursor.fetchall()

for x in res:

print(x)

elif ch==3:

sql="select * from Food"

mycursor.execute(sql)

res=mycursor.fetchall()

for x in res:

print(x)

elif ch==4:

s=int(input("Enter the Food ID : "))

rl=(s,)

sql="select * from orderfood where food_id=%s"

mycursor.execute(sql,rl)

res=mycursor.fetchall()

for x in res:

print(x)

def MenuSet():

print("Press 1 : To Add Employee")

print("Press 2 : To Add Cutomer details")

print("Press 3 : To Add Food Details ")

print("Press 4 : For Food Order")

print("Press 5 : To view Food booking")

try:

userInput = int(input("Please Select An Above Option: "))

except ValueError:

exit("\nHy! That's Not A Number")

else:

print("\n")

if (userInput==1):

Employee()
elif (userInput==2):

Customer()

elif (userInput==3):

Food()

elif (userInput==4):

OrderFood()

elif (userInput==5):

View()

else:

print("Enter correct choice. . . ")

def runAgain():

runAgn=input("\nwant to run Again Y/N")

while runAgn.lower()=='y':

if(platform.system()=="Windows"):

print(os.system('cls'))

else:

print(os.system('clear'))

MenuSet()

runAgn=input("\nwant to run Againy/n")

print("Good Bye ... HAVE A NICE DAY")

exit()

MenuSet()

runAgain()

You might also like