You are on page 1of 104

Mini Project Report

On
METRO RAIL MANAGEMENT
ONLINE

Submitted By:
MOHD ARBAB ANJUM
In partial fulfillment for the award of the degree of

B.C.A DEGREE
B.
INTERNATIONAL INSTITUTE OF MANAGEMENT MEDIA
& I.T

( 2023)
Final Year Students

(Paper Code: BCA-307)

BACHELOR OF COMPUTER
APPLICATION

PROGRAM (BCA)

INTERNATIONAL INSTITUTE OF
MANAGEMENT MEDIA & I.T. (IIMMI)
Name of Student : MOHD ARBAB ANJUM

Father‘s Name : ANJUM ASGHAR

Email ID of Student : arbabkhan835@gmail.com

Course : B.C.A
Project Code No:-

A MAJOR PROJECT REPORT


ON
“----------------------------------------------------------------
--”

Submitted in partial fulfillment for the award of the degree of


Bachelor of Computer Application

BCA 3rd Year


(Session: 2019 – 2022)
Under the guidance of: - Submitted By:-

<Name of Guide> <Name of student>


<Designation> Enroll No:-
Format of Page3

DECLARATION

I hereby declare that the project work entitled


“…METRO RAIL MANAGEMENT………………………………………”submitted
for the

Bachelor of Computer Application (BCA) is my original work carried

out by me under the guidance of < Project Mentor> for the partial fulfillment of the

award of the degree of the Bachelor of Computer Application.


The matter embodied in this report has not submitted anywhere else for the award of

any other degree/diploma.

(Student’s Full Signature)


SUPERVISOR’S PROFILE

1. Name :
2. Designation :
3. Qualification :
4. Area of Specialization :
5. Experience :
6. Office Name &Address :
7. Contact No. :
8. E_Mail :

I am willing to supervise

Mr. / Ms. < Student’s Name>

Enroll No.

For Project of BCA (3 Year course)

Date:

Signature of Guide
CERTIFICATE OF THE GUIDE

Mentor / Guide Name: <Guide Name>

Designation:

Working Place:

This is to certify that the project report entitled


“______________________________________________________________” has been

prepared by Mr. / Ms. <student’s Name> under my supervision and guidance, for the

fulfillment of Bachelors of Computer Application.

His / Her field work is satisfactory.

Date:

Signature of Guide
ACKNOWLEDGMENT

I take this occasion to thank God, almighty for blessing us with his

grace and taking our endeavor to a successful culmination. I extend my

sincere and heartfelt thanks to our esteemed guide, my parents for

providing me with the right guidance and advice at the crucial junctures and

for showing me the right way. I extend my sincere thanks to our respected

Head of the division Mrs.SWATI MADAM, for allowing us to use the

facilities available. I would like to thank the other faculty members also, at

this occasion. Last but not the least, I would like to thank my friends and

family for the support and encouragement they have given me during the

course of our work.

MOHD ARBAB ANJUM


ABSTRACT

This is an integrated service which provide all


information about the metro rail and it’s routes for
public. The proposed system is a web based
application which provides information regarding
timings, routes, fair.
This system manages public feedback about
services through it’s complaint management
system. This system also contains an online ticket
recharge module where users can recharge their
smart cards online through the site.
There is also an admin module where admin can
add stations, trains, routes and also update the
fairs. The admin is a panel consisting of a group of
authorized persons.
LIST OF FIGURES
PAGE

1.1 COMPLAINT MANAGMENT MODULE 2

1.2 ONLINE TICKET RECHARGE MODULE 3

1.3 METRO TIME TABLE MODULE 4

1.4 FAIR AND ROUTE MAP MODULE 4


5
1.5 ADMIN MODULE

E-R DIAGRAMS AND DFD

3.13 COMPLETE DIAGRAM 24

3.14 COMPLAINT MANAGMENT SYSTEM DFD 26

3.15 ONLINE TICKET RECHARGE DFD 27

3.16 METRO TIME TABLE DFD 28

3.17 FAIR AND ROUTE MAP DFD 29

3.18 ADMIN DFD 30


LIST OF TABLES
PAGE

3.1 ADMIN TABLE 18

3.2 COMPLAINT DETAILS TABLE 18

3.3 FAIR DETAILS TABLE 19

3.4 METRO CARD TABLE 19

3.5 RECHARGE DETAILS TABLE 20

3.6 REPLY TABLE 20

3.7 ROUTE TABLE 20

3.8 ROUTE DETAILS TABLE 21

3.9 STATIONS TABLE 21

3.10 TRAIN TABLE 21

3.11 TRIP TABLE 22

3.12 TRIP DETAILS TABLE 22


TABLE OF CONTENTS

PAGE
ACKNOWLEDGEMENT
ABSTRACT i
LIST OF FIGURE ii
LIST OF TABLES iii

1. INTRODUCTION
1.1 OBJECTIVES 1
1.2 OVER VIEW 1
1.2.1 COMPLAINT MANAGMENT MODULE
2
1.2.2 ONLINE TICKET RECHARGE
3
1.2.3 METRO TIME TABLE
4
1.2.4 FAIR AND ROUTE MAP
4
1.2.5 ADMIN
5

2. SYSTEM ANALYSIS 6
2.1 EXISTING SYSTEM
6
2.2 PROPOSED SYSTEM
7
2.3 SYSTEM REQUIREMENT SPECIFICATION
8
2.3.1 GENERAL DESCRIPTION 8
2.3.2 SYSTEM OBJECTIVES
9
2.3.3 SYSTEM REQUIREMENTS
9
2.3.3.1 NON FUNCTIONAL REQUIREMENT 9
2.3.3.2 FUNCTIONAL REQUIREMENT 10
2.3.4 SOFTWARE AND HARDWAREREQUIREMENTS 12
2.3.4.1 SOFTWARE REQUIREMENTS 12
2.3.4.2 HARDWARE REQUIREMENTS 13

3. SYSTEM DESIGN 14

3.1 INPUT AND OUTPUT DESIGN 14

3.1.1 INPUT DESIGN 14

3.1.2 OUTPUT DESIGN 15

3.2 DATABASE 15

3.3 SYSTEM TOOLS 16

3.3.1 FRONT END 16

3.3.2 BACK END 17

3.4 TABLES 18
3.5 E-R DIAGRAMS 28

3.6 DATA FLOW DIAGRAMS (DFD) 30

3.7 SCREEN SHOTS 37

4. CONCLUSION 56

REFERENCES 57

APPENDIX 58
Metro Rail Management Online

CHAPTER 1

INTRODUCTION

This is an integrated service which provide all information about the metro rail
and it’s routes for public. The proposed system is a web based application
which provides information regarding timings, routes, fair. This system manages
public feedback about services through it’s complaint management system. This
system also contains an online ticket recharge module where users can recharge
their smart cards online through the site.

