Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- import random
- import mysql.connector as my
- mydb=my.connect(host='localhost',user='root',database='movie')
- cur=mydb.cursor()
- cur.execute("create database if not exists movie")
- cur.execute("use movie")
- choice=None
- while choice!=0:
- print(" If EMPLOYEE press 1.")
- print("If CUSTOMER press 2.")
- print("To exit press 0")
- choice=int(input("Enter choice: "))
- if choice==0:
- print("Thank you for visting our site. Have a nice day")
- break
- if choice==1:
- password=int(input("Enter passcode: "))
- if password!=12345:
- print("!!!INCORRECT PASSWORD!!!")
- print(" # SYSTEM SHUTTING DOWN # ")
- choice=0
- while password==12345:
- print("\n\n\n")
- print("0. EXIT")
- print("1. VIEW ALL SHOWS RUNNING AND SEATS BOOKED")
- print("2. ADD NEW MOVIE")
- print("3. ADD NEW SHOW")
- print("4. DELETE SHOWS RUNNING")
- print("5. VIEW BOOKINGS")
- c=int(input("Enter choice: "))
- if c==5:
- query="SELECT*FROM customer"
- cur.execute(query)
- for j in cur.description:
- print(j[0].upper(),end="::")
- print()
- for i in cur:
- print(i)
- if c==1:
- query="SELECT*FROM booking"
- cur.execute(query)
- for j in cur.description:
- print(j[0].upper(),end="::")
- print()
- for i in cur:
- print(i)
- if c==2:
- print("\n")
- a=input(" Enter movie code ")
- b=input(" Enter movie name ")
- b=b.capitalize()
- c=input(" Enter hall no. ")
- c=c.capitalize()
- d=input(" Enter duration ")
- f=input(" Enter language ")
- f=f.capitalize()
- query=("INSERT INTO schedule VALUES('{}','{}','{}','{}','{}')").format(a,c,b,d,f)
- cur.execute(query)
- mydb.commit()
- print("Movie has been added")
- if c==3:
- a=input(" Enter movie code ")
- e=input("Enter start time in HH:MM format including ':' ")
- g=input("Enter date in DD/MM/YYYY format including '/' ")
- query1=("INSERT INTO booking VALUES('{}','{}','{}','10','1,2,3,4,5,6,7,8,9,10',NULL)").format(a,e,g)
- cur.execute(query1)
- mydb.commit()
- print("Show has been added")
- if c==4:
- print("\n")
- a=input("Enter movie code ")
- e=input("Enter start time in HH:MM format including ':' ")
- g=input("Enter date in DD/MM/YYYY format including '/' ")
- query=("DELETE*from booking where movie_code='{}' and timing='{}' and show_date='{}'").format(a,e,g)
- cur.execute(query)
- query=("DELETE*from customer where movie_code='{}' and timing='{}' and show_date='{}'").format(a,e,g)
- cur.execute(query)
- mydb.commit()
- print("The show has been deleted")
- if c==0:
- password=1
- print("\n\n")
- if choice==2:
- while choice==2:
- print("\n\n")
- print("0. EXIT")
- print("1. VIEW ALL MOVIES RUNNING")
- print("2. BOOK SEATS")
- print("3. SEARCH FOR YOUR BOOKING")
- ch=int(input("Enter your choice "))
- if ch==2:
- query="SELECT*FROM schedule"
- cur.execute(query)
- for j in cur.description:
- print(j[0].upper(),end="::")
- print()
- for i in cur:
- print(i)
- print("\n\n")
- a=input("Enter the movie code from the above running shows ")
- query=("SELECT*FROM booking where movie_code='{}'").format(a)
- cur.execute(query)
- for j in cur.description:
- print(j[0].upper(),end="::")
- print()
- for i in cur:
- print(i)
- print("\n\n")
- x=input("Enter preffered show date in DD/MM/YYYY format including '/' ")
- y=input("Enter your preffered timing in 24 hours format(HH:MM) including ':' ")
- print("\n\n")
- print("1. To book a single seat")
- print("2. To book a multiple seats")
- b=int(input("Enter your choice "))
- l=[]
- query=("Select*from booking where movie_code='{}' and timing='{}' and show_date='{}'").format(a,y,x)
- cur.execute(query)
- for j in cur.description:
- print(j[0].upper(),end=" ")
- print()
- for i in cur:
- print(i,end=",")
- print()
- if b==1:
- z=input("Enter your preferred seat no. ")
- query=("Select total_available,seat_no_available,seat_booked from booking where movie_code='{}' and timing='{}' and show_date='{}'").format(a,y,x)
- cur.execute(query)
- l1=[]
- l2=[]
- l3=[]
- for i in cur:
- l1=i[0]
- l2=i[1]
- l3=i[2]
- if l3==None:
- l3=z
- l3=l3.split(',')
- else:
- l3=l3.split(',')
- l3.append(z)
- l2=l2.split(",")
- l2.remove(z)
- l1=int(l1)-1
- l2=",".join(l2)
- l3=",".join(l3)
- query=("delete from booking where movie_code='{}' and timing='{}' and show_date='{}' ").format(a,y,x)
- query1=("insert into booking values('{}','{}','{}','{}','{}','{}')").format(a,y,x,l1,l2,l3)
- cur.execute(query)
- cur.execute(query1)
- na=input("Enter your name ")
- em=input("Enter your email address ")
- mo=input("Enter your mobile number ")
- bo=random.randint(10000,99999)
- co='Rs.500'
- query=("insert into customer values('{}','{}','{}','{}','{}','{}','{}','{}','{}')").format(bo,na,em,mo,z,a,co,y,x)
- cur.execute(query)
- print("Your booking has been confirmed")
- print()
- print("Your booking id is",bo,"Please remember it for future purposes")
- print()
- print("The total cost is Rs.",co,"Pay it at the counter in the hall")
- print('\n')
- print("#General guidelines#\n* Theatre operators to promote advance booking and keep counters open the whole day.")
- print("\n* Frequent visits outside the hall during intermission/break should be avoided by customers.")
- print("\n* Use of the Aarogya Setu app advised in the guidelines.")
- print( "\n* Government has also advised in favour of cashless transactions")
- print( "\n* No spitting will be allowed outside or inside the premises of the cinema halls.")
- print("\n* The cinema halls are to function on only half of their seating capacity.")
- print("\n* One seat will be kept vacant between two persons in the cinema hall")
- print( "\n* Cinema halls will keep the temperature of the hall fixed at 23 degree celsius.")
- print("\n* Proper ventilation in the hall is mandated to avoid the spread of the infection.")
- print( "\n* In order to avoid crowding at the end of the show, shows will be timed in a staggered manner.")
- print( "\n* Adequate number of ticket counters to avoid crowding at the counters.")
- print("\n\n#Guidelines for Theatre Entry#")
- print("\n* Mandatory thermal screening at the entry gates.")
- print("\n* Only asymptomatic individuals will be let inside the theatre.")
- print("\n* All the people will have to keep their face mask on throughout the entire duration of the film.")
- print("THANK YOU FOR YOUR COOPERATION.")
- mydb.commit()
- if b==2:
- z=input("Enter your preferred seat no. seperated by comma ")
- z=z.split(',')
- query=("Select total_available,seat_no_available,seat_booked from booking where movie_code='{}' and timing='{}' and show_date='{}'").format(a,y,x)
- cur.execute(query)
- t=[]
- for i in cur:
- l1=i[0]
- l2=i[1]
- l3=i[2]
- l2=l2.split(',')
- for i in z:
- if i in l2:
- t.append(i)
- else:
- print(i," seat not available")
- z=t
- t=[]
- for i in l2:
- if i not in z:
- t.append(i)
- l2=t
- if l3==None:
- l3=z
- else:
- l3=l3.split(',')
- for i in z:
- l3.append(i)
- l1=int(l1)-len(z)
- l2=",".join(l2)
- l3=",".join(l3)
- z=",".join(z)
- query=("delete from booking where movie_code='{}' and timing='{}' and show_date='{}' ").format(a,y,x)
- query1=("insert into booking values('{}','{}','{}','{}','{}','{}')").format(a,y,x,l1,l2,l3)
- cur.execute(query)
- cur.execute(query1)
- na=input("Enter your name ")
- em=input("Enter your email address ")
- mo=input("Enter your mobile number ")
- bo=random.randint(10000,99999)
- co1=500*len(z)
- co='Rs.'+str(co1)
- query=("insert into customer values('{}','{}','{}','{}','{}','{}','{}','{}','{}')").format(bo,na,em,mo,z,a,co,y,x)
- cur.execute(query)
- print("Your booking has been confirmed")
- print()
- print("Your booking id is",bo,"Please remember it for future purposes")
- print()
- print("The total cost is Rs.",co,"Pay it at the counter in the hall")
- mydb.commit()
- print('\n')
- print("#General guidelines#\n* Theatre operators to promote advance booking and keep counters open the whole day.")
- print("\n* Frequent visits outside the hall during intermission/break should be avoided by customers.")
- print("\n* Use of the Aarogya Setu app advised in the guidelines.")
- print( "\n* Government has also advised in favour of cashless transactions")
- print( "\n* No spitting will be allowed outside or inside the premises of the cinema halls.")
- print("\n* The cinema halls are to function on only half of their seating capacity.")
- print("\n* One seat will be kept vacant between two persons in the cinema hall")
- print( "\n* Cinema halls will keep the temperature of the hall fixed at 23 degree celsius.")
- print("\n* Proper ventilation in the hall is mandated to avoid the spread of the infection.")
- print( "\n* In order to avoid crowding at the end of the show, shows will be timed in a staggered manner.")
- print( "\n* Adequate number of ticket counters to avoid crowding at the counters.")
- print("\n\n#Guidelines for Theatre Entry#")
- print("\n* Mandatory thermal screening at the entry gates.")
- print("\n* Only asymptomatic individuals will be let inside the theatre.")
- print("\n* All the people will have to keep their face mask on throughout the entire duration of the film.")
- print("THANK YOU FOR YOUR COOPERATION.")
- if ch==0:
- print("\n\n")
- break
- if ch==3:
- print("1. To search by booking id")
- print("2. To search by phone number")
- tr=int(input("Enter your choice "))
- if tr==1:
- a=int(input("Enter your booking id "))
- query=("select*from customer where booking_id='{}'").format(a)
- cur.execute(query)
- for j in cur.description:
- print(j[0].upper(),end="::")
- print()
- for i in cur:
- print(i)
- if tr==2:
- a=input("Enter your phone number ")
- query=("select*from customer where mob_no='{}'").format(a)
- cur.execute(query)
- for j in cur.description:
- print(j[0].upper(),end="::")
- print()
- for i in cur:
- print(i)
- if ch==1:
- query="SELECT*FROM schedule"
- cur.execute(query)
- for j in cur.description:
- print(j[0].upper(),end="::")
- print()
- for i in cur:
- print(i)
Advertisement
Add Comment
Please, Sign In to add comment