Anda di halaman 1dari 121

Title of the Project:

Contractor Management System

Abstract of Project Contractor Management System


In

this

world

of

growing

technologies

everything

has

been

computerized. With large number of work opportunities the Human


workforce has increased. Thus there is a need of a system which can handle
the data of such a large number of Contractors in an organization. This
project simplifies the task of maintain records because of its user friendly
nature.
The CONTRACTOR MANAGEMENT SYSTEM has been developed to override
the problems prevailing in the practicing manual system. This software is
supported to eliminate and in some cases reduce the hardships faced by this
existing system. Moreover this system is designed for the particular need of
the company to carry out operations in a smooth and effective manner.
The application is reduced as much as possible to avoid errors while entering
the data. It also provides error message while entering invalid data. No
formal knowledge is needed for the user to use this system. Thus by this all
it proves it is user-friendly.

This project will allow admin to add new Contractors after proper
authentication. Admin can also add new departments and posts. It can
allocate Contractors to different departments at different posts. Database
should store all personal details of Contractors such as date of birth full
name etc. and his educational background, work experience, skill sets,
current and past projects in different tables with proper relations.
This system enables Contractors to perform their own profile. It enables the
automation of work flow notifications and leave request. Work flow
notification from administrator are stored in the backend and notified to
Contractor, once Contractor log in to the system. Leave request made by the
Contractor is placed for administrator approval, the administrator module
checks up with the leave availability and approves or rejects the request.

Introduction of the Project Contractor Management System


Every organization, whether big or small, has human resource
challenges

to

overcome.

every

organization

has

different

Contractor

management needs, therefore we design exclusive Contractor management


systems that are adapted to your managerial requirements. This is designed
to assist in strategic planning, and will help you ensure that your
organization is equipped with the right level of human resources for your
future goals. Also, for those busy executive who are always on the go, our
systems come with remote access features, which will allow you to manage
your workforce anytime, at all times.

These systems will ultimately allow

you to better manage resources. One of the main features in Contractor


management system is time tracking for Contractors. Effective time tracking
mechanism saves both time and money for the organization.

Implementation of security mechanisms at various levels


Data Security System: The data security system will allow data to be
securely transmitted between the various components of the e-commerce
portal. This includes transmission of product, merchant and customer
information from the content management system to the website, and also
the transmission of data from the website to the content management
system.
Folder Security using .htaccess: The .htaccess (short for Hypertext
Access) file in your sites directory is a configuration file you can use
to override the settings on your web server. With the right commands, you
can enable/disable extra functionality and features to protect your site from
spammers, hackers and other threats.
Prevent Directory Browsing: Protecting directories from being listed is, at
best, security by obscurity. That is, its hiding your stuff from view,
preventing meddling visitors from browsing through your directories. Really,
its the web equivalent of hiding your cash under your mattress.Still, its good
practice to prevent directory browsing, along with implementing other
measures to secure your site.
To disable browsing of your directories, add this to your .htaccess file:
Options All Indexes

Restrict Access to Your Admin Area : A simple way to restrict access if


your internet has a fixed IP address and you always access your site form
the same location is by creating a new .htaccess file with the following
snippet:
order deny,allow
allow from 192.168.5.1
deny from all

System Design
In this phase, a logical system is built which fulfils the given requirements.
Design

phase

of

software

development

deals

with

transforming

the

customers requirements into a logically working system. Normally, design is


performed in the following in the following two steps:
1) Primary Design Phase: In this phase, the system is designed at
block level. The blocks are created on the basis of analysis done in the
problem identification phase. Different blocks are created for different
functions emphasis is put on minimising the information flow between
blocks. Thus, all activities which require more interaction are kept in
one block.
2) Secondary Design Phase : In the secondary phase the detailed
design of every block is performed.
The general tasks involved in the design process are the following:
I. Design various blocks for overall system processes.
II. Design smaller, compact and workable modules in each block.
III. Design various database structures.
IV. Specify details of programs to achieve desired functionality.
V. Design the form of inputs, and outputs of the system.

VI. Perform documentation of the design.


VII. System reviews.
User Interface Design
User Interface Design is concerned with the dialogue between a user and the
computer. It is concerned with everything from starting the system or
logging into the system to the eventually presentation of desired inputs and
outputs. The overall flow of screens and messages is called a dialogue.
The following steps are various guidelines for User Interface Design:
1) The system user should always be aware of what to do next.
2) The screen should be formatted so that various types of information,
instructions and messages always appear in the same general display
area.
3) Message, instructions or information should be displayed long enough
to allow the system user to read them.
4) Use display attributes sparingly.
5) Default values for fields and answers to be entered by the user should
be specified.
6) A user should not be allowed to proceed without correcting an error.
7) The system user should never get an operating system message or
fatal error.

TESTING
Testing is the process in which the system is run on manually created
input so that the system is correctly working as desired or not.
During systems testing, the system is used experimentally to ensure
that the software does not fail. In other words, we can say that it will run
according to its specifications and in the way users expect. Special test data
are input for processing, and the results examined.
A limited number of users may be allowed to use the system so that
analyst can see whether they tr
y to use it in unforeseen ways. It is desirable to discover any surprises
before the organization implements the system and depends on it.
Testing of a system is generally done in two phases One is Unit Testing
which is done for each module independently on its completion and the other
one is System Testing which is done at the end of a project.

VALIDATION CRITERIA
The validation criteria in this project are as follows...
In System also, the user inputs are validated before storing them, and
then further for displaying etc. The main validations that are donel System
are as follows
All the screens have a similar look and feel. They all have the almost same
color combinations in its background. This provides a better user interface to
the users.
1) The primary key values cannot be duplicated.
2) All the entries in any combo box have been sorted in alphabetical
order. This helps a user while selecting a value from the combo box.
IMPORTANCE OF TESTING
During systems testing, the system is used experimentally to ensure that
the software does not fail. In other words, we can say that it will run
according to its specifications and in the way users expect. Special test data
are input for processing, and the results examined.
The importance of system testing is that the system is expected to run
according to members requirement before delivering it to the customer.

The System is tested on the basis of specification so that it does not


fail on user site.
Implementation and Testing

Implementation
Detailed Design of Implementation - This phase of the systems
development

life

cycle

refines

hardware

and

software

specifications,

establishes programming plans, trains users and implements extensive


testing procedures, to evaluate design and operating specifications and/or
provide the basis for further modification.
Technical Design - This activity builds upon specifications produced during
new

system

design,

adding

detailed

technical

specifications

and

documentation.
Test Specifications and Planning - This activity prepares detailed test
specifications

for

individual

modules

and

programs,

job

streams,

subsystems, and for the system as a whole.


Programming

and

Testing

This

activity

encompasses

actual

development, writing, and testing of program units or modules.


User Training - This activity encompasses writing user procedure manuals,
preparation of user training materials, conducting training programs, and

testing procedures.
Acceptance Test - A final procedural review to demonstrate a system and
secure user approval before a system becomes operational.
Installation Phase - In this phase the new Computerized system is
installed, the conversion to new procedures is fully implemented, and the
potential of the new system is explored.
System Installation: The process of starting the actual use of a system
and training user personnel in its operation.
Review Phase - This phase evaluates the successes and failures during a
systems development project, and to measure the results of a new
Computerized Transystem in terms of benefits and savings projected at the
start of the project.
Development Recap - A review of a project immediately after completion
to find successes and potential problems in future work.
Post-Implementation Review - A review, conducted after a new system
has been in operation for some time, to evaluate actual system performance
against original expectations and projections for cost-benefit improvements.
Also identifies maintenance projects to enhance or improve the system.
THE STEPS IN THE SOFTWARE TESTING

The steps involved during Unit testing are as follows:


a) Preparation of the test cases.
b) Preparation of the possible test data with all the validation checks.
c) Complete code review of the module.
d) Actual testing done manually.
e) Modifications done for the errors found during testing.
f) Prepared the test result scripts.
The unit testing done included the testing of the following items:
1) Functionality of the entire module/forms.
2) Validations for user input.
3) Checking of the Coding standards to be maintained during coding.
4) Testing the module with all the possible test data.
5) Testing of the functionality involving all type of calculations etc.
6) Commenting standard in the source files.
After completing the Unit testing of all the modules, the whole system is
integrated with all its dependencies in that module. While System
Integration, We integrated the modules one by one and tested the system at
each step. This helped in reduction of errors at the time of the system
testing.
The steps involved during System testing are as follows:

Integration of all the modules/forms in the system.

Preparation of the test cases.

Preparation of the possible test data with all the validation checks.

Actual testing done manually.

Recording of all the reproduced errors.

Modifications done for the errors found during testing.

COST ESTIMATION OF THE PROJECT


Software cost comprises a small percentage of overall computer-based
system cost. There are a number of factors, which are considered, that can
affect the ultimate cost of the software such as - human, technical,
Hardware and Software availability etc.
The main point that was considered during the cost estimation of project
was its sizing. In spite of complete software sizing, function point and
approximate lines of code were also used to "size" each element of the
Software and their costing.
The cost estimation done by me for Project also depend upon the baseline
metrics collected from past projects and these were used in conjunction with
estimation variables to develop cost and effort projections.
We have basically estimated this project mainly on two bases -

1) Effort Estimation - This refers to the total man-hours required for the
development of the project. It even includes the time required for doing
documentation and user manual.
2) Hardware Required Estimation - This includes the cost of the PCs and
the hardware cost required for development of this project.

SYSTEM ANALYSIS
The analysis model is a concise, precise abstraction of what the desired
system must do, and not how it will be done after the study of the
existing system is completed. This basically includes system study and
the requirement analysis. Interacting with the clients regarding their
requirements and expectations from the system does requirement
analysis.
The steps, which are essential for system analysis, are:
1. Research and define essential components.
2. Analyze current processes and identify gaps.
3. Interview

users,

Trainee,

Trainers

and

other

concerned

personnel

regarding essential components and current processes.


4. Write requirements document.
5. Define standards for standards, policies, and procedures.
6. Review draft requirements document with users, Trainee, Trainers and
other concerned personnel.
7. Update and expand project plan.

FEASIBILITY STUDY
At this stage, the analyst estimates the urgency of the project and estimates
the development cost.
In feasibility analysis, we have to study the following:
1) Technical Feasibility:
Technical feasibility is concerned with the availability of hardware and
software required for the development

of the system, to see

compatibility and maturity of the technology proposed to be used and


to see the availability of the required technical manpower to develop
the system.
After the study we came to conclusion that we proceed further with
the tools and development environment chosen by us. This was
important in our case as we were working on two various phases of
the department that will need to be integrated in future to make an
extended system.
2) Operational Feasibility:
Operational feasibility is all about problems that may arise during
operations. There are two aspects related with this issue:

What is the probability that the solution developed may not be


put to use or may not work?

What is the inclination of the management and end users


towards the solution? Though, there is very least possibility of
management being averse to the solution, there is a significant
probability that the end users may not be interested in using the
solution due to lack of training, insight etc.

3) Economic Feasibility:
It is the measure of cost effectiveness of the project. The economic
feasibility is nothing but judging whether the possible benefit of solving
the problems is worthwhile of not. At the feasibility study level, it is
impossible to estimate the cost because members requirements and
alternative solutions have not been identified at this stage. However,
when the specific requirements and solutions have been identified, the
analyst weighs the cost and benefits of all solutions, this is called cost
benefit analysis.

PROJECT SCHEDULING
An elementary Gantt chart or Timeline chart for the development plan is
given below. The plan explains the tasks versus the time (in weeks) they will
take to complete.
January

February

March

Requirement
Gathering
Analysis
Design
Coding
Testing
Implement
W

Wis are weeks of the months, for i =1, 2, 3, 4

W4

RDBMS Architecture Diagram


Project Category:
Relational Database Management System (RDBMS) : This is an RDBMS
based project which is currently using MySQL for all the transaction
statements. MySQL is an opensource RDBMS System.
Brief Introduction about RDBSM :
A

relational

database

management

system

(RDBMS)

is

database

management system (DBMS) that is based on the relational model as


invented by E. F. Codd, of IBM's San Jose Research Laboratory. Many popular
databases currently in use are based on the relational database model.
RDBMSs have become a predominant choice for the storage of information in
new databases used for financial records, manufacturing and logistical
information, personnel data, and much more since the 1980s. Relational
databases have often replaced legacy hierarchical databases and network
databases because they are easier to understand and use.

Implementation Methodology:
Model View Controller or MVC as it is popularly called, is a software design
pattern for developing web applications. A Model View Controller pattern is
made up of the following three parts:

Model - The lowest level of the pattern which is responsible for

maintaining data.
View - This is responsible for displaying all or a portion of the data to

the user.
Controller - Software Code that controls the interactions between the
Model and View.

MVC is popular as it isolates the application logic from the user interface
layer and supports separation of concerns. Here the Controller receives all
requests for the application and then works with the Model to prepare any
data needed by the View. The View then uses the data prepared by the
Controller to generate a final presentable response. The MVC abstraction can
be graphically represented as follows.
MVC (Model View Controller Flow) Diagram

Design Diagrams
of the Project

Input and Output


Screen of the Project

Coding of the
Project

Code of Connect.java
package com;
import java.sql.*;
import java.util.*;
public class Connect
{
public static Statement statement = null;
public static Connection connection;
public static ResultSet rs;
public static PreparedStatement pstmt;
/////Function for connect to the MySQL Server Database////////////
public static void connect_mysql()
{
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection =
DriverManager.getConnection("jdbc:mysql://localhost/Contractor_managem
ent_system?" + "user=root&password=root");
statement=connection.createStatement();
}
catch(Exception e)
{
System.out.println(" Error : "+ e.toString());
}
}
////////Function for geting the Option/////////////////////

public static String getOptionList(String tableName,String


idColumn,String valueColumn,String Columns,int selID,String conn)
{
String SQL = "SELECT "+Columns+" FROM "+tableName+"
where "+conn;
String Option="<option value=''>Please Select</option>";
try
{
rs = statement.executeQuery(SQL);
while(rs.next())
{
int selectedID = rs.getInt(idColumn);
if(selectedID==selID)
Option+="<option value=\""+selectedID+"\"
Selected>"+rs.getString(valueColumn)+"</option>";
else
Option+="<option
value=\""+selectedID+"\">"+rs.getString(valueColumn)+"</option>";
}
}
catch(Exception e)
{
System.out.println("Error : "+e);
}
return Option;
}
}

Code of Contractor.java
package Model;
import java.util.*;
import java.sql.*;
import com.*;
import java.io.*;
public class Contractor extends Connect
{
/////Function for connect to the MySQL Server Database////////////
public Contractor()
{
Connect.connect_mysql();
}
//////////Save User Details /////
public String saveContractor(HashMap ContractorData)
{
String SQL = "INSERT INTO Contractor (Contractor_user,
Contractor_password, Contractor_level, Contractor_sal,
Contractor_first_name, Contractor_middle_name, Contractor_last_name,
Contractor_gender, Contractor_address, Contractor_village,
Contractor_state, Contractor_country, Contractor_landline,
Contractor_mobile, Contractor_email, Contractor_status,
Contractor_deparment, Contractor_dob, Contractor_nationalty) VALUES
(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);";
int record=0,last_inserted_id=0;
String error = "";

try
{
pstmt = connection.prepareStatement(SQL);
pstmt.setString(1,(String)
ContractorData.get("Contractor_user"));
pstmt.setString(2,(String)
ContractorData.get("Contractor_password"));
pstmt.setString(3,(String)
ContractorData.get("Contractor_level"));
pstmt.setString(4,(String)
ContractorData.get("Contractor_sal"));
pstmt.setString(5,(String)
ContractorData.get("Contractor_first_name"));
pstmt.setString(6,(String)
ContractorData.get("Contractor_middle_name"));
pstmt.setString(7,(String)
ContractorData.get("Contractor_last_name"));
pstmt.setString(8,(String)
ContractorData.get("Contractor_gender"));
pstmt.setString(9,(String)
ContractorData.get("Contractor_address"));
pstmt.setString(10,(String)
ContractorData.get("Contractor_village"));
pstmt.setString(11,(String)
ContractorData.get("Contractor_state"));
pstmt.setString(12,(String)
ContractorData.get("Contractor_country"));
pstmt.setString(13,(String)
ContractorData.get("Contractor_landline"));

pstmt.setString(14,(String)
ContractorData.get("Contractor_mobile"));
pstmt.setString(15,(String)
ContractorData.get("Contractor_email"));
pstmt.setString(16,(String)
ContractorData.get("Contractor_status"));
pstmt.setString(17,(String)
ContractorData.get("Contractor_deparment"));
pstmt.setString(18,(String)
ContractorData.get("Contractor_dob"));
pstmt.setString(19,(String)
ContractorData.get("Contractor_nationalty"));
record = pstmt.executeUpdate();
/// Get the Last Insert ID ///
rs = pstmt.getGeneratedKeys();
if(rs.next())
{
last_inserted_id = rs.getInt(1);
}
pstmt.close();
}
catch(Exception e)
{
StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter( writer );
e.printStackTrace( printWriter );
printWriter.flush();
String stackTrace = writer.toString();

error+="Error : "+stackTrace;
System.out.println(" Error : "+ e.toString());
}
/// Save Credentials to Login ////
SQL = "INSERT INTO login (login_emp_id, login_user, login_password,
login_email) VALUES (?, ?, ?, ? );";
try
{
pstmt = connection.prepareStatement(SQL);
pstmt.setInt(1,last_inserted_id);
pstmt.setString(2,(String)
ContractorData.get("Contractor_user"));
pstmt.setString(3,(String)
ContractorData.get("Contractor_password"));
pstmt.setString(4,(String)
ContractorData.get("Contractor_email"));
record = pstmt.executeUpdate();
pstmt.close();
connection.close();
}
catch(Exception e)
{
StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter( writer );
e.printStackTrace( printWriter );
printWriter.flush();
String stackTrace = writer.toString();
error+="Error : "+stackTrace;
System.out.println(" Error : "+ e.toString());

}
return error;
}
//////////////////Function for getting Users Details//////////
public HashMap getContractorDetails(int Contractor_id)
{
HashMap resultsArray = new HashMap();
int count=0;
try
{
String SQL = "SELECT * FROM Contractor WHERE Contractor_id =
"+Contractor_id ;
statement = connection.createStatement();
rs = statement.executeQuery(SQL);
while(rs.next())
{
resultsArray.put("Contractor_id",rs.getString("Contractor_id"));
resultsArray.put("Contractor_user",rs.getString("Contractor_user"));
resultsArray.put("Contractor_level",rs.getString("Contractor_level"));

resultsArray.put("Contractor_sal",Integer.parseInt(rs.getString("Contractor_s
al")));

resultsArray.put("Contractor_first_name",rs.getString("Contractor_first_nam
e"));

resultsArray.put("Contractor_middle_name",rs.getString("Contractor_middle
_name"));

resultsArray.put("Contractor_last_name",rs.getString("Contractor_last_name
"));

resultsArray.put("Contractor_gender",rs.getString("Contractor_gender"));

resultsArray.put("Contractor_address",rs.getString("Contractor_address"));

resultsArray.put("Contractor_village",rs.getString("Contractor_village"));

resultsArray.put("Contractor_state",Integer.parseInt(rs.getString("Contractor
_state")));

resultsArray.put("Contractor_country",Integer.parseInt(rs.getString("Contrac
tor_country")));

resultsArray.put("Contractor_landline",rs.getString("Contractor_landline"));

resultsArray.put("Contractor_mobile",rs.getString("Contractor_mobile"));

resultsArray.put("Contractor_email",rs.getString("Contractor_email"));

resultsArray.put("Contractor_status",Integer.parseInt(rs.getString("Contract
or_status")));

resultsArray.put("Contractor_deparment",Integer.parseInt(rs.getString("Cont
ractor_deparment")));
resultsArray.put("Contractor_dob",rs.getString("Contractor_dob"));

resultsArray.put("Contractor_nationalty",rs.getString("Contractor_nationalty"
));
count++;
}
if(count==0)
{
resultsArray.put("Contractor_id","");
resultsArray.put("Contractor_user","");
resultsArray.put("Contractor_level","");
resultsArray.put("Contractor_sal",0);
resultsArray.put("Contractor_first_name","");
resultsArray.put("Contractor_middle_name","");
resultsArray.put("Contractor_last_name","");
resultsArray.put("Contractor_gender","");
resultsArray.put("Contractor_address","");
resultsArray.put("Contractor_village","");
resultsArray.put("Contractor_state",0);

resultsArray.put("Contractor_country",0);
resultsArray.put("Contractor_landline","");
resultsArray.put("Contractor_mobile","");
resultsArray.put("Contractor_email","");
resultsArray.put("Contractor_status",0);
resultsArray.put("Contractor_deparment",0);
resultsArray.put("Contractor_dob","");
resultsArray.put("Contractor_nationalty","");
}
}
catch(Exception e)
{
System.out.println("Error is: "+ e);
}
return resultsArray;
}
public String updateContractor(HashMap ContractorData)
{
String SQL = "UPDATE Contractor SET Contractor_sal = ?,
Contractor_first_name = ?, Contractor_middle_name = ?,
Contractor_last_name = ?, Contractor_gender = ?, Contractor_address = ?,
Contractor_village = ?, Contractor_state = ?, Contractor_country = ?,
Contractor_landline = ?, Contractor_mobile = ?, Contractor_email = ?,
Contractor_status = ?, Contractor_deparment = ?, Contractor_dob = ?,
Contractor_nationalty = ? WHERE Contractor_id = ?";
String error = "";
int record=0;

try
{
pstmt = connection.prepareStatement(SQL);
pstmt.setString(1,(String)
ContractorData.get("Contractor_sal"));
pstmt.setString(2,(String)
ContractorData.get("Contractor_first_name"));
pstmt.setString(3,(String)
ContractorData.get("Contractor_middle_name"));
pstmt.setString(4,(String)
ContractorData.get("Contractor_last_name"));
pstmt.setString(5,(String)
ContractorData.get("Contractor_gender"));
pstmt.setString(6,(String)
ContractorData.get("Contractor_address"));
pstmt.setString(7,(String)
ContractorData.get("Contractor_village"));
pstmt.setString(8,(String)
ContractorData.get("Contractor_state"));
pstmt.setString(9,(String)
ContractorData.get("Contractor_country"));
pstmt.setString(10,(String)
ContractorData.get("Contractor_landline"));
pstmt.setString(11,(String)
ContractorData.get("Contractor_mobile"));
pstmt.setString(12,(String)
ContractorData.get("Contractor_email"));
pstmt.setString(13,(String)
ContractorData.get("Contractor_status"));

pstmt.setString(14,(String)
ContractorData.get("Contractor_deparment"));
pstmt.setString(15,(String)
ContractorData.get("Contractor_dob"));
pstmt.setString(16,(String)
ContractorData.get("Contractor_nationalty"));
pstmt.setString(17,(String)
ContractorData.get("Contractor_id"));
record = pstmt.executeUpdate();
pstmt.close();
connection.close();
}
catch(Exception e)
{
StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter( writer );
e.printStackTrace( printWriter );
printWriter.flush();
String stackTrace = writer.toString();
error+="Error : "+stackTrace;
System.out.println(" Error : "+ e.toString());
}
return error;
}
public boolean deleteContractor(int Contractor_id)
{
return true;
}

/////Function for Getting the List////////////


public String getStateOption(Integer SelID)
{
int selectedID = SelID.intValue();
return
Connect.getOptionList("state","state_id","state_name","state_id,state_name
",selectedID,"1");
}
/////Function for Getting the List////////////
public String getCountryOption(Integer SelID)
{
int selectedID = SelID.intValue();
return
Connect.getOptionList("country","country_id","country_name","country_id,c
ountry_name",selectedID,"1");
}
/////Function for Getting the List////////////
public String getSalutionOption(Integer SelID)
{
int selectedID = SelID.intValue();
return
Connect.getOptionList("salutions","sl_id","sl_name","sl_id,sl_name",selected
ID,"1");
}
/////Function for Getting the List////////////
public String getConnectionTypeOption(Integer SelID)
{

int selectedID = SelID.intValue();


return
Connect.getOptionList("connection_type","cont_id","cont_name","cont_id,co
nt_name",selectedID,"1");
}
/////Function for Getting the List////////////
public String getStatusOption(Integer SelID)
{
int selectedID = SelID.intValue();
return
Connect.getOptionList("status","status_id","status_name","status_id,status_
name",selectedID,"1");
}
/////Function for Getting the List////////////
public String getDepartmentOption(Integer SelID)
{
int selectedID = SelID.intValue();
return
Connect.getOptionList("department","dept_id","dept_name","dept_id,dept_n
ame",selectedID,"1");
}
////////////////Function for getting all the Airport
Details////////////////////
public ArrayList getAllContractor()
{
int count=0;
String error = "";

ArrayList resultArray = new ArrayList();


try
{
String SQL = "SELECT * FROM Contractor" ;
statement = connection.createStatement();
rs = statement.executeQuery(SQL);
while(rs.next())
{
HashMap results = new HashMap();
results.put("Contractor_id",rs.getString("Contractor_id"));
results.put("Contractor_user",rs.getString("Contractor_user"));
results.put("Contractor_level",rs.getString("Contractor_level"));
results.put("Contractor_sal",rs.getString("Contractor_sal"));

results.put("Contractor_first_name",rs.getString("Contractor_first_name"));

results.put("Contractor_middle_name",rs.getString("Contractor_middle_nam
e"));

results.put("Contractor_last_name",rs.getString("Contractor_last_name"));
results.put("Contractor_gender",rs.getString("Contractor_gender"));
results.put("Contractor_address",rs.getString("Contractor_address"));

results.put("Contractor_village",rs.getString("Contractor_village"));
results.put("Contractor_state",rs.getString("Contractor_state"));
results.put("Contractor_country",rs.getString("Contractor_country"));
results.put("Contractor_landline",rs.getString("Contractor_landline"));
results.put("Contractor_mobile",rs.getString("Contractor_mobile"));
results.put("Contractor_email",rs.getString("Contractor_email"));

results.put("Contractor_status",Integer.parseInt(rs.getString("Contractor_sta
tus")));

results.put("Contractor_deparment",Integer.parseInt(rs.getString("Contracto
r_deparment")));
results.put("Contractor_dob",rs.getString("Contractor_dob"));

results.put("Contractor_nationalty",rs.getString("Contractor_nationalty"));
count++;
resultArray.add(results);
}
}
catch(Exception e)
{
StringWriter writer = new StringWriter();

PrintWriter printWriter = new PrintWriter( writer );


e.printStackTrace( printWriter );
printWriter.flush();
String stackTrace = writer.toString();
error+="Error : "+stackTrace;
System.out.println(" Error : "+ e.toString());
}
return resultArray;
}
public String getDepartment(int dept_id)
{
HashMap results = new HashMap();
String SQL = "";
String value = "";
int count=0;
try
{
SQL = "SELECT dept_name FROM department WHERE dept_id =
"+dept_id ;
statement = connection.createStatement();
rs = statement.executeQuery(SQL);
while(rs.next())
{
value = rs.getString("dept_name");
}
}
catch(Exception e)
{
System.out.println("Error is: "+ e);

}
return value;
}
public String getStatus(int status_id)
{
HashMap results = new HashMap();
String SQL = "";
String value = "";
int count=0;
try
{
SQL = "SELECT status_name FROM status WHERE status_id =
"+status_id ;
statement = connection.createStatement();
rs = statement.executeQuery(SQL);
while(rs.next())
{
value = rs.getString("status_name");
}
}
catch(Exception e)
{
System.out.println("Error is: "+ e);
}
return value;
}
}

Code of Leave.java
package Model;
import java.util.*;
import java.sql.*;
import com.*;
import java.io.*;
public class Leave extends Connect
{
/////Function for connect to the MySQL Server Database////////////
public Leave()
{
Connect.connect_mysql();
}
//////////Save User Details /////
public String saveLeave(HashMap leaveData)
{
String SQL = "INSERT INTO `leave` (leave_Contractor_id,
leave_reason, leave_description, leave_from_date, leave_to_date) VALUES
(?, ?, ?, ?, ?);";
int record=0;
String error = "";
try
{
pstmt = connection.prepareStatement(SQL);
pstmt.setString(1,(String)
leaveData.get("leave_Contractor_id"));

pstmt.setString(2,(String) leaveData.get("leave_reason"));
pstmt.setString(3,(String)
leaveData.get("leave_description"));
pstmt.setString(4,(String)
leaveData.get("leave_from_date"));
pstmt.setString(5,(String)
leaveData.get("leave_to_date"));
record = pstmt.executeUpdate();
pstmt.close();
connection.close();
}
catch(Exception e)
{
StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter( writer );
e.printStackTrace( printWriter );
printWriter.flush();
String stackTrace = writer.toString();
error+="Error : "+stackTrace;
System.out.println(" Error : "+ e.toString());
}
return error;
}
//////////////////Function for getting Users Details//////////
public HashMap getLeaveDetails(int leave_id)
{
HashMap results = new HashMap();
int count=0;
try

{
String SQL = "SELECT * FROM `leave` WHERE leave_id =
"+leave_id ;
statement = connection.createStatement();
rs = statement.executeQuery(SQL);
while(rs.next())
{
results.put("leave_id",rs.getString("leave_id"));

results.put("leave_Contractor_id",Integer.parseInt(rs.getString("leave_Contr
actor_id")));
results.put("leave_reason",rs.getString("leave_reason"));
results.put("leave_description",rs.getString("leave_description"));
results.put("leave_from_date",rs.getString("leave_from_date"));
results.put("leave_to_date",rs.getString("leave_to_date"));
results.put("leave_status",rs.getString("leave_status"));
count++;
}
if(count==0)
{
results.put("leave_id","");
results.put("leave_Contractor_id",0);
results.put("leave_reason","");
results.put("leave_description","");

results.put("leave_from_date","");
results.put("leave_to_date","");
results.put("leave_status",0);
}
}
catch(Exception e)
{
System.out.println("Error is: "+ e);
}
return results;
}
/// Update the Leave ////
public String updateLeave(HashMap leaveData)
{
String SQL = "UPDATE `leave` SET leave_status = ? WHERE
leave_id = ?";
String error = "";
int record=0;
try
{
pstmt = connection.prepareStatement(SQL);
pstmt.setString(1,(String) leaveData.get("leave_status"));
pstmt.setString(2,(String) leaveData.get("leave_id"));
record = pstmt.executeUpdate();
pstmt.close();
connection.close();
}
catch(Exception e)

{
StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter( writer );
e.printStackTrace( printWriter );
printWriter.flush();
String stackTrace = writer.toString();
error+="Error : "+stackTrace;
System.out.println(" Error : "+ e.toString());
}
return error;
}
////////////////Function for getting all the Airport
Details////////////////////
public ArrayList getAllLeave(String emp_id)
{
String SQL = "SELECT * FROM `leave`,`Contractor` WHERE
leave_Contractor_id = Contractor_id";
int count=0;
ArrayList resultArray = new ArrayList();
try
{
if(!emp_id.equals("0"))
{
SQL = "SELECT * FROM `leave`,`Contractor`
WHERE leave_Contractor_id = Contractor_id AND Contractor_id =
"+emp_id;
}
statement = connection.createStatement();
rs = statement.executeQuery(SQL);

while(rs.next())
{
HashMap results = new HashMap();
results.put("leave_id",rs.getString("leave_id"));

results.put("leave_Contractor_id",Integer.parseInt(rs.getString("leave_Contr
actor_id")));
results.put("leave_reason",rs.getString("leave_reason"));
results.put("leave_description",rs.getString("leave_description"));
results.put("leave_from_date",rs.getString("leave_from_date"));
results.put("leave_to_date",rs.getString("leave_to_date"));
results.put("leave_status",rs.getString("leave_status"));

results.put("Contractor_name",rs.getString("Contractor_first_name")
+" "+rs.getString("Contractor_last_name"));
count++;
resultArray.add(results);
}
}
catch(Exception e)
{
System.out.println("Error is: "+ e);
}
return resultArray;

}
/////Function for Getting the List////////////
public String getContractorOption(Integer SelID)
{
int selectedID = SelID.intValue();
return
Connect.getOptionList("Contractor","Contractor_id","Contractor_id","Contrac
tor_id,Contractor_id",selectedID,"1");
}
}

Code of Login.java
package Model;
import java.util.*;
import java.sql.*;
import com.*;
import java.io.*;
public class Login extends Connect
{
/////Function for connect to the MySQL Server Database////////////
public Login()
{
Connect.connect_mysql();
}
//////////////////Function for Update the airport////////////////////////
public boolean changePassword(String old_password,String
new_password, int login_id)
{
String SQL;
int count = 0;
try
{
SQL = "SELECT * FROM login WHERE login_password =
'"+old_password+"' AND login_id = "+login_id ;
statement = connection.createStatement();
rs = statement.executeQuery(SQL);
while(rs.next())

count++;

if(count==1)

{
SQL = "UPDATE login SET login_password=? WHERE
login_id=?";
int record=0;
pstmt = connection.prepareStatement(SQL);
pstmt.setString(1,new_password);
pstmt.setInt(2,1);
record = pstmt.executeUpdate();
pstmt.close();
connection.close();
}
}
catch(Exception e)
{
System.out.println(" Error : "+ e.toString());
}
if(count==0)
return false;
return true;
}
//////////////////Function for geting the Single Airport Details//////////
public boolean checkLogin(String login_user,String login_password)
{
int count=0;
try
{
String SQL = "SELECT * FROM login WHERE login_user =
'"+login_user+"' AND login_password = '"+login_password+"'" ;
statement = connection.createStatement();

rs = statement.executeQuery(SQL);
while(rs.next())

count++;

}
catch(Exception e)
{
System.out.println("Error is: "+ e);
}
if(count==0)
return false;
return true;
}
//////////////////Function for getting Login Details//////////
public HashMap getLoginDetails(String login_user,String login_password)
{
HashMap resultsArray = new HashMap();
int count=0;
try
{
String SQL = "SELECT * FROM login WHERE login_user =
'"+login_user+"' AND login_password = '"+login_password+"'" ;
statement = connection.createStatement();
rs = statement.executeQuery(SQL);
while(rs.next())
{
resultsArray.put("login_id",rs.getString("login_id"));
resultsArray.put("login_emp_id",rs.getString("login_emp_id"));
resultsArray.put("login_user",rs.getString("login_user"));

resultsArray.put("login_level",rs.getString("login_level"));
count++;
}
if(count==0)
{
resultsArray.put("login_id","");
resultsArray.put("login_emp_id","");
resultsArray.put("login_user","");
resultsArray.put("login_level","");
}
}
catch(Exception e)
{
System.out.println("Error is: "+ e);
}
return resultsArray;
}
}

Code of Salary.java
package Model;
import java.util.*;
import java.sql.*;
import com.*;
import java.io.*;
public class Salary extends Connect
{
/////Function for connect to the MySQL Server Database////////////
public Salary()
{
Connect.connect_mysql();
}
//////////Save User Details /////
public String saveSalary(HashMap salaryData)
{
String SQL = "INSERT INTO salary (sal_employe_id, sal_month,
sal_year, sal_amount) VALUES (?, ?, ?, ?);";
int record=0;
String error = "";
try
{
pstmt = connection.prepareStatement(SQL);
pstmt.setString(1,(String)
salaryData.get("sal_employe_id"));
pstmt.setString(2,(String) salaryData.get("sal_month"));

pstmt.setString(3,(String) salaryData.get("sal_year"));
pstmt.setString(4,(String) salaryData.get("sal_amount"));
record = pstmt.executeUpdate();
pstmt.close();
connection.close();
}
catch(Exception e)
{
StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter( writer );
e.printStackTrace( printWriter );
printWriter.flush();
String stackTrace = writer.toString();
error+="Error : "+stackTrace;
System.out.println(" Error : "+ e.toString());
}
return error;
}
//////////////////Function for getting Users Details//////////
public HashMap getSalaryDetails(int sal_id)
{
HashMap results = new HashMap();
int count=0;
try
{
String SQL = "SELECT * FROM salary WHERE sal_id = "+sal_id ;
statement = connection.createStatement();
rs = statement.executeQuery(SQL);
while(rs.next())

{
results.put("sal_id",rs.getString("sal_id"));

results.put("sal_employe_id",Integer.parseInt(rs.getString("sal_employe_id"
)));
results.put("sal_year",rs.getString("sal_year"));
results.put("sal_month",Integer.parseInt(rs.getString("sal_month")));
results.put("sal_amount",rs.getString("sal_amount"));
count++;
}
if(count==0)
{
results.put("sal_id","");
results.put("sal_employe_id",0);
results.put("sal_year","");
results.put("sal_month",0);
results.put("sal_amount","");
}
}
catch(Exception e)
{
System.out.println("Error is: "+ e);
}
return results;
}
//////////////////Function for getting Users Details//////////

public String getMonth(int mon_id)


{
HashMap results = new HashMap();
String SQL = "";
String value = "";
int count=0;
try
{
SQL = "SELECT month_name FROM month WHERE month_id =
"+mon_id ;
statement = connection.createStatement();
rs = statement.executeQuery(SQL);
while(rs.next())
{
value = rs.getString("month_name");
}
}
catch(Exception e)
{
System.out.println("Error is: "+ e);
}
return value;
}
public String updateSalary(HashMap salaryData)
{
String SQL = "UPDATE salary SET sal_employe_id = ?,sal_year
= ?,sal_month = ?,sal_amount = ? WHERE sal_id = ?";
String error = "";

int record=0;
try
{
pstmt = connection.prepareStatement(SQL);
pstmt.setString(1,(String)
salaryData.get("sal_employe_id"));
pstmt.setString(2,(String) salaryData.get("sal_year"));
pstmt.setString(3,(String) salaryData.get("sal_month"));
pstmt.setString(4,(String) salaryData.get("sal_amount"));
pstmt.setString(5,(String) salaryData.get("sal_id"));
record = pstmt.executeUpdate();
pstmt.close();
connection.close();
}
catch(Exception e)
{
StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter( writer );
e.printStackTrace( printWriter );
printWriter.flush();
String stackTrace = writer.toString();
error+="Error : "+stackTrace;
System.out.println(" Error : "+ e.toString());
}
return error;
}
public boolean delete_login(int airline_id)
{
return true;

}
////////////////Function for getting all the Airport
Details////////////////////
public ArrayList getAllSalary(String emp_id)
{
String SQL = "SELECT * FROM salary";
int count=0;
ArrayList resultArray = new ArrayList();
try
{
if(!emp_id.equals("0"))
{
SQL = "SELECT * FROM salary WHERE
sal_employe_id = "+emp_id;
}
statement = connection.createStatement();
rs = statement.executeQuery(SQL);
while(rs.next())
{
HashMap results = new HashMap();
results.put("sal_id",rs.getString("sal_id"));

results.put("sal_employe_id",Integer.parseInt(rs.getString("sal_employe_id"
)));
results.put("sal_year",rs.getString("sal_year"));
results.put("sal_month",Integer.parseInt(rs.getString("sal_month")));

results.put("sal_amount",rs.getString("sal_amount"));
count++;
resultArray.add(results);
}
}
catch(Exception e)
{
System.out.println("Error is: "+ e);
}
return resultArray;
}
/////Function for Getting the List////////////
public String getMonthOption(Integer SelID)
{
int selectedID = SelID.intValue();
return
Connect.getOptionList("month","month_id","month_name","month_id,month
_name",selectedID,"1");
}
/////Function for Getting the List////////////
public String getContractorOption(Integer SelID)
{
int selectedID = SelID.intValue();
return
Connect.getOptionList("Contractor","Contractor_id","Contractor_id","Contrac
tor_id,Contractor_id",selectedID,"1");
}
}

Code of Timesheet.java
package Model;
import java.util.*;
import java.sql.*;
import com.*;
import java.io.*;
public class Timesheet extends Connect
{
/////Function for connect to the MySQL Server Database////////////
public Timesheet()
{
Connect.connect_mysql();
}
//////////Save User Details /////
public String saveTimesheet(HashMap timesheetData)
{
String SQL = "INSERT INTO timesheet (timesheet_Contractor_id,
timesheet_project_id, timesheet_work_title, timesheet_description,
timesheet_hours, timesheet_date) VALUES (?, ?, ?, ?, ?, ?);";
int record=0;
String error = "";
try
{
pstmt = connection.prepareStatement(SQL);
pstmt.setString(1,(String)
timesheetData.get("timesheet_Contractor_id"));

pstmt.setString(2,(String)
timesheetData.get("timesheet_project_id"));
pstmt.setString(3,(String)
timesheetData.get("timesheet_work_title"));
pstmt.setString(4,(String)
timesheetData.get("timesheet_description"));
pstmt.setString(5,(String)
timesheetData.get("timesheet_hours"));
pstmt.setString(6,(String)
timesheetData.get("timesheet_date"));
record = pstmt.executeUpdate();
pstmt.close();
connection.close();
}
catch(Exception e)
{
StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter( writer );
e.printStackTrace( printWriter );
printWriter.flush();
String stackTrace = writer.toString();
error+="Error : "+stackTrace;
System.out.println(" Error : "+ e.toString());
}
return error;
}
//////////////////Function for getting Users Details//////////
public HashMap getTimesheetDetails(int timesheet_id)
{

HashMap results = new HashMap();


int count=0;
try
{
String SQL = "SELECT * FROM `timesheet` WHERE timesheet_id =
"+timesheet_id ;
statement = connection.createStatement();
rs = statement.executeQuery(SQL);
while(rs.next())
{
results.put("timesheet_id",rs.getString("timesheet_id"));

results.put("timesheet_Contractor_id",Integer.parseInt(rs.getString("timeshe
et_Contractor_id")));

results.put("timesheet_project_id",Integer.parseInt(rs.getString("timesheet_
project_id")));

results.put("timesheet_work_title",rs.getString("timesheet_work_title"));

results.put("timesheet_description",rs.getString("timesheet_description"));
results.put("timesheet_hours",rs.getString("timesheet_hours"));
results.put("timesheet_date",rs.getString("timesheet_date"));
count++;

}
if(count==0)
{
results.put("timesheet_id","");
results.put("timesheet_Contractor_id",0);
results.put("timesheet_project_id",0);
results.put("timesheet_work_title","");
results.put("timesheet_description","");
results.put("timesheet_hours","");
results.put("timesheet_date","");
}
}
catch(Exception e)
{
System.out.println("Error is: "+ e);
}
return results;
}
/// Update the Timesheet ////
public String updateTimesheet(HashMap timesheetData)
{
String SQL = "UPDATE timesheet SET timesheet_Contractor_id =
?, timesheet_project_id = ?, timesheet_work_title = ?,
timesheet_description = ?, timesheet_hours = ?, timesheet_date = ?
WHERE timesheet_id = ?;";
String error = "";
int record=0;
try

{
pstmt = connection.prepareStatement(SQL);
pstmt.setString(1,(String)
timesheetData.get("timesheet_Contractor_id"));
pstmt.setString(2,(String)
timesheetData.get("timesheet_project_id"));
pstmt.setString(3,(String)
timesheetData.get("timesheet_work_title"));
pstmt.setString(4,(String)
timesheetData.get("timesheet_description"));
pstmt.setString(5,(String)
timesheetData.get("timesheet_hours"));
pstmt.setString(6,(String)
timesheetData.get("timesheet_date"));
pstmt.setString(7,(String)
timesheetData.get("timesheet_id"));
record = pstmt.executeUpdate();
pstmt.close();
connection.close();
}
catch(Exception e)
{
StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter( writer );
e.printStackTrace( printWriter );
printWriter.flush();
String stackTrace = writer.toString();
error+="Error : "+stackTrace;
System.out.println(" Error : "+ e.toString());

}
return error;
}
////////////////Function for getting all the Airport
Details////////////////////
public ArrayList getAllTimesheet(String emp_id)
{
String SQL = "SELECT * FROM `timesheet`,`Contractor`
WHERE timesheet_Contractor_id = Contractor_id";
int count=0;
ArrayList resultArray = new ArrayList();
try
{
if(!emp_id.equals("0"))
{
SQL = "SELECT * FROM `timesheet`,`Contractor`
WHERE timesheet_Contractor_id = Contractor_id AND Contractor_id =
"+emp_id;
}
statement = connection.createStatement();
rs = statement.executeQuery(SQL);
while(rs.next())
{
HashMap results = new HashMap();
results.put("timesheet_id",rs.getString("timesheet_id"));

results.put("timesheet_Contractor_id",Integer.parseInt(rs.getString("timeshe
et_Contractor_id")));

results.put("timesheet_project_id",Integer.parseInt(rs.getString("timesheet_
project_id")));

results.put("timesheet_work_title",rs.getString("timesheet_work_title"));

results.put("timesheet_description",rs.getString("timesheet_description"));
results.put("timesheet_hours",rs.getString("timesheet_hours"));
results.put("timesheet_date",rs.getString("timesheet_date"));
results.put("Contractor_name",rs.getString("Contractor_first_name")
+" "+rs.getString("Contractor_last_name"));
count++;
resultArray.add(results);
}
}
catch(Exception e)
{
System.out.println("Error is: "+ e);
}
return resultArray;
}
/////Function for Getting the List////////////

public String getContractorOption(Integer SelID)


{
int selectedID = SelID.intValue();
return
Connect.getOptionList("Contractor","Contractor_id","Contractor_id","Contrac
tor_id,Contractor_id",selectedID,"1");
}
/////Function for Getting the List////////////
public String getProjectOption(Integer SelID)
{
int selectedID = SelID.intValue();
return
Connect.getOptionList("project","project_id","project_id","project_id,project
_id",selectedID,"1");
}
}

Code of Model Contractor.jsp:


<%@ page import= "Model.*" %>
<%@ page import= "java.util.*" %>
<%
Contractor Contractor_obj = new Contractor();
if((request.getParameter("act")).equals("Save"))
{
HashMap Contractor_data = new HashMap();

Contractor_data.put("Contractor_id",request.getParameter("Contractor_id"))
;

Contractor_data.put("Contractor_user",request.getParameter("Contractor_us
er"));

Contractor_data.put("Contractor_password",request.getParameter("Contract
or_password"));
Contractor_data.put("Contractor_level","1");

Contractor_data.put("Contractor_sal",request.getParameter("Contractor_sal"
));

Contractor_data.put("Contractor_first_name",request.getParameter("Contrac
tor_first_name"));

Contractor_data.put("Contractor_middle_name",request.getParameter("Cont
ractor_middle_name"));

Contractor_data.put("Contractor_last_name",request.getParameter("Contrac
tor_last_name"));

Contractor_data.put("Contractor_gender",request.getParameter("Contractor
_gender"));

Contractor_data.put("Contractor_address",request.getParameter("Contractor
_address"));

Contractor_data.put("Contractor_village",request.getParameter("Contractor_
village"));

Contractor_data.put("Contractor_state",request.getParameter("Contractor_s
tate"));

Contractor_data.put("Contractor_country",request.getParameter("Contractor
_country"));

Contractor_data.put("Contractor_landline",request.getParameter("Contractor
_landline"));

Contractor_data.put("Contractor_mobile",request.getParameter("Contractor_
mobile"));

Contractor_data.put("Contractor_email",request.getParameter("Contractor_e
mail"));

Contractor_data.put("Contractor_status",request.getParameter("Contractor_
status"));

Contractor_data.put("Contractor_deparment",request.getParameter("Contrac
tor_deparment"));

Contractor_data.put("Contractor_dob",request.getParameter("Contractor_do
b"));

Contractor_data.put("Contractor_nationalty",request.getParameter("Contract
or_nationalty"));

if((request.getParameter("Contractor_id")).equals(""))
{
Contractor_obj.saveContractor(Contractor_data);
response.sendRedirect("../report-Contractor.jsp?
msg=Contractor Saved Successfully");
}
else

Contractor_data.put("Contractor_id",request.getParameter("Contractor_id"))
;
out.print(Contractor_obj.updateContractor(Contractor_data));

if(request.getParameter("Contractor_id").equals(session.getAttribute("login_
emp_id")))
{
response.sendRedirect("../Contractor.jsp?
Contractor_id="+session.getAttribute("login_emp_id")+"&msg=Account
Updated Successfully");
}
else
{
response.sendRedirect("../report-Contractor.jsp?
msg=Contractor Updated Successfully");
}
}
}
if((request.getParameter("act")).equals("delete"))
{
int Contractor_id =
Integer.parseInt(request.getParameter("Contractor_id"));
if(Contractor_obj.deleteContractor(Contractor_id))
response.sendRedirect("../register.jsp?msg=Record
Deleted Successfully");

else
response.sendRedirect("../register.jsp?msg=Problem in
Deletion.");
}
%>

Code of model Leave.jsp


<%@ page import= "Model.*" %>
<%@ page import= "java.util.*" %>
<%
Leave leaveObj = new Leave();
String emp_id = "0";
if(session.getAttribute("login_level") != null &&
session.getAttribute("login_level").equals("3")) {
emp_id = (String) session.getAttribute("login_emp_id");
}
if((request.getParameter("act")).equals("Save"))
{
HashMap results = new HashMap();
results.put("leave_id",request.getParameter("leave_id"));

results.put("leave_Contractor_id",request.getParameter("leave_Contractor_i
d"));
results.put("leave_reason",request.getParameter("leave_reason"));

results.put("leave_description",request.getParameter("leave_description"));

results.put("leave_from_date",request.getParameter("leave_from_date"));
results.put("leave_to_date",request.getParameter("leave_to_date"));

results.put("leave_status",request.getParameter("leave_status"));

if((request.getParameter("leave_id")).equals(""))
{
out.println(leaveObj.saveLeave(results));
response.sendRedirect("../report-leave.jsp?
emp_id="+emp_id+"&msg=Leave Saved Successfully");
}
else
{
results.put("leave_id",request.getParameter("leave_id"));
out.println(leaveObj.updateLeave(results));
response.sendRedirect("../report-leave.jsp?
emp_id=0&msg=Leave Updated Successfully");
}
}
%>

Code of model login.jsp


<%@ page import= "Model.*" %>
<%@ page import= "java.util.*" %>
<%
Login login_obj = new Login();
if((request.getParameter("act")).equals("chk_login"))
{

if(login_obj.checkLogin(request.getParameter("login_user"),request.getPara
meter("login_password")))
{
HashMap Values =
login_obj.getLoginDetails(request.getParameter("login_user"),request.getPar
ameter("login_password"));
session.setAttribute("login_id",Values.get("login_id"));
session.setAttribute("login_emp_id",Values.get("login_emp_id"));
session.setAttribute("login_user",Values.get("login_user"));
session.setAttribute("login_level",Values.get("login_level"));
response.sendRedirect("../login-home.jsp?msg=You are
login successfully.");
}
else
{
response.sendRedirect("../login.jsp?msg=Invalid
User/Password. Please try again.........");

}
}
if((request.getParameter("act")).equals("change_password"))
{

if(login_obj.changePassword(request.getParameter("old_password"),request.
getParameter("new_password"),Integer.parseInt((String)
session.getAttribute("login_id"))))
{
response.sendRedirect("../change-password.jsp?msg=Your
Password has been changed successfully.");
}
else
{
response.sendRedirect("../change-password.jsp?msg=Old
Password doesnot match. Please try again......");
}
}
if((request.getParameter("act")).equals("logout"))
{
session.setAttribute("login_id",null);
session.setAttribute("login_level",null);
response.sendRedirect("../login.jsp?msg=You are logout
successfully......");
}
%>

Code of model register.jsp


<%@ page import= "Model.*" %>
<%@ page import= "java.util.*" %>
<%
Login login_obj = new Login();
if((request.getParameter("act")).equals("Save"))
{
HashMap login_data = new HashMap();
login_data.put("login_user",request.getParameter("login_user"));

login_data.put("login_password",request.getParameter("login_password"));
login_data.put("login_email",request.getParameter("login_email"));
login_data.put("login_sal",request.getParameter("login_sal"));

login_data.put("login_first_name",request.getParameter("login_first_name")
);

login_data.put("login_middle_name",request.getParameter("login_middle_na
me"));

login_data.put("login_last_name",request.getParameter("login_last_name"))
;
login_data.put("login_gender",request.getParameter("login_gender"));

login_data.put("login_address",request.getParameter("login_address"));
login_data.put("login_village",request.getParameter("login_village"));
login_data.put("login_state",request.getParameter("login_state"));

login_data.put("login_country",request.getParameter("login_country"));

login_data.put("login_landline",request.getParameter("login_landline"));
login_data.put("login_mobile",request.getParameter("login_mobile"));
if((request.getParameter("login_id")).equals(""))
{
login_obj.save_login(login_data);
if(request.getParameter("login_id").equals(""))
{
response.sendRedirect("../login.jsp?msg=You have
registered successfully.<br>Login to access your account.");
}
else
{
response.sendRedirect("../report-customer.jsp?
msg=Customer Saved Successfully");
}
}
else

{
login_data.put("login_id",request.getParameter("login_id"));
login_obj.update_login(login_data);

if(request.getParameter("login_id").equals(session.getAttribute("login_id")))
{
response.sendRedirect("../register.jsp?
login_id=1&msg=Account Updated Successfully");
}
else
{
response.sendRedirect("../report-customer.jsp?
msg=Customer Updated Successfully");
}
}
}
if((request.getParameter("act")).equals("delete"))
{
int login_id =
Integer.parseInt(request.getParameter("login_id"));
if(login_obj.delete_login(login_id))
response.sendRedirect("../register.jsp?msg=Record
Deleted Successfully");
else
response.sendRedirect("../register.jsp?msg=Problem in
Deletion.");
}
%>

Code of model Salary.jsp


<%@ page import= "Model.*" %>
<%@ page import= "java.util.*" %>
<%
Salary salaryObj = new Salary();
if((request.getParameter("act")).equals("Save"))
{
HashMap results = new HashMap();
results.put("sal_id",request.getParameter("sal_id"));

results.put("sal_employe_id",request.getParameter("sal_employe_id"));
results.put("sal_year",request.getParameter("sal_year"));
results.put("sal_month",request.getParameter("sal_month"));
results.put("sal_amount",request.getParameter("sal_amount"));
if((request.getParameter("sal_id")).equals(""))
{
out.println(salaryObj.saveSalary(results));
response.sendRedirect("../report-salary.jsp?msg=Salary
Saved Successfully");
}
else
{
results.put("sal_id",request.getParameter("sal_id"));
out.println(salaryObj.updateSalary(results));
response.sendRedirect("../report-salary.jsp?msg=Salary
Updated Successfully");
}

}
if((request.getParameter("act")).equals("delete"))
{
int pay_id = Integer.parseInt(request.getParameter("sal_id"));
if(salaryObj.delete_login(pay_id))
response.sendRedirect("../register.jsp?msg=Record
Deleted Successfully");
else
response.sendRedirect("../register.jsp?msg=Problem in
Deletion.");
}
%>

Code of model timesheet.jsp


<%@ page import= "Model.*" %>
<%@ page import= "java.util.*" %>
<%
Timesheet timesheetObj = new Timesheet();
String emp_id = "0";
if(session.getAttribute("login_level") != null &&
session.getAttribute("login_level").equals("3")) {
emp_id = (String) session.getAttribute("login_emp_id");
}
if((request.getParameter("act")).equals("Save"))
{
HashMap results = new HashMap();

results.put("timesheet_id",request.getParameter("timesheet_id"));

results.put("timesheet_Contractor_id",request.getParameter("timesheet_Con
tractor_id"));

results.put("timesheet_project_id",request.getParameter("timesheet_project
_id"));

results.put("timesheet_work_title",request.getParameter("timesheet_work_ti
tle"));

results.put("timesheet_description",request.getParameter("timesheet_descri
ption"));

results.put("timesheet_hours",request.getParameter("timesheet_hours"));

results.put("timesheet_date",request.getParameter("timesheet_date"));

results.put("Contractor_name",request.getParameter("Contractor_first_nam
e")+" "+request.getParameter("Contractor_last_name"));

if((request.getParameter("timesheet_id")).equals(""))
{
out.println(timesheetObj.saveTimesheet(results));
response.sendRedirect("../report-timesheet.jsp?
emp_id="+emp_id+"&msg=Timesheet Saved Successfully");
}
else
{
results.put("timesheet_id",request.getParameter("timesheet_id"));
out.println(timesheetObj.updateTimesheet(results));
response.sendRedirect("../report-timesheet.jsp?
emp_id=0&msg=Timesheet Updated Successfully");
}
}
%>

Bibliography and References:


Books Used:
Software Engineering - R.S. Pressman
JAVA For Dummies
JAVA Begineers Guide By McGrawhill Publication
JAVAscript By McGrawhill Publication

Anda mungkin juga menyukai