There is also an admin module where admin can add stations, trains, routes and
also update the fairs. The admin is a panel consisting of a group of authorized
persons.

1.1 OBJECTIVE
. The objectives of the projectare as follows:

 Users can register complaints through the site.


 User login page where users can recharge tickets online.
 Users can view metro timetable.
 User can also view the fair details and the route map.
 An admin login page where admin can add stations, trains,routes , update
fairs and even add a new admin.

Division of Computer Engineering, SOE,CUSAT 1


Metro Rail Management Online

1.2 OVERVIEW

Metro Rail Management System consist of the following implementation


modules.

Fig 1.2.1 Complaint Management Module

This module contains various facilities like view complaints and reply to
complaints.

Division of Computer Engineering, SOE,CUSAT 2


Metro Rail Management Online

Fig 1.2.2 Online Ticket Recharge Module

This module contains various facilities like request for smart card, recharge
,view balance ,view journey history.

Division of Computer Engineering, SOE,CUSAT 3


Metro Rail Management Online

Fig 1.2.3 Metro Time table module

This module contains various facilities like view time chart between two stations.

Division of Computer Engineering, SOE,CUSAT 4


Metro Rail Management Online

Fig 1.2.4 Fair and route map module

This module contains various facilities like display fair and display route map.

Division of Computer Engineering, SOE,CUSAT 5


Metro Rail Management Online

Fig 1.2.5 Admin module

This module contains facilities like view & reply to complaints, issue smart
card,add stations ,add train ,add routes ,add & update fair details ,add trip
and add admin.

CHAPTER 2

SYSTEM ANALYSIS

System analysis is the process of gathering and interpreting facts, diagnosing


problems and using the information to recommend improvements on the system.

Division of Computer Engineering, SOE,CUSAT 6


Metro Rail Management Online

System analysis is a problem solving activity that requires intensive


communication between the system users and system developers.

System analysis or study is an important phase of any system development


process. The system is viewed as a whole, the inputs are identified and the
system is subjected to close study to identify the problem areas. The solutions
are given as a proposal. The proposal is reviewed on user request and suitable
changes are made. This loop ends as soon as the user is satisfied with the
proposal.

2.1 EXISTING SYSTEM

 Information cannot be collected, processed and communicated


more quickly and efficiently.

 Current working systems doesn’t ensure that right information


reaches the right person at the right time.

2.2 PROPOSED SYSTEM

The proposed system is designed to eliminate the disadvantages of the existing


system.The proposed system “Metro Rail Management System” is mentioned
for tracing the problems in the existing system.

Division of Computer Engineering, SOE,CUSAT 7


Metro Rail Management Online

 Increased efficiency and reliability.

 Easier Access.

 Easy to use

 Provide accurate information to the user for taking necessary

decisions.

 Accuracy - The information will be correct, accurate and

unambiguous.

 Efficiency - Information can be collected, processed and

communicated more quickly and efficiently. Systems ensure that

right information reaches the right person at the right time.

Division of Computer Engineering, SOE,CUSAT 8


Metro Rail Management Online

 Reliability - Since systems are free from boredom and tiredness,

they work constantly on data to produce more reliable outputs.

 Accessibility, Usability and Understandability

 The options used can be easily accessed, used and realized.

Division of Computer Engineering, SOE,CUSAT 9


Metro Rail Management Online

2.3 SYSTEM REQUIREMENT SPECIFICATION

2.3.1 GENERAL DESCRIPTION

Product Description:
Metro rail management system is an online system which helps the user to
recharge their tickets online, it also have a complaint management system in
which users can register their complaints online.

By visiting the site the users can get metro time table. Other than that by entering
the source station and destination station the users can get all sorts of
information about trains arriving and departing from the stations, it’s fair details
and even it provides you the route map.

Problem Statement:
The problem occurred before having online system includes:  File
lost

When online system is not implemented the complaints are reported in files. The
files are always lost due to some human errors.

 Time consuming
When there is no computerized system then for recharge purposes the users
need to travel to the stations and also sometimes even need to stand in large
queues for recharge purposes.

 Most updations are unnoticeable

Division of Computer Engineering, SOE,CUSAT 10


Metro Rail Management Online

When online systems is not implemented any changes in fair, timings etc when
updated ,the details of these things are only available at the stations.

2.3.2 SYSTEM OBJECTIVES

 Improvement in Control and performance


The system is developed to cope up with current issues and problems of the
metro rail. The system helps to recharge online, make a complaint online ,
display metro timetable ,fairs and route maps.

 Save time
User is able to recharge online, see details of metro time table , fairs & route
maps and even the user can complaint online there by saving his valuable time.

 Easy to Use
A person with just an internet connection and a pc can do things such as
complaint, recharge and view metro details very easily.

Division of Computer Engineering, SOE,CUSAT 11


Metro Rail Management Online

2.3.3 SYSTEM REQUIREMENTS

2.3.3.1 NON FUNCTIONAL REQUIREMENTS

 EFFICIENCY REQUIREMENT
When a metro rail management system will be implemented then the user can
recharge, complaint and view metro information fastly& easily. RELIABILITY
REQUIREMENT

The system should accurately perform recharge, store complaints, show the
details of metro such as fair, route maps.

 USABILITY REQUIREMENT
The system is designed for a user friendly environment so that user and admin
of metro rail can perform various tasks easily and in an effective way.

 IMPLEMENTATION REQUIREMENTS

In implementing whole system it uses html in front end with jsp as server side
scripting language which will be used for database connectivity and the
backend ie the database part is developed using mysql.

 DELIVERY REQUIREMENTS
The whole system is expected to be delivered in six months of time with a weekly
evaluation by the project guide.

Division of Computer Engineering, SOE,CUSAT 12


Metro Rail Management Online

2.3.3.2 FUNCTIONAL REQUIREMENTS

REGISTER COMPLAINT

Description of Feature

This feature allows users to file complaints through the site. The user does not
require a registration. He can give his name, email-id, phone number, address
and other details along with the complaints. The admin will reply to the
complaints sent by user.

Functional Requirements

 System must be able to verify information.


 System must be able to store the information in database.
 System must be able to retrieve information when required by admin.

METRO CARD

Description of Feature

This feature allows the user to recharge their metro card online, there by saving
their valuable time. Users need to login with their card number& password and
can recharge their tickets online. It also allows them to view their balance and
journey history.

Functional Requirements

 User id is provided when they register.


 The system must be able to show the users balance and journey history.
 The user must be able to logout after they had finished recharging or
after viewing the balance or journey history.

Division of Computer Engineering, SOE,CUSAT 13


Metro Rail Management Online

METRO TIME TABLE

Description of feature

This feature allows the users to view the metro time table. Users are required to
enter the source station and destination station, when they enter the data then
the system will show the metro time table.

