CS Railway Managemnet Project Class 12
CS Railway Managemnet Project Class 12
mycon=mys.connect(host="localhost",user="root”,
password="dev2006")
mycursor=mycon.cursor()
mycon.commit()
def MENU():
ch=1
while True:
print("------------WELCOME TO IRCTC-----------")
print('1.SIGN IN')
print('2.SIGN UP')
print("3.DELETE ACCOUNT")
print('3.EXIT')
ch1=int(input("enter ur choice:"))
if ch1 == 1:
a=checking()
if a==True:
print('Welcome!')
main()
else:
continue
elif ch1 == 2:
a=checking_1()
if a==True:
main()
else:
elif ch1 == 3:
c3=checking_2()
if c==True:
print("ACCOUNT DELETED")
continue
else:
continue
elif ch1==4:
print("THANK YOU")
break
else:
print("error")
break
print("1.yes")
print("2.no")
print("1.yes")
print("2.no")
while c == 1:
print('1.TICKET BOOKING')
print('2.TICKET CHECKING')
print('3.TICKET CANCELLING')
print('4.LOG OUT')
if ch == 1:
ticket_book()
elif ch == 2:
ticket_check()
elif ch == 3:
ticket_cancel()
elif ch == 4:
checking_3()
elif ch==5:
print("thank you")
break
else:
print("ERROR 404")
def ticket_book():
mycon.commit()
print("Available trains")
mycursor.execute(g)
data = mycursor.fetchall()
Data=list(data)
print("1010.RAJDHANI EXPRESS")
print("1020,VANDE BHARAT")
print("1030.JANSHATABDI")
print("1040.VIVEK EXPRESS")
if n<=2:
if x=='1010':
g=delhi()
h= 'delhi'
c1='kanyakumari'
c2='rajdhani express'
elif x=='1020':
g=guj()
h='ahmedabad'
c1='delhi'
c2='vande bharat'
elif x=='1030':
g=blore()
h="bangalore"
c1='kolkata'
c2='janshatabadi'
elif x=='1040':
g=kerala()
h='thiruvanthapuram'
c1='delhi'
c2='garibradh'
elif x=='1050':
g=assam()
h='assam'
c1='kanyakumari'
c2='vivek express'
else:
print("invalid choice")
pnrno=random.randint(1000,3000)
for i in range(n):
c=input("age")
s=input("gender")
mycursor.execute(s2)
print("booked")
def delhi():
print('FIRST CLASS')
s = 4000
elif x == "AC2":
print('SECOND CLASS')
s = 5000
elif x == "AC3":
print('third CLASS')
s = 6000
elif x == "SLEEPER":
print('sleeper CLASS')
s = 8000
else:
print("Invalid")
s=0
def guj():
x=input("enter ur choice of
seat(AC1/AC2/AC3/SLEEPER):")
if (x=="AC1"):
print('FIRST CLASS')
s=5000
elif(x=="AC2"):
print('SECOND CLASS')
s=7000
elif(x=="AC3"):
print('third CLASS')
s=8000
elif(x=="SLEEPER"):
print('sleeper CLASS')
s=9000
else:
print("invalid")
return s,x
def blore():
x=input("enter ur choice of
seat(AC1/AC2/AC3/SLEEPER):")
if (x=="AC1"):
print('FIRST CLASS')
s=3000
elif(x=="AC2"):
print('SECOND CLASS')
s=4000
elif(x=="AC3"):
print('third CLASS')
s=5000
elif(x=="SLEEPER"):
print('sleeper CLASS')
s=6000
else:
print("invalid")
return s,x
blore()
def kerala():
x=input("enter ur choice of
seat(AC1/AC2/AC3/SLEEPER):")
if (x=="AC1"):
print('FIRST CLASS')
s=500
elif(x=="AC2"):
print('SECOND CLASS')
s=600
elif(x=="AC3"):
print('third CLASS')
s=700
elif(x=="SLEEPER"):
print('sleeper CLASS')
s=900
else:
print("invalid")
return s,x
def assam():
x=input("enter ur choice of
seat(AC1/AC2/AC3/SLEEPER):")
if (x=="AC1"):
print('FIRST CLASS')
s=1000
elif(x=="AC2"):
print('SECOND CLASS')
s=2000
elif(x=="AC3"):
print('third CLASS')
s=3000
elif(x=="SLEEPER"):
print('sleeper CLASS')
s=5000
else:
print("invalid")
return s,x
def ticket_check():
print('1. yes')
print('2. no')
ch = int(input("Check a ticket?"))
if ch == 1:
try:
mycursor.execute(s1)
data = mycursor.fetchall()
DATA = list(data)
except:
print("Not exists")
elif ch == 2:
print("THANK YOU")
else:
print("Error")
def ticket_cancel():
print('1.yes')
print('2.no')
ch=int(input("cancel a ticket?"))
if ch==1:
mycursor.execute(s1)
print("cancelled")
elif ch==2:
print("THANK YOU")
else:
print("error")
def checking_2():
b = input("password: ")
try:
mycursor.execute(c1)
data1 = mycursor.fetchall()[0]
data1 = list(data1)
if data[0]==a:
print("is this ur acc")
mycursor.execute(s1)
data1 = mycursor.fetchall()[0]
data1 = list(data1)
data1=data1[0]+''+data1[1]
mycursor.execute(s1)
data=cursor.fetchall()[0]
data=list(data)
if data[0]==a:
mycursor.execute(s1)
data=curosr.fetchall()[0]
data=list(data)
for i in range(0,6):
print(x[i],":::",data[i])
print('1.yes')
print('2.no')
vi=int(input("enter ur choice:"))
if vi==1:
mycursor.execute(b1)
return True
elif vi==2:
print("sry")
else:
print("error")
else:
print("account does not exist")
def checking_1():
mycursor = mycon.cursor()
try:
n = f + '' + l
b = input("password: ")
d = input("DATE(DD):")
o = input("MONTH(MM):")
B = input("YEAR(YY):")
if b == c:
mycursor.execute(c1)
mycon.commit()
print("Welcome", f, l)
return True
else:
print("Passwords do not match.")
return False
except mys.Error as e:
print("Error:", e)
return False
checking_1()
def checking():
b = input("password: ")
try:
mycursor.execute(c1)
data1 = mycursor.fetchall()[0]
data1 = list(data1)
mycursor.execute(s1)
data2 = mycursor.fetchall()[0]
data2 = list(data2)
if data2[0] == a:
mycursor.execute(s2)
data = mycursor.fetchall()
data1 = list(data)
print(tabulate(data, headers=x, tablefmt="psql"))
return True
else:
return False
except Exception as e:
print("Error:", e)
return False
def checking_3():
b = input("password: ")
try:
mycursor.execute(c1)
data1 = mycursor.fetchall()[0]
data1 = list(data1)
mycursor.execute(s1)
data = mycursor.fetchall()[0]
data = list(data)
if data[0]==a:
mycursor.execute(s1)
data=cursor.fetchall()
data=list(data)
print(tabulate(data,headers=x,tablefmt="pmsql"))
else:
return False
except:
print("account does not exist")