0% found this document useful (0 votes)
13 views26 pages

Blood Bank

Uploaded by

GeenaJoan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views26 pages

Blood Bank

Uploaded by

GeenaJoan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 26

BLOOD BANK

KASTURBA

ENGLISH MEDIUM SENIOR SECONDARY SCHOOL


Affiliated to CBSE, New Delhi, Aff. No. : 930463

Report on the Computer Project

Name :

Standard : XII Science

Project Guide : Aravind Lakshman

Project : BLOOD BANK

Certified that this is the bonafide report of the project work


of_____________________ in this school submitted for the practical examination
held in 2022, Kasturba School, Manjummel.

Examiner Project Guide Principal


KASTURBA

ENGLISH MEDIUM SENIOR SECONDARY SCHOOL


Affiliated to CBSE, New Delhi, Aff. No. : 930463

Bonafide Certificate

I certify that ______________________ Student of Computer Science

studying in Std XII, Kasturba Senior Secondary School, Manjummel

has successfully completed the project Blood Bank under my

guidance during the year 2021-2022.

Project Guide
INDEX
1. Acknowledgement
2. Aim
3. Apparatus
4. Program Description
5. Program Code
6. MYSQL Table
7.Program Output
ACKNOWLEDGMENT

I would like to express my deep sense of gratitude


to all those who have helped me in completing this project.
I specially thank our sir Aravind Lakshman who
gave me all guidance to complete my project work
successfully .
Apart from it , I acknowledge my parents, group
members who helped me for completing this great task .
Above all I thank the Almighty God for making this project
a great success .

AIM
It is a program based on python connectivity for entering
details of Blood Donors and for updating, deleting details
and also to generate Donor details from it.

APPARATUS
HARDWARE:-
 Logitech Mouse
 Logitech Keyboard
 HP Printer
 Intel Dual Core
 LCD Monitor

SOFTWARE:-

 UBUNTU 2018
 Python IDLE
 MYSQL
 MS Word

PROGRAM DESCRIPTION
This is a user friendly, menu driven program
which allows user to add or delete Donor details and to
modify details of the Donor.
When the program is opened it displays a main
menu . Main menu contains options like show Donor list,
add new Donor, search, modify, delete, locate and exit .
The program is quite interactive and error
messages and success messages are reported wherever
necessary .

PROGRAM
CODE

import mysql.connector as mycon