Functional Requirements

 System must allow the users to enter the source station and destination
stations.
 System must be able to process information from database.

FAIR AND ROUTEMAP

Description of Feature

This feature allows the users to view the fair and route map. Users are required
to enter the source and destination station, when they enter the data then the
system will display fair details and the route map.

Functional Requirements

 System must allow the users to enter the source and destination stations.
 System must be able to retrieve information from the database.

ADMIN

Description of Feature

Division of Computer Engineering, SOE,CUSAT 14


Metro Rail Management Online

This feature allows the admin to view and reply to complaints. Admin can add
stations, routes ,train , trip . Admin can also add and update fair details, and
even add a new admin. Actually, the admin is a panel consisting of a group of
authorized persons.

Functional Requirements

 The system must allow admin to add train, stations ,routes,fair ,metro
timetable and even add a new admin.
 The system must also allow admin to reply to the complaints send by the
user.
 The system should be designed in such a way that only authorized people
should be allowed to access some particular modules.
 The records should be modified by only administrators and no one else.

2.3.4 SOFTWARE AND HARDWARE REQUIREMENTS


This section describes the software and hardware requirements of the system

2.3.4.1 SOFTWARE REQUIREMENTS


 Operating system- Windows 7 is used as the operating system as it is
stable and supports more features and is more user friendly

 Database MYSQL-MYSQL is used as database as it easy to maintain


and retrieve records by simple queries which are in English language
which are easy to understand and easy to write.

 Development tools and Programming language- HTML is used to write


the whole code and develop webpages with css, java script for styling
work and php for sever side scripting.

Division of Computer Engineering, SOE,CUSAT 15


Metro Rail Management Online

2.3.4.2 HARDWARE REQUIREMENTS


 Intel core i3 2nd generation is used as a processor because it is fast than
other processors an provide reliable and stable and we can run our pc
for longtime. By using this processor we can keep on developing our
project without any worries.

 Ram 1 gb is used as it will provide fast reading and writing capabilities


and will in turn support in processing

CHAPTER 3

SYSTEM DESIGN

System design is the solution for the creation of a new system.

Division of Computer Engineering, SOE,CUSAT 16


Metro Rail Management Online

This phase focuses on the detailed implementation of the feasible system. It


emphasis on translating design.Specifications to performance specification.
System design has two phases of development

 Logical design
 Physical design

During logical design phase the analyst describes inputs (sources), output
s(destinations), databases (data sores) and procedures (data flows) all in a
format that meets the user requirements. The analyst also specifies the needs
of the user at a level that virtually determines the information flow in and out of
the system and the data resources. Here the logical design is done through data
flow diagrams and database design. The physical design is followed by
physical design or coding. Physical design produces the working system
by defining the design specifications, which specify

exactly what the candidate system must do.The programmers write the
necessary programs that accept input from the user, perform necessary
processing on accepted data and produce the required report on a hard copy or
display it on the screen.

3.1 INPUT AND OUTPUT DESIGN

3.1.1 INPUT DESIGN:

Division of Computer Engineering, SOE,CUSAT 17


Metro Rail Management Online

Input design is the link that ties the information system into the world of its

users. The input design involves determining the inputs, validating the data,
minimizing the data entry and provides a multi-user facility. Inaccurate inputs are
the most common cause of errors in data processing. Errors entered by
the data entry operators can be controlled by input design. The user-originated
inputs are converted to a computer based format in the input design. Input data
are collected and organized into groups of similar data. Once identified, the
appropriate input media are selected for processing. All the input data are
validated and if any data violates any conditions, the user is warned by a
message. If the data satisfies all the conditions, it is transferred to the
appropriate tables in the database. In this project the student details are to be
entered at the time of registration. A page is designed for this purpose which is
user friendly and easy to use. The design is done such that users get
appropriate messages when exceptions occur.

3.1.2 OUTPUT DESIGN:

Computer output is the most important and direct source of information to the
user. Output design is a very important phase since the output needs to be in
an efficient manner. Efficient and intelligible output design improves the system
relationship with the user and helps in decision making. Allowing the user to

Division of Computer Engineering, SOE,CUSAT 18


Metro Rail Management Online

view the sample screen is important because the user is the ultimate judge of
the quality of output. The output module of this system is the selected
notifications.

3.2 DATABASE

DATABASE DESIGN:

Databases are the storehouses of data used in the software systems. The data
is stored in tables inside the database. Several tables are created for the
manipulation of the data for the system. Two essential settings for a database
are

- the field that is unique for all the record occurrences.

-the field used to set relation between tables.

Normalization is a technique to avoid redundancy in the tables.

3.3 SYSTEM TOOLS

The various system tools that have been used in developing both the front end
and the back end of the project are being discussed in this chapter.

3.3.1.FRONT END:

Division of Computer Engineering, SOE,CUSAT 19


Metro Rail Management Online

JSP, HTML, CSS, JAVA SCRIPTS are utilized to implement the frontend.

Java Server Pages (JSP)

Different pages in the applications are designed using jsp. A Java Server Pages
component is a type of Java servlet that is designed to fulfil the role of a user
interface for a Java web application. Web developers write JSPs as text files that
combine HTML or XHTML code, XML elements, and embedded JSP actions and
commands. Using JSP, one can collect input from users through web page.

HTML (Hyper Text Markup Language)

HTML is a syntax used to format a text document on the web.

CSS (Cascading Style Sheets)

CSS is a style sheet language used for describing the look and formatting
of a document written in a markup language.

Java Script

JS is a dynamic computer programming language. It is most commonly used as


part of web browsers, whose implementations allow client-side scripts to interact

Division of Computer Engineering, SOE,CUSAT 20


Metro Rail Management Online

with the user, control the browser, communicate asynchronously, and alter
the document content that is displayed.

3.3.2 BACK END

The back end is implemented using MySQL which is used to design the
databases.

MySQL

MySQL is the world's second most widely used open-source relational


database management system (RDBMS). The SQL phrase stands for
Structured Query Language.

An application software called wamp was used to design the tables in MySQL.

3.4 TABLES

 Admin

Division of Computer Engineering, SOE,CUSAT 21


Metro Rail Management Online

S# Name Type
1 admin_id int(11)
2 a_name varchar(25)
3 a_address varchar(75)
4 phone_num varchar(13)
5 email varchar(30)
6 Age int(11)
7 Gender varchar(6)
8 Permission int(11)
9 designation varchar(25)
10 Password varchar(30)

Fig 3.4.1 Admin Table

 Complaints

# Name Type

1 c_id int(11)
2 u_name varchar(25)
3 u_address varchar(50)
4 phone_num varchar(13)
5 c_msg varchar(100)

Division of Computer Engineering, SOE,CUSAT 22


Metro Rail Management Online

6 email varchar(25)
7 age int(11)
8 status tinyint(1)
9 time timstamp

Fig 3.4.2 complaint Details table

 Fair

# Name Type
1 f_id int(11)
2 fair_unit Float
3 amt_per_unit float
4 min_charge float
5 min_distance float

Fig 3.4.3 Fair Details Table

 METRO CARD

# Name Type
1 card_id int(11)
2 card_num varchar(20)

Division of Computer Engineering, SOE,CUSAT 23


Metro Rail Management Online

3 u_name varchar(25)
4 u_address varchar(75)
5 age int(11)
6 gender varchar(5)
7 phone_num varchar(11)
8 email varchar(30)
9 password varchar(20)
10 card_status tinyint(1)
11 balance int(11)

Fig 3.4.4 Metro Card Table

 RECHARGE _DETAILS

# Name Type
1 r-id int(11)
2 card_num int(11)
3 amount int(11)
4 date timestamp
5 r_status int(11)
6 payment_dtls varchar(30)

Fig 3.4.5 Recharge Details Table

 Reply

# Name Type

Division of Computer Engineering, SOE,CUSAT 24


Metro Rail Management Online

1 r_id int(11)
2 c_id int(11)
3 r_msg text
4 admin_id int(11)

Fig 3.4.6 Reply Table

 Routes

# Nmae Type
1 route_id int(11)
2 route_name varchar(30)
3 total_stations int(11)

Fig 3.4.7Route Table

 Route_details

Division of Computer Engineering, SOE,CUSAT 25


Metro Rail Management Online

# Name Type
1 r_id int(11)
2 s_id int(11)
3 s_order_num int(11)
4 length_from_start Float

Fig 3.4.8 Route Details Table

 Stations

# Name Type
1 stations_id int(11)
2 s_name varchar(25)
3 latitude float
4 longitude float

Fig 3.4.9 Stations Table

 Trains

# Name Type
1 train_id int(11)
2 t_name varchar(15)
3 capacity int(11)

Division of Computer Engineering, SOE,CUSAT 26


Metro Rail Management Online

Fig 3.4.10 Train Table

 Trip

# Name Type
1 trip_id int(11)
2 trip_code varrchar(15)
3 train_id int(11)
4 route_id int(11)

Fig 3.4.11 Trip Table

 Trip details

# Name Type
1 td_id int(11)
2 trip_num int(11)
3 stations_id int(11)
4 arrival_time time
5 departure_time time

Fig 3.4.12 Trip Details Table

Division of Computer Engineering, SOE,CUSAT 27


Metro Rail Management Online

3.5 E-R DIAGRAMS

Fig 3.5.1. Complaint Management

Division of Computer Engineering, SOE,CUSAT 28


Metro Rail Management Online

Fig 3.5.1 Route& Trip Management

Division of Computer Engineering, SOE,CUSAT 29


Metro Rail Management Online

3.6 DATA FLOW DIAGRAMS

A Data Flow Diagram (DFD) is a structured analysis and design tool that can be
used for flowcharting. A DFD is a network that describes the flow of data
and the processes that change or transform the data throughout a system.
This network is constructed by using a set of symbols that do not imply
any physical implementation. It has the purpose of clarifying system
requirements and identifying major transformations. So it is the starting point of
the design phase that functionally decomposes the requirements specifications
down to the lowest level of detail. DFD can be considered to an abstraction
of the logic of an information-oriented or a process-oriented system
flowchart. For these reasons DFD’s are often referred to as logical data flow
diagrams.

EXTERNAL ENTITY

An external entity is a source or destination of a data flow. Only those entities


which originate or receive data are represented on a data flow diagram. The
symbol used is a rectangular box.

PROCESS

Division of Computer Engineering, SOE,CUSAT 30


Metro Rail Management Online

A process shows a transformation or manipulation of data flow within the


system. The symbol used is an oval shape.

DATAFLOW

The data flow shows the flow of information from a source to its destination.
Data flow is represented by a line, with arrowheads showing the direction
of flow. Information always flows to or from a process and may be written,
verbal or electronic. Each data flow may be referenced by the processes
or data stores at its head and tail, or by a description of its contents.

DATA STORE

A data store is a holding place for information within the system: It is represented
by an open ended narrow rectangle. Data stores may be long-term files
such as sales ledgers, or may be short-term accumulations: for example
batches of documents that are waiting to be processed. Each data store should
be given a reference followed by an arbitrary number.

 DATA FLOW DIAGRAM FOR COMPLAINT MANAGEMENT SYSTEM

Division of Computer Engineering, SOE,CUSAT 31


Metro Rail Management Online

Fig 3.6.1 Complaint management system DFD

 DATA FLOW DIAGRAM FOR ONLINE TICKET RECHARGE

Division of Computer Engineering, SOE,CUSAT 32


Metro Rail Management Online

Fig 3.6.2 Online ticket recharge DFD

Division of Computer Engineering, SOE,CUSAT 33


Metro Rail Management Online

 DATA FLOW DIAGRAM FOR METRO TIME TABLE

Fig 3.6.3 Metro time table DFD

 DATA FLOW DIAGRAM FOR FAIR & ROUTE MAP

Division of Computer Engineering, SOE,CUSAT 34


Metro Rail Management Online

Fig 3.6.4 Fair and route map DFD

 DATA FLOW DIAGRAM FOR ADMIN

Division of Computer Engineering, SOE,CUSAT 35


Metro Rail Management Online

Fig 3.6.5 Admin DFD

Division of Computer Engineering, SOE,CUSAT 36


Metro Rail Management Online

3.7 SCREENSHOT

 HOME

Division of Computer Engineering, SOE,CUSAT 37


Metro Rail Management Online

 SUBMIT COMPLAINTS

Division of Computer Engineering, SOE,CUSAT 38


Metro Rail Management Online

 TIMING

 FAIR AND ROUTE

Division of Computer Engineering, SOE,CUSAT 39


Metro Rail Management Online

 METRO CARD HOME

Division of Computer Engineering, SOE,CUSAT 40


Metro Rail Management Online

Division of Computer Engineering, SOE,CUSAT 41


Metro Rail Management Online

APPLICATION FOR METRO CARD

Division of Computer Engineering, SOE,CUSAT 42


Metro Rail Management Online

 RECHARGE METRO CARD

BALANCE ENQUIRY

Division of Computer Engineering, SOE,CUSAT 43


Metro Rail Management Online

Division of Computer Engineering, SOE,CUSAT 44


Metro Rail Management Online

ADMIN LOGIN

Division of Computer Engineering, SOE,CUSAT 45


Metro Rail Management Online

ADD STATION

Division of Computer Engineering, SOE,CUSAT 46


Metro Rail Management Online

ADD ROUTE

Division of Computer Engineering, SOE,CUSAT 47


Metro Rail Management Online

ADD TRAIN

