Professional Documents
Culture Documents
Mini Project Boutique-1
Mini Project Boutique-1
DATE:
BOUTIQUE MANAGEMENT SYSTEM
Aim:
To design and implement an application “Boutique Management System”.
Theory:
This is a boutique management system made using MySQL connectivity with Python. It uses a
MySQL database to store data in the form of tables and to maintain a proper record of all details.
Different SQL queries that include DDL, DQL, DML, and DCL commands are used in this project which
is useful to perform CRUD (Create, Read, Update, Delete) operations using MySQL. This
management system provides a common platform for customers, employees, as well employers to
use the services. The various functionalities provided in this system are:
Customer can create their accounts, sign in to their accounts and perform various operations such as
book their orders, view booking, delete bookings and update their details.Employees can sign in to
their account using their employee id and perform operations such as updating delivered orders of
customers, adding a new product, and deleting a product.
PROGRAM :
PYTHON CODE :
import mysql.connector
mycon = mysql.connector.connect(
host='localhost', user='root',
password='password', database='sboutique')
mycur = mycon.cursor()
def space():
for i in range(1):
print()
# To check if a customer of a given ID exists or not
def check():
mycur.execute(qry)
Each tuple contains a single element as only customer IDs are fetched
d = mycur.fetchall()
list_of_ids = []
for ids in d:
list_of_ids.append(ids[0])
return list_of_ids
def cust_ac():
ask = 'Y'
list_of_ids = check()
if custid in list_of_ids:
c_det = ()
''' Values inserted in the table and default NULL value are
val = c_det
mycur.execute(qry, val)
mycon.commit()
space()
break
def get_bkd_pro(cust_id):
mycur.execute(qry, (cust_id,))
bp = mycur.fetchone()
bkd_pro = bp[0]
return bkd_pro
def sign_in():
try:
list_of_ids = check()
if ask in list_of_ids:
while True:
1) View Bookings
2) Book a product
if ccc == '1':
# is passed as an argument
s = get_bkd_pro(ask)
else:
d = s.split('_')
print('Booked products')
for bkditems in d:
print(bkditems)
if ccc == '2':
mycur.execute(qry)
pro_list = mycur.fetchall()
list_of_products = []
for i in pro_list:
list_of_products.append(i[0])
if pro_id in list_of_products:
pr = mycur.fetchone()
prl = pr[0]
mycur.execute(qry, val)
mycon.commit()
else:
prl1 = prl+pro_id
mycur.execute(qry2, val2)
mycon.commit()
else:
if ccc == '3':
qry = 'select cust_id,c_nam,c_lnam,c_phno,c_adrs\
mycur.execute(qry, (ask,))
clist = mycur.fetchone()
dic = {}
for i in range(4):
dic[flds[i]] = clist[i+1]
for i in range(len(clist)):
dic[flds[updtc-1]] = upval
yn = input(
if yn in 'Nn':
break
updtl = tuple(dic.values())+(ask,)
mycur.execute(qry, val)
mycon.commit()
if ccc == '4':
try:
bkd_pro = get_bkd_pro(ask)
else:
if cw in 'Aa':
where cust_id=%s'
mycur.execute(qry, (ask,))
mycon.commit()
elif cw in bkd_pro:
x = (bkd_pro[0:-1]).split('_')
updt_pro = ''
for item in x:
updt_pro = updt_pro+item+'_'
mycur.execute(qry, val)
mycon.commit()
except Exception:
if ccc.lower() == 'back':
space()
break
else:
except Exception:
def view_pro():
mycur.execute(qry)
d = mycur.fetchall()
dic = {}
# Each record fetched is separated into a key value pair
for i in d:
dic[i[0]] = i[1:]
print('_'*80)
print('_'*80)
for k, v in dic.items():
a, b, c = v
print('_'*80)
def addpro():
view_pro()
for j in range(n):
# product details.
t = ()
mycur.execute(qry, val)
mycon.commit()
print("Product Added")
def delpro():
view_pro()
mycur.execute(qry, (delt,))
mycon.commit()
print("Product is deleted")
def emp_sign_in():
try:
mycur.execute(qry)
d = mycur.fetchall()
lis = []
for i in d:
lis.append(i[0])
else:
while True:
space()
ccc = input("1. Update delivered records\n
3. Delete a product \n
if ccc == '1':
bkd_pro = get_bkd_pro(cust_id)
else:
if pro_id in bkd_pro:
x = (bkd_pro[0:-1]).split('_')
x.remove(pro_id)
updt_pro = ''
for i in x:
updt_pro = updt_pro+i+'_'
where cust_id=%s;'
mycur.execute(qry, val)
mycon.commit()
else:
addpro()
delpro()
break
except Exception:
def addemp():
mycur.execute(qry)
emp_list = mycur.fetchall()
ne = []
t = ()
print('Name ')
print('Address ')
# of employees to be added
ne = ne+[t, ]
for i in range(len(ne)):
val = ne[i]
mycur.execute(qry, val)
mycon.commit()
space()
def employer():
while True:
print()
if ccc == '1':
view_pro()
if ccc == '2':
addemp()
if ccc.lower() == "back":
break
print('WELCOME !')
while True:
print('''Are you a :
(A). Customer
(B). Employee
(C). Employer
ch = input('Enter - ')
try:
if ch in 'aA':
if choice == '1':
cust_ac()
sign_in()
else:
if ch in 'bB':
emp_sign_in()
if ch in 'cC':
employer()
break
except Exception:
space()
MySQL CODE :
Checking the table structure and data stored in the table
OUTPUT :
RESULT :
Thus the application for Boutique Management system is designed and implemented successfully.