Parking Source Code
Parking Source Code
import os
import platform
import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root",password="admin"
,database='parking')
mycursor=mydb.cursor()
def Add_Record():
L=[]
L.append(id1)
L.append(pname1)
L.append(level1)
L.append(freespace1)
L.append(vehicleno1)
L.append(nod1)
if nod1==1:
Payment1=20
elif nod1==2:
Payment1=40
elif nod1==3:
Payment1=60
elif nod1==4:
Payment1=80
elif nod1==5:
Payment1=100
elif nod1==6:
Payment1=120
L.append(Payment1)
stud=(L)
mycursor.execute(sql,stud)
mydb.commit()
def Rec_View():
print("4. All")
if ch==1:
rl=(s,)
mycursor.execute(sql,rl)
res=mycursor.fetchall()
elif ch==2:
rl=(s,)
mycursor.execute(sql,rl)
res=mycursor.fetchall()
elif ch==3:
rl=(s,)
mycursor.execute(sql,rl)
res=mycursor.fetchall()
elif ch==4:
mycursor.execute(sql)
res=mycursor.fetchall()
for x in res:
print(x)
def Vehicle_Detail():
L=[]
L.append(vid1)
L.append(vnm1)
L.append(dateofpur1)
vdt=(L)
mycursor.execute(sql,vdt)
mydb.commit()
def Vehicle_View():
sql='select parkmaster12.pid,parkmaster12.pnm,parkmaster12.vehicleno,
vehicle.pid,vehicle.vnm from parkmaster12 INNER JOIN vehicle ON
parkmaster12.pid=vehicle.pid and vehicle.pid=%s'
rl=(vid1,)
mycursor.execute(sql,rl)
res=mycursor.fetchall()
for x in res:
print(x)
print('Task completed')
def remove():
rl=(vid1,)
mycursor.execute(sql,rl)
mydb.commit()
def Menu():
if(input_dt== 1):
Add_Record()
elif (input_dt==2):
Rec_View()
elif (input_dt==3):
Vehicle_Detail()
elif (input_dt==4):
remove()
elif (input_dt==5):
Vehicle_View()
else:
Menu()
def runAgain():
while(runAgn.lower()=='y'):
if(platform.system()=='Windows'):
print(os.system('cls'))
else:
print(os.system('clear'))
Menu()
runAgain()
OUTPUT: