Вы находитесь на странице: 1из 63

BLOOD BANK SYSTEM

DISSERTATION

Submitted in partial fulfillment of the


Requirements for the award of the degree

of

Bachelor of Technology
in

Information Technology

By:

HARSAHIB SINGH (04113203115)

LAKSHAY SINGH (00113207716)

LAKHWANT SINGH (40213207716)

Under the guidance of:

Mr KANWARJEET SINGH Commented [G1]: Name of the Guide

Department of Information Technology

Guru Tegh Bahadur Institute of Technology

Guru Gobind Singh Indraprastha University

Dwarka,New Delhi

Year 2015-2019
Table of Contents

 Introduction …………………………………………….1
 Project Description………………………………….......2
 Problems with Existing System…………………….......4
 Proposed System………………………………………..4
 Software Architecture of Proposed System …………..5
 Feasibility Study……………………………………......5
 Front End……………………………………………….6
 Back End………………………………………………10
 Reason for choosing JAVA…………………………...12
 Hardware Requirement………………………………..12
 Software Requirement………………………………...12
 Coding of the Project………………………………….13
 Outputs………………………………………………...53
 Conclusion…………………………………………….57
 References……………………………………………..58
1. Blood Bank Centre

Blood Bank Centre is a Haryana government initiative to provide


Government services and to residents of Haryana in a seamless and Effective way about the blood
Donation and usage in the various Hospitals across all the Districts of the state.

Some of the services being offered by Blood Banks are:-


 Recruitment and retention of voluntary and replacement blood donors.
 Collection, processing, storage and transportation of blood and its components.
 Laboratory procedures
 Participation in the clinical use of blood and blood components.
 Research and development

Current Scenarios at Blood Bank


Project Description

Project Name

Haryana Blood Information System

Objectives

 The Main objective of the project is to provide convenience to users an information regarding
the Availability of blood units in the various blood banks of the district.

 The project’s objective is to access the server for making reliable connections in response
to request for connection by client and delivering Information.
 It aims at daily update of data to deliver information to client without any flaws and with
high reliability
 It aims at creating a user friendly environment for login or signup. It ensures the security of
user’s account as no user with wrong password or no user with same username can access the
account.

Features of the Project

 Citizens will be able to access the blood availability and the location of blood banks
according to their residing districts from their homes
 Citizens will be able to access data according the nearest hospital and also according to
emergency requirements of specific blood groups and blood component count
 Citizens will be able to fill blood donation forms online which will allow specialized
Ambulance vans to collect blood right from the doorstep
 The blood Bank centers can login to update the availability of the various blood group and
components on a daily basis
 A district officer can monitor the activation and deactivation of blood banks and specific
blood group requirements
 Support has been added to expand the system to other states in future.
Description

The software allows the functioning of a BLOOD BANK.


A Citizen can select his district and use various services such as accessing information about various
blood banks using Hospital wise, or blood group wise. The user can also access the data of recently
donated blood and can contact a blood Donor in case of Emergencies.
Information regarding the various separated components of blood is also provided
In addition to this, the user can also fill out a form for blood donation online which allows Interested
Donors to Donate blood right from their home using Specialised Ambulances for this purpose

As an Admin, the blood Bank officials can access and Update the Records of blood availability on a
regular Basis.
A District official for each District can Monitor the records of all the Hospitals and also Activate and
deactivate the availability of a specific component. The official can verify the blood report of a Blood
Donor and can add temporary ones to be added to a genuine Donor list.

Sometimes even in Complete Surplus availability, the lack of location of storage and other information
leads to chaos and maybe untimely delivery of blood to a patient .The System allows a User to search
with ease a blood group with convenience of home in case of emergencies and timely delivery of blood
can help save a precious life.
2 .Drawbacks in existing system

Although Blood Bank Centres have come a long way with several landmark improvement in
technology and health services but it has some drawbacks:-
 Long Queues
 No prompt service in case of Emergency
 Many Patients die every year due to lack of timely reach of service
 Long Waiting Time
 Lack of knowledge of procedure
 Although deposits are much, there is no information upon which blood bank has the
availability during requirement

3 .Proposed System

 Citizens will be able to access the blood availability and the location of blood banks
according to their residing districts from their homes
 Citizens will be able to access data according the nearest hospital and also according to
emergency requirements of specific blood groups and blood component count
 Citizens will be able to fill blood donation forms online which will allow specialized
Ambulance vans to collect blood right from the doorstep
 The blood Bank centers can login to update the availability of the various blood group and
components on a daily basis
 A district officer can monitor the activation and deactivation of blood banks and specific
blood group requirements
Support has been added to expand the system to other states in future

4 .Software Architecture of Proposed System


5 .Feasibility Study

Economic Feasibility
The project would require the cost of a central application server along with computers and operators
for the blood banks of various districts.

Tools Requirement Feasibility


 Net Beans IDE 7.4
 Oracle Database 10g Express Edition
 Java 1.8

Schedule Feasibility
Gantt chart Follows in Last section. The project has been Alloted a Time period of 7 months
including Testing and Installation.

6 .Front End
Java is a general purpose and the most popular object-oriented programming language. Java was
developed by James Gosling and his colleagues at Sun Microsystems in the early 1990’s.

Due to its simplicity and easy to learn and advanced features, we opted this language for our six months
industrial training. This language supports many interesting features that make it an ideal language for
software development. In addition to the object oriented features, it also provides features such as
platform independence, security, multithreading, portability; etc which makes it well suited for the
web and networked services, applications, platform-independent desktops, robotics and any other
embedded devices.
Simple: Java is a compact and simple language. Programs are easy to write and debug as it omits
many clumsy, poorly understood and confusing features of other programming languages such as
C++.

Object-oriented: Java is purely object-oriented language because programming in java is centered


on creating objects; manipulating objects and making objects work together.

Distributed: Java is a distributed language which means that the programs can be designed to run
on computer networks. Java provides an extensive library of classes for communicating using
TCP/IP protocols such as HTTP and FTP. This makes creating network connections much easier.

Robust: Java is designed for writing programs that are highly robust and Reliable

Secure: As java is intended to be used in networked/distributed environments so it implements


several security mechanisms to protect you against malicious code that might try to invade
your file system.

Architectural Neutral: This means that the programs written on one platform can run on any
other platform without having to rewrite or recompile them. It follows ‘Write-once-run-
anywhere’ approach.
Portable: In Java, the size of the primitive data types is machine independent. These
consistencies make java program portable among different platforms such as Windows, UNIX
and Mac.

Interpreted: Java is such a language that is both compiled and interpreted. The two steps of
compilation and interpretation allow extensive code checking and improved security.

High performance: Java programs are complied with portable intermediate form known as byte
codes, rather than to native machine level instructions and JVM executes java byte codes on
any machine on which it is installed. This architecture means that java programs are faster.

Multithreaded: Java is also a multithreaded programming language. It allows you to write a


program that can do many tasks simultaneously.

Dynamic: Java is designed to be dynamic. Classes are stored in separate files and are loaded
into the Java Interpreter only when they are needed

Swing Programming in Java

Swing is a GUI widget toolkit for Java. It is part of Oracle's Java Foundation Classes (JFC) —
an API for providing a graphical user interface (GUI) for Java programs.
Swing was developed to provide a more sophisticated set of GUI components than the
earlier Abstract Window Toolkit (AWT). Swing provides a native look and feel that emulates the
look and feel of several platforms, and also supports a pluggable look and feel that allows
applications to have a look and feel unrelated to the underlying platform. It has more powerful and
flexible components than AWT.
In addition to familiar components such as buttons, check boxes and labels, Swing provides several
advanced components such as tabbed panel, scroll panes, trees, tables, and lists.
Unlike AWT components, Swing components are not implemented by platform-specific code.
Instead, they are written entirely in Java and therefore are platform-independent. The term
"lightweight" is used to describe such an element.[1]
Swing is currently in the process of being replaced by JavaFX.
Swing Components in Java

Jbutton: This is used to create a Button using a text, icon, string or both. When a button is pressed an
ActionEvent is generated

JcheckBox: This is used to create a checkbox using Text inside a frame.

JtextField: This is used to take an input of a single line using methods of “gettext( )” & “settext( )”

JLabel: This can display either text, an image, or both. Label's contents are aligned by setting the
vertical and horizontal alignment in its display area. By default, labels are vertically centered in
their display area. Text-only labels are leading edge aligned, by default; image-only labels are
horizontally centered, by default.

JFrame : Java Swing Tutorial Explaining the JFrame class. The components added to the frame are
referred to as its contents; these are managed by the contentPane. To add a component to a JFrame,
we must use its content Pane instead .JFrame is a Window with border, title and buttons. When JFrame
is set visible, an event dispatching thread is started. JFrame objects store several objects including
a Container object known as the content pane. To add a component to a JFrame, add it to the content
pane.
7 .Back End

