Skip to content

Commit c877be5

Browse files
authored
First Commit
0 parents  commit c877be5

File tree

7 files changed

+598
-0
lines changed

7 files changed

+598
-0
lines changed

AddBook.py

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
from tkinter import *
2+
from PIL import ImageTk,Image
3+
from tkinter import messagebox
4+
import cx_Oracle
5+
6+
# Insert data to the Table
7+
def bookRegister():
8+
9+
bid = bookInfo1.get()
10+
pubid = bookInfo2.get()
11+
title = bookInfo3.get()
12+
author = bookInfo4.get()
13+
ISBN = bookInfo5.get()
14+
No_of_Books = bookInfo6.get()
15+
16+
sql = """ INSERT into Books values (:1,:2,:3,:4,:5,:6) """
17+
try:
18+
cur.execute(sql, [bid, pubid, title, author, ISBN, No_of_Books])
19+
con.commit()
20+
messagebox.showinfo('Success',"Book added successfully")
21+
except:
22+
messagebox.showinfo("Error","Can't add data into Database")
23+
24+
print(bid)
25+
print(title)
26+
print(author)
27+
print(pubid)
28+
print(ISBN)
29+
print(No_of_Books)
30+
root.destroy()
31+
32+
33+
def addBook():
34+
35+
global bookInfo1 ,bookInfo2, bookInfo3, bookInfo4, bookInfo5, bookInfo6, Canvas1, con, cur,bookTable, root
36+
37+
root = Tk()
38+
root.title("Library")
39+
root.minsize(width=400,height=400)
40+
root.geometry("600x500")
41+
42+
try:
43+
44+
con = cx_Oracle.connect('system/system@localhost')
45+
cur = con.cursor()
46+
print(con.version)
47+
48+
except cx_Oracle.DatabaseError as e:
49+
print("There is a problem with Oracle", e)
50+
51+
# Enter Table Names here
52+
bookTable = "Books" # Book Table
53+
54+
Canvas1 = Canvas(root)
55+
56+
Canvas1.config(bg="#9acd32")
57+
Canvas1.pack(expand=True,fill=BOTH)
58+
59+
headingFrame1 = Frame(root,bg="#FFBB00",bd=5)
60+
headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)
61+
62+
headingLabel = Label(headingFrame1, text="Add Books", bg='black', fg='white', font=('Courier',15))
63+
headingLabel.place(relx=0,rely=0, relwidth=1, relheight=1)
64+
65+
66+
labelFrame = Frame(root,bg='black')
67+
labelFrame.place(relx=0.1,rely=0.4,relwidth=0.8,relheight=0.4)
68+
69+
# Book ID
70+
lb1 = Label(labelFrame,text="Book ID : ", bg='black', fg='white')
71+
lb1.place(relx=0.05,rely=0.2, relheight=0.08)
72+
73+
bookInfo1 = Entry(labelFrame)
74+
bookInfo1.place(relx=0.3,rely=0.2, relwidth=0.62, relheight=0.08)
75+
76+
# Publisher ID
77+
lb2 = Label(labelFrame,text="Publisher ID : ", bg='black', fg='white')
78+
lb2.place(relx=0.05,rely=0.3, relheight=0.08)
79+
80+
bookInfo2 = Entry(labelFrame)
81+
bookInfo2.place(relx=0.3,rely=0.3, relwidth=0.62, relheight=0.08)
82+
83+
# Title
84+
lb3 = Label(labelFrame,text="Title : ", bg='black', fg='white')
85+
lb3.place(relx=0.05,rely=0.4, relheight=0.08)
86+
87+
bookInfo3 = Entry(labelFrame)
88+
bookInfo3.place(relx=0.3,rely=0.4, relwidth=0.62, relheight=0.08)
89+
90+
# Book Author
91+
lb4 = Label(labelFrame,text="Author : ", bg='black', fg='white')
92+
lb4.place(relx=0.05,rely=0.50, relheight=0.08)
93+
94+
bookInfo4 = Entry(labelFrame)
95+
bookInfo4.place(relx=0.3,rely=0.50, relwidth=0.62, relheight=0.08)
96+
97+
# Book ISBN
98+
lb5 = Label(labelFrame,text="ISBN", bg='black', fg='white')
99+
lb5.place(relx=0.05,rely=0.6, relheight=0.08)
100+
101+
bookInfo5 = Entry(labelFrame)
102+
bookInfo5.place(relx=0.3,rely=0.6, relwidth=0.62, relheight=0.08)
103+
104+
# No. of books
105+
lb6 = Label(labelFrame,text="No. of books", bg='black', fg='white')
106+
lb6.place(relx=0.05,rely=0.7, relheight=0.08)
107+
108+
bookInfo6 = Entry(labelFrame)
109+
bookInfo6.place(relx=0.3,rely=0.7, relwidth=0.62, relheight=0.08)
110+
111+
#Submit Button
112+
SubmitBtn = Button(root,text="SUBMIT",bg='#d1ccc0', fg='black',command=bookRegister)
113+
SubmitBtn.place(relx=0.28,rely=0.9, relwidth=0.18,relheight=0.08)
114+
115+
print('Submit Button:')
116+
quitBtn = Button(root,text="Quit",bg='#f7f1e3', fg='black', command=root.destroy)
117+
quitBtn.place(relx=0.53,rely=0.9, relwidth=0.18,relheight=0.08)
118+
119+
root.mainloop()

