Class 12 Cs Project Library Management System - Compress
Class 12 Cs Project Library Management System - Compress
System
2) Ali Ahmad
—
Computer Science Grade XII
—
Teacher – Mr. Prashant Kumar
Certificate
External
Acknowledgement
1) Problem Statement
2) Current Setup
4) Functionalities Provided
6) Reports Of LMS
7) Software Requirements
8) Hardware Requirements
12) Conclusion
13) Bibliography
Problem statement
● In computer system the person has to fill the various forms and
numbers of copies of the forms can be easily generated at a
time.
● It is not necessary to create the manifest but we can directly
print it, which saves time.
● To assist the staff in capturing the effort spent on their
respective working areas.
● To utilize the resources in an efficient manner by increasing
their productivity through automation.
● The system generates types of information that can be used for
various purposes.
● It satisfies the user requirement.
Systems:
Management Systems:
1)Cataloging of Books
a) Add Book Details -- Add a new book to library
b)Delete Book -- Remove a book from the library
2)Viewing the Data
a) View Book List -- Shows a list of all the books in
the library
b)View Issue List -- Shows a list of books issued to
students/members
3)Management of Issues
Hardware Requirements
Management Systems
● All the fields such as student, Issues, member are validated and
does not take invalid values.
● Avoiding errors in data.
Input/
Output
MySQLsendsoutputviaPython User sends data to Python
after executing the commands
MySQL Python
Command Command
Executer Interpreter
PythonInterpretsthedataand sends
suitable commands toMySQL
Future Scope of the project:
def clear():
uname.delete(0, END)
entry.delete(0, END)
try:
mycon=msql.connect(host='localhost', user='root', passwd='root', database='lib')
if mycon.is_connected():
print('Successfully connected!')
if mycon.is_connected()==False:
print('Error!')
mycon.close()
except:
import mysql.connector
mydb =
mysql.connector.connect( host="local
host",
user="root",
password="root"
)
mycursor = mydb.cursor()
mycursor.execute("CREATE DATABASE lib")
mydb.close()
mydb =
mysql.connector.connect( host="local
host",
user="root",
password="root",
database='lib'
)
mycursor = mydb.cursor()
mycursor.execute("create table books(bid varchar(20) primary key, title varchar(30),
author varchar(30), status varchar(30));")
mycursor.execute("create table books_issued(bid varchar(20) primary key, issuedto
varchar(30), issuedate varchar(20));")
print('Database does not exist!\n---------CREATING DATABASE---------\n DATABASE
CREATED---------\n---------Rerun the Program ')
try:
mycon=msql.connect(host='localhost', user='root', passwd='root', database='login')
if mycon.is_connected():
print('Successfully connected!')
if mycon.is_connected()==False:
print('Error!')
cur=mycon.cursor()
try:
import mysql.connector
mydb =
mysql.connector.connect( host="loc
alhost",
user="root",
password="root",
database='login'
)
mycursor = mydb.cursor()
mycursor.execute("select * from uname;")
f=mycursor.fetchall()
e=('master','root','y')
if e not in f:
mycursor.execute("insert into uname values('master','root','y');")
mydb.commit()
else:
print('continue')
except:
print('continue2')
def next1(event):
entry.focus_set()
def next2(event):
enter.focus_set()
win = Tk()
win.geometry("400x200")
password = StringVar()
username = StringVar()
try:
cur.execute("select * from uname")
f=cur.fetchall()
def log():
p = password.get()
u =
username.get() z =
['y','n']
for i in z:
x = (u,p,i)
if x in f:
win.destroy()
if i=='y':
main()
else:
user()
break
else:
win.mainloop()
except:
print('Cannot fetch data from db')
mycon.close()
except:
import mysql.connector
try:
mycon=msql.connect(host='localhost', user='root', passwd='root', database='login')
mycon.close()
mydb =
mysql.connector.connect( host="loc
alhost",
user="root",
password="root",
database='login'
)
mycursor = mydb.cursor()
mycursor.execute("create table uname(uname varchar(30) primary key, pass
varchar(30), trueadmin varchar(1));")
mycursor.execute("select * from uname;")
f=mycursor.fetchall()
e=('master','root','y')
if e in f:
print('continue')
else:
mycursor.execute("insert into uname values('master','root','y');")
mycursor = mydb.cursor()
mycursor.execute("create table uname(uname varchar(30) primary key, pass varchar(30),
trueadmin varchar(1));")
mycursor.execute("select * from uname;")
f=mycursor.fetchall()
e=('master','root','y')
if e in f:
print('continue')
else:
mycursor.execute("insert into uname values('master','root','y');")
print('Database does not exist!\n---------CREATING DATABASE---------\n DATABASE
CREATED---------\n---------Rerun the Program ')
Functions Used:-
AddBook.py
command=root.destroy) quitBtn.place(relx=0.53,rely=0.9,
relwidth=0.18,relheight=0.08)
root.mainloop()
def bookRegister():
bid = bookInfo1.get()
title = bookInfo2.get()
author = bookInfo3.get()
status = bookInfo4.get()
status = status.lower()
insertBooks = "insert into "+bookTable+" values
('"+bid+"','"+title+"','"+author+"','"+status+"')"
try:
cur.execute(insertBooks)
mycon.commit()
messagebox.showinfo('Success',"Book added successfully")
except:
messagebox.showinfo("Error","Can't add data into Database")
print(bid)
print(title)
print(author)
print(status)
root.destroy()
DeleteBook.py
global bookInfo1,bookInfo2,bookInfo3,bookInfo4,Canvas1,mycon,cur,bookTable,root
root = Tk()
root.title("Library")
root.minsize(width=400,height=400)
root.geometry("600x500")
Canvas1 = Canvas(root)
Canvas1.config(bg="#12a4d9")
Canvas1.pack(expand=True,fill=BOTH)
headingFrame1 = Frame(root,bg="#FFBB00",bd=5)
headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)
headingLabel = Label(headingFrame1, text="Delete Book", bg='black', fg='white',
font=('Courier',15))
headingLabel.place(relx=0,rely=0, relwidth=1, relheight=1)
labelFrame = Frame(root,bg='black')
labelFrame.place(relx=0.1,rely=0.3,relwidth=0.8,relheight=0.5
) # Book ID to Delete
lb2 = Label(labelFrame,text="Book ID : ", bg='black', fg='white')
lb2.place(relx=0.05,rely=0.5)
bookInfo1 = Entry(labelFrame)
bookInfo1.place(relx=0.3,rely=0.5, relwidth=0.62)
#Submit Button
SubmitBtn = Button(root,text="SUBMIT",bg='#d1ccc0', fg='black',command=deleteBook)
SubmitBtn.place(relx=0.28,rely=0.9, relwidth=0.18,relheight=0.08)
quitBtn = Button(root,text="Quit",bg='#f7f1e3', fg='black', command=root.destroy)
quitBtn.place(relx=0.53,rely=0.9, relwidth=0.18,relheight=0.08)
root.mainloop()
IssueBook.py
global bookInfo1 ,bookInfo2, bookInfo3, bookInfo4, Canvas1, mycon, cur, bookTable, root
global issueBtn,labelFrame,lb1,inf1,inf2,inf3,quitBtn,root,Canvas1,status
bookTable = "books"
issueTable = "books_issued"
allBid = []
bid = inf1.get()
issueto = inf2.get()
issuedate = inf3.get()
issueBtn.destroy()
labelFrame.destroy()
lb1.destroy()
inf1.destroy()
inf2.destroy()
inf3.destroy()
extractBid = "select bid from "+bookTable
try:
cur.execute(extractBid)
for i in cur:
allBid.append(i[0])
mycon.commit()
if bid in allBid:
checkAvail = "select status from "+bookTable+" where bid = '"+bid+"'"
cur.execute(checkAvail)
for i in cur:
check = i[0]
if check == 'avail':
status = True
else:
status = False
mycon.commit()
else:
allBid.clear()
messagebox.showinfo('Message',"Book Already Issued")
root.destroy()
return
except:
messagebox.showinfo("Search Error","The value entered is wrong, Try again")
print(bid)
print(issueto)
allBid.clear()
def issueBook():
global issueBtn,labelFrame,lb1,inf1,inf2,inf3,quitBtn,root,Canvas1,status
root = Tk()
root.title("Library")
root.minsize(width=400,height=400)
root.geometry("600x500")
Canvas1 = Canvas(root)
Canvas1.config(bg="#12a4d9")
Canvas1.pack(expand=True,fill=BOTH)
headingFrame1 = Frame(root,bg="#FFBB00",bd=5)
headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)
global bookInfo1 ,bookInfo2, bookInfo3, bookInfo4, Canvas1, mycon, cur, bookTable, root
bookTable = "books_issued"
root = Tk()
root.title("Library")
root.minsize(width=400,height=400)
root.geometry("600x500")
Canvas1 = Canvas(root)
Canvas1.config(bg="#12a4d9")
Canvas1.pack(expand=True,fill=BOTH)
headingFrame1 = Frame(root,bg="#FFBB00",bd=5)
headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)
headingLabel = Label(headingFrame1, text="View Books", bg='black', fg='white', font =
('Courier',15))
headingLabel.place(relx=0,rely=0, relwidth=1, relheight=1)
labelFrame = Frame(root,bg='black')
labelFrame.place(relx=0.1,rely=0.3,relwidth=0.8,relheight=0.5
) y = 0.25
Label(labelFrame, text="%-10s%-40s%-20s"%('BID','Issued To','Issue Date'),
bg='black',fg='white').place(relx=0.07,rely=0.1)
Label(labelFrame, text = "
",bg='black',fg='white').place (relx=0.05,rely=0.2)
getBooks = "select * from "+bookTable
try:
cur.execute(getBooks)
for i in cur:
Label(labelFrame,text="%-10s%-40s%-20s"%(i[0],i[1],i[2])
,bg='black'
, fg='white').place(relx=0.07,rely=y)
y += 0.1
mycon.commit()
except:
messagebox.showinfo("Failed to fetch files from database")
quitBtn = Button(root,text="Quit",bg='#f7f1e3', fg='black', command=root.destroy)
quitBtn.place(relx=0.4,rely=0.9, relwidth=0.18,relheight=0.08)
root.mainloop()
NewUser.py
u = name.get()
b = ent3.get()
print(u,p,b)
sqls="insert into uname values ('"+u+"','"+p+"','"+b+"');"
print(sqls)
cur.execute(sqls)
mycon.commit()
messagebox.showinfo('Success',"User added successfully")
new.destroy()
def y2(event):
p=ent.get()
u = name.get()
b = ent3.get()
print(u,p,b)
sqls="insert into uname values ('"+u+"','"+p+"','"+b+"');"
print(sqls)
cur.execute(sqls)
mycon.commit()
messagebox.showinfo('Success',"User added successfully")
new.destroy()
enter = Button(new, text="Add User", command=y)
enter.bind('<Return>', y2)
enter.pack()
mycon.commit()
ttk.Label(new, text="(Keep hitting Enter to navigate / submit or\n or press button to
submit!)").pack()
new.mainloop()
mycon.close()
ReturnBook.py
# Book ID to Delete
lb1 = Label(labelFrame,text="Book ID : ", bg='black', fg='white')
lb1.place(relx=0.05,rely=0.5)
bookInfo1 = Entry(labelFrame)
bookInfo1.place(relx=0.3,rely=0.5, relwidth=0.62)
#Submit Button
SubmitBtn = Button(root,text="Return",bg='#d1ccc0', fg='black',command=returnn)
SubmitBtn.place(relx=0.28,rely=0.9, relwidth=0.18,relheight=0.08)
quitBtn = Button(root,text="Quit",bg='#f7f1e3', fg='black', command=root.destroy)
quitBtn.place(relx=0.53,rely=0.9, relwidth=0.18,relheight=0.08)
root.mainloop()
ViewBooks.py
global bookInfo1 ,bookInfo2, bookInfo3, bookInfo4, Canvas1, mycon, cur, bookTable, root
bookTable = "books"
root = Tk()
root.title("Library")
root.minsize(width=400,height=400)
root.geometry("600x500")
Canvas1 = Canvas(root)
Canvas1.config(bg="#12a4d9")
Canvas1.pack(expand=True,fill=BOTH)
headingFrame1 = Frame(root,bg="#FFBB00",bd=5)
headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)
headingLabel = Label(headingFrame1, text="View Books", bg='black', fg='white', font =
('Courier',15))
headingLabel.place(relx=0,rely=0, relwidth=1, relheight=1)
labelFrame = Frame(root,bg='black')
labelFrame.place(relx=0.1,rely=0.3,relwidth=0.8,relheight=0.5
) y = 0.25
Label(labelFrame, text="%-10s%-40s%-30s%-20s"%('BID','Title','Author','Status'),
bg='black',fg='white').place(relx=0.07,rely=0.1)
Label(labelFrame, text = "
",bg='black',fg='white').place (relx=0.05,rely=0.2)
getBooks = "select * from "+bookTable
try:
cur.execute(getBooks)
for i in cur:
Label(labelFrame,text="%-10s%-30s%-30s%-20s"%(i[0],i[1],i[2],i[3]) ,bg='black',
fg='white').place(relx=0.07,rely=y)
y += 0.1
mycon.commit()
except:
messagebox.showinfo("Error","Failed to fetch files from database")
def export():
ex='select * from books'
cur.execute(ex)
l=cur.fetchall()
fh=open(".//Exports//data.txt","w")
for i in l:
i=str(i)+'\n'
fh.write(str(i))
messagebox.showinfo("Success","File exported to CS_Project/Exports/data.txt")
quitBtn = Button(root,text="Quit",bg='#f7f1e3', fg='black', command=root.destroy)
quitBtn.place(relx=0.6,rely=0.9, relwidth=0.18,relheight=0.08)
exBtn = Button(root,text="Export",bg='#f7f1e3', fg='black', command=export)
exBtn.place(relx=0.2,rely=0.9, relwidth=0.18,relheight=0.08)
root.mainloop()
Output
Login:
Add Books:
Delete Book:
View Books:
Issue List:
Issue Books:
Return Book:
Management Systems:
2) google.com
3) slideshare.in
4) github.com
THANK YOU