Sunteți pe pagina 1din 26

BookShop Management

By,
Rahul Kumar(15MCA1015)
Arijeet Kumar(15MCA1025)
Deepak M.Chakrasali(15MCA1013)

Introduction
In todays era computers have become a vital
component of any enterprise for giving it proper
directions and extensive control of the various
activities
to
attain
business
objectives.
Computer applications have affected scientific &
commercial knowledge.
The information System of the old times totally
differs from the today It is automation system
of a book shop or any information system. In the
previous ages the process of maintaining data
and record seemed very difficult. Now days,
computer
is
very
essential
component.
The
implementation of computer based Information
System can be depicted as the ease in handling
and maintaining the data bank of any size.
Our project is on Book Shop Management System
which deals with almost all the information of
Book Shop .It keeps the database of customer
records and publishing records. It also keeps
the author list, charges and Book-title list.

Modules included and their description

1.

Employee: This actor will be having the access


to book details and adds the books to the add

2.

books table whenever a new stock arrives.


Book_Details: This module consists of all the
details related to each and every book present
in the store, whenever a transaction occurs the
particular ISBN no is removed from the add book

3.
4.

table.

Admin: This actor will have the access to


add and delete the pdf files.
PDF_Table:This table consists of PDF files
which can be accessed by the employee.

ER-Diagram

BookTitle

Password

User-Name

Author
name

Price

Book-id
Pub-year
Have Access

Employe
e

Book_
Details

N
1
maintains

ISBN-NO

M
Have
Have

BOOK-ID

Add
Books
Add-Books
Table
TABLE

views
M

PDF table

M
PDF

Book_ID

Maintains
Admin

CODING