Oracle Database (commonly referred to as Oracle RDBMS or simply as Oracle) is an object-relational


database management system [2] produced and marketed by Oracle Corporation.

Larry Ellison and two friends and former co-workers, Bob Miner and Ed Oates, started a consultancy
called Software Development Laboratories (SDL) in 1977. SDL developed the original version of the
Oracle software. The name Oracle comes from the code-name of a CIA-funded project Ellison had
worked on while previously employed by Ampex.

Oracle Express Edition (DB XE) (Oracle XE)


An addition to the Oracle database product family (beta version released in 2005, production version
released in February 2006), offers a free version of the Oracle RDBMS, but one limited to 11 GB of
user data and to 1 GB of memory used by the database (SGA+PGA). XE will use no more than one
CPU and lacks an internal JVM. XE runs on 32-bit and 64-bit Windows and 64-bit Linux, but not on
AIX, Solaris, HP-UX and the other operating systems available for other editions. Support is via a
free Oracle Discussion Forum only.

As computers running Oracle often have many multi-core processors (resulting in many cores, all to
be licensed), the software price can rise into the hundreds of thousands of dollars. The total cost of
ownership often exceeds this, as large Oracle installations usually require experienced and
trained database administrators to do the set-up properly. Furthermore, further components must be
licensed and paid for, for instance the Enterprise Options used with the databases. Many licensing
pitfalls let even rise the costs of ownership. Because of the product's large installed base and available
training courses, Oracle specialists in some areas have become a more abundant resource than those
for more exotic databases. Oracle frequently provides special training offers for database-
administrators.

On Linux, Oracle's certified configurations include Oracle's own Oracle Linux and other
commercial Linux distributions (Red Hat Enterprise Linux 3, 4 and 5, SuSE SLES 8, 9, 10 and
11, Asianux), which can cost in a range from a few hundred to a few thousand USD per year
(depending on processor architecture and the support package purchased).

The Oracle database system can also install and run on freely available Linux distributions such as the
Red Hat-based CentOS or Debian-based systems.

8. Reason for Choosing JAVA

 Windows vs. Multi-Platform: Microsoft .NET is primarily targeted for the windows
operating system. Java, on the other hand, is based on the idea that the same software should
run on many different kinds of computers, consumer gadgets, and other devices on a
network.
 Complexity: Microsoft tools have an edge over Java for building applications that require
rich graphical user interfaces and that deliver content to web browsers. The perception is that
Java servers are better for complex applications supporting higher volumes of users.
 Proprietary vs. Open source: One of Java’s strengths is that a wide variety of tools, products,
and applications are available from numerous vendors.
 Competition among Java EE vendors drives innovation, while strict compatibility standards
help maintain quality. Microsoft users, on the other hand, must rely on Microsoft for all
.NET innovation.
9 .Hardware Requirements
Hardware requirements include that hardware which is required for its working. It includes:

 Pentium 4 Computer
 512 MB RAM
 High Speed Internet Connection(DSL/Cable)

10 .Software Requirements
The technical specifications of requirements for the software are as follows:
 Any Operating System (Windows, Linux, MAC)

 Java run time environment

 Oracle Database 10g Express Edition

 Net Beans IDE 7.4

 Any web browser(Chrome , Firefox , etc)


11 .Coding of the Project

 Code for login.java

package design;

import Logic.*;

import java.awt.Color;

import java.awt.Dimension;

import java.awt.Toolkit;

import java.sql.ResultSet;

//import javax.swing.JFrame;

import javax.swing.JOptionPane;