Division of Computer Engineering, SOE,CUSAT 48


Metro Rail Management Online

ADD NEW TRIP

Division of Computer Engineering, SOE,CUSAT 49


Metro Rail Management Online

UPDATE FAIR DETAILS

Division of Computer Engineering, SOE,CUSAT 50


Metro Rail Management Online

COMPLAINTS GRID

Division of Computer Engineering, SOE,CUSAT 51


Metro Rail Management Online

REPLY COMPLAINT

Division of Computer Engineering, SOE,CUSAT 52


Metro Rail Management Online

METRO CARD GRID

Division of Computer Engineering, SOE,CUSAT 53


Metro Rail Management Online

ISSUE METRO CARD

Division of Computer Engineering, SOE,CUSAT 54


Metro Rail Management Online

Division of Computer Engineering, SOE,CUSAT 55


Metro Rail Management Online

ADD NEW ADMIN

Division of Computer Engineering, SOE,CUSAT 56


Metro Rail Management Online

CHAPTER 4

CONCLUSION

The project entitled Metro Rail Management Onlinewas completed


successfully.

The system has been developed with much care and free of errors and at
the same time it is efficient and less time consuming. The purpose of this
project was to develop a web application for metro rail management .

This project helped us in gaining valuable information and practical


knowledge on several topics like designing web pages using html &css,
usage of responsive templates, designing of android applications, and
management of database using mysql . The entire system is secured. Also
the project helped us understanding about the development phases of a
project and software development life cycle. We learned how to test
different features of a project.

This project has given us great satisfaction in having designed an


application which can be implemented to any nearby shops or branded
shops selling various kinds of products by simple modifications.

Division of Computer Engineering, SOE,CUSAT 57


Metro Rail Management Online

There is a scope for further development in our project to a great extend. A


number of features can be added to the system in future like watch me
module, each admin having separate permissions.
REFERENCES

[1] Cody Lindley ,”JavaScript Enlightenment”,First Edition, ECMA-262


,2007

[2] Herbert Schildit, “Java : The complete reference”, 7th Edition,Mc


GrawHill’s, 2004

[3]Jaison Falkner and Kevin Jones,”Servlets and JavaServer Pages: The


J2EE Technology Web Tier”,3rd Edition,2010;

APPENDIX

3.8 SAMPLE CODE

1. Index page

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"

pageEncoding="ISO-8859-1"%>

Division of Computer Engineering, SOE,CUSAT 58


Metro Rail Management Online

<%@ page import="java.util.*" language="java" %>

<%@ page import="javax.servlet.http.HttpSession"%>

<!DOCTYPE html >

<%

String currentTab = "home"; String adminFlag="false";

if(session.getAttribute("adminVar")!= null)

adminFlag=session.getAttribute("adminVar").toString();

System.out.println("session:"+adminFlag);

} try

{
if(!(request.getParameter("currentTab").isEmpty())) currentTab

= request.getParameter("currentTab");

else

currentTab = "home";

Division of Computer Engineering, SOE,CUSAT 59


Metro Rail Management Online

catch(Exception e)

System.out.print(e);

%>

<html>

<head>

<title>Metro Rail</title>

<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />

<link rel="stylesheet" type="text/css" href="css/styles.css" /> <script

language="JavaScript" type="text/javascript"> functionredirectToTab(tab)

document.getElementById("currentTab").value = tab;

document.forms["homejspform"].submit();

function logout()

Division of Computer Engineering, SOE,CUSAT 60


Metro Rail Management Online

//alert("logout"); window.location.href

= "logout.jsp";

</script>

</head>

<body>

<div class="container">

<div style="float:left;width:100%;height:2px;" >

<% if(adminFlag=="false") {%>

<div class="adminLogin"><a href="#"


class="login"onClick="redirectToTab('adminLogin')">Admin</a>

</div> <%}

else{%>

<div class="adminLogin"><a href="#" class="login"onClick="logout()">Logout</a>

</div>
<%} %>

Division of Computer Engineering, SOE,CUSAT 61


Metro Rail Management Online

</div>

<div class="header">

<img alt="" src="img/metro.jpg" style="height:100%;width:100%;">

</div>

<div class="navdiv">

<div class="main-nav">

<ul>

<li><a href="#" class="link1" onClick="redirectToTab('home')">Home</a></li>

<li><a href="#" class="link2" onClick="redirectToTab('complaints')">


Complaints</a></li>

<li><a href="#" class="link3" onClick="redirectToTab('timing')">Timing</a></li>

<li><a href="#" class="link4" onClick="redirectToTab('fair')">Fair and Route</a></li>

<li><a href="#" class="link5" onClick="redirectToTab('recharge')">Metro card</a></li>

<% if(adminFlag=="true") {%>

<li><a href="#" class="link6" onClick="redirectToTab('admin')">Admin</a></li>

<%}%>

</ul>

Division of Computer Engineering, SOE,CUSAT 62


Metro Rail Management Online

</div>

</div>
<%

if(currentTab.compareToIgnoreCase("home")==0)

%>

<div id="homeContainer" class="tabset_content" >

<jsp:include page="home.jsp">

<jsp:param name="PRJID" value="<%=


currentTab %>"/>

</jsp:include>

</div>

<%}

if(currentTab.compareToIgnoreCase("complaints")==0)

%>

Division of Computer Engineering, SOE,CUSAT 63


Metro Rail Management Online

<div id="complaintsContainer" class="tabset_content" >

<jsp:include page="complaints.jsp">

<jsp:param name="PRJID" value="<%=


currentTab %>"/>

</jsp:include>

</div> <%}

if(currentTab.compareToIgnoreCase("adminLogin")==0)

%>

<div id="complaintsContainer" class="tabset_content" >

<jsp:include page="adminLogin.jsp">

<jsp:param name="PRJID" value="<%=


currentTab %>"/>

</jsp:include>

Division of Computer Engineering, SOE,CUSAT 64


Metro Rail Management Online

</div> <%}

if(currentTab.compareToIgnoreCase("fair")==0)

%>

<div id="complaintsContainer" class="tabset_content" >


<jsp:include page="fair.jsp">

<jsp:param name="PRJID" value="<%= currentTab %>"/>

</jsp:include>

</div>

<%}

if(currentTab.compareToIgnoreCase("timing")==0)

%>

<div id="complaintsContainer" class="tabset_content" >

Division of Computer Engineering, SOE,CUSAT 65


Metro Rail Management Online

<jsp:include page="timing.jsp">

<jsp:param name="PRJID" value="<%=


currentTab %>"/>

</jsp:include>

</div>

<%}

if(currentTab.compareToIgnoreCase("recharge")==0)

%>
<div id="complaintsContainer" class="tabset_content" >

<jsp:include page="metroCard.jsp">

<jsp:param name="PRJID" value="<%= currentTab %>"/>

