0% found this document useful (0 votes)
160 views

Final Document

The document provides details about developing an online bus ticket reservation system for SRC Travel Agencies. It includes sections on system analysis, design, source code, testing, and future scope. Key aspects covered are tools and platforms, data flow diagrams, entity relationship diagrams, process diagrams, table structures, and modules. The system will allow customers to book and cancel tickets online, and employees and agents to access the system.

Uploaded by

Nikhil Saxena
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
160 views

Final Document

The document provides details about developing an online bus ticket reservation system for SRC Travel Agencies. It includes sections on system analysis, design, source code, testing, and future scope. Key aspects covered are tools and platforms, data flow diagrams, entity relationship diagrams, process diagrams, table structures, and modules. The system will allow customers to book and cancel tickets online, and employees and agents to access the system.

Uploaded by

Nikhil Saxena
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 107

[Online Bus Ticket Services]

INDEX
Contents Page Numbers
1. Introduction 2
2. System Analysis 3
2.1. Tools and platform specification 10
2.2. Data Flow Diagrams 19
2.3. ER-Diagram 22

3. System Design 26

3.1. Process Diagram 29

3.2.Table Structures 34

3.3. Input/Output 42

4. Source Code 66

5. System Testing and Implementation 177

8. Modules 201

9. Future Scope 203

10. Bibliography 205

1
[Online Bus Ticket Services]

Introduction

SRC Travel Agencies is a domestic privatized transportation company that runs the
vehicles all over the country. They have several branches at different locations of the
country, and they provide the transportation facilities between different places.

Online Bus Ticket Reservation Services application is developed, where the details of the
bookings done and the customer are updated from time to time .

Existing system:

SRC Travel Agencies is the agency that provides the transportation facility to the
customers based on their requirements. They provide different buses like Express,
Luxury, and Volvo (Has two types A/C and Non A/C). The charges are in the below
mentioned format.

Express < Luxury < Volvo (Non A/C) < Volvo (A/C)

The charges are different for different buses. The charges also depend on the distance the
customer wants to travel and as well on the age of the customer.

The charges will be like –

Charges for Children below 5 years is ------- No Charges


Charges for Children between 5-12 years is ------- 50% Charges
Charges for Adults between 12-50 years is ------- Full Charges
Charges for Senior Citizens is ------- 30% Discount

2
[Online Bus Ticket Services]

Tools and Platform Specification


Software Requirements:

Front End : Asp.Net With C#, HTML, XML

RDBMS : SQL Server 2005

Server : IIS 5.0 , 6.0 ,7.0.

Operating System : Windows XP

Hardware Requirements:

Disc space : 1 GB

Processor : Intel Pentium IV based Processor

Processor speed : 1.13 MHz

3
[Online Bus Ticket Services]

Memory : 128 MB RAM

Server : Xeon server 3.6 GHz For hosting website

4
[Online Bus Ticket Services]

DATA FLOW
DIAGRAMS

5
[Online Bus Ticket Services]

Data Flow Diagrams

Zero Level DFD

First Level DFD

6
[Online Bus Ticket Services]

ER-DIAGRAM

7
[Online Bus Ticket Services]

Entity Relationship Diagram

The object/ relationship pair is the cornerstone of the data model. These pairs can be
represented graphically using the entity/relationship diagram. The ERD was originally
proposed by peter Chen for the design of relational database systems and has been
extended by others. A set of primary components are identified for the ERD: data objects,
attributes, relationships, and various type indicators. The primary purpose of the ERD is
to represent data objects and relationships. Data objects are represented by a labeled
rectangle. Relationships are indicating with a labeled line connecting objects. In some
variations of the ERD, the connecting line contains a diamond that is labeled with the
relationship. Connections between data objects and relationships are established using a
variety of special symbols that indicate cardinality and modality.

8
[Online Bus Ticket Services]

ER-Diagram

9
[Online Bus Ticket Services]

The Attributes of the Entities are:


NewUser ( New_Id , Emp_Id , Employee , New_Pass )

Bus ( B_Type, R_Num, B_Num, Source, Destination, Via, Dpt_hr, Dpt_Min, Arv_hr,
Arv_Min, Distance, T_Sheet, T_Adult, T_Half, T_Disc)

Employee ( Emp_Id ,Emp_Name, Emp_Gen ,Emp_Qul , Emp_Desg , Emp_DobDate ,


Emp_DobMonth , Emp_DobYear, Emp_DojDate, Emp_DojMonth, Emp_DojYear ,
Emp_DorDate , Emp_DorMonth , Emp_DorYear, Emp_State , Emp_CityEmp_PCode
Emp_Add , Emp_Mail, Emp_Mob)

OnlineBookTicket ( Tkt_Num , Bus_Type , Bus_Num , Route_Num , Book_Date ,


Source , Destination , Dpt_Hr , Dpt_Min , Arv_Hr , Arv_Min , Appl_Name , Appl_State
, Appl_City , Appl_PCode , Appl_Add , Per_AdTkt , Per_ChTkt , Per_CtTkt , T_Adult
,T_Child , T_Citizen , Crg_Adult , Crg_Child , Crg_citizen , Crg_Total )

BookingEnquiry ( Enq_Num , Bus_Type , Pas_Name , Mail_Id , Mob_Num ,


Pick_Date , Location , Doj , Roj , Add_From , Add_To , Rpt_Add , P_Code , Msg )

TicketCancelation ( Tkt_Num , Bus_Type , Bus_Num , Route_Num , Source ,


Destination , Dpt_Hr , Dpt_Min , Arv_Hr , Arv_Min , Appl_Name , Appl_State ,
Appl_City , Appl_PCode , Appl_Add , Per_AdTkt , Per_ChTkt , Per_CtTkt , T_Adult
,T_Child , T_Citizen , Crg_Adult , Crg_Child , Crg_citizen , Total_Amt , JDate
,Cancel_Date , Les_Percent , Refund_Amt )

Agent ( A_Id , A_Pass , A_Cnf )

10
[Online Bus Ticket Services]

PROCESS
DIAGRAMS

11
[Online Bus Ticket Services]

Process diagrams

Process Logic for Employee Registration

12
[Online Bus Ticket Services]

Process Logic for Agent Registration

13
[Online Bus Ticket Services]

Employee Authentication

14
[Online Bus Ticket Services]

Agent Authentication

15
[Online Bus Ticket Services]

Process Logic For Forget Password

16
[Online Bus Ticket Services]

17
[Online Bus Ticket Services]

TABLE STRUCTURES

18
[Online Bus Ticket Services]

Table Structures

Physical and Logical Design Logical Design:


The DFD shows the logical flow of system. It describes the inputs(sources),
outputs(destinations), databases(data stores), and procedures(data flows). Based on this,
the logical system design made which specify the user needs at a level of details that
virtually determine the information flow into and out of system and required data
resources. Thus it consists of design of input, output specifications (formats, contents),
files, control specifications and implementation.
Physical Design:
Following logical design is physical design. This produces the working system by
defining the design specifications that tell programmers exactly what the candidate
system must do. Thus the physical system design consists of specifying input/output
media, physical storage, design of data structures and data bases and specifying backup
procedures.

19
[Online Bus Ticket Services]

Table Structures :

TableName : NewUser

Column Name Data Type Length Description Reference


New_Id varchar 10 New User ID Primary key
Emp_Id varchar 10 Employee ID Foreign key

New_Pass varchar 20 Password

Table Name: Agent

Column Name Data Type Length Description Reference


A_Id Varchar 10 Agent-ID/Name Primary
Key
A_Pass Varchar 10 Agent Password
A_Cnf Varchar 10 Agent-Confirm Password

TableName: Employee

20
[Online Bus Ticket Services]

Column Name Data Type Length Description Reference

Emp_Id Varchar 10 Employee ID Primary key

Emp_Name Varchar 20 Employee Name

Emp_Gen Varchar 20 Employee Gender

Emp_Qul varchar 20 Employee Qualification

Emp_Desg Varchar 20 Employee Designation

Emp_DobDate Varchar 10 Employee Birth -Date

Emp_DobMont Varchar 10 Employee Birth –Month


h

Emp_DobYear int Employee Birth –Year

Emp_DojDate Varchar 10 Employee Join -Date

Emp_DojMonth varchar 10 Employee Join-Month

Emp_DojYear int Employee Join-Year

Emp_DorDate Varchar 10 Employee Retire-Date

Emp_DorMonth Varchar 10 Employee Retire-Month

Emp_DorYear Varchar 10 Employee Retire-Year

Emp_State Varchar 20 Employee State

Emp_City Varchar 20 Employee City

Emp_PCode Varchar 6 Employee Postal Code

Emp_Add Varchar 100 Employee Address

Emp_Mail Varchar 100 Employee Email ID

Emp_Mob varchar 10 Employee Mobile Number

TableName: Bus

Column Name Data Type Length Description Reference

21
[Online Bus Ticket Services]

B_Type varchar 20 Bus Type


R_Num Int Route Number
B_Num varchar 20 Bus Number Primary Key

Source varchar 20
Destination varchar 20
Via varchar 500
Dpt_hr varchar 10 Departure Hour
Dpt_Min varchar 10 Departure Minute
Arv_hr varchar 10 Arrival Hour
Arv_Min varchar 10 Arrival Minute
Distance Int
T_Sheet Int Total seat
T_Adult Int Total Adults Tickets
T_Half Int Total Half
Tickets(children)
T_Disc Int Total Discount
Tickets(citizens)

TableName: BookingEnquiry

Column Name Data Type Length Description Reference

22
[Online Bus Ticket Services]

Enq_Num bigint Enquiry Number Primary key

Bus_Type varchar 20 Bus type

Pas_Name Varchar 20 Passenger Name

Mail_Id Varchar 20 Email ID

Mob_Num Varchar 20 Mobile Number

Pick_Date Varchar 20 Pick up Date

Location varchar 20

Doj Varchar 20 Date Of Journey

Rroj Varchar 20 Return date of journey

Add_From Varchar 20 From Address

Add_To Varchar 20 To address

Rpt_Add Varchar 100 Reporting Address

P_Code Varchar 20 Postal Code

Msg Varchar 500 Message

TableName: OnlineBookTicket
Column Name Data Type Length Description Reference

23
[Online Bus Ticket Services]

Tkt_Num int Ticket Number Primary key

Bus_Type Varchar 20 Bus Type

Bus_Num Varchar 10 Bus Number

Route_Num Varchar 10 Route Number

Book_Date Varchar 20 Booking Date

Source Varchar 20

Destination Varchar 20

Dpt_Hr Int Departure Hour

Dpt_Min Int Departure Minute

Arv_Hr Int Arrival Hour

Arv_Min Int Arrival Minute

Appl_Name Varchar 20 Applicant Name

Appl_State Varchar 20 Applicant State

Appl_City Varchar 20 Applicant City

Appl_PCode Varchar 20 Applicant Postal Code

Appl_Add Varchar 200 Applicant Address

Per_AdTkt Int Charge Per one Adult Ticket

Per_ChTkt Int Charge Per one Child Ticket

Per_CtTkt Int Charge Per one Citizen Ticket

T_Adult Int Total Number of Adult Tickets

T_Child Int Total Number of Children


Tickets

T_Citizen Int Total Number of Citizens


Tickets

Crg_Adult Int Total Charges For Adults

Crg_Child Int Total Charges For children

24
[Online Bus Ticket Services]

Crg_citizen Int Total Charges For Citizens

Crg_Total Int GrandTotal Charges

TableName: TicketCancelation

Column Name Data Type Length Description Reference

Tkt_Num Int Ticket Number Primary Key

Bus_Type Varchar 20 Bus Type

Bus_Num Varchar 10 Bus Number

Route_Num Varchar 10 Route Number

Source Varchar 20

Destination Varchar 20

Dpt_Hr Int Departure-Hour

Dpt_Min Int Departure-Minute

Arv_Hr Int Arrival-Hour

Arv_Min Varchar 20 Arrival-Minute

Appl_Name Varchar 20 Applicant Name

Appl_State Varchar 20 Applicant State

Appl_City Varchar 20 Applicant City

Appl_PCode Varchar 20 Applicant Postal Code

Appl_Add Varchar 20 Applicant Address

Per_AdTkt Int Charge Per one Adult Ticket

Per_ChTkt Int Charge Per one Child Ticket

Per_CtTkt Int Charge Per one Citizen Ticket

T_Adult Int Total Number of Adult Tickets

T_Child Int Total Number of Children Tickets

25
[Online Bus Ticket Services]

T_Citizen Int Total Number of Citizens Tickets

Crg_Adult Int Total Charges For Adults

Crg_Child Int Total Charges For children

Crg_citizen Int Total Charges For Citizens

Total_Amt Int GrandTotal Charges

JDate DateTime Journey Date

Cancel_Date DateTime Cancel Ticket Date