IssueBook.py

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
from tkinter import *
2+
from PIL import ImageTk,Image
3+
from tkinter import messagebox
4+
import cx_Oracle
5+
6+
def bookissue():
7+
8+
Cust_id = bookInfo1.get()
9+
Book_id = bookInfo2.get()
10+
Issue_date = bookInfo3.get()
11+
Return_date = bookInfo4.get()
12+
B_ID = bookInfo5.get()
13+
S_id = bookInfo6.get()
14+
15+
sql = """ INSERT into Issue values (:1,:2,:3,:4,:5,:6) """
16+
try:
17+
cur.execute(sql, [Cust_id, Book_id, Issue_date, Return_date, B_ID, S_id])
18+
con.commit()
19+
messagebox.showinfo('Success',"Book Issued successfully! Please return it on time")
20+
except:
21+
messagebox.showinfo("Error","Can't add data into Database")
22+
23+
print(Cust_id)
24+
print(Book_id)
25+
print(Issue_date)
26+
print(Return_date)
27+
print(B_ID)
28+
print(S_id)
29+
root.destroy()
30+
31+
32+
def issueBook():
33+
34+
global bookInfo1 ,bookInfo2, bookInfo3, bookInfo4, bookInfo5, bookInfo6, Canvas1, con, cur,bookTable, root
35+
36+
root = Tk()
37+
root.title("Issue Book")
38+
root.minsize(width=400,height=400)
39+
root.geometry("600x500")
40+
41+
try:
42+
43+
con = cx_Oracle.connect('system/system@localhost')
44+
cur = con.cursor()
45+
print(con.version)
46+
47+
except cx_Oracle.DatabaseError as e:
48+
print("There is a problem with Oracle", e)
49+
50+
# Enter Table Names here
51+
bookTable = "Issue" # Book Table
52+
53+
Canvas1 = Canvas(root)
54+
55+
Canvas1.config(bg="#ffff66")
56+
Canvas1.pack(expand=True,fill=BOTH)
57+
58+
headingFrame1 = Frame(root,bg="#FFBB00",bd=5)
59+
headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)
60+
61+
headingLabel = Label(headingFrame1, text="Issue Books", bg='black', fg='white', font=('Courier',15))
62+
headingLabel.place(relx=0,rely=0, relwidth=1, relheight=1)
63+
64+
65+
labelFrame = Frame(root,bg='black')
66+
labelFrame.place(relx=0.1,rely=0.4,relwidth=0.8,relheight=0.4)
67+
68+
# Book ID
69+
lb1 = Label(labelFrame,text="Customer ID : ", bg='black', fg='white')
70+
lb1.place(relx=0.05,rely=0.2, relheight=0.08)
71+
72+
bookInfo1 = Entry(labelFrame)
73+
bookInfo1.place(relx=0.3,rely=0.2, relwidth=0.62, relheight=0.08)
74+
75+
# Publisher ID
76+
lb2 = Label(labelFrame,text="Book ID : ", bg='black', fg='white')
77+
lb2.place(relx=0.05,rely=0.3, relheight=0.08)
78+
79+
bookInfo2 = Entry(labelFrame)
80+
bookInfo2.place(relx=0.3,rely=0.3, relwidth=0.62, relheight=0.08)
81+
82+
# Title
83+
lb3 = Label(labelFrame,text="Issue Date : ", bg='black', fg='white')
84+
lb3.place(relx=0.05,rely=0.4, relheight=0.08)
85+
86+
bookInfo3 = Entry(labelFrame)
87+
bookInfo3.place(relx=0.3,rely=0.4, relwidth=0.62, relheight=0.08)
88+
89+
# Book Author
90+
lb4 = Label(labelFrame,text="Return Date : ", bg='black', fg='white')
91+
lb4.place(relx=0.05,rely=0.50, relheight=0.08)
92+
93+
bookInfo4 = Entry(labelFrame)
94+
bookInfo4.place(relx=0.3,rely=0.50, relwidth=0.62, relheight=0.08)
95+
96+
# Book ISBN
97+
lb5 = Label(labelFrame,text="Branch ID", bg='black', fg='white')
98+
lb5.place(relx=0.05,rely=0.6, relheight=0.08)
99+
100+
bookInfo5 = Entry(labelFrame)
101+
bookInfo5.place(relx=0.3,rely=0.6, relwidth=0.62, relheight=0.08)
102+
103+
# No. of books
104+
lb6 = Label(labelFrame,text="Staff ID", bg='black', fg='white')
105+
lb6.place(relx=0.05,rely=0.7, relheight=0.08)
106+
107+
bookInfo6 = Entry(labelFrame)
108+
bookInfo6.place(relx=0.3,rely=0.7, relwidth=0.62, relheight=0.08)
109+
110+
#ISSUE Button
111+
SubmitBtn = Button(root,text="ISSUE",bg='#d1ccc0', fg='black',command=bookissue)
112+
SubmitBtn.place(relx=0.28,rely=0.9, relwidth=0.18,relheight=0.08)
113+
114+
print('Submit Button:')
115+
quitBtn = Button(root,text="Quit",bg='#f7f1e3', fg='black', command=root.destroy)
116+
quitBtn.place(relx=0.53,rely=0.9, relwidth=0.18,relheight=0.08)
117+
118+
root.mainloop()

