Cs Project With Edit
Cs Project With Edit
import mysql.connector
DB=mysql.connector.connect(host="localhost",
user="root",
password="ashish",
database="book_store"
C=DB.cursor()
#ADMIN FUNCTIONS
def ADD():
genre=str(input("Genre:"))
quantity=int(input("Enter quantity:"))
DB.commit()
print("""++++++++++++++++++++++++SUCCESSFULLY
ADDED++++++++++++++++++++++++""")
n=int(input("""Want To Continue:
Yes: 1
NO: 2
OPTION: """ ))
if n==1:
ADD()
if n==2:
Staff()
def NewStaff():
fname=str(input("Enter Fullname:"))
gender=str(input("Gender(M/F/O):"))
age=int(input("Age:"))
add=str(input("Address:"))
DB.commit()
print("""+++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++""")
n=int(input("""Want To Continue:
Yes: 1
NO: 2
OPTION: """ ))
if n==1:
NewStaff()
if n==2:
Staff()
def RemoveStaff():
DB.commit()
n=int(input("""Want To Continue:
Yes: 1 NO: 2
OPTION: """ ))
if n==1:
RemoveStaff()
if n==2:
Staff()
def StaffDetailfS():
C.execute(spl_statement)
output =C.fetchall()
for x in output:
print("************************************")
print("************************************")
n=int(input("""Want To Continue:
Yes: 1 NO: 2
OPTION: """ ))
if n==1:
StaffDetail()
if n==2:
Staff()
def SellRec():
for u in C:
print("*********************************************")
print("**********************************************")
n=int(input("""Want To Continue:
Yes: 1
NO: 2
OPTION: """ ))
if n==1:
SellRec()
if n==2:
Staff()
def DelRec():
if bb=="Y":
DB.commit()
n=int(input("""Want To Continue:
Yes: 1 NO: 2
OPTION: """ ))
if n==1:
DelRec()
if n==2:
Staff()
def TotalIncome():
for x in C:
n=int(input("""Want To Continue:
Yes: 1 NO: 2
OPTION: """ ))
if n==1:
TotalIncome()
if n==2:
Staff()
def AvailablefS():
for v in C:
print("****************************************************")
print("****************************************************")
n=int(input("""Want To Continue:
Yes: 1 NO: 2
OPTION: """ ))
if n==1:
AvailablefS()
if n==2:
Staff()
#***************************************BUYER
FUNCTION********************************************
def AvailablefU():
print("****************************************************")
print("****************************************************")
n=int(input("""Want To Continue:
Yes: 1 NO: 2
OPTION: """ ))
if n==1:
AvailablefU()
if n==2:
Buyer()
def StaffDetailfU():
C.execute(spl_statement)
output =C.fetchall()
for x in output:
print("************************************")
print("************************************")
n=int(input("""Want To Continue:
Yes: 1 NO: 2
OPTION: """ ))
if n==1:
StaffDetailfU()
if n==2:
Buyer()
def Purchase():
print("AVAILABLE BOOKS...")
for i in C:
print("****************************************************")
print("****************************************************")
cusname=str(input("Enter customer name:"))
n=int(input("Enter quantity:"))
k=C.fetchone()
if max(k)<n:
else:
log=C.fetchone()
DB.commit()
print("""++++++++++++++++++++++
++++++++++++++++++++++""")
else:
n=int(input("""Want To Continue:
Yes: 1 NO: 2
OPTION: """ ))
if n==1:
Purchase()
if n==2:
Buyer()
def UsingName():
t=C.fetchone()
if t != None:
print("""++++++++++++++++++++
++BOOK IS IN STOCK++
++++++++++++++++++++""")
else:
n=int(input("""Want To Continue:
Yes: 1
NO: 2
OPTION: """ ))
if n==1:
UsingName()
if n==2:
Buyer()
def UsingGenre():
poll=C.fetchall()
print("""++++++++++++++++++++
++BOOK IS IN STOCK++
++++++++++++++++++++""")
for y in C:
print("*******************************************")
print("*******************************************")
else:
print("BOOKS OF SUCH GENRE ARE NOT AVAILABLE!!!!!!!!!")
n=int(input("""Want To Continue:
Yes: 1
NO: 2
OPTION: """ ))
if n==1:
UsingGenre()
if n==2:
Buyer()
def UsingAuthor():
t=C.fetchone()
if t != None:
print("""++++++++++++++++++++
++BOOK IS IN STOCK++
++++++++++++++++++++""")
else:
n=int(input("""Want To Continue:
Yes: 1
NO: 2
OPTION: """ ))
if n==1:
UsingGenre()
if n==2:
Buyer()
def Staff():
2.Staff Details
3.Sell Record
6. Exit""")
if n==1:
ADD()
if n==2:
2:Remove staff
if ch==1:
NewStaff()
#REMOVE STAFF
if ch==2:
RemoveStaff()
if ch==3:
StaffDetail()
if n==3:
if ty==1:
SellRec()
if ty==2:
DelRec()
TotalIncome()
if n==5:
AvailablefS()
#Break
if n==6:
return
def Buyer():
#USER Choices
print("""1.Purchase Books
2.Search Books
3.Available Books
4.Staff Details
5. Exit""")
if r==1:
Purchase()
#Searching of books using Name,Genre,Author
if r==2:
print("""1:Search by name
2:Search by genre
3:Search by author""")
if l==1:
UsingName()
if l==2:
UsingGenre()
if l==3:
UsingAuthor()
if r==3:
AvailablefU()
StaffDetail()
#MAIN PROGRAM
print("**********************************************Welcome To Book
Store***************************************************")
while 1:
a=int(input("""Enter as Employee: 1
Enter as User: 2
Exit : 3
Enter : """ ))
if a==1:
Staff()
if a==2:
print('''''****************BOOK SHOP*********************
1. Signup
2. login''')
#Sign-Up
if s==1:
user_name=input("USERNAME(ex: abcd1234): ")
password=input("PASSWORD: ")
DB.commit()
print("Sign Up Completed")
#Log in
else:
b=C.fetchone()
a2=C.fetchone()
if a2 is not None:
print("************************Login Success********************")
Buyer()
if a==3:
break