Les_Percent Int Deducted Percentage of Ticket


Charges

Refund_Amt Int Refundable Amount

26
[Online Bus Ticket Services]

Home

27
[Online Bus Ticket Services]

Services

Package tour

28
[Online Bus Ticket Services]

Gallery

Clients

29
[Online Bus Ticket Services]

Contact Us

About Us

30
[Online Bus Ticket Services]

Bus Information

Bus Hire Request

31
[Online Bus Ticket Services]

Call For Us

Source To Destination

32
[Online Bus Ticket Services]

Booking Ticket

Enquiry Bus Number

33
[Online Bus Ticket Services]

Cancellation Ticket

34
[Online Bus Ticket Services]

35
[Online Bus Ticket Services]

Master.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class UserControlPage_MasterPage : System.Web.UI.MasterPage
{
SqlConnection conn = new SqlConnection("server=.\\sqlexpress;
Database=onlinebusservices; Trusted_Connection=yes");
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Redirect("~/User/CallBusTicket.htm");
}
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select New_Id,New_Pass from NewUser where
New_Id=@New_Id and New_Pass=@New_Pass";
cmd.Parameters.Add("@New_Id", SqlDbType.VarChar).Value =
Login1.UserName;
cmd.Parameters.Add("@New_Pass", SqlDbType.VarChar).Value =
Login1.Password;
try
{
cmd.Connection.Open();
string UName = (string)cmd.ExecuteScalar();
if (UName != null)
{
Login1.DestinationPageUrl = "~/WebSiteUser/NewBusst.aspx";
e.Authenticated = true;
}

36
[Online Bus Ticket Services]

}
catch (Exception ex)
{
Login1.FailureText = ex.Message;
}
finally {
cmd.Connection.Close();
}
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
Response.Redirect("~/WebSiteUser/CreateNewUser.aspx");
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("~/User/BusInformation.aspx");
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("~/User/BookingEnquiry.aspx");
}
protected void BtnSourceToDestinatio_Click(object sender, EventArgs e)
{
Response.Redirect("~/User/EnquiryByRoute.aspx");
}
protected void BtnBookTicket_Click(object sender, EventArgs e)
{
Response.Redirect("~/User/LoginUserForOnLineBookTicket.aspx");
}
protected void BtnBusNumber_Click(object sender, EventArgs e)
{
Response.Redirect("~/User/EnquiryByBusNumber.aspx");
}
protected void BtnCancelTicket_Click(object sender, EventArgs e)
{
Response.Redirect("~/User/LoginUserForOnLineBookTicket.aspx");
}
protected void MenuControl1_Load(object sender, EventArgs e)
{
}}

37
[Online Bus Ticket Services]

Employee.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.IO;
public partial class WebSiteUser_EmployeeForm : System.Web.UI.Page
{
SqlConnection conn = new
SqlConnection("server=.\\sqlexpress;Database=onlinebusservices;Trusted_Connection=y
es");
void AutoGenrate()
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select max(Emp_Id) from employee";
cmd.Connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();
int trc;
if (rdr.Read() == true)
{
trc = Convert.ToInt32(rdr[0].ToString());
trc = trc + 1;
}
else {
trc = 1;
}
cmd.Connection.Close();
TxtEmpId.Text = trc.ToString();
}
protected void Page_Load(object sender, EventArgs e)
{
LblMsg.Visible = false;

38
[Online Bus Ticket Services]

if (!Page.IsPostBack)
{
this.AutoGenrate();
DdlDesigination.Items.Insert(0, "--Select Desigination--");
DdlGender.Items.Insert(0, "--Select Gender--");
DdlQul.Items.Insert(0, "--select Qualification--");
DdlDobDate.Items.Insert(0, "--Select date--");
DdlDobMonth.Items.Insert(0, "--Select Month--");
DdlDobYear.Items.Insert(0,"--Select Year--");
DdlDojDate.Items.Insert(0,"--Select Joining Date--");
DdlDojMonth.Items.Insert(0,"--Select Joining Month--");
DdlDojYear.Items.Insert(0,"--Select Joining Year--");
ArrayList ArlState = new ArrayList();
ArlState.Add("Andhra Pradesh");
ArlState.Add("Kerla");
ArlState.Add("Maharastra");
ArlState.Add("Karnatak");
ArlState.Add("Rajsthan");
ArlState.Add("Delhi");
ArlState.Add("MadhyaPradesh");
//Sorting Statewise
ArlState.Sort();
DdlState.DataSource = ArlState;
DdlState.DataBind();
DdlState.Items.Insert(0, "---Select State---");
for (int DobDate = 1; DobDate <= 31; DobDate++)
{
DdlDobDate.Items.Add(DobDate.ToString());
DdlDojDate.Items.Add(DobDate.ToString());
}
for (int DobYear = 1900; DobYear < 2010; DobYear++)
{
DdlDobYear.Items.Add(DobYear.ToString());
DdlDojYear.Items.Add(DobYear.ToString());
}
}
}
protected void DdlDojDate_SelectedIndexChanged(object sender, EventArgs e)
{
TxtRetDate.Text = DdlDojDate.Text;
}

39
[Online Bus Ticket Services]

protected void DdlDojMonth_SelectedIndexChanged(object sender, EventArgs e)


{
TxtRetMonth.Text = DdlDojMonth.Text;
}
protected void DdlDojYear_SelectedIndexChanged(object sender, EventArgs e)
{
int Ret = Convert.ToInt32(DdlDojYear.Text);
int Ret1 = Ret + 50;
TxtRetYear.Text = Ret1.ToString();
int Age = Convert.ToInt32(DdlDobYear.Text);
int Age1 = Convert.ToInt32(DdlDojYear.Text);
int Age3 = Age1 - Age;
TxrAge.Text = Age3.ToString();
}
protected void DdlState_SelectedIndexChanged(object sender, EventArgs e)
{
if (DdlState.SelectedIndex == 1)
{
DdlCity.Items.Clear();
DdlCity.Items.Add("Hyderabad");
DdlCity.Items.Add("Kachiguda");
DdlCity.Items.Add("KamanaHalli");
}
else if (DdlState.SelectedIndex == 2)
{
DdlCity.Items.Clear();
DdlCity.Items.Add("Okhla");
DdlCity.Items.Add("Kanat-Place");
DdlCity.Items.Add("Noida");
DdlCity.Items.Add("Gurgaon");
}
else if (DdlState.SelectedIndex == 3)
{
DdlCity.Items.Clear();
DdlCity.Items.Add("Bangalore");
DdlCity.Items.Add("Mangalore");
DdlCity.Items.Add("Mysor");
DdlCity.Items.Add("Nandi Hill");
}
else if (DdlState.SelectedIndex == 4)
{

40
[Online Bus Ticket Services]

DdlCity.Items.Clear();
DdlCity.Items.Add("KK11");
DdlCity.Items.Add("KK222");
DdlCity.Items.Add("KK333");
DdlCity.Items.Add("KK444");
}
else if (DdlState.SelectedIndex == 5)
{
DdlCity.Items.Clear();
DdlCity.Items.Add("MP11");
DdlCity.Items.Add("MP222");
DdlCity.Items.Add("MP333");
DdlCity.Items.Add("MP444");
}
else if (DdlState.SelectedIndex == 6)
{
DdlCity.Items.Clear();
DdlCity.Items.Add("MR11");
DdlCity.Items.Add("MR222");
DdlCity.Items.Add("MR333");
DdlCity.Items.Add("MR444");
}
else if (DdlState.SelectedIndex == 7)
{
DdlCity.Items.Clear();
DdlCity.Items.Add("R11");
DdlCity.Items.Add("R222");
DdlCity.Items.Add("R333");
DdlCity.Items.Add("R444");
}
}
protected void BtnSubmit_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "insert into Employee
values(@Emp_Id,@Emp_Name,@Emp_Gen,@Emp_Qul,@Emp_Desg,@Emp_DobDat
e,@Emp_DobMonth,@Emp_DobYear,@Emp_DojDate,@Emp_DojMonth,@Emp_Doj
Year,@Emp_Age,@Emp_DorDate,@Emp_DorMonth,@Emp_DorYear,@Emp_State,@
Emp_City,@Emp_PCode,@Emp_Add,@Emp_Mail,@Emp_Mob)";
cmd.Parameters.Add("Emp_Id",SqlDbType.Int).Value=TxtEmpId.Text;

41
[Online Bus Ticket Services]

cmd.Parameters.Add("Emp_Name",SqlDbType.VarChar).Value=TxtEmpName.Text;
cmd.Parameters.Add("Emp_Gen", SqlDbType.VarChar).Value = DdlGender.Text;
cmd.Parameters.Add("Emp_Qul", SqlDbType.VarChar).Value = DdlQul.Text;

cmd.Parameters.Add("Emp_Desg",SqlDbType.VarChar).Value=DdlDesigination.Text;

cmd.Parameters.Add("Emp_DobDate",SqlDbType.VarChar).Value=DdlDobDate.Text;

cmd.Parameters.Add("Emp_DobMonth",SqlDbType.VarChar).Value=DdlDobMonth.Te
xt;

cmd.Parameters.Add("Emp_DobYear",SqlDbType.VarChar).Value=DdlDobYear.Text;

cmd.Parameters.Add("Emp_DojDate",SqlDbType.VarChar).Value=DdlDojMonth.Text;

cmd.Parameters.Add("Emp_DojMonth",SqlDbType.VarChar).Value=DdlDojMonth.Text
;

cmd.Parameters.Add("Emp_DojYear",SqlDbType.VarChar).Value=DdlDojYear.Text;
cmd.Parameters.Add("Emp_Age",SqlDbType.VarChar).Value=TxrAge.Text;

cmd.Parameters.Add("Emp_DorDate",SqlDbType.VarChar).Value=TxtRetDate.Text;

cmd.Parameters.Add("Emp_DorMonth",SqlDbType.VarChar).Value=TxtRetMonth.Text
;
cmd.Parameters.Add("Emp_DorYear",SqlDbType.VarChar).Value=TxtRetYear.Text;
cmd.Parameters.Add("Emp_State",SqlDbType.VarChar).Value=DdlState.Text;
cmd.Parameters.Add("Emp_City",SqlDbType.VarChar).Value=DdlCity.Text;
cmd.Parameters.Add("Emp_PCode",SqlDbType.VarChar).Value=TxtPostal.Text;
cmd.Parameters.Add("Emp_Add",SqlDbType.VarChar).Value=TxtAddress.Text;
cmd.Parameters.Add("Emp_Mail",SqlDbType.VarChar).Value=TxtMailId.Text;
cmd.Parameters.Add("Emp_Mob", SqlDbType.VarChar).Value =
TxtMobileNum.Text;
try
{
cmd.Connection.Open();
cmd.ExecuteNonQuery();
LblMsg.Visible = true;
LblMsg.Text = "Saved Your Records";
}

42
[Online Bus Ticket Services]

catch (Exception ex)


{
LblMsg.Visible = true;
LblMsg.Text = ex.Message;
}
finally {
cmd.Connection.Close();
}
}
protected void BtnNew_Click(object sender, EventArgs e)
{
TxtEmpId.Text = "";
this.AutoGenrate();
TxtEmpName.Text = "";
TxtAddress.Text = "";

}
}

43
[Online Bus Ticket Services]

Employee_Login.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class UserControlPage_MasterPage : System.Web.UI.MasterPage


{
SqlConnection conn = new SqlConnection("server=.\\sqlexpress;
Database=onlinebusservices; Trusted_Connection=yes");
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Redirect("~/User/CallBusTicket.htm");
}
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select New_Id,New_Pass from NewUser where
New_Id=@New_Id and New_Pass=@New_Pass";
cmd.Parameters.Add("@New_Id", SqlDbType.VarChar).Value =
Login1.UserName;
cmd.Parameters.Add("@New_Pass", SqlDbType.VarChar).Value =
Login1.Password;
try
{
cmd.Connection.Open();
string UName = (string)cmd.ExecuteScalar();
if (UName != null)
{
Login1.DestinationPageUrl = "~/WebSiteUser/NewBusst.aspx";
e.Authenticated = true;
}

44
[Online Bus Ticket Services]

}
catch (Exception ex)
{
Login1.FailureText = ex.Message;
}
finally {
cmd.Connection.Close();
}
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
Response.Redirect("~/WebSiteUser/CreateNewUser.aspx");
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("~/User/BusInformation.aspx");
}
protected void Button2_Click(object sender, EventArgs e)
{
Response.Redirect("~/User/BookingEnquiry.aspx");
}
protected void BtnSourceToDestinatio_Click(object sender, EventArgs e)
{
Response.Redirect("~/User/EnquiryByRoute.aspx");
}
protected void BtnBookTicket_Click(object sender, EventArgs e)
{
Response.Redirect("~/User/LoginUserForOnLineBookTicket.aspx");
}
protected void BtnBusNumber_Click(object sender, EventArgs e)
{
Response.Redirect("~/User/EnquiryByBusNumber.aspx");
}
protected void BtnCancelTicket_Click(object sender, EventArgs e)
{
Response.Redirect("~/User/LoginUserForOnLineBookTicket.aspx");
}