addcust.py

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
from tkinter import *
2+
from PIL import ImageTk,Image
3+
from tkinter import messagebox
4+
import cx_Oracle
5+
6+
# Insert data to the Table
7+
def bookRegister():
8+
9+
Reg_id = bookInfo1.get()
10+
Name = bookInfo2.get()
11+
Email_ID = bookInfo3.get()
12+
City = bookInfo4.get()
13+
Contact = bookInfo5.get()
14+
15+
sql = """ INSERT into Customer values (:1,:2,:3,:4,:5) """
16+
try:
17+
cur.execute(sql, [Reg_id, Name, Email_ID, City, Contact])
18+
con.commit()
19+
messagebox.showinfo('Success',"Customer added successfully!")
20+
except:
21+
messagebox.showinfo("Error","Can't add data into Database")
22+
23+
print(Reg_id)
24+
print(Name)
25+
print(Email_ID)
26+
print(City)
27+
print(Contact)
28+
root.destroy()
29+
30+
31+
def addCust():
32+
33+
global bookInfo1 ,bookInfo2, bookInfo3, bookInfo4, bookInfo5, Canvas1, con, cur,bookTable, root
34+
35+
root = Tk()
36+
root.title("Library")
37+
root.minsize(width=400,height=400)
38+
root.geometry("600x500")
39+
40+
try:
41+
42+
con = cx_Oracle.connect('system/system@localhost')
43+
cur = con.cursor()
44+
print(con.version)
45+
46+
except cx_Oracle.DatabaseError as e:
47+
print("There is a problem with Oracle", e)
48+
49+
# Enter Table Names here
50+
bookTable = "Books" # Book Table
51+
52+
Canvas1 = Canvas(root)
53+
54+
Canvas1.config(bg="#663399")
55+
Canvas1.pack(expand=True,fill=BOTH)
56+
57+
headingFrame1 = Frame(root,bg="#FFBB00",bd=5)
58+
headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)
59+
60+
headingLabel = Label(headingFrame1, text="Add Customer", bg='black', fg='white', font=('Courier',15))
61+
headingLabel.place(relx=0,rely=0, relwidth=1, relheight=1)
62+
63+
64+
labelFrame = Frame(root,bg='black')
65+
labelFrame.place(relx=0.1,rely=0.4,relwidth=0.8,relheight=0.4)
66+
67+
# Book ID
68+
lb1 = Label(labelFrame,text="Customer ID : ", bg='black', fg='white')
69+
lb1.place(relx=0.05,rely=0.2, relheight=0.08)
70+
71+
bookInfo1 = Entry(labelFrame)
72+
bookInfo1.place(relx=0.3,rely=0.2, relwidth=0.62, relheight=0.08)
73+
74+
# Publisher ID
75+
lb2 = Label(labelFrame,text="Name: ", bg='black', fg='white')
76+
lb2.place(relx=0.05,rely=0.3, relheight=0.08)
77+
78+
bookInfo2 = Entry(labelFrame)
79+
bookInfo2.place(relx=0.3,rely=0.3, relwidth=0.62, relheight=0.08)
80+
81+
# Title
82+
lb3 = Label(labelFrame,text="Email ID : ", bg='black', fg='white')
83+
lb3.place(relx=0.05,rely=0.4, relheight=0.08)
84+
85+
bookInfo3 = Entry(labelFrame)
86+
bookInfo3.place(relx=0.3,rely=0.4, relwidth=0.62, relheight=0.08)
87+
88+
# Book Author
89+
lb4 = Label(labelFrame,text="City : ", bg='black', fg='white')
90+
lb4.place(relx=0.05,rely=0.50, relheight=0.08)
91+
92+
bookInfo4 = Entry(labelFrame)
93+
bookInfo4.place(relx=0.3,rely=0.50, relwidth=0.62, relheight=0.08)
94+
95+
# Book ISBN
96+
lb5 = Label(labelFrame,text="Contact", bg='black', fg='white')
97+
lb5.place(relx=0.05,rely=0.6, relheight=0.08)
98+
99+
bookInfo5 = Entry(labelFrame)
100+
bookInfo5.place(relx=0.3,rely=0.6, relwidth=0.62, relheight=0.08)
101+
102+
#Submit Button
103+
SubmitBtn = Button(root,text="ADD",bg='#d1ccc0', fg='black',command=bookRegister)
104+
SubmitBtn.place(relx=0.28,rely=0.9, relwidth=0.18,relheight=0.08)
105+
106+
print('Submit Button:')
107+
quitBtn = Button(root,text="Quit",bg='#f7f1e3', fg='black', command=root.destroy)
108+
quitBtn.place(relx=0.53,rely=0.9, relwidth=0.18,relheight=0.08)
109+
110+
root.mainloop()

0 commit comments

Comments
 (0)