public class Login extends javax.swing.JFrame {

/**

* Creates new form Login

*Creates new form Login

*/

public static String distt_select=null;

/**

* Creates new form Login

*/
public static String diodistt=null,bankuserpwd=null,bankusername=null;

public static int distt_code=0,dioid=0,diodisttcode=0;

public Login() {

initComponents();

//JFrame f=new JFrame();

//setResizable(false);

Toolkit tk=Toolkit.getDefaultToolkit();

Dimension d=tk.getScreenSize();

setSize(d);

jLabel1.setOpaque(true);

// getContentPane().setBackground(Color.blue);

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

jLabel1 = new javax.swing.JLabel();

jPanel1 = new javax.swing.JPanel();

jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();

jTextField1 = new javax.swing.JTextField();


jPasswordField1 = new javax.swing.JPasswordField();

jButton1 = new javax.swing.JButton();

jPanel2 = new javax.swing.JPanel();

disttlist = new javax.swing.JComboBox();

jButton2 = new javax.swing.JButton();

jLabel4 = new javax.swing.JLabel();

jLabel5 = new javax.swing.JLabel();

jLabel6 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setBackground(new java.awt.Color(255, 0, 0));

jLabel1.setBackground(new java.awt.Color(0, 0, 255));

jLabel1.setFont(new java.awt.Font("Monotype Corsiva", 1, 36)); // NOI18N

jLabel1.setForeground(new java.awt.Color(255, 0, 51));

jLabel1.setText(" ***Haryana Blood Bank Information System***");

jLabel1.setToolTipText("");

jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Login For Admin User",


javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Aharoni", 1, 18))); //
NOI18N

jLabel2.setFont(new java.awt.Font("Monotype Corsiva", 0, 24)); // NOI18N

jLabel2.setText("User:");
jLabel2.setToolTipText("");

jLabel3.setFont(new java.awt.Font("Monotype Corsiva", 0, 24)); // NOI18N

jLabel3.setText("Password:");

jLabel3.setToolTipText("");

jTextField1.setToolTipText("");

jPasswordField1.setToolTipText("");

jButton1.setFont(new java.awt.Font("Monotype Corsiva", 3, 18)); // NOI18N

jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/addEmp1.png"))); //
NOI18N

jButton1.setText("LogIn");

jButton1.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton1ActionPerformed(evt);

});

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);

jPanel1.setLayout(jPanel1Layout);

jPanel1Layout.setHorizontalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()

.addContainerGap()

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 49,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 96,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(18, 18, 18)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)

.addComponent(jTextField1)

.addComponent(jPasswordField1, javax.swing.GroupLayout.DEFAULT_SIZE, 143,


Short.MAX_VALUE)

.addGroup(jPanel1Layout.createSequentialGroup()

.addGap(14, 14, 14)

.addComponent(jButton1)))

.addContainerGap(79, Short.MAX_VALUE))

);

jPanel1Layout.setVerticalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel1Layout.createSequentialGroup()

.addContainerGap()

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jLabel2)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(28, 28, 28)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jLabel3)

.addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(26, 26, 26)

.addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addContainerGap())

);

jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "For Citizens",


javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Aharoni", 1, 18))); //
NOI18N

disttlist.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N

disttlist.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Select Distt.",


"Ambala", "Bhiwani", "Faridabad", "Fatehabad", "Gurgaon", "Hisar", "Jhajjar", "Jind", "Kaithal",
"Karnal", "Kurukshetra", "Mahendragarh", "Mewat", "Palwal", "Panchkula", "Panipat", "Rewari",
"Rohtak", "Sirsa", "Sonipat", "Yamuna Nagar" }));

jButton2.setFont(new java.awt.Font("Monotype Corsiva", 3, 18)); // NOI18N


jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/addEmp2.png"))); //
NOI18N

jButton2.setText("NEXT");

jButton2.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jButton2ActionPerformed(evt);

});

javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);

jPanel2.setLayout(jPanel2Layout);

jPanel2Layout.setHorizontalGroup(

jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel2Layout.createSequentialGroup()

.addGap(48, 48, 48)

.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(disttlist, javax.swing.GroupLayout.PREFERRED_SIZE, 255,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 110,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addContainerGap(87, Short.MAX_VALUE))

);

jPanel2Layout.setVerticalGroup(

jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(38, 38, 38)

.addComponent(disttlist, javax.swing.GroupLayout.PREFERRED_SIZE, 28,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(43, 43, 43)

.addComponent(jButton2)

.addContainerGap(23, Short.MAX_VALUE))

);

jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/bloodLogo1.png")));
// NOI18N

jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/loginHeader.png")));
// NOI18N

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(106, 106, 106)

.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(97, 97, 97))

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()

.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jLabel4)

.addContainerGap())

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel5)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 956,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(0, 0, Short.MAX_VALUE))

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel1)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 206,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)

.addComponent(jLabel5)))

.addGap(18, 18, 18)

.addComponent(jLabel4)

.addGap(74, 74, 74)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

.addContainerGap(52, Short.MAX_VALUE))

);

jPanel1.getAccessibleContext().setAccessibleName("Login For Admin User's");

jPanel1.getAccessibleContext().setAccessibleDescription("");

pack();

}// </editor-fold>

//

public static String b_bank_code,userid,distt_id;

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

String user=jTextField1.getText();

String pwd=jPasswordField1.getText();

