Project 40
Project 40
Project 40
Introduction
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:
Customers: 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: 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.
Prerequisites
MySQL should be installed on our system. Refer to this link to
Download the MySQL installer. Once MySQL Server is installed
properly, we can create databases and tables using MySQL commands
in MySQL Command-Line-Client. MySQL Command Line Client is
installed together with the MySQL Server, so you don’t need to
download and install the MySQL client separately. To check whether
you have the client program on your machine, go to search, and type
“MySQL”. To access MySQL Server from the command-line client,
open the program and enter the password after that, you will be able to
use the client.
The tables used for this Boutique Management System are made using
MySQL Command-Line-Client.
● Further define and refine the functional and data requirements and
document them in the Requirements Document,
● Complete business process reengineering of the functions to be
supported (i.e., verify what information drives the business
process, what information is generated, who generates it, where
does the information go, and who processes it),
● Develop detailed data and process models (system inputs,
outputs, and the process.
● Develop the test and evaluation requirements that will be used to
determine acceptable system performance.
DESIGN PHASE
DEVELOPMENT PHASE
IMPLEMENTATION PHASE
This phase is initiated after the system has been tested and
accepted by the user. In this phase, the system is installed to support
the intended business functions. System performance is compared to
performance objectives established during the planning phase.
9
Implementation includes user notification, user training, installation
of hardware, installation of software onto production computers, and
integration of the system into daily work processes. This phase
continues until the system is operating in production in accordance with
the defined userrequirements.
Creating database
The customer table has 6 columns, which store customer ID, customer
name, last name, customer’s phone number, address of the customer,
and products booked.
create table customer (
cust_id int(8) PRIMARY KEY,
c_nam varchar(30),
c_lnam varchar(30),
c_phno varchar(10),
c_adrs varchar(50),
bkd_pro varchar(40) );
Here cust_id is made the primary key because each customer is
considered to be unique.
1. Check() Function
This function is being used to return a list of IDs of all the customers in
the boutique. At the time of a customer login or new customer, it is
used to check if the customer with
This function is used for employer login and allows the employer to :
View all products
Add a new employee
# For employer login
d = mycur.fetchall()
mycur.execute(qry, val)
mycon.commit()
print('Customer details entered')
ask = input('Do you want to continue (Y/N) ')
if ask not in ('Yy'):
space()
break
def sign_in():
try:
ask = int(input('Enter customer ID to sign in : '))
# Using check function to check whether this account exists
or not
list_of_ids = check()
if ask in list_of_ids:
while True:
print(''' Do you want to :
1) View Bookings
2) Book a product
3) Update Self Details
4) Cancel booked products
enter 'back' to exit ''')
# Take choice of the customer
ccc = input('enter choice - ')
if ccc == '1':
# Get booked product function is used
where cutomer ID
# is passed as an argument
s = get_bkd_pro(ask)
# To check if the column has any value
if s is None or s == ' ':
print('you have not booked products
yet')
else:
''' If more than one products are
booked,
their IDs are stored as a single value
separated by '_' so we have to split
the
string to print each product ID.'''
print('Booked products')
for bkditems in d:
print(bkditems)
if ccc == '2':
else:
prl1 = prl+pro_id
qry2 = 'update customer set
bkd_pro=%s where cust_id=%s;'
# val2 is the new value
containing all booked products
# to be stored in the column
val2 = (prl1+'_', ask)
mycur.execute(qry2, val2)
mycon.commit()
print('Your Product is booked !!')
else:
print('This product does not exists.\
Please write the correct product id!')
if ccc == '3':
qry = 'select
cust_id,c_nam,c_lnam,c_phno,c_adrs\
from customer where cust_id =%s'
mycur.execute(qry, (ask,))
# clist contains list of all values fetched
# in the form of a tuple for this customer ID
clist = mycur.fetchone()
# list of fields to be updated
flds = ['Name', 'Last Name', 'Ph.No',
'Address']
dic = {}
print("Your existing record is :")
# The fetched details are stored in the form
of key
# value pair in a dictionary
for i in range(4):
dic[flds[i]] = clist[i+1]
print(i+1, ' ', flds[i], ' : ', clist[i+1])
for i in range(len(clist)):
updtc = int(input('enter choice to
update '))
upval = input('enter'+flds[updtc-1]+' ')
# Change the value corresponding to the
required field
dic[flds[updtc-1]] = upval
yn = input(
'Do you want to update other
details? y or n ')
if yn in 'Nn':
break
qry = 'update customer set c_nam=
%s,c_lnam=%s,c_phno=%s,\
c_adrs=%s where cust_id=%s;'
updtl = tuple(dic.values())+(ask,)
# The value to be passed along with the
query is a tuple
# containing updated details of the given
customer ID
val = (updtl)
mycur.execute(qry, val)
mycon.commit()
print('Your details are are updated ')
if ccc == '4':
try:
# To get the existing bookings
# Booked products in the table
bkd_pro = get_bkd_pro(ask)
print('Your Booking(s) : \n ', bkd_pro)
if bkd_pro is None or bkd_pro == ' ':
print('you have no bookings to
cancel')
else:
cw = input("To cancel all
products; enter A \nOR \
enter the product code to cancel : ")
if cw in 'Aa':
qry = 'update customer
set bkd_pro=NULL\
where cust_id=%s'
mycur.execute(qry, (ask,))
mycon.commit()
print('All bookings
deleted')
elif cw in bkd_pro:
# If more than one
products entered,
# split them on the basis
of '_'
# x is a list containing all
booked products
x = (bkd_pro[0:-
1]).split('_')
(A). Customer
(B). Employee
(C). Employer
enter e to exit ''')
ch = input('Enter - ')
try:
if ch in 'aA':
print(" 1. Create Account\n 2.Sign In into existing
account")
choice = input('enter- ')
if choice == '1':
cust_ac()
elif choice == '2':
sign_in()
else:
print('Enter correct choice')
if ch in 'bB':
emp_sign_in()
if ch in 'cC':
employer()
elif ch.lower() == "e":
print("Thankyou for visiting !")
break
except Exception:
print('Give the right input')
space()