</jsp:include>

</div> <%}

if(currentTab.compareToIgnoreCase("admin")==0)

Division of Computer Engineering, SOE,CUSAT 66


Metro Rail Management Online

%>

<div id="adminContainer" class="tabset_content" >

<jsp:include page="admin/admin.jsp">

<jsp:param name="PRJID" value="<%=


currentTab %>"/>

</jsp:include>

</div>

<% } %>

<form name="homejspform" id="homejspform" method="post">

<input type="hidden" name="currentTab" id="currentTab" value="<%= currentTab


%>"/>

</form>

</div>

</body>

Division of Computer Engineering, SOE,CUSAT 67


Metro Rail Management Online

</html>

2. Complaint Registration

<%@pagelanguage="java"contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPEhtml>
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<linkrel="stylesheet"type="text/css"href="css/complaints.css"/>
<scripttype="text/javascript"src="jquery/jquery-2.0.2.js"></script>
<scriptsrc="jquery/jquery.h5validate.js"></script>
<scripttype="text/javascript">

$(document).ready(function(){

$('Form').submit(function(event){//prevent from refresh


event.preventDefault();
});

$('#complaintForm').submit(function ()
{

$.ajax({ type:
"post",
url: "addComplaintsAjax.jsp",
data: $("#complaintForm").serialize(),
success: function(msg){ alert(msg);
document.getElementById("user").value="";
document.getElementById("age").value="";
document.getElementById("email").value="";
document.getElementById("phone").value="";
document.getElementById("address").value="";
document.getElementById("c_msg").value="";

Division of Computer Engineering, SOE,CUSAT 68


Metro Rail Management Online

}
});
});
});
</script>
</head>
<body>
<divclass="complaintTable">
<formid="complaintForm"name="complaintForm"class="complaintForm"method="
post"action="">
<tablewidth="400"border="0">

<tr>
<thheight="35"align="left">
<p><b>Submit a complaint</b></p>
</th>
</tr>
<tr>
<tdheight="35"align="left">
<p>Name</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><inputtype="text"name="user"id="user"size="30"required/></p>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>Age</p>
</td>
<tdalign="left"style="padding-left:7px;">
<inputtype="number"min="10"max="100"step="1"pattern="[1-
9][09]"placeholder="00"requiredname="age"id="age"size="30"/>
</td>
</tr>
<tr>
<tdheight="35"align="left">

Division of Computer Engineering, SOE,CUSAT 69


Metro Rail Management Online

<p>email</p>
</td>
<tdalign="left"style="padding-left:7px;">
<inputtype="email"placeholder="Enter your
email"id="email"name="email"size="30"required/>

</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>Phone number</p>
</td>
<tdalign="left"style="padding-left:7px;">

<inputtype="tel"name="phone"id="phone"size="30"placeholder="eg:
9496826455"pattern="[789][0-9]{9}"size="30"required/>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>Address</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><textareaname="address"id="address"style="width: 200px;
height: 50px;" required></textarea></p>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>Message</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><textareaname="c_msg"id="c_msg"style="width: 200px; height:


60px;" required></textarea></p>
</td>
</tr>

Division of Computer Engineering, SOE,CUSAT 70


Metro Rail Management Online

<tr>
<tdcolspan=2align="center">

<inputtype="submit"value="Submit"id="submit"/>
</td>
</tr>

</table>
</form>
</div>
</body>
</html>

3.Fair And Route details

<%@pagelanguage="java"contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD HTML 4.01
Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<linkrel="stylesheet"type="text/css"href="css/fair.css"/>
<scripttype="text/javascript"src="jquery/jquery-2.0.2.js"></script>
<scriptsrc="http://maps.google.com/maps/api/js?sensor=false"type="text/j
avascript"></script>