45
[Online Bus Ticket Services]

NewBus.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class WebSiteUser_NewBusst : System.Web.UI.Page


{
SqlConnection conn = new
SqlConnection("server=.\\sqlexpress;Database=OnlineBusServices;Trusted_Connection=
yes");
void ExxpresBind()
{
SqlDataAdapter sda = new SqlDataAdapter("Select * from Bus where
B_Type='Express Bus'",conn);
DataSet ds = new DataSet();
sda.Fill(ds);
DataView dview = ds.Tables[0].DefaultView;
GrdExpress.DataSource = dview;
GrdExpress.DataBind();
}
void NonAcBus()
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select * from Bus where B_Type='Volvo (Non/AC) Bus'";
cmd.Connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();
GrdNonAcBus.DataSource = rdr;
GrdNonAcBus.DataBind();
cmd.Connection.Close();
}

46
[Online Bus Ticket Services]

void LuxuryBus()
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select * from Bus where B_Type='Luxury Bus'";
cmd.Connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();
GrdLuxury.DataSource = rdr;
GrdLuxury.DataBind();
cmd.Connection.Close();
}
void VolvoAcBus()
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select * from Bus where B_Type='Volvo (Non/AC) Bus'";
cmd.Connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();
GrdVolvoAc.DataSource = rdr;
GrdVolvoAc.DataBind();
cmd.Connection.Close();
}
void DepartureTime()
{
DdlDephr.Items.Add("00");
DdlDephr.Items.Add("01");
DdlDephr.Items.Add("02");
DdlDephr.Items.Add("03");
DdlDephr.Items.Add("04");
DdlDephr.Items.Add("05");
DdlDephr.Items.Add("06");
DdlDephr.Items.Add("07");
DdlDephr.Items.Add("08");
DdlDephr.Items.Add("09");
DdlDephr.Items.Add("10");
DdlDephr.Items.Add("11");
DdlDephr.Items.Add("12");
DdlDephr.Items.Add("13");
DdlDephr.Items.Add("14");
DdlDephr.Items.Add("15");
DdlDephr.Items.Add("16");

47
[Online Bus Ticket Services]

DdlDephr.Items.Add("17");
DdlDephr.Items.Add("18");
DdlDephr.Items.Add("19");
DdlDephr.Items.Add("20");
DdlDephr.Items.Add("21");
DdlDephr.Items.Add("22");
DdlDephr.Items.Add("23");
DdlDephr.Items.Add("24");
DdlDepMin.Items.Add("00");
DdlDepMin.Items.Add("15");
DdlDepMin.Items.Add("30");
DdlDepMin.Items.Add("45");
}
void ArrivalTime()
{
DdlArhr.Items.Add("00");
DdlArhr.Items.Add("01");
DdlArhr.Items.Add("02");
DdlArhr.Items.Add("03");
DdlArhr.Items.Add("04");
DdlArhr.Items.Add("05");
DdlArhr.Items.Add("06");
DdlArhr.Items.Add("07");
DdlArhr.Items.Add("08");
DdlArhr.Items.Add("09");
DdlArhr.Items.Add("10");
DdlArhr.Items.Add("11");
DdlArhr.Items.Add("12");
DdlArhr.Items.Add("13");
DdlArhr.Items.Add("14");
DdlArhr.Items.Add("15");
DdlArhr.Items.Add("16");
DdlArhr.Items.Add("17");
DdlArhr.Items.Add("18");
DdlArhr.Items.Add("19");
DdlArhr.Items.Add("20");
DdlArhr.Items.Add("21");
DdlArhr.Items.Add("22");
DdlArhr.Items.Add("23");
DdlArhr.Items.Add("24");
DdlArMin.Items.Add("00");

48
[Online Bus Ticket Services]

DdlArMin.Items.Add("15");
DdlArMin.Items.Add("30");
DdlArMin.Items.Add("45");
}
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.NonAcBus();
this.DepartureTime();
this.ArrivalTime();
this.VolvoAcBus();
this.LuxuryBus();
this.ExxpresBind();
DdlBusType.Items.Insert(0, "---Select Bus Type---");
Label3.Visible = false;
Button1.Visible = false;
for (int s = 10; s <= 100; s++)
{
DdlSheet.Items.Add(s.ToString());
}
int a=50;
while (a <= 2000)
{
DdlAdult.Items.Add(a.ToString());
a++;
}
ArrayList ArlSource = new ArrayList();
ArlSource.Add("Bangalore");
ArlSource.Add("Ahmedabad");
ArlSource.Add("Delhi");
ArlSource.Add("Mumbai");
ArlSource.Add("Mangalore");
ArlSource.Add("Chenni");
ArlSource.Add("Hyderabad");
ArlSource.Add("Pune");
ArlSource.Sort();
DdlSource.DataSource = ArlSource;
DdlSource.DataBind();
DdlDestination.DataSource = ArlSource;
DdlDestination.DataBind();

49
[Online Bus Ticket Services]

DdlBusType.Items.Add("Express Bus");
DdlBusType.Items.Add("Luxury Bus");
DdlBusType.Items.Add("Volvo (Non/AC) Bus");
DdlBusType.Items.Add("Volvo (A/C) Bus");
}
}
protected void BtnSub_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "insert into
Bus(B_Type,R_Num,B_Num,Source,Destination,Via,Dpt_Hr,Dpt_Min,Arv_Hr,Arv_Mi
n,T_Sheet,T_Adult,T_Half,T_Disc,Distance)
values(@B_Type,@R_Num,@B_Num,@Source,@Destination,@Via,@Dpt_Hr,@Dpt_
Min,@Arv_Hr,@Arv_Min,@T_Sheet,@T_Adult,@T_Half,@T_Disc,@Distance)";
cmd.Parameters.Add("@B_Type", SqlDbType.VarChar).Value =
DdlBusType.SelectedItem.Text;
cmd.Parameters.Add("@R_Num", SqlDbType.Int).Value = TxtRouteNum.Text;
cmd.Parameters.Add("@B_Num", SqlDbType.VarChar).Value =
TxtBusNume.Text;
cmd.Parameters.Add("@Source", SqlDbType.VarChar).Value =
DdlSource.SelectedItem.Text;
cmd.Parameters.Add("@Destination", SqlDbType.VarChar).Value =
DdlDestination.SelectedItem.Text;
cmd.Parameters.Add("@Via", SqlDbType.VarChar).Value = TxtVia.Text;
cmd.Parameters.Add("Dpt_Hr", SqlDbType.VarChar).Value =
DdlDephr.SelectedItem.Text;
cmd.Parameters.Add("Dpt_Min", SqlDbType.VarChar).Value =
DdlDepMin.SelectedItem.Text;
cmd.Parameters.Add("Arv_Hr", SqlDbType.VarChar).Value =
DdlArhr.SelectedItem.Text;
cmd.Parameters.Add("Arv_Min", SqlDbType.VarChar).Value =
DdlArMin.SelectedItem.Text;
cmd.Parameters.Add("@T_Sheet", SqlDbType.Int).Value =
DdlSheet.SelectedItem.Text;
cmd.Parameters.Add("T_Adult", SqlDbType.Int).Value =
DdlAdult.SelectedItem.Text;
cmd.Parameters.Add("T_Half", SqlDbType.Int).Value = TxtHalf.Text;
cmd.Parameters.Add("T_Disc", SqlDbType.Int).Value = TxtDiscount.Text;
cmd.Parameters.Add("@Distance", SqlDbType.Int).Value = TxtDistance.Text;
try

50
[Online Bus Ticket Services]

{
cmd.Connection.Open();
cmd.ExecuteNonQuery();
Label2.Text = "Saved";
cmd.Connection.Close();
this.VolvoAcBus();
this.LuxuryBus();
this.ExxpresBind();
this.NonAcBus();
}
catch (Exception ex)
{
Label2.Text = ex.Message;
cmd.Connection.Close();
}
finally {
cmd.Connection.Close();
}
}
protected void DdlAdult_SelectedIndexChanged(object sender, EventArgs e)
{
int a = Convert.ToInt32(DdlAdult.SelectedItem.Text);
int b = a / 2;
int c = a % 30;
int d = a - c;
TxtHalf.Text = b.ToString();
TxtDiscount.Text = d.ToString();
}
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (RadioButtonList1.SelectedIndex == 0)
{
MultiView1.ActiveViewIndex = 0;
}
else if (RadioButtonList1.SelectedIndex == 1)
{
MultiView1.ActiveViewIndex = 1;
}
else if (RadioButtonList1.SelectedIndex == 2)
{
MultiView1.ActiveViewIndex = 2;

51
[Online Bus Ticket Services]

}
else if (RadioButtonList1.SelectedIndex == 3)
{
MultiView1.ActiveViewIndex = 3;
}
}
protected void GrdNonAcBus_RowEditing(object sender, GridViewEditEventArgs e)
{
GrdNonAcBus.EditIndex = e.NewEditIndex;
this.NonAcBus();
}
protected void GrdExpress_RowEditing(object sender, GridViewEditEventArgs e)
{
GrdExpress.EditIndex = e.NewEditIndex;
this.ExxpresBind();
}
protected void GrdExpress_RowUpdating(object sender, GridViewUpdateEventArgs
e)
{
TextBox T1 = (TextBox)GrdExpress.Rows[e.RowIndex].Cells[0].Controls[0];
TextBox T2 = (TextBox)GrdExpress.Rows[e.RowIndex].Cells[1].Controls[0];
TextBox T3 = (TextBox)GrdExpress.Rows[e.RowIndex].Cells[2].Controls[0];
TextBox T4 = (TextBox)GrdExpress.Rows[e.RowIndex].Cells[3].Controls[0];
TextBox T5 = (TextBox)GrdExpress.Rows[e.RowIndex].Cells[4].Controls[0];
TextBox T6 = (TextBox)GrdExpress.Rows[e.RowIndex].Cells[5].Controls[0];
TextBox T7 = (TextBox)GrdExpress.Rows[e.RowIndex].Cells[6].Controls[0];
TextBox T8 = (TextBox)GrdExpress.Rows[e.RowIndex].Cells[7].Controls[0];
TextBox T9 = (TextBox)GrdExpress.Rows[e.RowIndex].Cells[8].Controls[0];
TextBox T10 = (TextBox)GrdExpress.Rows[e.RowIndex].Cells[9].Controls[0];
TextBox T11 = (TextBox)GrdExpress.Rows[e.RowIndex].Cells[10].Controls[0];
TextBox T12 = (TextBox)GrdExpress.Rows[e.RowIndex].Cells[11].Controls[0];
TextBox T13 = (TextBox)GrdExpress.Rows[e.RowIndex].Cells[12].Controls[0];
TextBox T14 = (TextBox)GrdExpress.Rows[e.RowIndex].Cells[13].Controls[0];
TextBox T15 = (TextBox)GrdExpress.Rows[e.RowIndex].Cells[14].Controls[0];
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "update bus set B_Type='" +T1.Text + "',R_Num='" +
T2.Text + "',Source='" + T4.Text + "',Destination='" + T5.Text + "',Via='" + T6.Text +
"',Dpt_Hr='" + T7.Text + "',Dpt_Min='" +T8.Text + "',Arv_Hr='" + T9.Text +
"',Arv_Min='" +T10.Text + "',Distance='" + T11.Text + "',T_Sheet='" + T12.Text +

52
[Online Bus Ticket Services]

"',T_Adult='" + T13.Text + "',T_Half='" + T14.Text + "',T_Disc='" + T15.Text + "' where


B_Num='" +T3.Text + "' ";

try
{
cmd.Connection.Open();
cmd.ExecuteReader();
this.ExxpresBind();
cmd.Connection.Close();
}
catch (SqlException sx)
{
Label3.Text = sx.Message;
}
catch (Exception ex)
{ Label3.Text = ex.Message; }
finally {
cmd.Connection.Close();
}
}
protected void GrdExpress_RowCancelingEdit(object sender,
GridViewCancelEditEventArgs e)
{
GrdExpress.EditIndex = -1;
this.ExxpresBind();
}
protected void GrdLuxury_RowEditing(object sender, GridViewEditEventArgs e)
{
GrdLuxury.EditIndex = e.NewEditIndex;
this.LuxuryBus();
}
protected void GrdLuxury_RowCancelingEdit(object sender,
GridViewCancelEditEventArgs e)
{
GrdLuxury.EditIndex = -1;
this.LuxuryBus();
}
protected void GrdLuxury_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
TextBox L1 = (TextBox)GrdLuxury.Rows[e.RowIndex].Cells[0].Controls[0];
TextBox L2 = (TextBox)GrdLuxury.Rows[e.RowIndex].Cells[1].Controls[0];

