Beruflich Dokumente
Kultur Dokumente
(B.Sc.IT)
By
Rajneesh
Roll No – ……….
(2019 – 2020)
1
No task is a single man’s effort. Various factors, situations and persons
Rajneesh
2
]
This is to certify that the project work “Airline Ticket Reservation system”
Being submitted by Mr. Rajneesh in the partial fulfillment of the requirements for the
award of the degree B.Sc.(IT), SIKKIM MANIPAL UNIVERSITY (SMU) Of Health,
Medical & Technological Sciences, is a record of the student’s own work carried out
under the My Best Teacher MISS. ARCHNA LAL.
INTRODUCTION
3
This project aims at automating all the work being done manually in airline
ticket reservaion at present. The project is taken in hand for developing the enhanced
database management system because the current method of maintaining the daily
record and maintaining all the data is done on a paper sheet which is quite not reliable
for large amount of data. Because as the time passes the records on paper can spoiled
The traditional method is such as take data from large volume of files
and process on them step by step. This takes large amount of time and large man power.
So, if the software is developed, it is easy to maintain the database. On completion this
project would expedite the work in all regards. Some of the features of this software
would be:
4
Objective of the project:-
As the title of the project suggests, the objective of this software is to automate
all the data storage and manipulation procedure for a airline ticket reservation
department. The objective of this project is proposed to develop for automation of data
keeping unit which have all the details regarding to employees, passengers, sectors, fare
etc.
If this shell is automated then all work will be run fast because all the entities in
any airline reservations directly and indirectly related to the database. So, if data is
keeping and retrival is fast, then all work will be fast. This project is developed to
reduce a lot of time for manual work. In other words we can say that the maintaining of
large amount of database of that department. And if this system is developed then it
helps to maintain better control over the data of that department. And it also helps to
5
System Analysis: -
System analysis refers to the process of examining a situation with the intent
of improving it through better procedures and methods. System Design is the process of
planning a new system to either replace or complement an existing system. But before
any planning is done, the old system must be thoroughly understood and the
requirements determined. System analysis is therefore, the process of gathering and
interpreting facts, diagnosis problems and using the information to re-comment
improvements in the system. Or in the other words, system analysis means a detailed
explanation or description. Before computerizing a system under consideration, it has
to be analyzed. We need to study how it functions currently, what are the problems, and
what are the requirements that the proposed system should meet.
System analysis is an activity that encompasses most of the tasks that are collectively
called Computer System Engineering. Confusing sometimes occurs because the term
often used in context that includes it only to software requirement analysis activities,
but system analysis focuses on all the system elements not just software.
6
Identification of need: -
The first strep of system analysis process involves the identification of need. The
analyst meets with the customer and the user. Identification of need is the starting point
in the evolution of a computer based system. The system analyst assists the customer
on defining the goals of the system.
What information will be produced?
What information is to be provided?
What functions and performance are required?
The analyst makes sure to distinguish between customer “needs” and customer
“wants”. Information gathered during the need identification step is specified in a
System Concept Documents. The customer before meeting sometimes prepares the
original concept documents with the analyst. Invariably, customer analyst
communication results in his modifications to the documents.
Preliminary Investigation: -
The First Step in the System Development Life Cycle is the Preliminary Investigation
to determine the feasibility of the system. The purpose of the preliminary investigation
is to evaluate project requests. It is not a design study nor does it include the collection
of details to describe the business system in all respect. Rather, it is the collecting of the
information that helps committee members to evaluate the merits of the project request
and make an informed judgment about the feasibility of the proposed project.
7
Determine the technical and operational feasibility of alternative approaches.
Report the findings to management; with recommendations outlining the
acceptance or rejection of the proposal.
The data that the analysts collect during preliminary investigations are gathered through
three primary methods: reviewing organization documents, on-site observations and
conducting interviews.
The analyst conducting the investigation first learns about the organization involved in,
or affected by the project. In AIRLINE management system, it is necessary to know
how the department works and who are the persons directly associated with inventory
system.
Onsite observation: -
Another important technique to collect data is on-site observation. The purpose of the
On-site observation is to get as close as possible to the real system being studied.
During On-site Observation, office environment can be seen, work load, method of
work and facilities provided by the organization to the users can be studied.
Conducting interview: -
Interviews allows learning more about the nature of the Project request and reasons for
submitting it. Interviews should provide details that further explain the project and
show whether assistance is merited economically, operationally and technically.
8
Cost Benefit Analysis: -
Since cost plays an important role deciding the new system, it must be identified and
estimated properly. Benefits are also of different types and can be grouped on the basis
of advantages they provide the managements.
9
Software requirement specification: -
The Software Requirements Specification is produced at the culmination of the analysis
task. The function and performance allocated to software as part of system engineering
are refined by establishing a complete information description, a detailed functional
description, a representation of system behavior, an indication of performance
requirement and design constraints, appropriate validation criteria, and other
information pertinent to requirement.
The Introduction to software requirements specification states the goals and objectives
of the software, describing it in the context of the computer based system.
The Information Description provides a detailed description of the problem that the
software must solve. Information content, flow, and structure are documented.
A Description of each function required to solve the problem is presented in the
Functional Description.
Validation Criteria is probably the most important and, ironically, the most often
neglected section of the Software requirement Specification.
Software Specifications can be used for different purposes. Here are there major uses.
10
A statement of the requirements for the implementation:
Specifications are also used as a reference point during product implementation. In fact,
the ultimate goal of the implementation is to build a product that needs specification.
Thus the implementers use specifications during design to make design decisions and
during the verification activity to check that the implementation compiles with the
specifications.
SOFTWARE REQUIREMENT: -
RDBMS: - MS Access
HARDWARE REQUIREMENT: -
PROCESSOR: - PIV
RAM: - 256MB
11
System Design:-
Software Design is the first of three technical activities – design, Code generation, and
test – that are required to build and verify the software. Each activity transforms
information in a manner that ultimately results in validated computer software.
The Design task produces a data design, an architectural design, an interface design and
component design.The Design of an information system produces the details that
clearly describe how a system will meet the requirements identified during system
analysis. The system design process is not a step by step adherence of clear procedures
and guidelines. When I started working on system design, I face different types of
problems; many of these are due to constraints imposed by the user or limitation of
hardware and software available. Some time it was quite difficult to enumerate the
complexity of the problems and solutions thereof since the variety of likely problems is
so great and no solutions are exactly similar however the following consideration I kept
in mind during Design phase.
12
Security: This is very important aspect which I followed in this designing phase
and tried to covers the areas of hardware reliability, fallback procedures, and
physical security of data.
Constraints: -
These are the following constraints:
Hardware
Software
Budget
Time Scale
Interface with other System
Operations:-
Throughout the design process I considered and specify the requirement of each of
these operational areas.
13
Data flow Diagram: -
Start
Is
No
Authorized?
No
If Administrator
Yes
Yes Yes
Data Store in
Database
Logou
t
Stop
14
Data Structure:-
Login Table
15
Flight Details Table
ScheduledFlight Details
Table
16
Passenger Details Table
17
START UP FORM
LOGIN FORM
18
CHANGE PASSWORD FORM
MAIN FORM
19
ADD SECTOR DETAILS FORM
20
SCHEDULED FLIGHT FORM
21
OVERBOOKING/WAITING LIST PASSENGER DETAILS
DAILYCOLLECTION FORM
22
ADD NEW ID FORM
UPDATE/DELETE ID FORM
23
RESERVATION FORM
24
CANCEL RESERVATION FORM
***
25
CODING
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AIRLINE_RESERVATION
{
public partial class Login : Form
{
System.Data.OleDb.OleDbDataAdapter adp;
System.Data.OleDb.OleDbConnection con;
public Login()
{
InitializeComponent();
}
private void btnlogin_Click(object sender, EventArgs e)
{
adp = new System.Data.OleDb.OleDbDataAdapter("select*
from Login where login_ID=?", con);
System.Data.OleDb.OleDbParameter p;
p = new System.Data.OleDb.OleDbParameter("Login",
System.Data.OleDb.OleDbType.VarChar);
adp.SelectCommand.Parameters.Add(p);
26
if (txtusername.Text == "")
{
MessageBox.Show("Pleas Enter your User Name");
txtusername.Focus();
}
if (txtpassword.Text == "")
{
MessageBox.Show("Please Enetr your Password");
txtpassword.Focus();
}
else
{
adp.SelectCommand.Parameters[0].Value =
txtusername.Text;
DataSet ds = new DataSet();
adp.Fill(ds, "Login");
if (ds.Tables.Count > 0)
{
bool validuser1 = false;
foreach (DataRow dr in ds.Tables[0].Rows)
{
string id = dr[0].ToString();
id = id.Trim();
string pass = dr[1].ToString();
pass = pass.Trim();
if (id == txtusername.Text && pass == txtpassword.Text)
{
validuser1 = true;
MainForm mfrm = new MainForm();
this.Hide();
mfrm.textBox1.Text =
ds.Tables[0].Rows[0].ItemArray[0].ToString();
mfrm.Show();
}
}
if (validuser1 == false)
27
{
MessageBox.Show("Enter valid UserID and Password");
txtpassword.Text = "";
txtpassword.Focus();
}
}
}
}
28
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AIRLINE_RESERVATION
{
public partial class ChangePassword : Form
{
System.Data.OleDb.OleDbConnection con;
System.Data.OleDb.OleDbDataAdapter adp;
public ChangePassword()
{
InitializeComponent();
}
29
return;
}
30
}
else
{
MessageBox.Show("No matching record found");
}
}
}
con.Close();
}
31
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AIRLINE_RESERVATION
{
public partial class MainForm : Form
{
System.Data.OleDb.OleDbConnection con;
System.Data.OleDb.OleDbDataAdapter adp;
public MainForm()
{
InitializeComponent();
}
32
frm.textBox1.Text = textBox1.Text;
frm.Show();
this.Hide();
}
33
adp.Fill(ds, "Login");
id = ds.Tables[0].Rows[0][0].ToString().Trim();
if (!(id == "Administrator"))
{
menuStrip1.Enabled = false;
}
}
catch
{
}
}
private void
confirmedPassengerListToolStripMenuItem_Click(object
sender, EventArgs e)
{
ConfirmedPassengers frm = new ConfirmedPassengers();
frm.Show();
this.Hide();
}
34
private void
overbookingWaitingListToolStripMenuItem_Click(object
sender, EventArgs e)
{
Overooked_Waitlisted frm = new Overooked_Waitlisted();
frm.Show();
this.Hide();
}
private void
dailyCollectionListToolStripMenuItem_Click(object sender,
EventArgs e)
{
DailyCollection dfrm = new DailyCollection();
dfrm.Show();
this.Hide();
}
35
Coding for Sector Details Form
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AIRLINE_RESERVATION
{
public partial class SecterDetails : Form
{
System.Data.OleDb.OleDbConnection con;
System.Data.OleDb.OleDbDataAdapter adp;
System.Data.OleDb.OleDbCommand cmdel;
System.Data.OleDb.OleDbCommand cmedit;
DataSet ds = new DataSet();
public SecterDetails()
{
InitializeComponent();
con = new System.Data.OleDb.OleDbConnection();
con.ConnectionString = "provider=Microsoft.jet.oledb.4.0;data
source= Ticket_Reservation.mdb";
con.Open();
}
DataRow row = null;
DataTable table = null;
private void SecterDetails_Load(object sender, EventArgs e)
{
adp = new System.Data.OleDb.OleDbDataAdapter("select*
from Secter",con);
adp.Fill(ds,"Secter");
dgvSecterDetails.DataSource = ds.Tables[0].DefaultView;
}
36
private void btnAdd_Click(object sender, EventArgs e)
{
System.Data.OleDb.OleDbDataAdapter adp;
adp = new System.Data.OleDb.OleDbDataAdapter("select*
from Secter", con);
DataSet ds = new DataSet();
adp.Fill(ds,"Secter");
if (txtSecterID.Text == "")
{
MessageBox.Show("Please Enter Secter ID");
txtSecterID.Focus();
return;
}
if (txtDesc.Text == "")
{
MessageBox.Show("Please Enter Description");
txtDesc.Focus();
return;
}
else if(txtFCFares.Text=="")
{
MessageBox.Show("Please Enter First Class Fares");
txtFCFares.Focus();
return;
}
if(!(txtFCFares.Text==""))
{
string fstr;
string fstr1=null;
bool fcheck=false;
int fi=0;
int fasci=0;
fstr=txtFCFares.Text;
for(fi=1;fi<=fstr.Length;fi++)
{
fstr1=fstr.Substring(fi-1,1);
fasci=System.Convert.ToInt32(fstr1[0]);
37
if(fasci>=48&fasci<=57)
{
fcheck=true;
}
else
{
fcheck=false;
break;
}
}
if(fcheck==false)
{
MessageBox.Show("Enter Valid Fares");
txtFCFares.Text="";
txtFCFares.Focus();
return;
}
}
if(txtBCFares.Text=="")
{
MessageBox.Show("Enter Valid Fares");
txtBCFares.Text = "";
txtBCFares.Focus();
return;
}
if (!(txtBCFares.Text == ""))
{
string bstr;
string bstr1 = null;
bool bcheck = false;
int bi = 0;
int basci = 0;
bstr = txtBCFares.Text;
for (bi = 1; bi <= bstr.Length; bi++)
{
bstr1 = bstr.Substring(bi - 1, 1);
basci = System.Convert.ToInt32(bstr1[0]);
38
if (basci >= 48 & basci <= 57)
{
bcheck = true;
}
else
{
bcheck = false;
break;
}
}
if (bcheck == false)
{
MessageBox.Show("Enter Valid Fares");
txtBCFares.Text = "";
txtBCFares.Focus();
return;
}
}
if (txtECFares.Text == "")
{
MessageBox.Show("Enter Valid Fares");
txtECFares.Text = "";
txtECFares.Focus();
return;
}
if (!(txtECFares.Text == ""))
{
string estr;
string estr1 = null;
bool echeck = false;
int ei = 0;
int easci = 0;
estr = txtECFares.Text;
for (ei = 1; ei <= estr.Length; ei++)
{
estr1 = estr.Substring(ei - 1, 1);
easci = System.Convert.ToInt32(estr1[0]);
39
if (easci >= 48 & easci <= 57)
{
echeck = true;
}
else
{
echeck = false;
break;
}
}
if (echeck == false)
{
MessageBox.Show("Enter Valid Fares");
txtECFares.Text = "";
txtECFares.Focus();
return;
}
}
try
{
table = ds.Tables["Secter"];
row = table.NewRow();
row[0] = txtSecterID.Text;
row[1] = txtDesc.Text;
row[2] = txtFCFares.Text;
row[3] = txtBCFares.Text;
row[4] = txtECFares.Text;
table.Rows.Add(row);
System.Data.OleDb.OleDbCommandBuilder comm = new
System.Data.OleDb.OleDbCommandBuilder(adp);
adp.InsertCommand = comm.GetInsertCommand();
adp.Update(ds, "Secter");
adp.Fill(ds);
MessageBox.Show("New Entry saved");
System.Data.OleDb.OleDbDataAdapter adp2 = new
System.Data.OleDb.OleDbDataAdapter("select* from Secter",
con);
DataSet ds2 = new DataSet();
40
adp2.Fill(ds2, "Secter");
dgvSecterDetails.DataSource = ds2.Tables[0].DefaultView;
txtSecterID.Text = "";
txtDesc.Text = "";
txtFCFares.Text = "";
txtBCFares.Text = "";
txtECFares.Text = "";
}
catch
{
MessageBox.Show("Secter ID already Exist");
}
}
41
txtFCFares.Text = ds.Tables["Secter"].Rows[0]
["FirstClassFare"].ToString();
txtBCFares.Text = ds.Tables["Secter"].Rows[0]
["BussinessClassFare"]. ToString();
txtECFares.Text = ds.Tables["Secter"].Rows[0]
["EconomyClassFare"]. ToString();
}
else
{
return;
}
}
catch
{
}
}
42
System.Windows.Forms.MessageBoxButtons.YesNo,
System.Windows.Forms.MessageBoxIcon.Question);
if (Result == DialogResult.Yes)
{
cmdel = new System.Data.OleDb.OleDbCommand("delete*
from Secter where Secter_ID=?", con);
System.Data.OleDb.OleDbParameter p;
p = new System.Data.OleDb.OleDbParameter("Secter_ID",
System.Data.OleDb.OleDbType.VarChar);
cmdel.Parameters.Add(p);
cmdel.Parameters[0].Value = txtSecterID.Text;
int del = cmdel.ExecuteNonQuery();
if (del >= 1)
MessageBox.Show("Record Deleted");
else
MessageBox.Show("No matching record found");
}
}
catch
{
}
}
private void btnReset_Click(object sender, EventArgs e)
{
txtSecterID.Text = "";
txtDesc.Text = "";
txtFCFares.Text = "";
txtBCFares.Text = "";
txtECFares.Text = "";
}
43
pe = new
System.Data.OleDb.OleDbParameter("Description",System.D
ata.OleDb.OleDbType.VarChar);
pe1 = new
System.Data.OleDb.OleDbParameter("FirstClassFare",
System.Data.OleDb.OleDbType.VarChar);
pe2 = new
System.Data.OleDb.OleDbParameter("BussinessClassFare",
System.Data.OleDb.OleDbType.VarChar);
pe3 = new
System.Data.OleDb.OleDbParameter("EconomyClassFare",
System.Data.OleDb.OleDbType.VarChar);
pe4 = new System.Data.OleDb.OleDbParameter("Secter_ID",
System.Data.OleDb.OleDbType.VarChar);
cmedit.Parameters.Add(pe);
cmedit.Parameters.Add(pe1);
cmedit.Parameters.Add(pe2);
cmedit.Parameters.Add(pe3);
cmedit.Parameters.Add(pe4);
cmedit.Parameters[0].Value = txtDesc.Text;
int ee;
try
{
cmedit.Parameters[1].Value = txtFCFares.Text;
cmedit.Parameters[2].Value = txtBCFares.Text;
cmedit.Parameters[3].Value = txtECFares.Text;
cmedit.Parameters[4].Value = txtSecterID.Text;
ee= cmedit.ExecuteNonQuery();
if (ee >= 1)
MessageBox.Show("Record Updated");
}
catch
{
MessageBox.Show("Enter only numeric value of fares");
}
}
}
}
44
Coding for Flight Details Form
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AIRLINE_RESERVATION
{
public partial class FlightDetails : Form
{
public FlightDetails()
{
InitializeComponent();
}
System.Data.OleDb.OleDbConnection con;
DataRow row = null;
DataTable table = null;
private void FlightDetails_Load(object sender, EventArgs e)
{
con = new System.Data.OleDb.OleDbConnection();
con.ConnectionString = "provider=Microsoft.jet.oledb.4.0;data
source=Ticket_Reservation.mdb";
con.Open();
System.Data.OleDb.OleDbDataAdapter adp;
adp = new System.Data.OleDb.OleDbDataAdapter("select*
from Flight", con);
DataSet ds = new DataSet();
adp.Fill(ds, "Flight");
dgvFlightDetails.DataSource =
ds.Tables["Flight"].DefaultView;
}
45
{
MainForm mfrm = new MainForm();
mfrm.Show();
this.Hide();
}
46
adp1 = new System.Data.OleDb.OleDbDataAdapter("select*
from Flight where Flight_Number=?", con);
System.Data.OleDb.OleDbParameter p1;
p1 = new
System.Data.OleDb.OleDbParameter("Flight_Number",
System.Data.OleDb.OleDbType.VarChar);
adp1.SelectCommand.Parameters.Add(p1);
adp1.SelectCommand.Parameters[0].Value =
dgvFlightDetails.Rows[e.RowIndex].Cells[1].Value.
ToString();
DataSet ds1 = new DataSet();
adp1.Fill(ds1, "Flight");
cmbSecterID.DataSource =
ds1.Tables["Flight"].DefaultView;
cmbSecterID.DisplayMember = "Sector_ID";
cmbSecterID.ValueMember = "Sector_ID";
}
else
{
return;
}
}
catch
{
}
}
private void btnAdd_Click(object sender, EventArgs e)
{
if (txtFlightNo.Text == "")
{
MessageBox.Show("Please Enter Flight Number");
txtFlightNo.Focus();
return;
}
else if (txtDepTime.Text == "")
{
MessageBox.Show("Please enter Departure Time");
txtDepTime.Focus();
47
return;
}
else if (!(txtDepTime.Text == ""))
{
string dstr;
string dstr1 = null;
bool dcheck = false;
int di = 0;
int dasci = 0;
dstr = txtDepTime.Text;
for (di = 1; di <= dstr.Length; di++)
{
dstr1 = dstr.Substring(di - 1, 1);
dasci = System.Convert.ToInt32(dstr1[0]);
if (dasci >= 48 & dasci <= 57)
{
dcheck = true;
}
else
{
dcheck = false;
break;
}
}
if (dcheck == false)
{
MessageBox.Show("Enter Valid Number of Seats in First
Class");
txtDepTime.Focus();
return;
}
if (txtArrTime.Text == "")
{
MessageBox.Show("Please Enter Arrival Time");
txtArrTime.Focus();
return;
}
if (!(txtArrTime.Text == ""))
{
48
string str;
string str1 = null;
bool check = false;
int i = 0;
int asci = 0;
str = txtArrTime.Text;
for (i = 1; i <= str.Length; i++)
{
str1 = str.Substring(i - 1, 1);
asci = System.Convert.ToInt32(str1[0]);
if (asci >= 48 & asci <= 57)
{
check = true;
}
else
{
check = false;
break;
}
}
if (check == false)
{
MessageBox.Show("Enter Valid Number of Seats in First
Class");
txtArrTime.Focus();
return;
}
}
if (txtAircraftID.Text == "")
{
MessageBox.Show("Please Enter the Aircraft ID");
return;
}
if (txtAircraftDesc.Text == "")
{
MessageBox.Show("Please Enter the description of the
Aircraft");
return;
}
49
System.Data.OleDb.OleDbDataAdapter adp = new
System.Data.OleDb.OleDbDataAdapter("Select * from Flight",
con);
DataSet ds = new DataSet();
adp.Fill(ds, "Flight");
try
{
table = ds.Tables["Flight"];
row = table.NewRow();
row[0] = txtFlightNo.Text;
row[1] = txtDepTime.Text;
row[2] = txtArrTime.Text;
row[3] = txtAircraftID.Text;
row[4] = txtAircraftDesc.Text;
row[5] = cmbSecterID.Text;
table.Rows.Add(row);
System.Data.OleDb.OleDbCommandBuilder comm = new
System.Data.OleDb.OleDbCommandBuilder(adp);
adp.InsertCommand = comm.GetInsertCommand();
adp.Update(ds, "Flight");
adp.Fill(ds);
MessageBox.Show("New Record Saved");
System.Data.OleDb.OleDbDataAdapter adp2 = new
System.Data.OleDb.OleDbDataAdapter("Select * from Flight",
con);
DataSet ds2 = new DataSet();
adp.Fill(ds2, "Flight");
dgvFlightDetails.DataSource = ds2.Tables[0].DefaultView;
txtFlightNo.Text = "";
txtDepTime.Text = "";
txtArrTime.Text = "";
txtAircraftID.Text = "";
txtAircraftDesc.Text = "";
cmbSecterID.Text = "";
}
catch
{
MessageBox.Show("No new record saved","INPUT ERROR");
50
}
}
}
51
adp = new System.Data.OleDb.OleDbDataAdapter("Select *
from Flight", con);
adp.Fill(ds, "Flight");
try
{
result = MessageBox.Show("Do You Want to Delete this record
?", "Delete?",
System.Windows.Forms.MessageBoxButtons.YesNo,
System.Windows.Forms.MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
cmdel = new System.Data.OleDb.OleDbCommand("delete*
from Flight where Flight_Number=?", con);
System.Data.OleDb.OleDbParameter p;
p = new
System.Data.OleDb.OleDbParameter("Flight_Number",
System.Data.OleDb.OleDbType.VarChar);
cmdel.Parameters.Add(p);
cmdel.Parameters[0].Value = txtFlightNo.Text;
int del = cmdel.ExecuteNonQuery();
if (del >= 1)
MessageBox.Show("Record Deleted");
else
MessageBox.Show("No matching record found","INPUT
ERROR");
adp.Update(ds, "Flight");
adp.Fill(ds);
System.Data.OleDb.OleDbDataAdapter adp2 = new
System.Data.OleDb.OleDbDataAdapter("Select * from Flight",
con);
DataSet ds2 = new DataSet();
adp2.Fill(ds2, "Flight");
dgvFlightDetails.DataSource = ds2.Tables[0].DefaultView;
txtFlightNo.Text = "";
txtArrTime.Text = "";
txtDepTime.Text = "";
txtAircraftID.Text = "";
txtAircraftDesc.Text = "";
cmbSecterID.Text = "";
52
}
}
catch
{
}
}
53
com.Parameters[0].Value =cmbSecterID.Text;
com.Parameters[1].Value = txtDepTime.Text;
com.Parameters[2].Value = txtArrTime.Text;
com.Parameters[3].Value = txtAircraftID.Text;
com.Parameters[4].Value = txtAircraftDesc.Text;
com.Parameters[5].Value =txtFlightNo.Text;
int res;
res=com.ExecuteNonQuery();
if (res >= 1)
{
MessageBox.Show("Record updated successfully");
}
else
MessageBox.Show("Record not updated ", "INUT ERROR");
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AIRLINE_RESERVATION
{
public partial class ScheduledFlight : Form
{
54
System.Data.OleDb.OleDbConnection con;
System.Data.OleDb.OleDbDataAdapter adp;
public ScheduledFlight()
{
InitializeComponent();
}
private void
dgvScheduledFlightDetails_CellContentClick(object
sender, DataGridViewCellEventArgs e)
{
try
{
int index = 0;
index = e.ColumnIndex;
if (index == 0)
{
System.Data.OleDb.OleDbDataAdapter adp;
DataSet ds = new DataSet();
adp = new System.Data.OleDb.OleDbDataAdapter("select*
from ScheduledFlight where ScheduledID=?", con);
System.Data.OleDb.OleDbParameter p;
p = new System.Data.OleDb.OleDbParameter("ScheduledID",
System.Data.OleDb.OleDbType.VarChar);
adp.SelectCommand.Parameters.Add(p);
adp.SelectCommand.Parameters[0].Value =
dgvScheduledFlightDetails.Rows[e.RowIndex].Cells[1].Valu
e.ToString();
adp.Fill(ds, "ScheduledFlight");
txtScheduledID.Text = ds.Tables["ScheduledFlight"].Rows[0]
["ScheduledID"]. ToString();
55
lstFNumber.Text = ds.Tables["ScheduledFlight"].Rows[0]
["Flight_Number"]. ToString();
dtpFlightDate.Text = ds.Tables["ScheduledFlight"].Rows[0]
["Flight_Date"]. ToString();
txtFCSeats.Text = ds.Tables["ScheduledFlight"].Rows[0]
["FirstClassSeatAvailable"].ToString();
txtBCSeats.Text = ds.Tables["ScheduledFlight"].Rows[0]
["BussinessClassSeatAvailable"].ToString();
txtECSeats.Text = ds.Tables["ScheduledFlight"].Rows[0]
["EconomyClassSeatAvailable"].ToString();
}
else
{
return;
}
}
catch
{
}
}
56
DataSet ds1 = new DataSet();
adp1.Fill(ds1,"Flight");
lstFNumber.DataSource = ds1.Tables["Flight"].DefaultView;
lstFNumber.DisplayMember = "Flight_Number";
lstFNumber.ValueMember = "Flight_Number";
}
57
cmdAdd.Parameters[3].Value = txtFCSeats.Text;
cmdAdd.Parameters[4].Value = txtBCSeats.Text;
cmdAdd.Parameters[5].Value = txtECSeats.Text;
int res;
res = cmdAdd.ExecuteNonQuery();
if (res >= 1)
{
MessageBox.Show("Record Saved");
System.Data.OleDb.OleDbDataAdapter adp1;
adp1 = new System.Data.OleDb.OleDbDataAdapter("select*
from ScheduledFlight",con);
DataSet ds1 = new DataSet();
adp1.Fill(ds1,"ScheduledFlight");
dgvScheduledFlightDetails.DataSource =
ds1.Tables[0].DefaultView;
}
else
MessageBox.Show("Record Not Saved");
}
58
System.Data.OleDb.OleDbParameter p;
p = new
System.Data.OleDb.OleDbParameter("ScheduledID",System.
Data.OleDb.OleDbType.VarChar);
cmDel.Parameters.Add(p);
cmDel.Parameters[0].Value = txtScheduledID.Text;
int res=0;
if (txtScheduledID.Text == "")
MessageBox.Show("Enter ScheduledID First");
else
{
result = MessageBox.Show("Do You Want to Delete this record
?", "Delete?",
System.Windows.Forms.MessageBoxButtons.YesNo,
System.Windows.Forms.MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
res = cmDel.ExecuteNonQuery();
if (res >= 1)
MessageBox.Show("Record Deleted");
}
}
System.Data.OleDb.OleDbDataAdapter adp1;
adp1 = new System.Data.OleDb.OleDbDataAdapter("select*
from ScheduledFlight", con);
DataSet ds1 = new DataSet();
adp1.Fill(ds1, "ScheduledFlight");
dgvScheduledFlightDetails.DataSource =
ds1.Tables[0].DefaultView;
}
catch
{
MessageBox.Show("Record Not Deleted", "INPUT ERROR");
}
}
59
cmdEdit = new System.Data.OleDb.OleDbCommand("update
ScheduledFlight set
Flight_Number=?,Flight_Date=?,FirstClassSeatAvailable=?,Bu
ssinessClassSeatAvailable=?,EconomyClassSeatAvailable=?
where ScheduledID=?",con);
System.Data.OleDb.OleDbParameter p1, p2, p3, p4,p5, p6;
p1 = new
System.Data.OleDb.OleDbParameter("Flight_Number",Syste
m.Data.OleDb.OleDbType.VarChar);
p2 = new System.Data.OleDb.OleDbParameter("Flight_Date",
System.Data.OleDb.OleDbType.VarChar);
p3 = new
System.Data.OleDb.OleDbParameter("FirstClassSeatAvailabl
e", System.Data.OleDb.OleDbType.VarChar);
p4 = new
System.Data.OleDb.OleDbParameter("BussinessClassSeatAv
ailable", System.Data.OleDb.OleDbType.VarChar);
p5 = new
System.Data.OleDb.OleDbParameter("EconomyClassSeatAva
ilable", System.Data.OleDb.OleDbType.VarChar);
p6 = new
System.Data.OleDb.OleDbParameter("ScheduledID",
System.Data.OleDb.OleDbType.VarChar);
cmdEdit.Parameters.Add(p1);
cmdEdit.Parameters.Add(p2);
cmdEdit.Parameters.Add(p3);
cmdEdit.Parameters.Add(p4);
cmdEdit.Parameters.Add(p5);
cmdEdit.Parameters.Add(p6);
cmdEdit.Parameters[0].Value = lstFNumber.SelectedValue;
cmdEdit.Parameters[1].Value = dtpFlightDate.Text;
cmdEdit.Parameters[2].Value = txtFCSeats.Text;
cmdEdit.Parameters[3].Value = txtBCSeats.Text;
cmdEdit.Parameters[4].Value = txtECSeats.Text;
cmdEdit.Parameters[5].Value = txtScheduledID.Text;
int res;
res = cmdEdit.ExecuteNonQuery();
if (res >= 1)
{
60
MessageBox.Show("Record Updated");
System.Data.OleDb.OleDbDataAdapter adp1;
adp1 = new System.Data.OleDb.OleDbDataAdapter("select*
from ScheduledFlight", con);
DataSet ds1 = new DataSet();
adp1.Fill(ds1, "ScheduledFlight");
dgvScheduledFlightDetails.DataSource =
ds1.Tables[0].DefaultView;
}
else
MessageBox.Show("Record Not Updated");
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AIRLINE_RESERVATION
{
public partial class ConfirmedPassengers : Form
{
System.Data.OleDb.OleDbConnection con;
System.Data.OleDb.OleDbDataAdapter adp;
public ConfirmedPassengers()
{
InitializeComponent();
}
61
private void ConfirmedPassengers_Load(object sender,
EventArgs e)
{
con = new System.Data.OleDb.OleDbConnection();
con.ConnectionString = "provider=Microsoft.jet.oledb.4.0;data
source=Ticket_Reservation.mdb";
con.Open();
adp = new System.Data.OleDb.OleDbDataAdapter("select*
from Passenger",con);
DataSet ds = new DataSet();
adp.Fill(ds,"Passenger");
dgvCPDetails.DataSource = ds.Tables[0].DefaultView;
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AIRLINE_RESERVATION
{
62
public partial class Overooked_Waitlisted : Form
{
System.Data.OleDb.OleDbConnection con;
System.Data.OleDb.OleDbDataAdapter adp;
public Overooked_Waitlisted()
{
InitializeComponent();
}
}
}
}
63
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AIRLINE_RESERVATION
{
public partial class DailyCollection : Form
{
System.Data.OleDb.OleDbConnection con;
System.Data.OleDb.OleDbDataAdapter adp;
public DailyCollection()
{
InitializeComponent();
}
64
dgvDCDetails.DataSource = ds.Tables[0].DefaultView;
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AIRLINE_RESERVATION
{
public partial class NewLoginID : Form
{
System.Data.OleDb.OleDbConnection con;
public NewLoginID()
{
InitializeComponent();
}
DataSet ds = new DataSet();
65
System.Data.OleDb.OleDbCommand cmdAdd;
cmdAdd = new System.Data.OleDb.OleDbCommand("insert
into Login values(?,?,?)",con);
System.Data.OleDb.OleDbParameter p, p1, p2;
p = new
System.Data.OleDb.OleDbParameter("login_ID",System.Data
.OleDb.OleDbType.VarChar);
p1 = new System.Data.OleDb.OleDbParameter("password",
System.Data.OleDb.OleDbType.VarChar);
p2 = new System.Data.OleDb.OleDbParameter("role",
System.Data.OleDb.OleDbType.VarChar);
cmdAdd.Parameters.Add(p);
cmdAdd.Parameters.Add(p1);
cmdAdd.Parameters.Add(p2);
cmdAdd.Parameters[0].Value = txtLoginID.Text;
cmdAdd.Parameters[1].Value = txtPassword.Text;
cmdAdd.Parameters[2].Value = cmbRole.Text;
int res;
try
{
res = cmdAdd.ExecuteNonQuery();
if (res >= 1)
{
MessageBox.Show("New Lgoin ID Saved");
txtLoginID.Text = "";
txtPassword.Text = "";
cmbRole.Text = "";
}
}
catch
{
MessageBox.Show("This lginid already exist", "Error");
}
}
}
private void NewLoginID_Load(object sender, EventArgs e)
{
66
con = new System.Data.OleDb.OleDbConnection();
con.ConnectionString = "provider=Microsoft.jet.oledb.4.0;data
source=Ticket_Reservation.mdb";
con.Open();
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AIRLINE_RESERVATION
{
public partial class UpdateorDeleteID : Form
{
System.Data.OleDb.OleDbConnection con;
System.Data.OleDb.OleDbDataAdapter adp;
System.Data.OleDb.OleDbDataAdapter adp1;
DataSet ds = new DataSet();
DataSet ds1 = new DataSet();
int index;
public UpdateorDeleteID()
{
InitializeComponent();
67
}
68
{
}
}
strpass = ds1.Tables[0].Rows[0][0].ToString();
MessageBox.Show(strpass);
if (strpass == txtoldpassword.Text)
{
if (txtpassword.Text == txtRenterpassword.Text)
{
System.Data.OleDb.OleDbCommand cmdEdit;
cmdEdit = new System.Data.OleDb.OleDbCommand("update
Login set [password]=?,role=? where login_ID=?", con);
System.Data.OleDb.OleDbParameter p, p1, p2;
p = new System.Data.OleDb.OleDbParameter("password",
System.Data.OleDb.OleDbType.VarChar);
69
p1 = new System.Data.OleDb.OleDbParameter("role",
System.Data.OleDb.OleDbType.VarChar);
p2 = new System.Data.OleDb.OleDbParameter("login_ID",
System.Data.OleDb.OleDbType.VarChar);
cmdEdit.Parameters.Add(p);
cmdEdit.Parameters.Add(p1);
cmdEdit.Parameters.Add(p2);
cmdEdit.Parameters[0].Value = txtpassword.Text;
cmdEdit.Parameters[1].Value = cmbRole.Text;
cmdEdit.Parameters[2].Value = cmbLoginID.Text;
int res;
res = cmdEdit.ExecuteNonQuery();
if (res > 0)
MessageBox.Show("Password has been changed");
else
MessageBox.Show("Password has not been changed");
}
else
{
MessageBox.Show("Password does not match");
}
}
else
MessageBox.Show("Wrong password");
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
70
using System.Text;
using System.Windows.Forms;
namespace AIRLINE_RESERVATION
{
public partial class Reservation : Form
{
string strGender, strSeatPref, strMealPref, strSecter;
string strNewPnr = null;
public Reservation()
{
InitializeComponent();
}
System.Data.OleDb.OleDbConnection con;
71
txtSSR.Text = "";
strGender = null;
strSeatPref = null;
strMealPref = null;
}
72
{
con = new System.Data.OleDb.OleDbConnection();
con.ConnectionString = "provider=Microsoft.jet.oledb.4.0;data
source=Ticket_Reservation.mdb";
con.Open();
System.Data.OleDb.OleDbDataAdapter adp = new
System.Data.OleDb.OleDbDataAdapter("select
Flight_Number,Description from Flight,Secter where
Flight.Sector_ID=Secter.Secter_ID ", con);
DataSet ds = new DataSet();
ds.Clear();
adp.Fill(ds);
lstFlightNo.DataSource = ds.Tables[0].DefaultView;
lstFlightNo.DisplayMember = "Fight_Number";
lstFlightNo.ValueMember = "Flight_Number";
lstDescription.DataSource = ds.Tables[0].DefaultView;
lstDescription.DisplayMember = "Description";
lstDescription.ValueMember = "Description";
System.Data.OleDb.OleDbDataAdapter adpdate;
adpdate = new
System.Data.OleDb.OleDbDataAdapter("select Flight_Date
from ScheduledFlight where Flight_Number=?", con);
System.Data.OleDb.OleDbParameter pdate;
pdate = new
System.Data.OleDb.OleDbParameter("Flight_Number",
System.Data.OleDb.OleDbType.VarChar);
adpdate.SelectCommand.Parameters.Add(pdate);
adpdate.SelectCommand.Parameters[0].Value =
lstFlightNo.Text;
DataSet dsDate = new DataSet();
adpdate.Fill(dsDate);
dtpTravelDate.Text = dsDate.Tables[0].Rows[0]
[0].ToString();
}
73
private void btnSave_Click(object sender, EventArgs e)
{
try
{
System.Data.OleDb.OleDbDataAdapter adpdate;
adpdate = new
System.Data.OleDb.OleDbDataAdapter("select Flight_Date
from ScheduledFlight where Flight_Number=?", con);
System.Data.OleDb.OleDbParameter pdate;
pdate = new
System.Data.OleDb.OleDbParameter("Flight_Number",
System.Data.OleDb.OleDbType.VarChar);
adpdate.SelectCommand.Parameters.Add(pdate);
adpdate.SelectCommand.Parameters[0].Value =
lstFlightNo.Text;
DataSet dsDate = new DataSet();
adpdate.Fill(dsDate);
string strdate = dsDate.Tables[0].Rows[0][0].ToString();
if (dtpTravelDate.Text == strdate)
{
}
else
{
MessageBox.Show("Sorry! No flight exist on this date");
dtpTravelDate.Focus();
return;
}
}
catch
{
}
if (cmbClass.Text.Trim(' ').Length == 0)
{
MessageBox.Show("Please specify the class of travel.","Input
Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
cmbClass.Focus();
74
return;
}
if (txtFareAmount.Text.Trim(' ').Length == 0)
{
MessageBox.Show("Please Fill the Field Correctly.", "Input
Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (txtFName.Text.Trim(' ').Length == 0)
{
MessageBox.Show("Please enter full Name of the passenger.",
"Input Error", MessageBoxButtons.OK,
MessageBoxIcon.Error);
txtFName.Focus();
return;
}
string str = txtFName.Text.ToString();
foreach (char c in str)
{
if (char.IsDigit(c))
{
MessageBox.Show("You cannot enter Numbers in Name",
"Input Error", MessageBoxButtons.OK,
MessageBoxIcon.Error);
txtFName.Text = "";
return;
}
}
string str1 = txtLName.Text.ToString();
foreach (char c in str1)
{
if (char.IsDigit(c))
{
MessageBox.Show("You cannot enter Numbers in Name",
"Input Error", MessageBoxButtons.OK,
MessageBoxIcon.Error);
txtLName.Text = "";
return;
}
75
}
if (txtAge.Text.Trim(' ').Length == 0)
{
MessageBox.Show("Please enter age of the passenger.",
"Input Error", MessageBoxButtons.OK,
MessageBoxIcon.Error);
txtAge.Focus();
return;
}
string str2 = txtAge.Text.ToString();
foreach (char c in str2)
{
if (char.IsLetter(c))
{
MessageBox.Show("You cannot enter characters in Age.",
"Input Error", MessageBoxButtons.OK,
MessageBoxIcon.Error);
txtAge.Text = "";
return;
}
}
76
{
MessageBox.Show("Please specify the meal preference of the
passenger.", "Input Error", MessageBoxButtons.OK,
MessageBoxIcon.Error);
return;
}
try
{
System.Data.OleDb.OleDbCommand cmdSave;
cmdSave = new System.Data.OleDb.OleDbCommand("insert
into Passenger values(?,?,?,?,?,?,?,?,?,?,?,?)", con);
System.Data.OleDb.OleDbParameter p1, p2, p3, p4, p5, p6,
p7, p8, p9, p10, p11, p12;
p1 = new System.Data.OleDb.OleDbParameter("PnrNo",
System.Data.OleDb.OleDbType.VarChar);
p2 = new
System.Data.OleDb.OleDbParameter("Flight_Number",
System.Data.OleDb.OleDbType.VarChar);
p3 = new System.Data.OleDb.OleDbParameter("Travel_Date",
System.Data.OleDb.OleDbType.VarChar);
p4 = new System.Data.OleDb.OleDbParameter("FName",
System.Data.OleDb.OleDbType.VarChar);
p5 = new System.Data.OleDb.OleDbParameter("LName",
System.Data.OleDb.OleDbType.VarChar);
p6 = new System.Data.OleDb.OleDbParameter("Age",
System.Data.OleDb.OleDbType.VarChar);
p7 = new System.Data.OleDb.OleDbParameter("Gender",
System.Data.OleDb.OleDbType.VarChar);
p8 = new System.Data.OleDb.OleDbParameter("Class",
System.Data.OleDb.OleDbType.VarChar);
p9 = new System.Data.OleDb.OleDbParameter("SeatPref",
System.Data.OleDb.OleDbType.VarChar);
p10 = new System.Data.OleDb.OleDbParameter("MealPref",
System.Data.OleDb.OleDbType.VarChar);
p11 = new System.Data.OleDb.OleDbParameter("SSR",
System.Data.OleDb.OleDbType.VarChar);
p12 = new System.Data.OleDb.OleDbParameter("Status",
System.Data.OleDb.OleDbType.VarChar);
cmdSave.Parameters.Add(p1);
77
cmdSave.Parameters.Add(p2);
cmdSave.Parameters.Add(p3);
cmdSave.Parameters.Add(p4);
cmdSave.Parameters.Add(p5);
cmdSave.Parameters.Add(p6);
cmdSave.Parameters.Add(p7);
cmdSave.Parameters.Add(p8);
cmdSave.Parameters.Add(p9);
cmdSave.Parameters.Add(p10);
cmdSave.Parameters.Add(p11);
cmdSave.Parameters.Add(p12);
strNewPnr = null;
strNewPnr = GeneratePNRNo();
cmdSave.Parameters[0].Value = strNewPnr;
cmdSave.Parameters[1].Value = lstFlightNo.Text;
cmdSave.Parameters[2].Value = dtpTravelDate.Value;
cmdSave.Parameters[3].Value = txtFName.Text;
cmdSave.Parameters[4].Value = txtLName.Text;
cmdSave.Parameters[5].Value = txtAge.Text;
cmdSave.Parameters[6].Value = strGender;
cmdSave.Parameters[7].Value = cmbClass.Text;
cmdSave.Parameters[8].Value = strSeatPref;
cmdSave.Parameters[9].Value = strMealPref;
cmdSave.Parameters[10].Value = txtSSR.Text;
cmdSave.Parameters[11].Value = "Booked";
DialogResult intres;
intres = MessageBox.Show("Do you want to continue",
"Confirmation Required", MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
if (intres == DialogResult.Yes)
{
if (cmbClass.Text == "First")
{
System.Data.OleDb.OleDbDataAdapter adp1;
adp1 = new System.Data.OleDb.OleDbDataAdapter("select
FirstClassSeatAvailable from ScheduledFlight where
Flight_number=?", con);
System.Data.OleDb.OleDbParameter p;
78
p = new
System.Data.OleDb.OleDbParameter("Flight_Number",
System.Data.OleDb.OleDbType.VarChar);
adp1.SelectCommand.Parameters.Add(p);
adp1.SelectCommand.Parameters[0].Value =
lstFlightNo.Text;
DataSet ds1 = new DataSet();
adp1.Fill(ds1);
string firstseat = ds1.Tables[0].Rows[0][0].ToString();
int fseat;
fseat = System.Convert.ToInt32(firstseat);
if (fseat > 0)
{
fseat = fseat - 1;
firstseat = System.Convert.ToString(fseat);
System.Data.OleDb.OleDbCommand cmdin;
cmdin = new System.Data.OleDb.OleDbCommand("update
ScheduledFlight set FirstClassSeatAvailable=? where
Flight_Number=?", con);
System.Data.OleDb.OleDbParameter p15, p16;
p15 = new
System.Data.OleDb.OleDbParameter("FirstClassSeatAvailabl
e", System.Data.OleDb.OleDbType.VarChar);
p16 = new
System.Data.OleDb.OleDbParameter("Flight_Number",
System.Data.OleDb.OleDbType.VarChar);
cmdin.Parameters.Add(p15);
cmdin.Parameters.Add(p16);
cmdin.Parameters[0].Value = firstseat;
cmdin.Parameters[1].Value = lstFlightNo.Text;
int result;
cmdSave.ExecuteNonQuery();
result = cmdin.ExecuteNonQuery();
if (result >= 1)
MessageBox.Show("Record inserted,PnrNo is" + strNewPnr);
else
MessageBox.Show("Record not inserted");
}
else
79
{
MessageBox.Show("Sorry! Seats are not Available for this flight
in the class.");
}
}
if (cmbClass.Text == "Bussiness")
{
System.Data.OleDb.OleDbDataAdapter adp2;
adp2 = new System.Data.OleDb.OleDbDataAdapter("select
BussinessClassSeatAvailable from ScheduledFlight where
Flight_number=?", con);
System.Data.OleDb.OleDbParameter pb;
pb = new
System.Data.OleDb.OleDbParameter("Flight_Number",
System.Data.OleDb.OleDbType.VarChar);
adp2.SelectCommand.Parameters.Add(pb);
adp2.SelectCommand.Parameters[0].Value =
lstFlightNo.Text;
DataSet ds2 = new DataSet();
adp2.Fill(ds2);
string firstseat = ds2.Tables[0].Rows[0][0].ToString();
int fseat;
fseat = System.Convert.ToInt32(firstseat);
if (fseat > 0)
{
fseat = fseat - 1;
firstseat = System.Convert.ToString(fseat);
System.Data.OleDb.OleDbCommand cmdup;
cmdup = new System.Data.OleDb.OleDbCommand("update
ScheduledFlight set BussinessClassSeatAvailable=? where
Flight_Number=?", con);
System.Data.OleDb.OleDbParameter p17, p18;
p17 = new
System.Data.OleDb.OleDbParameter("BussinessClassSeatAv
ailable", System.Data.OleDb.OleDbType.VarChar);
p18 = new
System.Data.OleDb.OleDbParameter("Flight_Number",
System.Data.OleDb.OleDbType.VarChar);
cmdup.Parameters.Add(p17);
80
cmdup.Parameters.Add(p18);
cmdup.Parameters[0].Value = firstseat;
cmdup.Parameters[1].Value = lstFlightNo.Text;
cmdSave.ExecuteNonQuery();
cmdup.ExecuteNonQuery();
MessageBox.Show("Record inserted,PnrNo:" + strNewPnr);
}
else
{
MessageBox.Show("Sorry! Seats are not Available for this flight
in the class.");
}
}
if (cmbClass.Text == "Economy")
{
System.Data.OleDb.OleDbDataAdapter adp3;
adp3 = new System.Data.OleDb.OleDbDataAdapter("select
EconomyClassSeatAvailable from ScheduledFlight where
Flight_number=?", con);
System.Data.OleDb.OleDbParameter pe;
pe = new
System.Data.OleDb.OleDbParameter("Flight_Number",
System.Data.OleDb.OleDbType.VarChar);
adp3.SelectCommand.Parameters.Add(pe);
adp3.SelectCommand.Parameters[0].Value =
lstFlightNo.Text;
DataSet ds3 = new DataSet();
adp3.Fill(ds3);
string firstseat = ds3.Tables[0].Rows[0][0].ToString();
int fseat;
fseat = System.Convert.ToInt32(firstseat);
if (fseat > 0)
{
fseat = fseat - 1;
firstseat = System.Convert.ToString(fseat);
System.Data.OleDb.OleDbCommand cmdeup;
81
cmdeup = new System.Data.OleDb.OleDbCommand("update
ScheduledFlight set EconomyClassSeatAvailable=? where
Flight_Number=?", con);
System.Data.OleDb.OleDbParameter p19, p20;
p19 = new
System.Data.OleDb.OleDbParameter("EconomyClassSeatAva
ilable", System.Data.OleDb.OleDbType.VarChar);
p20 = new
System.Data.OleDb.OleDbParameter("Flight_Number",
System.Data.OleDb.OleDbType.VarChar);
cmdeup.Parameters.Add(p19);
cmdeup.Parameters.Add(p20);
cmdeup.Parameters[0].Value = firstseat;
cmdeup.Parameters[1].Value = lstFlightNo.Text;
cmdSave.ExecuteNonQuery();
cmdeup.ExecuteNonQuery();
MessageBox.Show("Record inserted,PnrNo is:" + strNewPnr);
}
else
{
MessageBox.Show("Sorry! Seats are not Available for this flight
int the class.");
}
}
}
else
{
MessageBox.Show("Record not inserted");
}
System.Data.OleDb.OleDbCommand cmdDaily;
cmdDaily = new System.Data.OleDb.OleDbCommand("insert
into DailyCollection values(?,?,?,?)", con);
System.Data.OleDb.OleDbParameter pd1, pd2, pd3, pd4;
pd1 = new System.Data.OleDb.OleDbParameter("PnrNo",
System.Data.OleDb.OleDbType.VarChar);
pd2 = new System.Data.OleDb.OleDbParameter("TranDate",
System.Data.OleDb.OleDbType.VarChar);
pd3 = new System.Data.OleDb.OleDbParameter("TranType",
System.Data.OleDb.OleDbType.VarChar);
82
pd4 = new System.Data.OleDb.OleDbParameter("Amount",
System.Data.OleDb.OleDbType.VarChar);
cmdDaily.Parameters.Add(pd1);
cmdDaily.Parameters.Add(pd2);
cmdDaily.Parameters.Add(pd3);
cmdDaily.Parameters.Add(pd4);
cmdDaily.Parameters[0].Value = strNewPnr;
cmdDaily.Parameters[1].Value = System.DateTime.Today;
cmdDaily.Parameters[2].Value = "Collection";
cmdDaily.Parameters[3].Value = txtFareAmount.Text;
cmdDaily.ExecuteNonQuery();
PrintTicket frmPrintTicket = new PrintTicket();
frmPrintTicket.lblPnr.Text = strNewPnr;
frmPrintTicket.lblName.Text = txtFName.Text;
frmPrintTicket.lblLName.Text = txtLName.Text;
frmPrintTicket.lblFlightno.Text = lstFlightNo.Text + "(" +
lstDescription.Text + ")";
frmPrintTicket.lblDate.Text = dtpTravelDate.Text;
frmPrintTicket.lblclass.Text = cmbClass.Text;
frmPrintTicket.lblfare.Text = txtFareAmount.Text;
frmPrintTicket.ShowDialog();
}
catch
{
}
}
private void rbMale_CheckedChanged(object sender,
EventArgs e)
{
strGender = "M";
}
83
private void rbAisle_CheckedChanged(object sender,
EventArgs e)
{
strSeatPref = "Aisle";
}
84
DataSet dsSec = new DataSet();
sect.Fill(dsSec);
strSecter = dsSec.Tables[0].Rows[0][0].ToString();
System.Data.OleDb.OleDbDataAdapter adp1;
adp1 = new System.Data.OleDb.OleDbDataAdapter("select
FirstClassFare from Secter where Secter_ID=?", con);
System.Data.OleDb.OleDbParameter ps;
ps = new System.Data.OleDb.OleDbParameter("Secter_ID",
System.Data.OleDb.OleDbType.VarChar);
adp1.SelectCommand.Parameters.Add(ps);
adp1.SelectCommand.Parameters[0].Value = strSecter;
DataSet ds1 = new DataSet();
ds1.Clear();
adp1.Fill(ds1);
txtFareAmount.Text = ds1.Tables[0].Rows[0][0].ToString();
}
else if (cmbClass.Text == "Bussiness")
{
System.Data.OleDb.OleDbDataAdapter sect;
sect = new System.Data.OleDb.OleDbDataAdapter("select
Sector_ID from Flight where Flight_Number=?", con);
System.Data.OleDb.OleDbParameter p;
p = new
System.Data.OleDb.OleDbParameter("Flight_Number",
System.Data.OleDb.OleDbType.VarChar);
sect.SelectCommand.Parameters.Add(p);
sect.SelectCommand.Parameters[0].Value =
lstFlightNo.SelectedValue.ToString();
DataSet dsSec = new DataSet();
sect.Fill(dsSec);
strSecter = dsSec.Tables[0].Rows[0][0].ToString();
System.Data.OleDb.OleDbDataAdapter adp1;
adp1 = new System.Data.OleDb.OleDbDataAdapter("select
BussinessClassFare from Secter where Secter_ID=?", con);
System.Data.OleDb.OleDbParameter ps;
ps = new System.Data.OleDb.OleDbParameter("Secter_ID",
System.Data.OleDb.OleDbType.VarChar);
adp1.SelectCommand.Parameters.Add(ps);
adp1.SelectCommand.Parameters[0].Value = strSecter;
85
DataSet ds1 = new DataSet();
ds1.Clear();
adp1.Fill(ds1);
txtFareAmount.Text = ds1.Tables[0].Rows[0][0].ToString();
}
else if (cmbClass.Text == "Economy")
{
System.Data.OleDb.OleDbDataAdapter sect;
sect = new System.Data.OleDb.OleDbDataAdapter("select
Sector_ID from Flight where Flight_Number=?", con);
System.Data.OleDb.OleDbParameter p;
p = new
System.Data.OleDb.OleDbParameter("Flight_Number",
System.Data.OleDb.OleDbType.VarChar);
sect.SelectCommand.Parameters.Add(p);
sect.SelectCommand.Parameters[0].Value =
lstFlightNo.SelectedValue.ToString();
DataSet dsSec = new DataSet();
sect.Fill(dsSec);
strSecter = dsSec.Tables[0].Rows[0][0].ToString();
System.Data.OleDb.OleDbDataAdapter adp1;
adp1 = new System.Data.OleDb.OleDbDataAdapter("select
EconomyClassFare from Secter where Secter_ID=?", con);
System.Data.OleDb.OleDbParameter ps;
ps = new System.Data.OleDb.OleDbParameter("Secter_ID",
System.Data.OleDb.OleDbType.VarChar);
adp1.SelectCommand.Parameters.Add(ps);
adp1.SelectCommand.Parameters[0].Value = strSecter;
DataSet ds1 = new DataSet();
ds1.Clear();
adp1.Fill(ds1);
txtFareAmount.Text = ds1.Tables[0].Rows[0][0].ToString();
}
}
86
adpdate = new
System.Data.OleDb.OleDbDataAdapter("select Flight_Date
from ScheduledFlight where Flight_Number=?", con);
System.Data.OleDb.OleDbParameter pdate;
pdate = new
System.Data.OleDb.OleDbParameter("Flight_Number",
System.Data.OleDb.OleDbType.VarChar);
adpdate.SelectCommand.Parameters.Add(pdate);
adpdate.SelectCommand.Parameters[0].Value =
lstFlightNo.Text;
DataSet dsDate = new DataSet();
adpdate.Fill(dsDate);
dtpTravelDate.Text = dsDate.Tables[0].Rows[0]
[0].ToString();
txtFareAmount.Text = "";
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Printing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace AIRLINE_RESERVATION
{
public partial class PrintTicket : Form
{
public PrintTicket()
{
87
InitializeComponent();
}
StringReader myReader;
private void PrintTicket_Load(object sender, EventArgs e)
{
rbtTicket.BackColor = Color.White;
rbtTicket.Text = " HORIZON AIRWAYS
";
rbtTicket.Text += '\r' + " Passenger Ticket
";
rbtTicket.Text += '\r' +
"__________________________________________________
___";
rbtTicket.Text += '\r' +"
"+"Date of Issue:" +
System.DateTime.Today.ToShortDateString();
rbtTicket.Text += '\r' + "NOT TRANSFERABLE" + '\r' ;
rbtTicket.Text += '\r' + "PNR No. : "
+ lblPnr.Text + " Passenger Name:" + lblName.Text + " "
+ lblLName.Text + '\r' ;
rbtTicket.Text += '\r' + "Flight No. :" + lblFlightno.Text + '\r' ;
rbtTicket.Text += '\r' + "Class Travel
Date Fare";
rbtTicket.Text +='\r' +
"__________________________________________________
_____";
rbtTicket.Text += '\r' + lblclass.Text + " "
+ lblDate.Text+" " + lblfare.Text;
}
88
float lineperpage = 0;
float yPosition = 0;
int count = 0;
float leftMargin = e.MarginBounds.Left;
float topMargin = e.MarginBounds.Top;
string line = null;
Font PrintFont = rbtTicket.Font;
SolidBrush myBrush = new SolidBrush(Color.Black);
lineperpage = e.MarginBounds.Height /
PrintFont.GetHeight(e.Graphics);
while (count < lineperpage && ((line =
myReader.ReadLine()) != null))
{
yPosition = topMargin + (count *
PrintFont.GetHeight(e.Graphics));
e.Graphics.DrawString(line, PrintFont, myBrush,
leftMargin, yPosition, new StringFormat());
count++;
}
if (line != null)
e.HasMorePages = true;
else
e.HasMorePages = false;
myBrush.Dispose();
}
}
private void btnPrint_Click(object sender, EventArgs e)
{
try
{
PrintDialog pntDialog = new PrintDialog();
PrintDocument pDocument = new PrintDocument();
pntDialog.Document = pDocument;
string strText = rbtTicket.Text;
myReader = new StringReader(strText);
DialogResult result = pntDialog.ShowDialog();
if (result == System.Windows.Forms.DialogResult.OK)
pDocument.Print();
}
89
catch
{
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AIRLINE_RESERVATION
{
public partial class CancelReservation : Form
{
System.Data.OleDb.OleDbConnection con;
public CancelReservation()
{
InitializeComponent();
}
90
txtFName.Text = "";
txtLName.Text = "";
txtAge.Text = "";
txtGender.Text = "";
txtTravelDate.Text = "";
txtClass.Text = "";
txtStatus.Text = "";
txtAmountPaid.Text = "";
txtRefundAmt.Text = "";
btnGetDetails.Enabled = true;
btnCancel.Enabled = false;
}
private void CalculateRefundAmt()
{
if (txtStatus.Text.Trim(' ') == "Booked")
{
txtRefundAmt.Text = txtAmountPaid.Text;
}
else
{
System.DateTime dtDate = DateTime.MinValue;
dtDate = System.Convert.ToDateTime(txtTravelDate.Text);
System.DateTime dtTravelDate = new
DateTime(dtDate.Year,dtDate.Month,dtDate.Day);
int intNumDays = 0;
intNumDays =
dtTravelDate.Subtract(System.DateTime.Today.Date).Days;
if (intNumDays <= 1)
{
txtRefundAmt.Text =
System.Convert.ToString(System.Convert.ToDecimal(txtAmou
ntPaid.Text) * Convert.ToDecimal(0.9));
}
else
{
txtRefundAmt.Text = txtAmountPaid.Text;
}
}
}
91
private void btnBack_Click(object sender, EventArgs e)
{
MainForm mfrm = new MainForm();
mfrm.textBox1.Text = textBox1.Text;
mfrm.Show();
this.Hide();
}
92
adpfirst = new
System.Data.OleDb.OleDbDataAdapter("select
FirstClassSeatAvailable from scheduledFlight where
Flight_Number=?", con);
System.Data.OleDb.OleDbParameter pf;
pf = new
System.Data.OleDb.OleDbParameter("Flight_Nmuber",
System.Data.OleDb.OleDbType.VarChar);
adpfirst.SelectCommand.Parameters.Add(pf);
adpfirst.SelectCommand.Parameters[0].Value =
txtFlightNo.Text;
DataSet dsfirst = new DataSet();
adpfirst.Fill(dsfirst);
strseat = dsfirst.Tables[0].Rows[0][0].ToString();
seat = System.Convert.ToInt32(strseat);
seat = seat + 1;
strseat = System.Convert.ToString(seat);
System.Data.OleDb.OleDbCommand cmdfseat;
cmdfseat = new
System.Data.OleDb.OleDbCommand("update ScheduledFlight
set FirstClassSeatAvailable=? where Flight_Number=?", con);
System.Data.OleDb.OleDbParameter fseat, fnum;
fseat = new
System.Data.OleDb.OleDbParameter("FirstClassSeatAvailabl
e", System.Data.OleDb.OleDbType.VarChar);
fnum = new
System.Data.OleDb.OleDbParameter("Flight_Number",
System.Data.OleDb.OleDbType.VarChar);
cmdfseat.Parameters.Add(fseat);
cmdfseat.Parameters.Add(fnum);
cmdfseat.Parameters[0].Value = strseat;
cmdfseat.Parameters[1].Value = txtFlightNo.Text;
cmdfseat.ExecuteNonQuery();
}
if (txtClass.Text == "Bussiness")
{
MessageBox.Show("Reservation has been cancelled",
"Application Message", MessageBoxButtons.OK);
System.Data.OleDb.OleDbDataAdapter adpfirst;
93
adpfirst = new
System.Data.OleDb.OleDbDataAdapter("select
BussinessClassSeatAvailable from scheduledFlight where
Flight_Number=?", con);
System.Data.OleDb.OleDbParameter pf;
pf = new
System.Data.OleDb.OleDbParameter("Flight_Nmuber",
System.Data.OleDb.OleDbType.VarChar);
adpfirst.SelectCommand.Parameters.Add(pf);
adpfirst.SelectCommand.Parameters[0].Value =
txtFlightNo.Text;
DataSet dsfirst = new DataSet();
adpfirst.Fill(dsfirst);
strseat = dsfirst.Tables[0].Rows[0][0].ToString();
seat = System.Convert.ToInt32(strseat);
seat = seat + 1;
strseat = System.Convert.ToString(seat);
System.Data.OleDb.OleDbCommand cmdfseat;
cmdfseat = new
System.Data.OleDb.OleDbCommand("update ScheduledFlight
set BussinessClassSeatAvailable=? where Flight_Number=?",
con);
System.Data.OleDb.OleDbParameter fseat, fnum;
fseat = new
System.Data.OleDb.OleDbParameter("BussinessClassSeatAv
ailable", System.Data.OleDb.OleDbType.VarChar);
fnum = new
System.Data.OleDb.OleDbParameter("Flight_Number",
System.Data.OleDb.OleDbType.VarChar);
cmdfseat.Parameters.Add(fseat);
cmdfseat.Parameters.Add(fnum);
cmdfseat.Parameters[0].Value = strseat;
cmdfseat.Parameters[1].Value = txtFlightNo.Text;
cmdfseat.ExecuteNonQuery();
}
if (txtClass.Text == "Economy")
{
94
MessageBox.Show("Reservation has been cancelled",
"Application Message", MessageBoxButtons.OK);
System.Data.OleDb.OleDbDataAdapter adpfirst;
adpfirst = new
System.Data.OleDb.OleDbDataAdapter("select
EconomyClassSeatAvailable from scheduledFlight where
Flight_Number=?", con);
System.Data.OleDb.OleDbParameter pf;
pf = new
System.Data.OleDb.OleDbParameter("Flight_Nmuber",
System.Data.OleDb.OleDbType.VarChar);
adpfirst.SelectCommand.Parameters.Add(pf);
adpfirst.SelectCommand.Parameters[0].Value =
txtFlightNo.Text;
DataSet dsfirst = new DataSet();
adpfirst.Fill(dsfirst);
strseat = dsfirst.Tables[0].Rows[0][0].ToString();
seat = System.Convert.ToInt32(strseat);
seat = seat + 1;
strseat = System.Convert.ToString(seat);
System.Data.OleDb.OleDbCommand cmdfseat;
cmdfseat = new
System.Data.OleDb.OleDbCommand("update ScheduledFlight
set EconomyClassSeatAvailable=? where Flight_Number=?",
con);
System.Data.OleDb.OleDbParameter fseat, fnum;
fseat = new
System.Data.OleDb.OleDbParameter("EconomyClassSeatAva
ilable", System.Data.OleDb.OleDbType.VarChar);
fnum = new
System.Data.OleDb.OleDbParameter("Flight_Number",
System.Data.OleDb.OleDbType.VarChar);
cmdfseat.Parameters.Add(fseat);
cmdfseat.Parameters.Add(fnum);
cmdfseat.Parameters[0].Value = strseat;
cmdfseat.Parameters[1].Value = txtFlightNo.Text;
cmdfseat.ExecuteNonQuery();
}
}
95
PrintRefundRefundReceipt frmPrint = new
PrintRefundRefundReceipt();
frmPrint.label1.Text = txtFName.Text.Trim(' ') + " " +
txtLName.Text.Trim(' ');
frmPrint.label2.Text = txtPnrNo.Text.Trim(' ');
frmPrint.label3.Text = txtRefundAmt.Text;
frmPrint.ShowDialog();
}
96
if (txtPnrNo.Text.Trim(' ').Length == 0)
{
MessageBox.Show("Please enter PNR number","Input
Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
return;
}
System.Data.OleDb.OleDbDataAdapter adp;
adp = new System.Data.OleDb.OleDbDataAdapter("select
Flight_Number,travelDate,FName,Lname,Age,Gender,Class,St
atus,Amount from Passenger,DailyCollection where
Passenger.PnrNo=?",con);
System.Data.OleDb.OleDbParameter p;
p = new
System.Data.OleDb.OleDbParameter("PnrNo",System.Data.
OleDb.OleDbType.VarChar);
adp.SelectCommand.Parameters.Add(p);
adp.SelectCommand.Parameters[0].Value = txtPnrNo.Text;
DataSet ds = new DataSet();
ds.Clear();
adp.Fill(ds);
if (ds.Tables[0].Rows.Count == 0)
{
MessageBox.Show("PNR number not found. Please re-
enter","Input
Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
return;
}
string a = ds.Tables[0].Rows[0]["Status"].ToString();
if (a.Trim() == "Cancelled")
{
MessageBox.Show("The ticket is already cancelled","Input
Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
return;
}
if(Convert.ToDateTime(ds.Tables[0].Rows[0]
["TravelDate"].ToString()) < System.DateTime.Today)
{
97
MessageBox.Show("Cannot cancel the ticket since the travel
date is less than the current date.","Input
Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
return;
}
DataRow objDR = null;
objDR = ds.Tables[0].Rows[0];
txtFlightNo.Text= objDR["Flight_Number"].ToString();
txtFName.Text = objDR["FName"].ToString();
txtLName.Text = objDR["LName"].ToString();
txtTravelDate.Text = objDR["TravelDate"].ToString();
txtAge.Text = objDR["Age"].ToString();
txtGender.Text = objDR["Gender"].ToString();
txtClass.Text = objDR["Class"].ToString();
txtStatus.Text = objDR["Status"].ToString();
txtAmountPaid.Text = objDR["Amount"].ToString();
CalculateRefundAmt();
btnGetDetails.Enabled = false;
btnCancel.Enabled = true;
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Printing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace AIRLINE_RESERVATION
{
98
public partial class PrintRefundRefundReceipt : Form
{
public PrintRefundRefundReceipt()
{
InitializeComponent();
}
StringReader myReader;
99
if (rtbRefundReciept.Text != null)
{
float lineperpage = 0;
float yPosition = 0;
int count = 0;
float leftMargin = e.MarginBounds.Left;
float topMargin = e.MarginBounds.Top;
string line = null;
Font PrintFont = rtbRefundReciept.Font;
SolidBrush myBrush = new SolidBrush(Color.Black);
lineperpage = e.MarginBounds.Height /
PrintFont.GetHeight(e.Graphics);
while (count < lineperpage && ((line=myReader.ReadLine())
!= null))
{
yPosition = topMargin + (count *
PrintFont.GetHeight(e.Graphics));
e.Graphics.DrawString(line, PrintFont, myBrush,
leftMargin, yPosition, new StringFormat());
count++;
}
if (line != null)
e.HasMorePages = true;
else
e.HasMorePages = false;
myBrush.Dispose();
}
}
100
if (result == System.Windows.Forms.DialogResult.OK)
pDocument.Print();
}
catch
{
}
}
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AIRLINE_RESERVATION
{
public partial class Flash : Form
{
public Flash()
{
InitializeComponent();
}
101
}
}
}
}
***
102