try
{

ResultSet rs=Logic.check_login(user, pwd);//for bank user

ResultSet rs1=Logic.diologin(user, pwd);//for admin or

if(rs.next())

System.out.println("reruio");

bankusername=rs.getString(2);

b_bank_code=rs.getString(5);

userid=rs.getString(1);

distt_id=rs.getString(4);

bankuserpwd=pwd;

JOptionPane.showMessageDialog(rootPane,"Welcome Admin!!!");

dispose();

Admin_Welocme.main(new String[]{"ram"});

else if(rs1.next())

System.out.println("6544657687");

dioid=rs1.getInt(1);

System.out.println(dioid);

diodistt=rs1.getString(2);

diodisttcode=rs1.getInt(3);
System.out.println(diodisttcode);

JOptionPane.showMessageDialog(rootPane,"Welcome Distt Admin!!!");

dispose();

DIO_welcome.main(new String[]{"ram"});

System.out.println("$%^*(");}

else

JOptionPane.showMessageDialog(rootPane,"Incorrect user name or password!!");

System.out.println("678cgkjh");

catch(Exception e){System.out.println("cdfdc");}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

//"AmbalaCity", "Bhiwani","Faridabad","Fatehabad","Gurgaon","Hisar","Jhajjar
"JInd","Kaithal","Karnal""Kurukshetra","Mahendragarh" "Mewat","Palwal""panchkula", "panipat"
,"Rewari" "Rohtak", "sirsa", "Sonipat", "Yamuna nagar"

String distt=String.valueOf(disttlist.getSelectedItem());

if(distt.equals("Ambala"))

distt_code=4;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});
}

else if(distt.equals("Bhiwani"))

distt_code=5;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});

else if(distt.equals("Faridabad"))

distt_code=1;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});

else if(distt.equals("Fatehabad"))

distt_code=6;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});
}

else if(distt.equals("Gurgaon"))

distt_code=3;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});

else if(distt.equals("Hisar"))

distt_code=7;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});

else if(distt.equals("Jhajjar"))

distt_code=8;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});
}

else if(distt.equals("Jind"))

distt_code=9;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});

else if(distt.equals("Kaithal"))

distt_code=10;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});

else if(distt.equals("Karnal"))

distt_code=11;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});
}

else if(distt.equals("Kurukshetra"))

distt_code=12;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});

else if(distt.equals("Mahendragarh"))

distt_code=13;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});

else if(distt.equals("Mewat"))

distt_code=14;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});
}

else if(distt.equals("Palwal"))

distt_code=2;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});

else if(distt.equals("Panchkula"))

distt_code=15;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});

else if(distt.equals("Panipat"))

distt_code=16;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});
}

else if(distt.equals("Rewari"))

distt_code=17;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});

else if(distt.equals("Rohtak"))

distt_code=18;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});

else if(distt.equals("Sirsa"))

distt_code=19;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});
}

else if(distt.equals("Sonipat"))

distt_code=20;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});

else if(distt.equals("Yamuna Nagar"))

distt_code=21;

distt_select=distt;

dispose();

//String s[]={"ram"};

CitizenWelcome.main(new String[]{"Ram"});

else

JOptionPane.showMessageDialog(rootPane, "Please select a district.");

public static void main(String args[]) {

/* Set the Nimbus look and feel */

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.

* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/

try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

//</editor-fold>
/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new Login().setVisible(true);

});

// Variables declaration - do not modify

private javax.swing.JComboBox disttlist;

private javax.swing.JButton jButton1;

private javax.swing.JButton jButton2;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JLabel jLabel4;

private javax.swing.JLabel jLabel5;

private javax.swing.JLabel jLabel6;

private javax.swing.JPanel jPanel1;

private javax.swing.JPanel jPanel2;

private javax.swing.JPasswordField jPasswordField1;

private javax.swing.JTextField jTextField1;

// End of variables declaration}


 Code for logic.java