53
[Online Bus Ticket Services]

TextBox L3 = (TextBox)GrdLuxury.Rows[e.RowIndex].Cells[2].Controls[0];
TextBox L4 = (TextBox)GrdLuxury.Rows[e.RowIndex].Cells[3].Controls[0];
TextBox L5 = (TextBox)GrdLuxury.Rows[e.RowIndex].Cells[4].Controls[0];
TextBox L6 = (TextBox)GrdLuxury.Rows[e.RowIndex].Cells[5].Controls[0];
TextBox L7 = (TextBox)GrdLuxury.Rows[e.RowIndex].Cells[6].Controls[0];
TextBox L8 = (TextBox)GrdLuxury.Rows[e.RowIndex].Cells[7].Controls[0];
TextBox L9 = (TextBox)GrdLuxury.Rows[e.RowIndex].Cells[8].Controls[0];
TextBox L10 = (TextBox)GrdLuxury.Rows[e.RowIndex].Cells[9].Controls[0];
TextBox L11 = (TextBox)GrdLuxury.Rows[e.RowIndex].Cells[10].Controls[0];
TextBox L12 = (TextBox)GrdLuxury.Rows[e.RowIndex].Cells[11].Controls[0];
TextBox L13 = (TextBox)GrdLuxury.Rows[e.RowIndex].Cells[12].Controls[0];
TextBox L14 = (TextBox)GrdLuxury.Rows[e.RowIndex].Cells[13].Controls[0];
TextBox L15 = (TextBox)GrdLuxury.Rows[e.RowIndex].Cells[14].Controls[0];
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "update bus set B_Type='" + L1.Text + "',R_Num='" +
L2.Text + "',Source='" + L4.Text + "',Destination='" + L5.Text + "',Via='" + L6.Text +
"',Dpt_Hr='" + L7.Text + "',Dpt_Min='" + L8.Text + "',Arv_Hr='" + L9.Text +
"',Arv_Min='" + L10.Text + "',Distance='" + L11.Text + "',T_Sheet='" + L12.Text +
"',T_Adult='" + L13.Text + "',T_Half='" + L14.Text + "',T_Disc='" + L15.Text + "' where
B_Num='" + L3.Text + "' ";
try
{
cmd.Connection.Open();
cmd.ExecuteReader();
this.LuxuryBus();
cmd.Connection.Close();
}
catch (SqlException sx)
{
Label3.Text = sx.Message;
}
catch (Exception ex)
{ Label3.Text = ex.Message; }
finally
{
cmd.Connection.Close();
}
}
protected void GrdNonAcBus_RowCancelingEdit(object sender,
GridViewCancelEditEventArgs e)

54
[Online Bus Ticket Services]

{
GrdNonAcBus.EditIndex = -1;
this.NonAcBus();
}
protected void GrdNonAcBus_RowUpdating(object sender,
GridViewUpdateEventArgs e)
{
TextBox N1 = (TextBox)GrdNonAcBus.Rows[e.RowIndex].Cells[0].Controls[0];
TextBox N2 = (TextBox)GrdNonAcBus.Rows[e.RowIndex].Cells[1].Controls[0];
TextBox N3 = (TextBox)GrdNonAcBus.Rows[e.RowIndex].Cells[2].Controls[0];
TextBox N4 = (TextBox)GrdNonAcBus.Rows[e.RowIndex].Cells[3].Controls[0];
TextBox N5 = (TextBox)GrdNonAcBus.Rows[e.RowIndex].Cells[4].Controls[0];
TextBox N6 = (TextBox)GrdNonAcBus.Rows[e.RowIndex].Cells[5].Controls[0];
TextBox N7 = (TextBox)GrdNonAcBus.Rows[e.RowIndex].Cells[6].Controls[0];
TextBox N8 = (TextBox)GrdNonAcBus.Rows[e.RowIndex].Cells[7].Controls[0];
TextBox N9 = (TextBox)GrdNonAcBus.Rows[e.RowIndex].Cells[8].Controls[0];
TextBox N10 = (TextBox)GrdNonAcBus.Rows[e.RowIndex].Cells[9].Controls[0];
TextBox N11 = (TextBox)GrdNonAcBus.Rows[e.RowIndex].Cells[10].Controls[0];
TextBox N12 = (TextBox)GrdNonAcBus.Rows[e.RowIndex].Cells[11].Controls[0];
TextBox N13 = (TextBox)GrdNonAcBus.Rows[e.RowIndex].Cells[12].Controls[0];
TextBox N14 = (TextBox)GrdNonAcBus.Rows[e.RowIndex].Cells[13].Controls[0];
TextBox N15 = (TextBox)GrdNonAcBus.Rows[e.RowIndex].Cells[14].Controls[0];
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "update bus set B_Type='" + N1.Text + "',R_Num='" +
N2.Text + "',Source='" + N4.Text + "',Destination='" + N5.Text + "',Via='" + N6.Text +
"',Dpt_Hr='" + N7.Text + "',Dpt_Min='" + N8.Text + "',Arv_Hr='" + N9.Text +
"',Arv_Min='" + N10.Text + "',Distance='" + N11.Text + "',T_Sheet='" + N12.Text +
"',T_Adult='" + N13.Text + "',T_Half='" + N14.Text + "',T_Disc='" + N15.Text + "'
where B_Num='" + N3.Text + "' ";
try
{
cmd.Connection.Open();
cmd.ExecuteReader();
this.NonAcBus();
cmd.Connection.Close();
}
catch (SqlException sx)
{
Label3.Text = sx.Message;
}

55
[Online Bus Ticket Services]

catch (Exception ex)


{ Label3.Text = ex.Message; }
finally
{
cmd.Connection.Close();
}
}
protected void GrdVolvoAc_RowEditing(object sender, GridViewEditEventArgs e)
{
GrdVolvoAc.EditIndex = e.NewEditIndex;
this.VolvoAcBus();
}
protected void GrdVolvoAc_RowCancelingEdit(object sender,
GridViewCancelEditEventArgs e)
{
GrdVolvoAc.EditIndex = -1;
this.VolvoAcBus();
}
protected void GrdVolvoAc_RowUpdating(object sender, GridViewUpdateEventArgs
e)
{
TextBox A1 = (TextBox)GrdVolvoAc.Rows[e.RowIndex].Cells[0].Controls[0];
TextBox A2 = (TextBox)GrdVolvoAc.Rows[e.RowIndex].Cells[1].Controls[0];
TextBox A3 = (TextBox)GrdVolvoAc.Rows[e.RowIndex].Cells[2].Controls[0];
TextBox A4 = (TextBox)GrdVolvoAc.Rows[e.RowIndex].Cells[3].Controls[0];
TextBox A5 = (TextBox)GrdVolvoAc.Rows[e.RowIndex].Cells[4].Controls[0];
TextBox A6 = (TextBox)GrdVolvoAc.Rows[e.RowIndex].Cells[5].Controls[0];
TextBox A7 = (TextBox)GrdVolvoAc.Rows[e.RowIndex].Cells[6].Controls[0];
TextBox A8 = (TextBox)GrdVolvoAc.Rows[e.RowIndex].Cells[7].Controls[0];
TextBox A9 = (TextBox)GrdVolvoAc.Rows[e.RowIndex].Cells[8].Controls[0];
TextBox A10 = (TextBox)GrdVolvoAc.Rows[e.RowIndex].Cells[9].Controls[0];
TextBox A11 = (TextBox)GrdVolvoAc.Rows[e.RowIndex].Cells[10].Controls[0];
TextBox A12 = (TextBox)GrdVolvoAc.Rows[e.RowIndex].Cells[11].Controls[0];
TextBox A13 = (TextBox)GrdVolvoAc.Rows[e.RowIndex].Cells[12].Controls[0];
TextBox A14 = (TextBox)GrdVolvoAc.Rows[e.RowIndex].Cells[13].Controls[0];
TextBox A15 = (TextBox)GrdVolvoAc.Rows[e.RowIndex].Cells[14].Controls[0];
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "update bus set B_Type='" + A1.Text + "',R_Num='" +
A2.Text + "',Source='" + A4.Text + "',Destination='" + A5.Text + "',Via='" + A6.Text +
"',Dpt_Hr='" + A7.Text + "',Dpt_Min='" + A8.Text + "',Arv_Hr='" + A9.Text +

56
[Online Bus Ticket Services]

"',Arv_Min='" + A10.Text + "',Distance='" + A11.Text + "',T_Sheet='" + A12.Text +


"',T_Adult='" + A13.Text + "',T_Half='" + A14.Text + "',T_Disc='" + A15.Text + "'
where B_Num='" + A3.Text + "' ";

try
{
cmd.Connection.Open();
cmd.ExecuteReader();
this.VolvoAcBus();
cmd.Connection.Close();
}
catch (SqlException sx)
{
Label3.Text = sx.Message;
}
catch (Exception ex)
{ Label3.Text = ex.Message; }
finally
{
cmd.Connection.Close();
}
}
protected void GrdExpress_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "delete from bus where
B_Num='"+GrdExpress.Rows[e.RowIndex].Cells[2].Text+"'";
cmd.Connection.Open();
cmd.ExecuteNonQuery();
this.ExxpresBind();
cmd.Connection.Close();
}
protected void GrdLuxury_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "delete from bus where B_Num='" +
GrdLuxury.Rows[e.RowIndex].Cells[2].Text + "'";
cmd.Connection.Open();
cmd.ExecuteNonQuery();

57
[Online Bus Ticket Services]

this.LuxuryBus();
cmd.Connection.Close();
}
protected void GrdVolvoAc_RowDeleting(object sender, GridViewDeleteEventArgs
e)
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "delete from bus where B_Num='" +
GrdVolvoAc.Rows[e.RowIndex].Cells[2].Text + "'";
cmd.Connection.Open();
cmd.ExecuteNonQuery();
this.VolvoAcBus();
cmd.Connection.Close();
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Redirect("~/WebSiteUser/EmployeeForm.aspx");
}
}

58
[Online Bus Ticket Services]

Bus Information
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class User_BusInformation : System.Web.UI.Page


{
SqlConnection conn = new
SqlConnection("server=.\\sqlexpress;Database=OnlineBusServices;Trusted_Connection=
yes");
void ExxpresBind()
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select * from Bus where B_Type='Express Bus'";
cmd.Connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();
GrdExpress.DataSource = rdr;
GrdExpress.DataBind();
cmd.Connection.Close();
}
void NonAcBus()
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select * from Bus where B_Type='Volvo (Non/AC) Bus'";
cmd.Connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();
GrdNonAc.DataSource = rdr;
GrdNonAc.DataBind();
cmd.Connection.Close();

59
[Online Bus Ticket Services]

}
void LuxuryBus()
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select * from Bus where B_Type='Luxury Bus'";
cmd.Connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();
GrdLuxury.DataSource = rdr;
GrdLuxury.DataBind();
cmd.Connection.Close();
}
void AcBus()
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select * from Bus where B_Type='Volvo (A/C) Bus'";
cmd.Connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();
GrdAcBus.DataSource = rdr;
GrdAcBus.DataBind();
cmd.Connection.Close();
}
protected void Page_Load(object sender, EventArgs e)
{
this.NonAcBus();
this.LuxuryBus();
this.ExxpresBind();
this.AcBus();
if (!Page.IsPostBack)
{
MultiView1.ActiveViewIndex = RadioButtonList1.SelectedIndex;
}
}
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (RadioButtonList1.SelectedIndex == 0)
{
MultiView1.ActiveViewIndex = 0;
}
else if (RadioButtonList1.SelectedIndex == 1)

60
[Online Bus Ticket Services]

{
MultiView1.ActiveViewIndex = 1;
}
else if (RadioButtonList1.SelectedIndex == 2)
{
MultiView1.ActiveViewIndex = 2;
}
else {
MultiView1.ActiveViewIndex = 3;
}
}
}

61
[Online Bus Ticket Services]

Enquiry By Route.cs(Source To Destination)


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class User_EnquiryByRoute : System.Web.UI.Page


{
SqlConnection conn = new
SqlConnection("server=.\\sqlexpress;Database=Onlinebusservices;Trusted_Connection=
yes");
void Sources()
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select distinct Source from Bus";
cmd.Connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();
ArrayList ArlSource = new ArrayList();
while(rdr.Read())
{
ArlSource.Add(rdr["Source"]);
}

DdlSource.DataSource=ArlSource;
DdlSource.DataBind();

cmd.Connection.Close();
}
void Destination()
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;

62
[Online Bus Ticket Services]

cmd.CommandText = "select distinct Destination from Bus";


cmd.Connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();
ArrayList ArlDest = new ArrayList();
while (rdr.Read())
{
ArlDest.Add(rdr["Destination"]);
}
DdlDestination.DataSource = ArlDest;
DdlDestination.DataBind();
cmd.Connection.Close();
}
protected void Page_Load(object sender, EventArgs e)
{
Label1.Visible = false;
if (!Page.IsPostBack)
{
DdlDestination.Items.Insert(0, "--Select Destination--");
DdlSource.Items.Insert(0, "--Select Source--");
this.Sources();
this.Destination();
}
}
protected void DdlDestination_SelectedIndexChanged(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select * from Bus where
Source='"+DdlSource.SelectedItem.Text+"'and
Destination='"+DdlDestination.SelectedItem.Text+"'";
try
{
cmd.Connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();
if (rdr.Read() == true)
{
TxtBusType.Text = rdr[0].ToString();
TxtRouteNum.Text = rdr[1].ToString();
TxtBusNum.Text = rdr[2].ToString();
TxtSource.Text = rdr[3].ToString();
TxtDestination.Text = rdr[4].ToString();

63
[Online Bus Ticket Services]

TxtVia.Text = rdr[5].ToString();
TxtDptTime.Text = rdr[7].ToString();
TxtArvTime.Text = rdr[9].ToString();
TxtTotalSeat.Text = rdr[10].ToString();
TxtAdultFare.Text = rdr[11].ToString();
TxtChildFare.Text = rdr[12].ToString();
TxtCitFare.Text = rdr[13].ToString();
TxtDistance.Text = rdr[14].ToString();
}
cmd.Connection.Close();
}
catch (Exception ex)
{
Label1.Visible = true;
Label1.Text = ex.Message;
}
finally
{
cmd.Connection.Close();
}
}
}

64
[Online Bus Ticket Services]

Enquiry By Bus Number.cs


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class User_EnquiryByBusNumber : System.Web.UI.Page


{
SqlConnection conn = new
SqlConnection("server=.\\sqlexpress;Database=Onlinebusservices;Trusted_Connection=
yes");
void BusNumber()
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select distinct B_Num from Bus";
cmd.Connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();
ArrayList ArlBusNum = new ArrayList();
while (rdr.Read())
{
ArlBusNum.Add(rdr["B_Num"]);
}
DdlBusNum.DataSource = ArlBusNum;
DdlBusNum.DataBind();
cmd.Connection.Close();
}
protected void Page_Load(object sender, EventArgs e)
{
Label1.Visible = false;
if (!Page.IsPostBack)
{

65
[Online Bus Ticket Services]

this.BusNumber();
DdlBusNum.Items.Insert(0, "--Select Bus--");
}
}
protected void DdlBusNum_SelectedIndexChanged(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select * from Bus where
B_Num='"+DdlBusNum.SelectedItem.Text+"'";
cmd.Connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();
if (rdr.Read() == true)
{
TxtBusType.Text = rdr[0].ToString();
TxtRoutNum.Text = rdr[1].ToString();
TxtBusNum.Text = rdr[2].ToString();
TxtSource.Text = rdr[3].ToString();
TxtDestination.Text = rdr[4].ToString();
TxtVia.Text = rdr[5].ToString();
TxtDeparture.Text = rdr[6].ToString();
TxtArrival.Text = rdr[8].ToString();
TxtDistance.Text = rdr[14].ToString();
TxtTotalSeat.Text = rdr[10].ToString();
TxtAdultFr.Text = rdr[11].ToString();
TxtChildFr.Text = rdr[12].ToString();
TxtCitzinFr.Text = rdr[13].ToString();
}
cmd.Connection.Close();
}
}

66
[Online Bus Ticket Services]

Booking Enquiry
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class User_BookingEnquiry : System.Web.UI.Page
{
SqlConnection conn = new
SqlConnection("server=.\\sqlexpress;Database=OnlineBusServices;Trusted_Connection=
yes");
string StrLocal;
void Source()
{
ArrayList ArlSource = new ArrayList();
ArlSource.Add("Bangalore");
ArlSource.Add("Ahmedabad");
ArlSource.Add("Delhi");
ArlSource.Add("Mumbai");
ArlSource.Add("Mangalore");
ArlSource.Add("Chenni");
ArlSource.Add("Hyderabad");
ArlSource.Add("Pune");
DdlFrom.DataSource = ArlSource;
DdlFrom.DataBind();
DdlTo.DataSource = ArlSource;
DdlTo.DataBind();
}
void AutoGenerateEnquiryNum()
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select max(Enq_Num) from bookingEnquiry";

67
[Online Bus Ticket Services]

cmd.Connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();
int Inc;
if (rdr.Read() == true)
{
Inc = Convert.ToInt32(rdr[0].ToString());
Inc = Inc + 1;
}
else { Inc = 0; }
TxtEnquiryNum.Text = Inc.ToString();
cmd.Connection.Close();
}
protected void Page_Load(object sender, EventArgs e)
{
LblMsg.Visible = false;
LblMsg1.Visible = false;
Hprcalls.Visible = false;
if (!Page.IsPostBack)
{
this.AutoGenerateEnquiryNum();
this.Source();
DdlSelectBus.Items.Add("Express");
DdlSelectBus.Items.Add("Luxury");
DdlSelectBus.Items.Add("Volvo(Non-A/C)");
DdlSelectBus.Items.Add("Volvo(A/C)");
DdlSelectBus.Items.Insert(0,"----Select Bus Type----");
}
}
protected void BtnSubmit_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "insert into BookingEnquiry
values(@Enq_Num,@Bus_Type,@Pas_Name,@Mail_Id,@Mob_Num,@Pick_Date,@L
ocation,@Doj,@Roj,@Add_From,@Add_To,@Rpt_Add,@P_Code,@Msg)";
cmd.Parameters.Add("@Enq_Num",SqlDbType.BigInt).Value=TxtEnquiryNum.Text;

cmd.Parameters.Add("@Bus_Type",SqlDbType.VarChar).Value=DdlSelectBus.Text;
cmd.Parameters.Add("@Pas_Name",SqlDbType.VarChar).Value=TxtName.Text;
cmd.Parameters.Add("@Mail_Id",SqlDbType.VarChar).Value=TxtMail.Text;
cmd.Parameters.Add("@Mob_Num",SqlDbType.VarChar).Value=TxtMobile.Text;

68
[Online Bus Ticket Services]

cmd.Parameters.Add("@Pick_Date",SqlDbType.VarChar).Value=TxtPickUpDate.Text;
cmd.Parameters.Add("@Location",SqlDbType.VarChar).Value=StrLocal;
cmd.Parameters.Add("@Doj",SqlDbType.VarChar).Value=TxtJourney.Text;
cmd.Parameters.Add("@Roj",SqlDbType.VarChar).Value=TxtReturn.Text;
cmd.Parameters.Add("@Add_From",SqlDbType.VarChar).Value=DdlFrom.Text;
cmd.Parameters.Add("@Add_To",SqlDbType.VarChar).Value=DdlTo.Text;
cmd.Parameters.Add("@Rpt_Add",SqlDbType.VarChar).Value=TxtReport.Text;
cmd.Parameters.Add("@P_Code",SqlDbType.VarChar).Value=TxtPin.Text;
cmd.Parameters.Add("@Msg", SqlDbType.VarChar).Value = TxtMsg.Text;
try
{
cmd.Connection.Open();
cmd.ExecuteNonQuery();
LblMsg.Visible = true;
Hprcalls.Visible = true;
LblMsg1.Visible = true;
LblMsg.Text = "Successfully Sent Message to Bus Services";
LblMsg1.Text += "Your Enquiry Number is:" + TxtEnquiryNum.Text + " you
can call for details at link";
cmd.Connection.Close();
BtnSubmit.Visible = false;
Label4.Visible = false;
Label5.Visible = false;
Label6.Visible = false;
Label7.Visible = false;
Label8.Visible = false;
Label9.Visible = false;
Label10.Visible = false;
Label11.Visible = false;
Label12.Visible = false;
Label13.Visible = false;
Label14.Visible = false;
Label15.Visible = false;
Label16.Visible = false;
Label17.Visible = false;
TxtEnquiryNum.Visible = false;
DdlSelectBus.Visible = false;
TxtName.Visible = false;
TxtMail.Visible = false;
TxtPickUpDate.Visible = false;
TxtMobile.Visible = false;

69
[Online Bus Ticket Services]

RadioButtonList1.Visible = false;
TxtJourney.Visible = false;
TxtReturn.Visible = false;
DdlFrom.Visible = false;
DdlTo.Visible = false;
TxtReport.Visible = false;
TxtPin.Visible = false;
TxtMsg.Visible = false;
}
catch (Exception ex)
{
LblMsg.Text = ex.Message;
}
finally { cmd.Connection.Close(); }
}
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (RadioButtonList1.SelectedIndex == 0)
{
StrLocal = "Local";
}
else { StrLocal = "Out Station"; }
}
}

70
[Online Bus Ticket Services]

Login User For Online Book Ticket.cs


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class User_LoginUserForOnLineBookTicket : System.Web.UI.Page


{
SqlConnection conn = new
SqlConnection("server=.\\sqlexpress;Database=onlinebusservices;Trusted_Connection=y
es");
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select A_Id,A_Pass from Agent where A_Id=@A_Id and
A_Pass=@A_Pass";
cmd.Parameters.Add("@A_Id", SqlDbType.VarChar).Value = Login1.UserName;
cmd.Parameters.Add("@A_Pass", SqlDbType.VarChar).Value = Login1.Password;
try
{
cmd.Connection.Open();
string UName = (string)cmd.ExecuteScalar();
if (UName != null)
{
Login1.DestinationPageUrl = "~/User/OnLineBookTicket.aspx";
e.Authenticated = true;
}
}
catch (Exception ex)
{
Login1.FailureText = ex.Message;

71
[Online Bus Ticket Services]

}
finally
{
cmd.Connection.Close();
}
}
}

72
[Online Bus Ticket Services]

Online Book Ticket.cs


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class User_OnLineBookTicket : System.Web.UI.Page


{
SqlConnection conn = new
SqlConnection("server=.\\sqlexpress;Database=Onlinebusservices;
Trusted_Connection=yes");
void BusType()
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select distinct B_type from Bus";
cmd.Connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();
ArrayList ArlBusType = new ArrayList();
while (rdr.Read())
{
ArlBusType.Add(rdr["B_Type"]);
}
DdlBusType.DataSource = ArlBusType;
DdlBusType.DataBind();
cmd.Connection.Close();
DdlBusType.Items.Insert(0, "--Select Bus Type--");
}
protected void Page_Load(object sender, EventArgs e)
{
LblMsg.Visible = false;
BtnSubMit.Enabled = false;

73
[Online Bus Ticket Services]

if (!Page.IsPostBack)
{
DdlAdultList.Items.Insert(0, "--Select Adult--");
DdlChildList.Items.Insert(0, "--Select Child--");
DdlCitizenList.Items.Insert(0, "--Select Citizen--");
this.AutoGenerateTktNum1();
ArrayList ArlState = new ArrayList();
ArlState.Add("Andhra Pradesh");
ArlState.Add("Kerla");
ArlState.Add("Maharastra");
ArlState.Add("Karnatak");
ArlState.Add("Rajsthan");
ArlState.Add("Delhi");
ArlState.Add("MadhyaPradesh");
DdlState.DataSource = ArlState;
DdlState.DataBind();
for (int Ad = 0; Ad <= 20; Ad++)
{
DdlAdultList.Items.Add(Ad.ToString());
}
for (int Cd = 0; Cd <= 10; Cd++)
{
DdlChildList.Items.Add(Cd.ToString());
}
for (int Cit = 0; Cit <= 10; Cit++)
{
DdlCitizenList.Items.Add(Cit.ToString());
}
this.BusType();
TxtBookingDate.ReadOnly = true;
TxtBookingDate.Text = DateTime.Now.ToShortDateString();
}
}
protected void DdlBusType_SelectedIndexChanged(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select B_Num from bus where
B_Type='"+DdlBusType.SelectedItem.Text+"'";
cmd.Connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();

74
[Online Bus Ticket Services]

ArrayList ArlBusNum = new ArrayList();


while (rdr.Read())
{
ArlBusNum.Add(rdr["B_Num"]);
}
DdlBusNum.DataSource = ArlBusNum;
DdlBusNum.DataBind();
cmd.Connection.Close();
DdlBusNum.Items.Insert(0, "--Select Bus Number--");
}
protected void DdlBusNum_SelectedIndexChanged(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select * from bus where B_Num='" +
DdlBusNum.SelectedItem.Text + "'";
cmd.Connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();
if (rdr.Read() == true)
{
TxtRoutNum.Text = rdr[1].ToString();
TxtSource.Text = rdr[3].ToString();
TxtDestination.Text = rdr[4].ToString();
TxtDpthr.Text = rdr[6].ToString();
TxtDptMin.Text = rdr[7].ToString();
TxtArvhr.Text = rdr[8].ToString();
TxtArvMin.Text = rdr[9].ToString();
TxtPerTktChrg1.Text = rdr[11].ToString();
TxtPerTktChrg2.Text = rdr[12].ToString();
TxtPerTktCharg3.Text = rdr[13].ToString();
}
else
{
Label1.Text = "Wrong";
}
cmd.Connection.Close();
}
protected void DdlAdultList_SelectedIndexChanged(object sender, EventArgs e)
{
int t1, t2, t3;
t1 = Convert.ToInt32(TxtPerTktChrg1.Text);

75
[Online Bus Ticket Services]

t2=Convert.ToInt32(DdlAdultList.Text);
t3=t1*t2;
TxtAdultCharg.Text = t3.ToString();
}
protected void DdlChildList_SelectedIndexChanged(object sender, EventArgs e)
{
int c1, c2, c3;
c1 = Convert.ToInt32(TxtPerTktChrg2.Text);
c2 = Convert.ToInt32(DdlChildList.Text);
c3 = c1 * c2;
TxtChildCharg.Text = c3.ToString();
}
protected void DdlCitizenList_SelectedIndexChanged(object sender, EventArgs e)
{
int ct1, ct2, ct3;
ct1 = Convert.ToInt32(TxtPerTktCharg3.Text);
ct2 = Convert.ToInt32(DdlCitizenList.Text);
ct3 = ct1 * ct2;
TxtCitizenCharg.Text = ct3.ToString();
}
void AutoGenerateTktNum1()
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select max(Tkt_Num) from OnlineBookTicket";
cmd.Connection.Open();
SqlDataReader rdr = cmd.ExecuteReader();

int trc;
if (rdr.Read() == true)
{
trc = Convert.ToInt32(rdr[0].ToString());
trc = trc + 1;
}
else {
trc = 1;
}
cmd.Connection.Close();
TxtTktNum.Text = trc.ToString();
}
protected void BtnSubMit_Click(object sender, EventArgs e)