<scripttype="text/javascript">
var map;
var count1=0;
$(document).ready(function(){

$('#find').click(function ()
{ document.getElementById("stationsHiddenDiv").innerHTML
= ""; document.getElementById("map").innerHTML = "";

Division of Computer Engineering, SOE,CUSAT 71


Metro Rail Management Online

$.ajax({ type:
"post",
url: "getStationsForMapAjax.jsp", //this is my servlet
data:"s_stationid="+$('#s_station').val()+"&d_stationid="+$('#d_station'
).val(),
success: function(msg){

$("#stationsHiddenDiv").append(msg);
count1=$('#count1').val();
draw();
//document.getElementById("station").value="";
//document.getElementById("latitude").value="";
//document.getElementById("longitude").value="";
}
});

});//end of click function

$.ajax({ type:
"post",
url: "admin/stationSelectAjax.jsp", data:"",
success: function(msg){
//alert(msg);
$("#s_station").append(msg);
document.getElementById("s_station").selectedIndex = -1;
$("#d_station").append(msg);
document.getElementById("d_station").selectedIndex = -1;
}
});

});
function draw(){
var locations = new Array(count1);
for (var k=0;k<count1; k++)
{
locations[k] = new Array(3);
}

Division of Computer Engineering, SOE,CUSAT 72


Metro Rail Management Online

for(var m=0,j=1;m<count1;m++,j++)
{
locations[m][0]=document.getElementById('stname'+j).value;

locations[m][1]=document.getElementById('latitude'+j).value;

locations[m][2]=document.getElementById('longitude'+j).value;

//alert(locations[m][0]+","+locations[m][1]+","+locations[m][2]);
}

map = newgoogle.maps.Map(document.getElementById('map'), {
zoom: 11,
center: newgoogle.maps.LatLng(10.04754, 76.31846),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
varinfowindow = newgoogle.maps.InfoWindow();

var marker, i;
for (i = 0; i < count1; i++) {
marker = newgoogle.maps.Marker({
position: newgoogle.maps.LatLng(locations[i][1], locations[i][2]),
map: map });

google.maps.event.addListener(marker, 'click', (function(marker, i) {


returnfunction() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
}
}//end of draw

</script>
</head>
<body>
<divclass="fairTable">

Division of Computer Engineering, SOE,CUSAT 73


Metro Rail Management Online

<formid="fairTableForm"method="post"action="">
<tablewidth="500"border="0">
<tr>
<thheight="35"align="center"colspan="2">
<p>Find fair and route between two stations.
</p>
</th>
</tr>
<tr>
<tdheight="35"align="left">
<p>Source </p>
</td>
<tdalign="left">

<p><selectclass="s_station"name="s_station"id="s_station">
<option></option>
</select></p>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>Destination</p>
</td>
<tdwidth="50%"align="left">

<p><selectclass="d_station"name="d_station"id="d_station">
<option></option>
</select></p>
</td>
</tr>
<tr>
<tdcolspan=2align="center">
<inputtype="button"value="Find"id="find"/>
</td>
</tr>

Division of Computer Engineering, SOE,CUSAT 74


Metro Rail Management Online

</table>
</form>
<divid="stationsHiddenDiv"name="stationsHiddenDiv">
</div>

<divid="map"style="width: 500px; height: 400px;"></div>

</div>
</body>
</html>

3. Application for Metrocard

<%@pagelanguage="java"contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPEhtml>
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<linkrel="stylesheet"type="text/css"href="css/recharge.css"/>
<scripttype="text/javascript"src="jquery/jquery-2.0.2.js"></script>
<scripttype="text/javascript">

$(document).ready(function(){

$('Form').submit(function(event){//prevent from refresh


event.preventDefault();
});

$('#metroCardApplicationForm').submit(function ()
{
$.ajax({ type:
"post",
url: "addMetroCardFormAjax.jsp",
data: $("#metroCardApplicationForm").serialize(),
success: function(msg){ alert(msg);
document.getElementById("loadDiv").innerHTML

Division of Computer Engineering, SOE,CUSAT 75


Metro Rail Management Online

= "";

jQuery("#loadDiv").load('applicationForCard.jsp');

}
});
});
});
</script>
</head>
<body>
<divclass="rechargeTableDiv">
<formid="metroCardApplicationForm"method="post"action="">
<tablewidth="400"border="0">
<tr>
<thheight="35"align="left"colspan="2">
<p><b>Application for Metro card</b></p>
</th>

</tr>
<tr>
<tdheight="35"align="left">
<p>Name</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><inputtype="text"requiredname="user"id="user"size="30"/></p>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>Password</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><inputtype="password"requiredname="password"id="password"size=
"30"/></p>
</td>

Division of Computer Engineering, SOE,CUSAT 76


Metro Rail Management Online

</tr>
<tr>
<tdheight="35"align="left">
<p>Age</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><inputtype="text"requiredname="age"id="age"size="30"/></p>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>Gender</p>
</td>
<tdalign="left"style="padding-left:7px;">
<p><inputtype="text"requiredname="gender"id="gender"size="30"/></ p>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>Phone number</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><inputtype="text"requiredname="phone"id="phone"size="30"/></p>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>email</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><inputtype="text"requiredname="email"id="email"size="30"/></p>
</td>
</tr>
<tr>
<tdheight="35"align="left">

Division of Computer Engineering, SOE,CUSAT 77


Metro Rail Management Online

<p>Address</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><textareaname="address"requiredid="address"style="width:
200px; height: 50px;"></textarea></p>
</td>
</tr>
<tr>
<tdcolspan=2align="center">
<inputtype="submit"value="Submit"id="add"/>
</td>
</tr>

</table>
</form>
</div>
</body>
</html>

5. Database Connection
packageDataBase;

importjava.sql.*;

public class DB {

static Connection con = null;

static Statement stmt = null;

staticResultSetrs = null;

Division of Computer Engineering, SOE,CUSAT 78


Metro Rail Management Online

public static Connection getConnection() {

try {

Class.forName("com.mysql.jdbc.Driver");

con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/metrorail",
"root", "");

} catch (Exception e) {

System.out.println("Exception" + e);

} return

con;

}
public static booleanexecuteUpdate(String query) { boolean f = false;

try { con = getConnection(); stmt = con.createStatement(); int b =

stmt.executeUpdate(query); if (b > 0) { f = true;

} else { f = false;

} catch (Exception e) {

System.out.println("Exception" + e);

} return f;

Division of Computer Engineering, SOE,CUSAT 79


Metro Rail Management Online

} public static ResultSetexecuteQuery(String sql) { try {

con = getConnection(); stmt =

con.createStatement(); rs =

stmt.executeQuery(sql); returnrs;

} catch (Exception e) {

System.out.println("Exception" + e); return null;

} } public static void

close() { try { con.close();

stmt.close(); rs.close();

} catch (Exception e) {

System.out.println("Exception" + e);

6. Example- Informations inserting to database


<%@pagelanguage="java"contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%> <%@pageimport="java.io.File"%>
<%@pageimport="java.sql.ResultSet"%>
<%@pageimport="DataBase.DB"%>

<%

Division of Computer Engineering, SOE,CUSAT 80


Metro Rail Management Online

if (DB.executeUpdate("insert into metrocard values("


+ "null" + ","
+ "null" + ",'"
+ request.getParameter("user") + "','"
+ request.getParameter("address") + "',"
+ request.getParameter("age") + ",'"
+ request.getParameter("gender") + "','"
+ request.getParameter("phone") + "','"
+ request.getParameter("email") + "','"
+ request.getParameter("password") + "',"
+ "false" + ","
+ "0" + ")"))

{
%>Aplication submitted successfully
<% } else{%>

notsunmited<%}

%>

7. Admin login page


<%@pagelanguage="java"contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD HTML 4.01
Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<linkrel="stylesheet"type="text/css"href="css/adminLogin.css"/>
</head>
<body>
<divclass="tableForm">
<formid="login"method="post"action="loginServlet">
<tablewidth="300"border="0">

<tr>

Division of Computer Engineering, SOE,CUSAT 81


Metro Rail Management Online

<tdheight="35"align="left">
<p>User name</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><inputtype="text"name="user"id="user"size="30"/></p>
</td>
</tr>
<tr>
<tdheight="35"align="left">
<p>Password</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><inputtype="text"name="password"id="password"size="30"/></p>
</td>
</tr>
<tr>
<tdcolspan=2align="center">
<inputtype="submit"value="login"id="submit"/>
</td>
</tr>

</table>
</form>
</div>
</body>
</html>

8 .Add route page

<%@pagelanguage="java"contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD HTML 4.01
Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> <html>
<head>

Division of Computer Engineering, SOE,CUSAT 82


Metro Rail Management Online

<metahttp-equiv="Content-Type"content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<linkrel="stylesheet"type="text/css"href="css/admin.css"/>
<scripttype="text/javascript"src="jquery/jquery-2.0.2.js"></script>
<scripttype="text/javascript"> var
count=1;

$(document).ready(function(){

$('#save').click(function ()
{ document.getElementById("countnum").value =
count-1;
alert(document.getElementById("countnum").value);
$.ajax({
type: "post",
url: "admin/routeSubmitAjax.jsp", //this is my servlet
data: $("#routeForm").serialize(), success:
function(msg){ alert(msg);
}
});
});

$('#add').click(function (){
var tr1=createtablerow(count);
$("#stations").append(tr1);
getOptions();
});
});
functiongetOptions()
{
var count1=count-1;
$.ajax({ type:
"post",
url: "admin/stationSelectAjax.jsp", //this is my servlet data:"",
success: function(msg){
//alert(msg);
$("#"+ count1 ).append(msg); if(count1==1)
{

Division of Computer Engineering, SOE,CUSAT 83


Metro Rail Management Online

document.getElementById("length1").value=0; }

}
}); }
functionautoLength(sbox)
{

var sid2=parseInt(sbox.id); var


sid1=sid2-1;
//alert("inside lengths id: "+sid2);
if(sid2!==1)
{
getDistance(sid1,sid2);
}
else
{
document.getElementById("length1").value=0;
}
}

functiongetDistance(boxid1,boxid2)
{

$.ajax({
type: "post",
url: "admin/getDistanceAjax.jsp",
data:"boxid1="+$('#'+boxid1).val()+"&boxid2="+$('#'+ boxid2).val ()
,
success: function(msg){
var distance=parseFloat(msg);
if(distance==1000)
{

}
else{
var
len1=parseFloat(document.getElementById("length"+boxid1).value);

Division of Computer Engineering, SOE,CUSAT 84


Metro Rail Management Online

distance=distance+len1;
document.getElementById("length"+boxid2).value=distance;
}

}
});
}
functioncreatetablerow() {

vartr = '<tr>' ; var


label1='Station'+count; var
label2="Length from start"; var
id1 ='station'+count; var id3
=count; varid2 ='length'+count;
count++;
// create a new selectBox
varselectBox = '<select id="'+ id3 + '" onChange="autoLength(this);"
name="' + id1 + '" style="width:200px;min-width:200px;height:20px;"
/>';
varinputBox = '<input type="text" id="'+ id2 + '" name="' + id2 + '"
size="30" />'; // create a new Label Text tr += '<td>' + label1 +
'</td>'; tr += '<td>' + selectBox + '</td>'; tr += '<td>' + label2 +
'</td>'; tr += '<td>' + inputBox + '</td>'; tr +='</tr>'; returntr;
}
</script>
</head>
<body>
<divid="pageContainer"class="pageContainer">
<divclass="routeTable">
<formid="routeForm"method="post"action="">
<inputtype="hidden"name="countnum"id="countnum"value="2"/>
<tableid="stations"width="400"border="0">
<tr>
<tdheight="35"align="center"colspan="2">
<b> Add new route</b>
</td>
</tr>
<tr>
<tdheight="35"align="left">

Division of Computer Engineering, SOE,CUSAT 85


Metro Rail Management Online

<p>Route name</p>
</td>
<tdalign="left"style="padding-left:7px;">

<p><inputtype="text"name="rname"id="rname"size="30"/></p>
</td>
<td></td>
<td></td>
</tr>
</table>
<inputtype="button"value="Add station"id="add"/><br>
<inputtype="button"value="submit"id="save"/>

</form>
</div>
</div>
</body>
</html>

9.For getting auto fill distance when creating route

<%@pagelanguage="java"contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%> <%@pageimport="java.io.File"%>
<%@pageimport="java.sql.ResultSet"%>
<%@pageimport="DataBase.DB"%>
<%@pageimport="java.io.PrintWriter"%>
<%@pageimport="java.sql.*"%>

<% int boxid1=Integer.parseInt(request.getParameter("boxid1"));


int boxid2=Integer.parseInt(request.getParameter("boxid2"));
ResultSet rs1 = null; ResultSet rs2 =
null; intcnt=0;
int cnt2;//first station's position in route int
cnt3;//second station's position in route boolean
flag=false; float length1=0;
float length2=0;
float distance=0;

Division of Computer Engineering, SOE,CUSAT 86


Metro Rail Management Online

try
{
rs1=DB.executeQuery("select r_id from route_details where
s_id="+boxid1);

while(rs1.next())
{
cnt2=0;
cnt3=0;
intr_id=rs1.getInt("r_id");
rs2=DB.executeQuery("select s_id,length_from_start,s_order_num
from route_details where r_id="+r_id+" order by s_order_num ");
while(rs2.next())
{
cnt2++;
ints_id=rs2.getInt("s_id");
if(boxid1==s_id)
{
length1=rs2.getFloat("length_from_start");
break;
}

}
cnt3=cnt2;
while(rs2.next())
{
cnt3++;
ints_id=rs2.getInt("s_id");
if(boxid2==s_id)
{
flag=true;
length2=rs2.getFloat("length_from_start");
break;
}

}
if(flag==true)
{

Division of Computer Engineering, SOE,CUSAT 87


Metro Rail Management Online

System.out.println("ids1:"+length1);
System.out.println("ids1:"+length2); distance=length2-length1;
System.out.println("ds:"+distance);
%><%=distance%>
<%
break;
}//if true

}// while rid


if(flag==false)
{
%>1000<%
}

}//try
catch(Exception e)
{
System.out.println(e);
}
%>

10.Reply complaints page

<%@pagelanguage="java"contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD HTML 4.01
Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<linkrel="stylesheet"type="text/css"href="css/admin.css"/>
<scripttype="text/javascript"src="jquery/jquery-2.0.2.js"></script>

<scripttype="text/javascript"> var
count=1;

Division of Computer Engineering, SOE,CUSAT 88


Metro Rail Management Online

$(document).ready(function(){
$("#popup_block").hide(); loadComplaintsDiv();

});
functionsubmitReplyForm()
{
$("#popup_block").show();
$.ajax({ type:
"post",
url: "admin/submitReplyAjax.jsp", //this is my servlet data:
$("#complaintForm").serialize(), success: function(msg){
alert(msg);
$("#popup_block").hide(); hideReplyDiv();

}
});

}
functionloadComplaintsDiv()
{
$.ajax({
type: "post",
url: "admin/getAllComplaintsAjax.jsp", //this is my servlet data: "",
success: function(msg){
// alert(msg);
document.getElementById("allComplaintsDiv").innerHTML = "";
$("#allComplaintsDiv").append(msg);
}
});
}
functionloadReplyDiv(selectedId)
{
varcid=selectedId.id;
$.ajax({
type: "post",
url: "admin/getComplaintByIdAjax.jsp", //this is my servlet
data: "cid="+cid,
success: function(msg){
//alert(msg);

Division of Computer Engineering, SOE,CUSAT 89


Metro Rail Management Online

$("#allComplaintsDiv").hide();
document.getElementById("replyDiv").innerHTML = "";
$("#replyDiv").append(msg);
$("#replyDiv").show();

}
});
}
function Reply()
{
alert("hai");
}
functionhideReplyDiv()
{
$("#replyDiv").hide();
loadComplaintsDiv();
$("#allComplaintsDiv").show();
}
</script>

</head>
<body>

<divid="allComplaintsDiv">
</div>
<divid="replyDiv"style="padding-left:100px;padding-top:40px; "></div>
<divid="popup_block"class="popup_block"style="hieght:200px;width:100px;f
loat:left;position:fixed;top:50%;left:50%;z-index: 999999;">
<imgalt=""src="img/ajax-loader.gif">
</div>
</body>
</html>

Division of Computer Engineering, SOE,CUSAT 90

You might also like