package Logic;
import design.Login;
import java.sql.*;
public class Logic {

public static ResultSet hospitaldata(String b_bank_code)


{
ResultSet rs=null;
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();
rs=st.executeQuery("select
B_GROUP,WHITE_BLOOD_CELLS,RED_BLOOD_CELLS,FRESH_FROZEN_PLASM
A,PLATLETS from newbloodinfo where b_bank_code='"+b_bank_code+"'");
//USER_ID USER_NAME PWD STATE_CODE DISTT_CODE
ADMIN_ID B_BANK_CODE CHECKLOGIN DEACT

}
catch(Exception e){}
return rs;
}

public static ResultSet diologin(String user,String pwd)//login for admin or dio


{
ResultSet rs=null;
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();
//ADMIN_ID ADMIN_NAME PWD DISTT_CODE
rs=st.executeQuery("select admin_id,admin_name,distt_code from admin where
admin_name='"+user+"' and pwd='"+pwd+"'");

}
catch(Exception e)
{

}
return rs;
}

public static ResultSet check_login(String user,String pwd)//login for blood bank user
{
ResultSet rs=null;
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();
//USER_ID USER_NAME PWD STATE_CODE DISTT_CODE
ADMIN_ID B_BANK_CODE CHECKLOGIN DEACT
rs=st.executeQuery("select user_id,user_name,pwd,distt_code,b_bank_code from
user_master where user_name='"+user+"' and pwd='"+pwd+"' ");
//check=rs.next();
}
catch(Exception e){}
return rs;
}
public static int no_of_hospital(int distt_code)
{
int val=0;
ResultSet rs=null;
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();
rs=st.executeQuery("select count(B_BANK_NAME) from b_bank_master where
distt_code="+distt_code+"");
rs.next();
val=rs.getInt(1);
}
catch(Exception e)
{
System.out.println("exception in no_of_hospital :"+e);
}
return val;
}
public static ResultSet acess_hospital_name(int distt_code)
{
ResultSet rs=null;
try
{
//B_BANK_PHONE,B_BANK_CONT_PER,B_BANK_EMAIL,B_BANK_ADDRESS
from B_bank_master
Connection con=Connect.conn();
Statement st=con.createStatement();
rs=st.executeQuery("select B_BANK_NAME from b_bank_master where
distt_code="+distt_code+" and deact=0");
}
catch(Exception e)
{
System.out.println("exception in access_hospital_name :"+e);
}
return rs;
}

public static ResultSet get_basic_hos_detail(String h_name)


{
ResultSet rs=null;
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();
rs=st.executeQuery("select
b_bank_name,b_bank_cont_per,b_bank_phone,b_bank_address,b_bank_code from
b_bank_master where b_bank_name='"+h_name+"'");

}
catch(Exception r){}
return rs;
}

public static ResultSet getdatahospitalwise(String b_bank_code)


{
ResultSet rs=null;
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();

rs=st.executeQuery("select
B_GROUP,WHITE_BLOOD_CELLS,RED_BLOOD_CELLS,FRESH_FROZEN_PLASM
A,PLATLETS from newbloodinfo where b_bank_code='"+b_bank_code+"' and deact=0");

}
catch(Exception e)
{

}
return rs;
}

public static ResultSet getdatabloodwise(String b_group,String distt_name)


{
ResultSet rs=null;
try
{
String distt_code=getdisttcode(distt_name);
Connection con=Connect.conn();
Statement st=con.createStatement();
rs=st.executeQuery("select
bb.b_bank_name,bb.B_BANK_PHONE,bb.B_BANK_ADDRESS,bld.white_blood_cells,bld
.red_blood_cells,bld.fresh_frozen_plasma,bld.platlets from b_bank_master bb join
newbloodinfo bld on bb.b_bank_code=bld.b_bank_code where bld.b_group='"+b_group+"'
and bld.distt_code='"+distt_code+"' and bb.deact=0");
}
catch(Exception e)
{

}
return rs;
}

public static String getdisttcode(String distt_name)


{
String dcode=null;
ResultSet rs=null;
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();
rs=st.executeQuery("select DISTT_CODE from distt_master where
distt_name='"+distt_name+"'");
rs.next();
dcode=rs.getString(1);
}
catch(Exception e)
{

}
return dcode;
}
public static int saveDonorDatatemp(String don_distt_name,String don_name,String
don_address,String don_phone,String don_email,String don_bloodgroup,String
don_age,String don_bloodsum)
{
int r=0;
try
{
String don_distt_code=getdisttcode(don_distt_name);
// DON_DISTT_CODE DON_ID DON_NAME DON_ADDRESS
DON_PHONE DON_EMAIL DON_BLOODGROUP DON_AGE
DON_BLDSUM
Connection con=Connect.conn();

Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select max(don_id)from temp_donate");
rs.next();
int don_id=Integer.parseInt(rs.getString(1))+1;
System.out.println("test1");
st=con.createStatement();
System.out.println(don_distt_code);
System.out.println(don_id);
System.out.println(don_name);
System.out.println(don_address);
System.out.println(don_phone);
System.out.println(don_email);
System.out.println(don_bloodgroup);
System.out.println(don_age);
System.out.println(don_bloodsum);
r=st.executeUpdate("insert into temp_donate
values('"+don_distt_code+"','"+don_id+"','"+don_name+"','"+don_address+"','"+don_phone+
"','"+don_email+"','"+don_bloodgroup+"','"+don_age+"','"+don_bloodsum+"','0')");
System.out.println("test2");
}
catch(Exception e){System.out.println(e);}
return r;
}

public static ResultSet getdonordatatemp(int distt_code)


{
ResultSet rs=null;
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();
rs=st.executeQuery("select
DON_NAME,DON_ADDRESS,DON_PHONE,DON_EMAIL,DON_BLOODGROUP,DO
N_AGE,DON_BLDSUM from temp_donate where don_distt_code='"+distt_code+"'");
}
catch(Exception e)
{}
return rs;
}
public static void main(String gh[])
{
System.out.println(getdisttcode("Faridabad"));
System.out.println(getdisttcode("Faridabad"));
}

//get Address of blood bank


public static String getAdress(String b_bank_code)
{
String add=null;
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select B_BANK_ADDRESS from b_bank_master where
b_bank_code='"+b_bank_code+"'");
rs.next();
add=rs.getString(1);

}
catch(Exception e){}
return add;
}

//update blood bank Adress


public static int updateAdress(String b_bank_code,String newadd)
{
int status=0;
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();
status= st.executeUpdate("update b_bank_master set b_bank_address='"+newadd+"' where
b_bank_code='"+b_bank_code+"'");

}
catch(Exception e){}
return status;
}

//update password
public static int updatePassword(String old,String newpwd,String confirmnewpwd,String
b_bank_code)
{
int r=0;
try
{
if(old.equals(Login.bankuserpwd))
{
if(newpwd.equals(confirmnewpwd))
{
Connection con=Connect.conn();
Statement st=con.createStatement();
r= st.executeUpdate("update user_master set pwd='"+newpwd+"' where
b_bank_code='"+b_bank_code+"'");
return r;
}
else
return -1;
}
else
return -2;
}
catch(Exception e){}
return r;
}

public static ResultSet getdonorwise(String distt_code)


{
ResultSet rs=null;
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();
rs=st.executeQuery("select
DON_NAME,DON_ADDRESS,DON_PHONE,DON_EMAIL,DON_BLOODGROUP,DO
N_AGE from temp_donate where don_distt_code='"+distt_code+"' and don_status=1");
}catch(Exception e){}
return rs;
}
}
 Code for logicDIO.java
package Logic;

import design.Login;
import java.sql.Connection;
import jpava.sql.ResultSet;
import java.sql.Statement;

/**
*
* @author Praveen Chauhan
*/
public class LogicDIO {
public static String getInfo()
{
int b_bank_code=0;
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select max(b_bank_code)from b_bank_master");
rs.next();
b_bank_code=Integer.parseInt(rs.getString(1))+1;
}catch(Exception e){}
return String.valueOf(b_bank_code);
}
public static int save_in_newbloodinfo(String b_bank_code,String distt_code,String
dioid,String b_bank_name,String b_bank_phone,String cper,String email,String add)
{
String bloodgroup[]={"A(+)","A(-)","B(+)","B(-)","O(+)","O(-)","AB(+)","AB(-)"};
int i;
int res=0;
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();
//B_BANK_CODE B_BANK_NAME B_BANK_PHONE B_BANK_CONT_PER
B_BANK_EMAIL B_BANK_ADDRESS STATE_CODE
DISTT_CODE ADMIN_ID DEACT
st.executeUpdate("insert into b_bank_master
values('"+b_bank_code+"','"+b_bank_name+"','"+b_bank_phone+"','"+cper+"','"+email+"','"
+add+"','1','"+distt_code+"','"+dioid+"','0')");
//B_BANK_CODE B_GROUP WHITE_BLOOD_CELLS RED_BLOOD_CELLS
FRESH_FROZEN_PLASMA PLATLETS DISTT_CODE
for(i=0;i<bloodgroup.length;i++)
{
res=st.executeUpdate("insert into
newbloodinfo(b_bank_code,b_group,distt_code)values('"+b_bank_code+"','"+bloodgroup[i]
+"','"+distt_code+"')");
}
}catch(Exception e){}
return res;
}
public static void insert_bank_userpwd(String USER_ID,String USER_NAME,String
PWD,String STATE_CODE,String DISTT_CODE,String ADMIN_ID,String
B_BANK_CODE,String CHECKLOGIN,String DEACT)
{
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select max(user_id)from user_master");
rs.next();
int id=Integer.parseInt(rs.getString(1))+1;
st.executeUpdate("insert into user_master
values('"+String.valueOf(id)+"','"+USER_NAME+"','"+PWD+"','"+STATE_CODE+"','"+DI
STT_CODE+"','"+ADMIN_ID+"','"+B_BANK_CODE+"','"+CHECKLOGIN+"','0')");
}
catch(Exception e){}
}

public static String[] activate(String disttcode)


{
String data[]=null;
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select count(deact) from b_bank_master where deact=0 and
distt_code='"+disttcode+"'");
rs.next();
int size=rs.getInt(1);
data=new String[size];

rs=st.executeQuery("select b_bank_name from b_bank_master where deact=0 and


distt_code='"+disttcode+"'");
int i=0;
while(rs.next())
{
data[i]=rs.getString(1);
i++;
}
}catch(Exception e){}
return data;
}

public static String[] deactivate(String disttcode)


{
String data[]=null;
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select count(deact) from b_bank_master where deact=1 and
distt_code='"+disttcode+"'");
rs.next();
int size=rs.getInt(1);
data=new String[size];
rs=st.executeQuery("select b_bank_name from b_bank_master where deact=1 and
distt_code='"+disttcode+"'");
int i=0;
while(rs.next())
{
data[i]=rs.getString(1);
i++;
}
}catch(Exception e){}
return data;
}

public static int updatedect(String b_bank_name)


{
int res=0;
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();
//B_BANK_CODE B_BANK_NAME
ResultSet rs=st.executeQuery("select b_bank_code from b_bank_master where
b_bank_name='"+b_bank_name+"'");
rs.next();
int code=rs.getInt(1);
res=st.executeUpdate("update newbloodinfo set deact=1 where b_bank_code='"+code+"'");
res=st.executeUpdate("update b_bank_master set deact=1 where
b_bank_name='"+b_bank_name+"'");
}catch(Exception e){}
return res;
}

public static int updateact(String b_bank_name)


{
int res=0;
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select b_bank_code from b_bank_master where
b_bank_name='"+b_bank_name+"'");
rs.next();
int code=rs.getInt(1);
res=st.executeUpdate("update newbloodinfo set deact=0 where b_bank_code='"+code+"'");
res=st.executeUpdate("update b_bank_master set deact=0 where
b_bank_name='"+b_bank_name+"'");
}catch(Exception e){}
return res;
}

public static int updateDIOPassword(String old,String newpwd,String


confirmnewpwd,String dioid)
{
int r=0;
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select pwd from admin where admin_id='"+dioid+"'");
rs.next();
String oldpwd=rs.getString(1);
if(old.equals(oldpwd))
{
if(newpwd.equals(confirmnewpwd))
{

r= st.executeUpdate("update admin set pwd='"+newpwd+"' where admin_id='"+dioid+"'");


return r;
}
else
return -1;
}
else
return -2;
}
catch(Exception e){}
return r;
}

public static String[][] getdonorinfo(String distt_code)


{
ResultSet rs=null;
String data[][]=null;
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();
rs=st.executeQuery("select count(don_distt_code) from temp_donate where
don_distt_code='"+distt_code+"'");
rs.next();
data=new String[rs.getInt(1)][8];
System.out.println("1");
int i=0,j;
System.out.println("2");
rs=st.executeQuery("select
Don_id,DON_NAME,DON_ADDRESS,DON_PHONE,DON_EMAIL,DON_BLOODGRO
UP,DON_AGE,DON_BLDSUM from temp_donate where don_status=0 and
don_distt_code='"+distt_code+"'");

while(rs.next())
{
System.out.println("test");
for(j=0;j<8;j++)
data[i][j]=rs.getString(j+1);
i++;
System.out.println("3");
}
System.out.println(data[0][0]);
}

catch(Exception e){ System.out.println(e);}


return data;
}

public static void main(String gh[])


{
String data[][]=getdonorinfo("1");
int i,j;
for(i=0;i<data.length;i++)
{

for(j=0;j<7;j++)
System.out.print(data[i][j]+"\t");
System.out.println();
}
}

public static void updatedonor(String id)


{
try
{
Connection con=Connect.conn();
Statement st=con.createStatement();
st.executeUpdate("update temp_donate set don_status=1 where don_id='"+id+"'");
System.out.println("updated");
}catch(Exception e){}
}
}
12 .Outputs
13 .Conclusion

14. References

 w3schools.org

 Oracle.com

 J2se.com

 Software Engineering by Pankaj Jalote

 System Analysis and Design

Вам также может понравиться