76
[Online Bus Ticket Services]

{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "insert into OnlineBookTicket
values(@Tkt_Num,@Bus_Type,@Bus_Num,@Route_Num,@Book_Date,@Source,@D
estination,@Dpt_Hr,@Dpt_Min,@Arv_Hr,@Arv_Min,@Appl_Name,@Appl_State,@A
ppl_City,@Appl_PCode,@Appl_Add,@Per_AdTkt,@Per_ChTkt,@Per_CtTkt,@T_Adu
lt,@T_Child,@T_Citizen,@Crg_Adult,@Crg_Child,@Crg_Citizen,@Crg_Total,@JDate
)";
cmd.Parameters.Add("@Tkt_Num", SqlDbType.Int).Value = TxtTktNum.Text;
cmd.Parameters.Add("@Bus_Type",SqlDbType.VarChar).Value=DdlBusType.Text;
cmd.Parameters.Add("@Bus_Num",SqlDbType.VarChar).Value=DdlBusNum.Text;
cmd.Parameters.Add("@Route_Num",SqlDbType.VarChar).Value=TxtRoutNum.Text;
cmd.Parameters.Add("@Book_Date",SqlDbType.VarChar).Value=TxtBookingDate.Text
;
cmd.Parameters.Add("@Source",SqlDbType.VarChar).Value=TxtSource.Text;
cmd.Parameters.Add("@Destination",SqlDbType.VarChar).Value=TxtDestination.Text;
cmd.Parameters.Add("@Dpt_Hr",SqlDbType.Int).Value=TxtDpthr.Text;
cmd.Parameters.Add("@Dpt_Min",SqlDbType.Int).Value=TxtDptMin.Text;
cmd.Parameters.Add("@Arv_Hr",SqlDbType.Int).Value=TxtArvhr.Text;
cmd.Parameters.Add("@Arv_Min",SqlDbType.Int).Value=TxtArvMin.Text;
cmd.Parameters.Add("@Appl_Name",SqlDbType.VarChar).Value=TxtApplicantName.
Text;
cmd.Parameters.Add("@Appl_State",SqlDbType.VarChar).Value=DdlState.Text;
cmd.Parameters.Add("@Appl_City",SqlDbType.VarChar).Value=DdlCity.Text;
cmd.Parameters.Add("@Appl_PCode",SqlDbType.VarChar).Value=TxtPinCode.Text;
cmd.Parameters.Add("@Appl_Add",SqlDbType.VarChar).Value=TxtApplicantAdd.Text
;
cmd.Parameters.Add("@Per_AdTkt",SqlDbType.Int).Value=TxtPerTktChrg1.Text;
cmd.Parameters.Add("@Per_ChTkt",SqlDbType.Int).Value=TxtPerTktChrg2.Text;
cmd.Parameters.Add("@Per_CtTkt",SqlDbType.Int).Value=TxtPerTktCharg3.Text;
cmd.Parameters.Add("@T_Adult",SqlDbType.Int).Value=DdlAdultList.Text;
cmd.Parameters.Add("@T_Child",SqlDbType.Int).Value=DdlChildList.Text;
cmd.Parameters.Add("@T_Citizen",SqlDbType.Int).Value=DdlCitizenList.Text;
cmd.Parameters.Add("@Crg_Adult",SqlDbType.Int).Value=TxtAdultCharg.Text;
cmd.Parameters.Add("@Crg_Child",SqlDbType.Int).Value=TxtChildCharg.Text;
cmd.Parameters.Add("@Crg_Citizen",SqlDbType.Int).Value=TxtCitizenCharg.Text;
cmd.Parameters.Add("@Crg_Total", SqlDbType.Int).Value = TxtTotalCharg.Text;
cmd.Parameters.Add("@JDate", SqlDbType.VarChar).Value = TxtJoinDate.Text;
try
{

77
[Online Bus Ticket Services]

cmd.Connection.Open();
cmd.ExecuteNonQuery();
LblMsg.Visible = true;
LblMsg.Text = "Successfully Saved Your Records";
cmd.Connection.Close();
}
catch (Exception ex)
{
LblMsg.Text = ex.Message;
}
finally {
cmd.Connection.Close();
}
}
protected void DdlState_SelectedIndexChanged(object sender, EventArgs e)
{
if (DdlState.SelectedIndex == 1)
{
DdlCity.Items.Clear();
DdlCity.Items.Add("Hyderabad");
DdlCity.Items.Add("Kachiguda");
DdlCity.Items.Add("KamanaHalli");
}
else if (DdlState.SelectedIndex == 2)
{
DdlCity.Items.Clear();
DdlCity.Items.Add("Okhla");
DdlCity.Items.Add("Kanat-Place");
DdlCity.Items.Add("Noida");
DdlCity.Items.Add("Gurgaon");
}
else if (DdlState.SelectedIndex == 3)
{
DdlCity.Items.Clear();
DdlCity.Items.Add("Bangalore");
DdlCity.Items.Add("Mangalore");
DdlCity.Items.Add("Mysor");
DdlCity.Items.Add("Nandi Hill");
}
else if (DdlState.SelectedIndex == 4)
{

78
[Online Bus Ticket Services]

DdlCity.Items.Clear();
DdlCity.Items.Add("KK11");
DdlCity.Items.Add("KK222");
DdlCity.Items.Add("KK333");
DdlCity.Items.Add("KK444");
}
else if (DdlState.SelectedIndex == 5)
{
DdlCity.Items.Clear();
DdlCity.Items.Add("MP11");
DdlCity.Items.Add("MP222");
DdlCity.Items.Add("MP333");
DdlCity.Items.Add("MP444");
}
else if (DdlState.SelectedIndex == 6)
{
DdlCity.Items.Clear();
DdlCity.Items.Add("MR11");
DdlCity.Items.Add("MR222");
DdlCity.Items.Add("MR333");
DdlCity.Items.Add("MR444");
}
else if (DdlState.SelectedIndex == 7)
{
DdlCity.Items.Clear();
DdlCity.Items.Add("R11");
DdlCity.Items.Add("R222");
DdlCity.Items.Add("R333");
DdlCity.Items.Add("R444");
}
}
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (RadioSure.SelectedIndex == 0)
{
long TAchrg, TCchrg, TCtChrg, TTotal;
TAchrg = Convert.ToInt64(TxtAdultCharg.Text);
TCchrg = Convert.ToInt64(TxtChildCharg.Text);
TCtChrg = Convert.ToInt64(TxtCitizenCharg.Text);
TTotal = TAchrg + TCchrg+ TCtChrg;
TxtTotalCharg.Text = TTotal.ToString();

79
[Online Bus Ticket Services]

BtnSubMit.Enabled = true;
}
else
{
TxtTotalCharg.Text = "0";
BtnSubMit.Enabled = false;
}
}
}

80
[Online Bus Ticket Services]

Cancellation Ticket.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class User_CancelAtionTicket : System.Web.UI.Page