cn=mycon.connect(host='localhost',user='root',password="",database="b
bank")

cur = cn.cursor()

def showAll():

global cn

global cur
try:

query="select * from Blood_bank"

cur.execute(query)

results = cur.fetchall()

print("**************************************************")

print('%5s'%"SLNO",'%15s'%'DNAME','%12s'%'AGE','%10s'%'BGROUP','%1
5s'%'DMOBILE','%20s'%'ADDRESS')

print("**************************************************")

count=0

for row in results:

print('%5s' %
row[0],'%15s'%row[1],'%12s'%row[2],'%10s'%row[3],'%15s'%row[4],'%20s
'%row[5])

count+=1

print("*************** TOTAL RECORD : ",count,"**********")

except:

print("error")

def dname():

global cn,cur

print("*******************ADD NEW
DONOR**************************")
SLNO = int(input("Enter sl.no :"))

DNAME = input("Enter donor name :")

AGE = int(input("Enter age :"))

BGROUP = input("Enter blood group:")

DMOBILE = int(input("Enter donor mobile.no:"))

ADDRESS = input("Enter donor address:")

query="insert into Blood_bank values("+str(SLNO)


+",'"+DNAME+"',"+str(AGE)+",'"+BGROUP+"',"+str(DMOBILE)
+",'"+ADDRESS+"')"

cur.execute(query)

cn.commit()

#print(query)

print("\n ## RECORD ADDED SUCCESSFULLY!")

def searchdname():

global cn,cur

print("*******************SEARCH BLOOD BANK FORM


**************************")

sno = int(input("Enter SL number to search :"))

query="select * from Blood_bank where SLNO="+str(sno)

cur.execute(query)

results = cur.fetchall()
if cur.rowcount<=0:

print("\## SORRY! NO MATCHING DETAILS AVAILABLE ##")

else:

print("**************************************************")

print('%5s'%"SLNO",'%15s'%'DNAME','%12s'%'AGE','%10s'%'BGROUP','%1
5s'%'DMOBILE','%20s'%'ADDRESS')

print("**************************************************")

for row in results:

print('%5s' %
row[0],'%15s'%row[1],'%12s'%row[2],'%10s'%row[3],'%15s'%row[4],'%20s
'%row[5])

print("-"*50)

def editBBN():

global cn,cur

print("*******************EDIT BLOOD BANK FORM


**************************")

sno = int(input("Enter SL number to edit :"))

query="select * from Blood_bank where SLNO="+str(sno)

cur.execute(query)

results = cur.fetchall()
if cur.rowcount<=0:

print("\## SORRY! NO MATCHING DETAILS AVAILABLE ##")

else:

print("**************************************************")

print('%5s'%"SLNO",'%15s'%'DNAME','%12s'%'AGE','%10s'%'BGROUP','%1
5s'%'DMOBILE','%20s'%'ADDRESS')

print("**************************************************")

for row in results:

print('%5s' %
row[0],'%15s'%row[1],'%12s'%row[2],'%10s'%row[3],'%15s'%row[4],'%20s
'%row[5])

print("-"*50)

ans = input("Are you sure to update ? (y/n)")

if ans=="y" or ans=="Y":

a = int(input("Enter new age to update (enter old value if not to


update) :"))

g = input("Enter new blood group to update (enter old value if not to


update) :")

m = int(input("Enter new mobile.no to update (enter old value if not


to update) :"))
d = input("Enter new adress to update (enter old value if not to
update) :")

query="update Blood_bank set AGE='"+str(a)


+"',BGROUP='"+g+"',DMOBILE='"+str(m)+"',ADDRESS='"+d+"' where
SLNO="+str(sno)

cur.execute(query)

cn.commit()

print("\n## RECORD UPDATED ##")

def delBBN():

global cn,cur

print("*******************DELETE BLOOD BANK FORM


**************************")

sno = int(input("Enter SL number to delete :"))

query="select * from Blood_bank where SLNO="+str(sno)

cur.execute(query)

results = cur.fetchall()

if cur.rowcount<=0:

print("\## SORRY! NO MATCHING DETAILS AVAILABLE ##")

else:

print("**************************************************")
print('%5s'%"SLNO",'%15s'%'DNAME','%12s'%'AGE','%10s'%'BGROUP','%1
5s'%'DMOBILE','%20s'%'ADDRESS')

print("**************************************************")

for row in results:

print('%5s' %
row[0],'%15s'%row[1],'%12s'%row[2],'%10s'%row[3],'%15s'%row[4],'%20s
'%row[5])

print("-"*50)

ans = input("Are you sure to delete ? (y/n)")

if ans=="y" or ans=="Y":

query="delete from Blood_bank where SLNO="+str(sno)

cur.execute(query)

cn.commit()

print("\n## RECORD DELETED ##")

def clear():

for i in range(1,50):

print()

def Dlocation():

global cn,cur
print("*******************DONOR
LOCATION**************************")

sno = input("Enter SL number to get the location:")

query="select ADDRESS from Blood_bank where SLNO="+str(sno)

cur.execute(query)

results = cur.fetchone()

if cur.rowcount<=0:

print("\## SORRY! NO MATCHING DETAILS AVAILABLE ##")

else:

print("**************************************************")

print('%20s'%'ADDRESS')

print("**************************************************")

print('%20s'%results)

print("-"*50)

while True:

print("1. SHOW BLOOD BANK LIST ")

print("2. ADD NEW DONOR DETAILS")

print("3. SEARCH DONOR ")

print("4. EDIT DONOR DETAILS ")


print("5. DELETE DONOR DETAILS ")

print("6. LOCATE DONOR ")

print("7. CONTACT US")

print("0. EXIT")

ans = int(input("Enter your choice :"))

if ans==1:

showAll()

elif ans==2:

dname()

elif ans==3:

searchdname()

elif ans==4:

editBBN()

elif ans==5:

delBBN()

elif ans==6:

Dlocation()

elif ans==7:

print("*"*60)

print(" "*20,"AUTHOR :AMAL V KOSHY")


print(" "*20,"EMAIL :[email protected]")

print("*"*60)

elif ans==0:

print("\nBye!!")

cn.close() break
MYSQL TABLE DESIGN
OUTPUT

MAIN MENU
When Choice = 1

When choice = 2
When Choice = 3

When Choice = 4
When Choice = 5

When Choice = 6
When Choice = 7
When Choice = 0
Bibliography
Together with computer science
https://pythonworld.in/

You might also like