import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.sql.*;
import java.io.File;
public class bookshop implements ActionListener
{
CheckboxGroup cgb;
Checkbox g1,g2;
//JPanel p,p1,p2;
Choice j1,j2,j3;
TextArea x,x1;
String st,st1,sets;
JTextField tz,t,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12;
JPasswordField tz1;
JButton
bb,bb1,bb2,bb3,bb4,bb5,bb6,bb7,bb8,b1,b2,b5,bx,but1,but2,but3,but4,but40,
but5,but6,but7,bx1,by1;
int i=0;
String naam,passw,user;
Timer timer;
JLabel images=new JLabel();
ImageIcon p1,p2,p3,p4,p5,p6;
JFrame f,ffc,f2,f1,f3;
public void design()
{
ffc=new JFrame();
Container cc=ffc.getContentPane();
ffc.setSize(766,468);
ffc.setLocation(300,150);
ffc.setResizable(false);
cc.setBackground(new Color(255,255,255));
ffc.setLayout(null);
ffc.setTitle("LOGIN");
//ImageIcon pk1=new ImageIcon("log.jpg");
//JLabel ll1=new JLabel(pk1);
//ll1.setBounds(1,100,129,281);
ImageIcon pk=new ImageIcon("heade1.jpg");
JLabel ll=new JLabel(pk);
ll.setBounds(25,5,195,122);
ImageIcon pk1=new ImageIcon("book1.jpg");
JLabel ll1=new JLabel(pk1);
ll1.setBounds(10,135,250,250);

ImageIcon pkn2=new ImageIcon("log.png");


JLabel lln2=new JLabel(pkn2);
lln2.setBounds(290,10,212,84);
ImageIcon pk2=new ImageIcon("nm.jpg");
JLabel ll2=new JLabel(pk2);
ll2.setBounds(290,175,35,30);
tz=new JTextField();
tz.setBackground(Color.green);
tz.setBounds(330,175,300,30);
tz.setFont(new Font("arial",Font.BOLD,20));
tz.setForeground(Color.blue);
// tz.requestFocus();
ImageIcon pk3=new ImageIcon("pas11.jpg");
JLabel ll3=new JLabel(pk3);
ll3.setBounds(291,240,34,30);
tz1=new JPasswordField();
tz1.setBackground(Color.green);
tz1.setForeground(Color.blue);
// tz1.requestFocus();
tz1.setBounds(330,240,300,30);
ImageIcon pk4=new ImageIcon("login.jpg");
bb=new JButton(pk4);
bb.setBackground(Color.white);
bb.setBounds(285,350,150,43);
bb.addActionListener(this);
ImageIcon pk5=new ImageIcon("logout.jpg");
bb1=new JButton(pk5);
bb1.setBackground(Color.white);
bb1.setBounds(470,350,150,43);
bb1.addActionListener(this);
cc.add(tz);cc.add(ll);cc.add(ll1);cc.add(ll2);
cc.add(tz1);cc.add(bb);cc.add(bb1);
cc.add(ll3);cc.add(lln2);
ffc.setVisible(true);
ffc.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void design1()
{
f=new JFrame();
Container cc1=f.getContentPane();
f.setSize(1366,768);
ffc.setResizable(false);

cc1.setBackground(new Color(255,255,255));
f.setLayout(null);
ImageIcon x1=new ImageIcon("hhh.jpg");
JLabel y1=new JLabel(x1);
y1.setBounds(100,0,1366,160);
JLabel w1=new JLabel();
w1.setText(naam);
w1.setBounds(5,5,70,25);
ImageIcon ii1=new ImageIcon("yb.png");
but1=new JButton(ii1);
but1.setBackground(Color.yellow);
but1.setBounds(100,200,129,150);
but1.addActionListener(this);

ImageIcon ii2=new ImageIcon("rb.png");


but2=new JButton(ii2);
but2.setBackground(Color.red);
but2.setBounds(260,200,126,150);
but2.addActionListener(this);

ImageIcon ii3=new ImageIcon("bb.png");


but3=new JButton(ii3);
but3.setBackground(Color.blue);
but3.setBounds(416,200,129,150);
but3.addActionListener(this);

ImageIcon ii4=new ImageIcon("pb.png");


but4=new JButton(ii4);
but4.setBackground(Color.pink);
but4.setBounds(575,200,129,150);
but4.addActionListener(this);

ImageIcon ii5=new ImageIcon("YELLOW1.png");


but40=new JButton(ii5);
but40.setBackground(Color.yellow);
but40.setBounds(730,200,129,150);
but40.addActionListener(this);

JPanel pp1=new JPanel();


pp1.setBackground(Color.green);
pp1.setBounds(0,170,1366,10);

JPanel pp2=new JPanel();


pp2.setBackground(Color.green);
pp2.setBounds(0,340,1366,10);
JPanel pp3=new JPanel();
pp3.setBackground(Color.green);
pp3.setBounds(0,170,10,1366);

JPanel pp4=new JPanel();


pp4.setBackground(Color.green);
pp4.setBounds(1340,170,10,1366);

ImageIcon x2=new ImageIcon("body.jpg");


JLabel y2=new JLabel(x2);
y2.setBounds(50,370,1240,400);
cc1.add(y1);cc1.add(but1);cc1.add(but2);
cc1.add(but3);cc1.add(but4);cc1.add(pp1);
cc1.add(pp2);cc1.add(pp3);cc1.add(pp4);
cc1.add(y2);cc1.add(w1);cc1.add(but40);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

public void design12()


{
f2=new JFrame();
Container c2=f2.getContentPane();
f2.setSize(766,750);
f2.setTitle("ADD RECORD");
f2.setLocation(300,0);
f2.setResizable(false);
c2.setBackground(new Color(211,211,211));
f2.setLayout(null);
Font f5=new Font("Arial Rounded MT",1,25);

Color c5=new Color(0,100,0);


JLabel mm=new JLabel("BOOK_ID");
mm.setForeground(c5);
mm.setFont(f5);
mm.setBounds(50,44,200,45);

t=new JTextField();
//t.setBackground(Color.red);
t.setBounds(250,50,300,35);
t.setFont(new Font("arial",Font.BOLD,20));
//t.setForeground(Color.blue);

JLabel mm1=new JLabel("BOOK_TITLE");


mm1.setForeground(c5);
mm1.setFont(f5);
mm1.setBounds(30,120,200,45);

t1=new JTextField();
//t1.setBackground(Color.red);
t1.setBounds(250,130,300,35);
t1.setFont(new Font("arial",Font.BOLD,20));
// t1.setForeground(Color.blue);

JLabel mm2=new JLabel("PRICE ");


mm2.setForeground(c5);
mm2.setFont(f5);
mm2.setBounds(50,195,200,45);

t2=new JTextField();
//t2.setBackground(Color.red);
t2.setBounds(250,205,300,35);
t2.setFont(new Font("arial",Font.BOLD,20));
//t2.setForeground(Color.blue);

JLabel mm3=new JLabel("AUTHOR_NAME");


mm3.setForeground(c5);
mm3.setFont(f5);

mm3.setBounds(15,270,225,45);

t3=new JTextField();
//t3.setBackground(Color.red);
t3.setBounds(250,275,300,35);
t3.setFont(new Font("arial",Font.BOLD,20));
//t3.setForeground(Color.blue);

JLabel mm4=new JLabel("PUBLICATION_YR");


mm4.setForeground(c5);
mm4.setFont(f5);
mm4.setBounds(10,345,240,45);

t4=new JTextField();
//t4.setBackground(Color.red);
t4.setBounds(260,355,300,35);
t4.setFont(new Font("arial",Font.BOLD,20));
// t4.setForeground(Color.blue);

but5=new JButton("BACK");
but5.setBackground(Color.white);
but5.setBounds(200,444,150,43);
but5.addActionListener(this);

but6=new JButton("SUBMIT");
but6.setBackground(Color.white);
but6.setBounds(400,444,150,43);
but6.addActionListener(this);

c2.add(mm);c2.add(t);c2.add(mm1);
c2.add(t1);c2.add(mm2);c2.add(t2);
c2.add(mm3);c2.add(t3);c2.add(mm4);
c2.add(t4);c2.add(but5);c2.add(but6);
f2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

public void design13()


{
f3=new JFrame();
Container c3=f3.getContentPane();
f3.setSize(766,750);
f3.setTitle("ADD RECORD");
f3.setLocation(300,0);
f3.setResizable(false);
c3.setBackground(new Color(211,211,211));
f3.setLayout(null);
Font f5=new Font("Arial Rounded MT",1,25);
Color c5=new Color(0,100,0);
JLabel mm=new JLabel("BOOK_ID");
mm.setForeground(c5);
mm.setFont(f5);
mm.setBounds(50,44,200,45);

t11=new JTextField();
//t.setBackground(Color.red);
t11.setBounds(250,50,300,35);
t11.setFont(new Font("arial",Font.BOLD,20));
//t.setForeground(Color.blue);

JLabel mm1=new JLabel("ISBN_NO");


mm1.setForeground(c5);
mm1.setFont(f5);
mm1.setBounds(30,120,200,45);

t12=new JTextField();
//t1.setBackground(Color.red);
t12.setBounds(250,130,300,35);
t12.setFont(new Font("arial",Font.BOLD,20));
// t1.setForeground(Color.blue);

bx1=new JButton("BACK");
bx1.setBackground(Color.white);
bx1.setBounds(200,250,150,43);
bx1.addActionListener(this);

by1=new JButton("SUBMIT");
by1.setBackground(Color.white);
by1.setBounds(400,250,150,43);
by1.addActionListener(this);

c3.add(mm);c3.add(t11);c3.add(mm1);
c3.add(t12);c3.add(bx1);c3.add(by1);
f3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

public void actionPerformed(ActionEvent ae)


{

if(ae.getSource()==but4)
{
String test1;
int n;
test1= JOptionPane.showInputDialog("1.rko1.pdf\n\n2.help1.pdf\n\n Input ur choice
");
n=Integer.parseInt(test1);
if(n==1)
{
try {
if ((new File("D:\\rko.pdf")).exists())
{

Process p = Runtime.getRuntime() .exec("rundll32 url.dll,FileProtocolHandler


D:\\rko1.pdf");
p.waitFor();

}
else
{
System.out.println("File does not exists");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}

if(n==2)
{
try {
if ((new File("D:\\help1.pdf")).exists())
{
Process p = Runtime.getRuntime() .exec("rundll32 url.dll,FileProtocolHandler
D:\\help1.pdf");
p.waitFor();

}
else
{

System.out.println("File does not exists");


}
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
if(ae.getSource()==but3)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

String cs= "Jdbc:Odbc:rahul";


Connection conn=DriverManager.getConnection( cs,"system","rahul");

PreparedStatement ps= conn.prepareStatement("delete from add_book where


isbn=?");
String vid=JOptionPane.showInputDialog(null,"ENTER ISBN _NO");
ps.setString(1,vid);
int r=ps.executeUpdate();
JOptionPane.showMessageDialog(null,"book sold");
ps.close();
conn.close();
}
catch(Exception dfg)
{
}
}

if(ae.getSource()==but40)
{
f.setVisible(false);
f3.setVisible(true);

if(ae.getSource()==bx1)
{
f3.setVisible(false);
f.setVisible(true);
}

if(ae.getSource()==by1)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

String cs= "Jdbc:Odbc:rahul";


Connection conn=DriverManager.getConnection( cs,"system","rahul");

PreparedStatement ps= conn.prepareStatement("Insert into add_book values(?,?)");


String vc=t11.getText();
String vc1=t12.getText();
ps.setString(1,vc);
ps.setString(2,vc1);

int r=ps.executeUpdate();
JOptionPane.showMessageDialog(null,"RECORD INSERTED.......");
t11.setText("");
t12.setText("");

ps.close();
conn.close();
}
catch(Exception boo)
{
System.out.println(boo);
}

if(ae.getSource()==bb)
{
//user=tz.getText();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

String cs= "Jdbc:Odbc:rahul";


Connection conn=DriverManager.getConnection( cs,"system","rahul");

PreparedStatement ps= conn.prepareStatement("select * from acc where


name=?");
ps.setString(1,tz.getText());
while(true)
{
ResultSet rs=ps.executeQuery();
if(rs.next())
{
naam=rs.getString(1);
passw=rs.getString(2);
}
rs.close();
ps.close();
conn.close();
}
}
catch(Exception xx)
{}
if(tz.getText().equals(naam) && tz1.getText().equals(passw))
{
tz.setText(" ");
tz1.setText(" ");
ffc.setVisible(false);
f.setVisible(true);
}

else
{
JOptionPane.showMessageDialog(null,"INVALID USERNAME &
PASSWORD","ERROR",JOptionPane.ERROR_MESSAGE);
tz.setText("");
tz1.setText("");
}
}
if(ae.getSource()==bb1)
{
System.exit(0);
}
if(ae.getSource()==but1)
{
f.setVisible(false);
f2.setVisible(true);
}
if(ae.getSource()==but5)
{
f2.setVisible(false);
f.setVisible(true);
}
if(ae.getSource()==but6)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

String cs= "Jdbc:Odbc:rahul";


Connection conn=DriverManager.getConnection( cs,"system","rahul");

PreparedStatement ps= conn.prepareStatement("Insert into book_details


values(?,?,?,?,?)");

String vc=t.getText();
String vc1=t1.getText();
String vc2=t2.getText();

String vc3=t3.getText();
String vc4=t4.getText();
ps.setString(1,vc);
ps.setString(2,vc1);
ps.setString(3,vc2);
ps.setString(4,vc3);
ps.setString(5,vc4);
int r=ps.executeUpdate();
JOptionPane.showMessageDialog(null,"RECORD INSERTED.......");
t.setText("");
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
ps.close();
conn.close();
}
catch(Exception boo)
{}
}
if(ae.getSource()==but2)
{

try
{
String test1;
test1= JOptionPane.showInputDialog("Please input Book_Id: ");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

String cs= "Jdbc:Odbc:rahul";


Connection conn=DriverManager.getConnection( cs,"system","rahul");

PreparedStatement ps= conn.prepareStatement("select count(*) as total from


add_book where book_id=?");
ps.setString(1,test1);
ResultSet rs=ps.executeQuery();

while(rs.next())
JOptionPane.showMessageDialog(null,"Total number of Books : "+rs.getInt("total"));

rs.close();
ps.close();
conn.close();
}
catch(Exception xx)
{
System.out.println(xx);
}
}
}
public static void main(String ss[])
{
bookshop oo=new bookshop();
oo.design();
oo.design1();
oo.design12();
oo.design13();
}
}

Screenshots

S-ar putea să vă placă și