{
SqlConnection conn = new
SqlConnection("server=.\\sqlexpress;Database=Onlinebusservices;Trusted_Connection=
yes");
protected void Page_Load(object sender, EventArgs e)
{
Label6.Visible = false;
Button1.Visible = false;
Label1.Visible = false;
Label2.Visible = false;
Label3.Visible = false;
Label4.Visible = false;
Label5.Visible = false;
TxtRefundDate.Visible = false;
TxtRefundJrnDate.Visible = false;
TxtReAmount.Visible = false;
TxtLessPercent.Visible = false;
TxtTotalRefundAmount.Visible = false;
BtnCancelTicket.Visible = false;
TxtTicketNum.Visible=false;
TxtBusType.Visible = false;
TxtBusNum.Visible = false;
TxtRouteNum.Visible = false;
TxtBookDate.Visible = false;
TxtSource.Visible = false;

81
[Online Bus Ticket Services]

TxtDestination.Visible = false;
TxtDpthr.Visible = false;
TxtDptMin.Visible = false;
TxtArvhr.Visible = false;
TxtArvMin.Visible = false;
TxtAppName.Visible = false;
TxtState.Visible = false;
TxtCity.Visible = false;
TxtPostal.Visible = false;
TxtAddress.Visible = false;
TxtAdCharg.Visible = false;
TxtChCharg.Visible = false;
TxtCtCharg.Visible = false;
TxtAdList.Visible = false;
TxtChList.Visible = false;
TxtCtList.Visible = false;
TxtTAdChrg.Visible = false;
TxtTChChrg.Visible = false;
TxtTCtChrg.Visible = false;
TxtTotalChrg.Visible = false;
TxtJourneyDate.Visible = false;
LblMsg.Visible = false;
LblErrorMsg.Visible =false;
Label7.Visible = false;
Label8.Visible = false;
Label9.Visible = false;
Label10.Visible = false;
Label11.Visible = false;
Label12.Visible = false;
Label13.Visible = false;
Label14.Visible = false;
Label10.Visible = false;
Label15.Visible = false;
Label16.Visible = false;
Label17.Visible = false;
Label18.Visible = false;
Label19.Visible = false;
Label20.Visible = false;
Label21.Visible = false;
Label22.Visible = false;
Label23.Visible = false;

82
[Online Bus Ticket Services]

Label24.Visible = false;
Label25.Visible = false;
Label26.Visible = false;
Label27.Visible = false;
Label28.Visible = false;
Label29.Visible = false;
Label30.Visible = false;
Label31.Visible = false;
}
void ReadIteminText()
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "select * from OnlineBookTicket where
Tkt_Num='"+TxtTktNum.Text+"'";
cmd.Connection.Open();
SqlDataReader rdr1 = cmd.ExecuteReader();
if (rdr1.Read() == true)
{
TxtTicketNum.Text = rdr1[0].ToString();
TxtBusType.Text = rdr1[1].ToString();
TxtBusNum.Text = rdr1[2].ToString();
TxtRouteNum.Text = rdr1[3].ToString();
TxtBookDate.Text = rdr1[4].ToString();
TxtSource.Text = rdr1[5].ToString();
TxtDestination.Text = rdr1[6].ToString();
TxtDpthr.Text = rdr1[7].ToString();
TxtDptMin.Text = rdr1[8].ToString();
TxtArvhr.Text = rdr1[9].ToString();
TxtArvMin.Text = rdr1[10].ToString();
TxtAppName.Text = rdr1[11].ToString();
TxtState.Text = rdr1[12].ToString();
TxtCity.Text = rdr1[13].ToString();
TxtPostal.Text = rdr1[14].ToString();
TxtAddress.Text = rdr1[15].ToString();
TxtAdCharg.Text = rdr1[16].ToString();
TxtChCharg.Text = rdr1[17].ToString();
TxtCtCharg.Text = rdr1[18].ToString();
TxtAdList.Text = rdr1[19].ToString();
TxtChList.Text = rdr1[20].ToString();
TxtCtList.Text = rdr1[21].ToString();

83
[Online Bus Ticket Services]

TxtTAdChrg.Text = rdr1[22].ToString();
TxtTChChrg.Text = rdr1[23].ToString();
TxtTCtChrg.Text = rdr1[24].ToString();
TxtTotalChrg.Text = rdr1[25].ToString();
TxtJourneyDate.Text = rdr1[26].ToString();
TxtTicketNum.Visible = true;
TxtBusType.Visible = true;
TxtBusNum.Visible = true;
TxtRouteNum.Visible = true;
TxtBookDate.Visible = true;
TxtSource.Visible = true;
TxtDestination.Visible = true;
TxtDpthr.Visible = true;
TxtDptMin.Visible = true;
TxtArvhr.Visible = true;
TxtArvMin.Visible = true;
TxtAppName.Visible = true;
TxtState.Visible = true;
TxtCity.Visible = true;
TxtPostal.Visible = true;
TxtAddress.Visible = true;
TxtAdCharg.Visible = true;
TxtChCharg.Visible = true;
TxtCtCharg.Visible = true;
TxtAdList.Visible = true;
TxtChList.Visible = true;
TxtCtList.Visible = true;
TxtTAdChrg.Visible = true;
TxtTChChrg.Visible = true;
TxtTCtChrg.Visible = true;
TxtTotalChrg.Visible = true;
TxtJourneyDate.Visible = true;
Label7.Visible = true;
Label8.Visible = true;
Label9.Visible = true;
Label10.Visible = true;
Label11.Visible = true;
Label12.Visible = true;
Label13.Visible = true;
Label14.Visible = true;
Label10.Visible = true;

84
[Online Bus Ticket Services]

Label15.Visible = true;
Label16.Visible = true;
Label17.Visible = true;
Label18.Visible = true;
Label19.Visible = true;
Label20.Visible = true;
Label21.Visible = true;
Label22.Visible = true;
Label23.Visible = true;
Label24.Visible = true;
Label25.Visible = true;
Label26.Visible = true;
Label27.Visible = true;
Label28.Visible = true;
Label29.Visible = true;
Label30.Visible = true;
Label31.Visible = true;
Button1.Visible = true;
Label1.Visible = true;
Label2.Visible = true;
Label3.Visible = true;
Label4.Visible = true;
Label5.Visible = true;
TxtRefundDate.Visible = true;
TxtRefundJrnDate.Visible = true;
TxtReAmount.Visible = true;
TxtLessPercent.Visible = true;
TxtTotalRefundAmount.Visible = true;
BtnCancelTicket.Visible = true;
}
else
{
LblErrorMsg.Visible = true;
LblErrorMsg.Text = "No Such Records..............";
TxtTicketNum.Text = "";
TxtBusType.Text = "";
TxtBusNum.Text = "";
TxtRouteNum.Text ="";
TxtBookDate.Text = "";
TxtSource.Text = "";
TxtDestination.Text = "";

85
[Online Bus Ticket Services]

TxtDpthr.Text ="";
TxtDptMin.Text ="";
TxtArvhr.Text = "";
TxtArvMin.Text ="";
TxtAppName.Text ="";
TxtState.Text = "";
TxtCity.Text = "";
TxtPostal.Text ="";
TxtAddress.Text ="";
TxtAdCharg.Text = "";
TxtChCharg.Text = "";
TxtCtCharg.Text = "";
TxtAdList.Text = "";
TxtChList.Text = "";
TxtCtList.Text = "";
TxtTAdChrg.Text ="";
TxtTChChrg.Text ="";
TxtTCtChrg.Text = "";
TxtTotalChrg.Text ="";
TxtJourneyDate.Text ="";
}
cmd.Connection.Close();
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
this.ReadIteminText();
}
protected void Button1_Click(object sender, EventArgs e)
{
TxtTicketNum.Visible = true;
TxtBusType.Visible = true;
TxtBusNum.Visible = true;
TxtRouteNum.Visible = true;
TxtBookDate.Visible = true;
TxtSource.Visible = true;
TxtDestination.Visible = true;
TxtDpthr.Visible = true;
TxtDptMin.Visible = true;
TxtArvhr.Visible = true;
TxtArvMin.Visible = true;
TxtAppName.Visible = true;

86
[Online Bus Ticket Services]

TxtState.Visible = true;
TxtCity.Visible = true;
TxtPostal.Visible = true;
TxtAddress.Visible = true;
TxtAdCharg.Visible = true;
TxtChCharg.Visible = true;
TxtCtCharg.Visible = true;
TxtAdList.Visible = true;
TxtChList.Visible = true;
TxtCtList.Visible = true;
TxtTAdChrg.Visible = true;
TxtTChChrg.Visible = true;
TxtTCtChrg.Visible = true;
TxtTotalChrg.Visible = true;
TxtJourneyDate.Visible = true;
Label7.Visible = true;
Label8.Visible = true;
Label9.Visible = true;
Label10.Visible = true;
Label11.Visible = true;
Label12.Visible = true;
Label13.Visible = true;
Label14.Visible = true;
Label10.Visible = true;
Label15.Visible = true;
Label16.Visible = true;
Label17.Visible = true;
Label18.Visible = true;
Label19.Visible = true;
Label20.Visible = true;
Label21.Visible = true;
Label22.Visible = true;
Label23.Visible = true;
Label24.Visible = true;
Label25.Visible = true;
Label26.Visible = true;
Label27.Visible = true;
Label28.Visible = true;
Label29.Visible = true;
Label30.Visible = true;
Label31.Visible = true;

87
[Online Bus Ticket Services]

Button1.Visible = true;
Label1.Visible = true;
Label2.Visible = true;
Label3.Visible = true;
Label4.Visible = true;
Label5.Visible = true;
TxtRefundDate.Visible = true;
TxtRefundJrnDate.Visible = true;
TxtReAmount.Visible = true;
TxtLessPercent.Visible = true;
TxtTotalRefundAmount.Visible = true;
BtnCancelTicket.Visible = true;
TxtRefundDate.Text = DateTime.Now.ToString();
TxtRefundJrnDate.Text = TxtJourneyDate.Text;
DateTime m, n;
m=Convert.ToDateTime(TxtRefundDate.Text);
n=Convert.ToDateTime(TxtRefundJrnDate.Text);
if (m == n)
{
int a = 30;
TxtLessPercent.Text = a.ToString();
TxtReAmount.Text = TxtTotalChrg.Text;
int b;
b = Convert.ToInt32(TxtReAmount.Text);
int c;
c = a * b / 100;
int d;
d = b - c;
TxtTotalRefundAmount.Text = d.ToString();
TxtTotalRefundAmount.ReadOnly = true;
}
else
{
int a = 15;
TxtLessPercent.Text = a.ToString();
TxtReAmount.Text = TxtTotalChrg.Text;
int b;
b = Convert.ToInt32(TxtReAmount.Text);
int c;
c = a * b / 100;
int d;

88
[Online Bus Ticket Services]

d = b - c;
TxtTotalRefundAmount.Text = d.ToString();
}
}
void CancelTkt()
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "delete from onlinebookticket where Tkt_Num='" +
TxtTktNum.Text + "'";
cmd.Connection.Open();
cmd.ExecuteNonQuery();
cmd.Connection.Close();
}
void AddCancelTicket()
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "insert into TicketCancelation
values(@Tkt_Num,@Bus_Type,@Bus_Num,@Route_Num,@Source,@Destination,@D
pt_Hr,@Dpt_Min,@Arv_Hr,@Arv_Min,@Appl_Name,@Appl_State,@Appl_City,@Ap
pl_PCode,@Appl_Add,@Per_AdTkt,@Per_ChTkt,@Per_CtTkt,@T_Adult,@T_Child,
@T_Citizen,@Crg_Adult,@Crg_Child,@Crg_Citizen,@Total_Amt,@JDate,@Cancel_D
ate,@Les_Percent,@Refund_Amt) ";
cmd.Parameters.Add("@Tkt_Num",SqlDbType.Int).Value=TxtTicketNum.Text;
cmd.Parameters.Add("@Bus_Type",SqlDbType.VarChar).Value=TxtBusType.Text;
cmd.Parameters.Add("@Bus_Num",SqlDbType.VarChar).Value=TxtBusNum.Text;
cmd.Parameters.Add("@Route_Num",SqlDbType.VarChar).Value=TxtRouteNum.Text;
cmd.Parameters.Add("@Source",SqlDbType.VarChar).Value=TxtSource.Text;
cmd.Parameters.Add("@Destination",SqlDbType.VarChar).Value=TxtDestination.Text;
cmd.Parameters.Add("@Dpt_Hr",SqlDbType.Int).Value=TxtDpthr.Text;
cmd.Parameters.Add("@Dpt_Min",SqlDbType.Int).Value=TxtDptMin.Text;
cmd.Parameters.Add("@Arv_Hr",SqlDbType.Int).Value=TxtArvhr.Text;
cmd.Parameters.Add("@Arv_Min",SqlDbType.Int).Value=TxtArvMin.Text;
cmd.Parameters.Add("@Appl_Name",SqlDbType.VarChar).Value=TxtAppName.Text;
cmd.Parameters.Add("@Appl_State",SqlDbType.VarChar).Value=TxtState.Text;
cmd.Parameters.Add("@Appl_City",SqlDbType.VarChar).Value=TxtCity.Text;
cmd.Parameters.Add("@Appl_PCode",SqlDbType.VarChar).Value=TxtPostal.Text;
cmd.Parameters.Add("@Appl_Add",SqlDbType.VarChar).Value=TxtAddress.Text;
cmd.Parameters.Add("@Per_AdTkt",SqlDbType.Int).Value=TxtAdCharg.Text;
cmd.Parameters.Add("@Per_ChTkt",SqlDbType.Int).Value=TxtChCharg.Text;

89
[Online Bus Ticket Services]

cmd.Parameters.Add("@Per_CtTkt",SqlDbType.Int).Value=TxtCtCharg.Text;
cmd.Parameters.Add("@T_Adult",SqlDbType.Int).Value=TxtAdList.Text;
cmd.Parameters.Add("@T_Child",SqlDbType.Int).Value=TxtChList.Text;
cmd.Parameters.Add("@T_Citizen",SqlDbType.Int).Value=TxtCtList.Text;
cmd.Parameters.Add("@Crg_Adult",SqlDbType.Int).Value=TxtTAdChrg.Text;
cmd.Parameters.Add("@Crg_Child",SqlDbType.Int).Value=TxtTChChrg.Text;
cmd.Parameters.Add("@Crg_Citizen",SqlDbType.Int).Value=TxtTCtChrg.Text;
cmd.Parameters.Add("@Total_Amt",SqlDbType.Int).Value=TxtTotalChrg.Text;
cmd.Parameters.Add("@JDate",SqlDbType.DateTime).Value=TxtJourneyDate.Text;
cmd.Parameters.Add("@Cancel_Date",SqlDbType.DateTime).Value=TxtRefundDate.Te
xt;
cmd.Parameters.Add("@Les_Percent",SqlDbType.Int).Value=TxtLessPercent.Text;
cmd.Parameters.Add("@Refund_Amt", SqlDbType.Int).Value =
TxtTotalRefundAmount.Text;
try
{
cmd.Connection.Open();
cmd.ExecuteNonQuery();
Label6.Text = "Saved in cancellation ticket and delete from OnlineBookTickets
";
cmd.Connection.Close();
}
catch (Exception ex)
{
Label6.Text = ex.Message;
}
finally {
cmd.Connection.Close();
}
}
void DeleteAfterCancel()
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = "delete From onlinebookticket where
Tkt_Num='"+TxtTktNum.Text+"'";
cmd.Connection.Open();
cmd.ExecuteNonQuery();
cmd.Connection.Close();
}
protected void BtnCancelTicket_Click(object sender, EventArgs e)

90
[Online Bus Ticket Services]

{
this.AddCancelTicket();
this.DeleteAfterCancel();
}
}

91
[Online Bus Ticket Services]

92
[Online Bus Ticket Services]

TESTING & IMPLEMENTATION

Testing Strategies
A strategy for software testing integrates software test case methods into a well-planned
series of steps that result in the successful construction of software. The strategy provides
a road map that describes the steps to be conducted as part of testing, when these steps
are planned and then undertaken, and how much effort, time, and resources will be
required. Therefore, any testing strategy must incorporate test planning , test case design,
test execution, and resultant adapt collection and evaluation.
A software testing strategy should be flexible enough to promote a
customized testing approach. At the same time, it must be rigid enough to promote
reasonable planning and management tracking as the project progresses.
The software engineering process may be viewed as the spiral illustration.
Initially, system engineering defines the role of software and leads to software
requirements analysis, where the information domain, function, behavior, performance,
constraints, and validation criteria for software are established. Moving inwards along the
spiral, we come to design and finally to coding. To develop computer software, we spiral
inward along streamlines that decrease the level of abstraction on each turn.
A strategy for software testing may also be viewed in the context of the
spiral. Unit testing begins at the vortex of the spiral and concentrates on each unit of the
software as implemented in source code. Testing progresses by moving outwards along
the spiral to integration testing, where the focus is on design and the construction of the
software architecture. Testing another turn outward on the spiral, we encounter validation
testing, where requirements established as part of software requirements analysis are
validated against the software that has been constructed. Finally, we arrive at system
testing, where the software and other system elements are tested as a whole. To test
computer software, we spiral out along streamlines that broaden the scope of testing with
each turn. Considering the process from a procedural point of view, testing within the
context of software engineering is actually a series of four steps that are implemented
sequentially. Initially, tests focus on each component individually, ensuring that it

93
[Online Bus Ticket Services]

functions properly as a unit. Hence, the name unit testing. Unit testing makes heavy use

of White-box testing techniques, exercising specific paths in a module‟s control structure


to ensure complete coverage and maximum error detection. Next, components must be
assembled or integrated to form the complete software package. Integration testing
addresses the issues associated with the dual problems of verification and program
construction. Black-box test case design techniques are most prevalent during integration,
although a limited amount of White-box testing may be used to ensure coverage of major
control paths. After the software has been integrated (constructed), a set of high-order
tests are conducted. Validation testing provides final assurance that software meets all
functional, behavioral, and performance requirements. Black-box testing techniques are
used exclusively during validation.

94
[Online Bus Ticket Services]

Software Testing Steps

The last high-order testing step falls outside the boundary of software engineering and
into the broader context of computer system engineering. Software, once validated, must
be combined with other system elements (e.g. , hardware, people, databases). System
testing verifies that all elements mesh properly and that overall system
function/performance is achieved.

Unit Testing:
Unit testing focuses verification efforts on the smallest unit of software design- the
software component or module. Using the component-level design description as a guide,
important control paths are tested to uncover errors within the boundary of the module.
The relative complexity of tests and uncovered errors is limited by the constrained scope
established for unit testing. The unit test is white-box oriented, and the step cab be
conducted in parallel for multiple components.
Unit Test Considerations:
The module interface is tested to ensure that information properly flows into and out of
the program unit under test. The local data structure is examined to ensure that data store
temporarily maintains its integrity during all steps in an algorithm’s execution. Boundary
conditions are tested to ensure that the module operates properly at boundaries
established to limit or restrict processing. All independent paths through the control
structure are exercised to ensure that all statements in a module have been executed at
least once. And finally, all error handling paths are tested.
Interface Local data structure boundary Conditions Independent path Error handling
paths.
Tests of data flow across a module interface are required before any other test is initiated.
If data do not enter and exit properly, all other tests are moot. In addition, local data
structure should be ascertained during unit testing.

95
[Online Bus Ticket Services]

Selective testing of execution paths is an essential task during the unit test. Test cases
should be designed to uncover errors due to erroneous computations, incorrect
comparisons, or improper control flow. Basis path and loop testing are effective
techniques for uncovering a broad array of path errors.
Online bus Ticket Services

Among the more common errors in computation are:


Misunderstood or incorrect arithmetic precedence.
Mixed mode operations.
Incorrect initialization.

96
[Online Bus Ticket Services]

Precision inaccuracy.
Incorrect symbolic representation of an expression.

Test Cases should uncover errors such as:


Comparison of different data types.
Incorrect logical operators or precedence.
Exception of equality when precision error makes equality unlikely.
Incorrect comparison of variables.
Improper or nonexistent loop termination.
Failure to exit when divergent iteration is encountered.
Improperly modified loop variables.

Integration Testing:
Integration testing is a systematic technique for constructing the program structure while
at the same time conducting tests to uncover errors associated with interfacing. The
objective is to take unit tested components and build a program structure that has been
dictated by design.
There is often a tendency to attempt no incremental integration; that is, to construct the
program using a “big bang” approach. All components are combined in advance. The
entire program is tested as a whole. And chaos usually results! A set of errors is
encountered. Correction is difficult because isolation of causes is complicated by vast
expanse of the entire program. Once these errors are corrected new ones appear and the
process continues in a seemingly endless loop.
Incremental integration is the antithesis of the big bang approach. The program is
constructed and tested in small increments, where errors are easier to isolate and correct;
interfaces are more likely to be tested completely; and a systematic test approach may be
applied.
The various integration testing are as follows:
Top- Down integration.
Bottom-Up integration.
Regression Testing

97
[Online Bus Ticket Services]

Smoke Testing.

Validation Testing:
At the culmination of integration testing, software is completely assembled as a package,
interfacing errors have been uncovered and corrected, and final series of software test-
validation testing – may begin. Validation can be defined in many ways, but a simple
definition is that validation succeeds when software functions in a manner that can be
reasonably expected by the customer. At this point a battle-hardened software developer
might protest: “Who or What is the arbiter of reasonable expectations?”
Software validation is achieved through a series of black-box tests that demonstrate
conformity with requirements. A test plan outlines the classes of tests to be conducted
and test procedure defines specific test cases that will be used to demonstrate conformity
with requirements. Both the plan and procedure are designed to ensure that all functional
requirements are satisfied, all behavioral characteristics are achieved, all performance
requirements are attained, documentation is correct, and human- engineered and other
requirements are met.
After each validation test case has been conducted, one of two possible conditions exists:
1. The function or performance characteristics conform to specification and are
accepted.
2. A deviation from specification is uncovered and a deficiency list is created.
Deviation or errors discovered at this stage in a project can rarely be corrected prior to
scheduled delivery. It is often to negotiate with the customer to establish a method for
resolving deficiencies.

System Testing:

Software is incorporated with other system element (e.g. hardware, people, information),
and a series of system integration and validation test are conducted. These test fall
outside the scope of the software process and are not conducted solely by software
engineers. However, steps are taken during software design and testing van greatly

98
[Online Bus Ticket Services]

improves the portability of successful software integration in the larger system. A classic
system testing problem is “finer-pointing”. This occurs when an error is uncovered, and
each system element developer blames the other for the problem. Rather than indulging
in such nonsense, the software engineer should anticipate potential interfacing problems
and:
Design error-handling paths that test all information coming from other elements
of the system.
Conduct a series of tests that stimulate bad data or other potential errors at the
software interface.
Record the results of tests to use as “evidence” if finger-pointing does occur.
Participate in planning and design of system tests to ensure that software is
adequately tested.
System testing is actually a series of different tests whose primary purpose is to fully
exercise the computer-based system. Although each test has a different purpose, al work
to verify that system elements have been properly integrated and perform allocated
functions. Types of System Tests are as follows:
Recovery Testing.
Security Testing.
Stress Testing.
Performance Testing.

Testing Web Based Applications

Testing is the process of exercising software with the intent of finding errors. This
fundamental philosophy does not change for WebApps. In fact, because Web-based
systems and applications reside on a network and interoperate with many different
operating systems, browsers, hardware platforms, and communications protocol, search
for errors represents a significant challenge for web-based engineers.
The approach for Web-based testing adopts the basic principles for all software testing
and applies a strategy and tactics that have recommended for object-oriented systems.

99
[Online Bus Ticket Services]

1. The Content model for WebApp is reviewed to uncover errors: This “testing”
activity is similar in many respects to copy editing a written document. Infact, a large
Web-site might enlist the services of a professional copy editor to uncover typographical
errors, grammatical mistakes, errors in content consistency, errors in graphical
representations, and cross-referencing errors.
2. The Design model for the WebApp is reviewed to uncover navigation errors:
Use-cases, derived as part of the analysis activity, allow a Web engineer to exercise each
usage scenario against the architectural and navigation design. In essence, these no
executable tests help uncover errors in navigation. In addition, the navigation links are
reviewed to ensure that they correspond with those specified in each SNU for each user
role.

100
[Online Bus Ticket Services]

3. Selected processing components and Web pages are unit tested: When WebApps are
considered, the concept of the unit changes. Each Web page encapsulates content, navigation
links, and processing elements. It is not always possible or practical to test each of these
characteristics individually. In many cases, the smallest testable unit is the web page. Unlike unit
testing of conventional software, which tends to focus on the algorithmic detail of a module and
the data that flow across the module interface, page-level testing for WebApps is driven by the
content, processing, and links encapsulated by the Web page.
4. The architecture is constructed and integration test are conducted: The strategy for
integration testing depends on the architecture that has been chosen for WebApp. If the WebApp
has been designed with a linear, grid, or simple hierarchical structure, it is possible to integrate
Web pages in much the same way as we integrate modules for conventional software. However,
if a mixed hierarchy or network (Web) architecture is used, integration testing is similar to the
approach used for OO systems. Thread-based testing can be used to integrate the set of Web
pages required to respond to a user event. Each thread is integrated and tested individually.
Regression testing is applied to ensure that no side effects occur. Cluster testing integrates a set
of collaborating pages. Test cases are derived to uncover errors in the collaborations.
5. The assembled WebApp is tested for overall functionality and content delivery: Like
conventional validation, the validation of Web-based system and applications focus on user-
visible actions and user-recognizable output from the system. To assist in the derivation of
validation test, the tester should draw upon use-cases. The use-cases provide a scenario that has a
high likelihood of uncovering errors in user interaction requirements.
6. The WebApp is implemented in a variety of different environmental configurations
and is tested for compatibility with each configuration: A cross-reference matrix that defines all
probable operating systems, browsers, hardware platforms, and communications protocols is
created. Tests are then conducted to uncover errors associated with each possible configuration.
7. The WebApp is tested by a controlled and monitored population of end users: A
population of users that encompasses every possible user role is chosen. The WebApp is
exercised by these users and the results of their interaction with the system are evaluated for
content and navigation errors, usability concerns, compatibility concerns, and WebApp
reliability and performance.

101
[Online Bus Ticket Services]

Because many WebApps evolve continuously, testing process is an ongoing activity, conducted
by Web support staff who use regression tests derived from the tests developed when the
WebApps was first engineered.

Implementation :
A crucial phase in the system life cycle is the successful implementation of the new system
design. Implementation includes all those activities that take place to convert from the old
system to the new. The new system may be totally new, replacing an existing manual or
automated system. Even the best systems can be weakened if the analysts managing the
implementation do not attend to every important detail.

MODULES

102
[Online Bus Ticket Services]

Modules

Modules in this website are

1. Home
2. Services
3. Package Tour
4. Gallery
5. Clients
6. Contact Us
7. About Us
8. Bus Information
9. Bus Hire request
10. Call for Bus
11. Enquiry By source to destination
12. Online Book Ticket
13. Enquiry By Bus Number
14. Cancel Ticket

103
[Online Bus Ticket Services]

104
[Online Bus Ticket Services]

Chapter 8

105
[Online Bus Ticket Services]

FUTURE SCOPE
1. This model can be enhanced and applied to similar online Booking services like OnlineBus,
OnlineTaxi of special operations like Book Ticket, Cancel Ticket, Create New Agent by
Employee, Create New Employee Records and if other user wants to get information about
Website then no need for Login with id and password etc.
2. A Web based application needs provision to support scalability to cater to
Growth. The Architecture should support the constant continuous growth of
Operation.
3. Dynamic and periodic updating of data information flow, operations of data
Information flows, operation required.
4. Faster processing of information as compared to the current system with high
accuracy and reliability.
5. Automatic and error free report generation as per the specified format.
6. Automatic calculation and generation of correct and precise Bills-thus reducing
much of the workload on the accounting staff and the errors arising due to manual
calculations.
7. Better Agent management is foreseen with the a few enhancements in this
application.
A future application of this system lies in the fact that the proposed system would remain
relevant in the future. In case there be any additions or deletion of the Employee, New Bus
Information and New Agent, addition or deletion of any Employee in the any type of
modification in future can be implemented easily.

106
[Online Bus Ticket Services]

BIBLIOGRAPHY

The books which I referred during the development of this project where of great help to me. It
assisted me a lot and rather gave me the confidence to perform such a work. The name of some
of these books are listed below:

1. ASP.Net 3.0 with C#.Net : (Beginning,Professional) by Wrox. (Wiley


Publishing,Inc.)

2. C#.Net 2003 : (Beginning,Professional) by Wrox. (Wiley


Publishing,Inc.)

3. C#.Net : by E.Balagurusamy (Tata McGraw-Hill


Publishing Company Ltd.)

4. ASP.Net 3.0 with C#.Net : by Orelly.

5. C#.Net : by Patrick Naugton Herbert Schildt (Tata


MacGraw-Hill Publishing Company Ltd.)

6. XML : (Sikkim Manipal University)

7. HTML : from Maran Graphics& IDG Books INDIA.

8. Software Engineering : by Roger S. Pressman,Ph.D. (MC Graw Hill)

I am very grateful to the writers of these books which has been of great help to me. I am
really very thankful to them.

107

You might also like