Sunteți pe pagina 1din 64

Presented By:-

Dheeraj Raj

1
Indian Railway
Batch Code :-
Start Date :- 15th may 2009 End Date:-7th june 2009
Name of the Developer :- Dheeraj Raj

Date of Submission :- 8th june 2009

2
CERTIFICATE

This is to certify that this project, titled


“INDIAN RALWAY” embodies the original
work done by Dheeraj Raj in partial fulfillment
of their GNIIT course requirement at ..

DECLARATION

3
This is to declare that Dheeraj Raj have completed the project
on:-
I have developed this application using Visual C# as front end
and MS Access2003 as back end and bound them using Database
Applications using ADO.NET, and use Windows XP operating system
within the period of three months.

ACKNOWLEDGEMENTS

4
I am feeling very happy to present this project.
It is a fascinating project. It amounted to make
research, deep and wide; to create ,recreate
and reproduce; and ultimately to edit it all
according to the dictates of the basic
requirements of the project.

I would like to express my sincere gratitude


and indebtedness to my faculty … who has
given his valuable suggestions for the
improvement of the quality of this project.

Dedicated to god…………

Dhiraj Raj

To make this project we also referred a book called “Trains at a


glance”, World Book CD 1999 and various websites like google.com,
indianrailway.gov.in. Etc.

5
CONTENTS

1. Introduction Pages
a. Overview ..……………………… 7
b. Definition
2. Objectives………………………………….……….. 8
3. System Analysis……………………….………….. 9
4. System Design
a. Database structure ………….…………….. 10-
12
b. ER_Digram ………….………………………… 13
5. Coding
a. Form.cs [Design] ………………………… 14-
46
b. Form.cs
6. Sample Output…………………………………….. 47-
59
7. Future scope
8. Conclusion ……………………….. 60
9. Bibliography ……………………..………………... 61-
62

6
1 Introduction

[a] Overview

This project aims to model the working of a client Railway


Reservation System. The project has been built and tested on the MS
Access, and uses C# programming language. SQLCLIENT, ODBC was
used as an interface between Database and C#. The MS Access is
used for Backend and C# is used for the front end.
This project is built to the model the reservation system as
closely as possible. Some features are:-
*Separate profile for users, containing all their personal data.
*Finding train scheduling information.
*Handling train schedules across multiple stops, and multiple
stations in one city.

[b] Definition

Train type: this defines the physical type of train. It dictates


(*different types of trains like Rajhdhani, Express, goods train... etc.)
A/c, First class, Second class and Sleeper seats that a train have.
Stations: A station consists of a name, a station code.
Train: A train is identified by its number and its name.
Ticket: A ticket is unequally identified by the PNR_number, the ticket
like a passengers tickets and can be booked under a passenger profile.

7
A ticket is booked on a train for a route that the train is associated
with. A passenger ticket contains all details of the passengers.

2 Objectives
The objectives of making this project are as follows:-

• Train Enquiry
It helps to search a particular train’s information. It
contains the details of train number, its name, service, departure
and arriving stations and times.
• Train status
It helps to search train’s status details. It contains the
details of train’s number and its available coaches and seats.
• Reservations
tickets are reserved for 10 days in advance. It contains all
the information of the passenger’s details that is pnr_number,
ticket-number, train_no. train-name, name, age, date of journey,
etc.
• Cancellation
It helps to cancel the records of reservation details of a
particular person.
• Update train status
This form helps to modify and save the current status of
the train.
• PNR status
This helps to check current status of the reserved ticket.
• Day-to-Day report
This form helps to enter all arrival and departure details of
a train.

8
3 System Analysis

The system analyses are mainly classified into two.


They are follows:-

*Hardware requirements

Processor Intel Pentium IV


Minimum RAM 256MB
Hard disk 40GB

*Software requirements

*Windows XP Operating System.


*Microsoft Visual Studio 2005.
*MS Access 2003.

9
4 System Design

[a] Database structure

The database structure contains the list of tables in the database


constraints

[1] TRAIN_INFO Table structure

Field Data Field size constraints


Name type (characters)
Train_No Text 50 Primary key
Train Name Text 50 Not null
Services Text 50 Not null

10
Station1 Text 50 Not null
Time1 Text 50 Not null
Station2 Text 50 Not null
Time2 Text 50 Not null
Station3 Text 50 Not null
Time3 Text 50 Not null
Station4 Text 50 Not null
Time4 Text 50 Not null
Station5 Text 50 Not null
Time5 Text 50 Not null
Station6 Text 50 Not null
Time6 Text 50 Not null
Station7 Text 50 Not null
Time7 Text 50 Not null
Station8 Text 50 Not null
Time8 Text 50 Not null
Station9 Text 50 Not null
Time9 Text 50 Not null
Station10 Text 50 Not null
Time10 Text 50 Not null
Station11 Text 50 Not null
Time11 Text 50 Not null
Station12 Text 50 Not null
Time12 Text 50 Not null

[2] DAY-TO-DAY Table structure

Field Data type Field size constraint


Name (characters) s
Train_No Text 50 Primary key
Train Name Text 50 Not null
Arrival Text 50 Not null
Departure Text 50 Not null
Time Text 50 Not null
Boarding Text 50 Not null
Destination Text 50 Not null

[3] RESERVATION Table

Field Name Data Field size constraint


type (characters) s
Pnr_no Text 50 Primary key
Ticket_no Text 50 Not null
Train_no Text 50 Not null

11
Train_name Text 50 Not null
Boarding Text 50 Not null
Destination Text 50 Not null
Class Text 50 Not null
Seat Text 50 Not null
Birth Text 50 Not null
Couch Text 50 Not null
Date_of_journey Text 50 Not null
Name Text 50 Not null
Age Text 50 Not null
Gender Text 50 Not null
Personal_status Text 50 Not null
Address Text 50 Not null
Phone_no Text 50 Not null
Ticket_status Text 50 Not null
Amount Text 50 Not null
Application_date Text 50 Not null
Current_time Text 50 Not null

[4] TRAIN_STATUS Table

Field Name Data Field constraints


type size
(characters)
Train_No Text 50 Primary key
I_AC Text 50 Not null
II_AC Text 50 Not null
III_AC Text 50 Not null
CC Text 50 Not null
EX_EC Text 50 Not null
FC Text 50 Not null
SL Text 50 Not null
II-C Text 50 Not null

[5] TRAIN_FARE Table

Field Name Data Field size constraints


type (characters)
Train_No Text 50 Primary key
I_AC Text 50 Not null
II_AC Text 50 Not null
III_AC Text 50 Not null
III_AC Text 50 Not null

12
CC Text 50 Not null
EX_EC Text 50 Not null
FC Text 50 Not null
SL Text 50 Not null
II-C Text 0 Not null

[b] ER_DIAGRAM

13
5 Coding

Form1.cs [Design]

14
Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Railway_project
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

private void button2_Click(object sender, EventArgs e)


{
Application.Exit();

15
}

private void button1_Click(object sender, EventArgs e)


{
string name, pass;
name = textBox1.Text;
pass = textBox2.Text;
if ((name == "railway") && (pass == "password"))
{
Form2 f2 = new Form2();
f2.Show();
}
else
{
label3.Text = "Invalid User_name and Password...,Try
Again...";
textBox1.Focus();
textBox1.Text = "";
textBox2.Text = "";
}
//this.Close();
}

private void Form1_Load(object sender, EventArgs e)


{

}
}
}
*************

Form2.cs [Design]

16
Form2.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Railway_project
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}

private void Form2_Load(object sender, EventArgs e)


{
//label1.Text = "Welcome....to..";
label2.Text = "INDIAN RAILWAY ";
label3.Text = DateTime.Now.ToLongDateString();

label4.Text = DateTime.Now.ToShortTimeString();
}

17
private void button1_Click(object sender, EventArgs e)
{
Form3 f3 = new Form3();
f3.Show();
this.Close();
}
}
}

*****************

Form3.cs[Design]

Form3.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;

18
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Railway_project
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}

private void label2_Click(object sender, EventArgs e)


{
MessageBox.Show("You can reserve your ticket 10 Days in
advance.\nYou can also use the internet-ticket visit website:-
<www.irctc.co.in>\nthe paymet can be made directly through the
site.1340-\ncomuterised Resevation centers across the country.\n\nIf
you know the ticket-staus for the Indian Railway passanger
information\nvisit <website:www.indianrailways.gov.in>\n\nThe
telephone-numbers at mettropolitan cities are
follows:\n\nKolkatta:138\tChennai:131,1361,1362,1363\nMumbai:132,137(PN
R-ENQUIRY),\n136(Arrival/Depature Enquiry),New_Delhi:1330,1335.\n*On
these numbers and followed step-by-step instructions....");
}

private void label3_Click(object sender, EventArgs e)


{
MessageBox.Show("Each passenger is allowed a Free Allowance
up to which he can carry luggage \nwhith him in the compartment,free
cost.Children aged 5 and below 12years are\nallowed half of the Fare-
Allowance subject to the max.of 50kgs.\n\n Class:I-
AC\tMax.Limit:150kgs\tFree-Allowance(max.Limit):70kgs\nMarginal
Allow.for luggage:15kgs\n\nClass:II-AC/FC\tMax.Limit:100kgs\tFree-
Allowance(max.Limit):50kgs\nMarginal Allow.for
luggage:10kgs\n\nClass:3tire/CC\tMax.Limit:40kgs\tFree-
Allowance(max.Limit):40kgs\nMarginal Allow.for
luggage:10kgs\n\nClass:SL(Ex/Ordy)\tMax.Limit:80kgs\tFree-
Allowance(max.Limit):40kgs\nMarginal Allow.for
luggage:10kgs\n\nClass:II-C(Ex/Ordy)\tMax.Limit:70kgs\tFree-
Allowance(max.Limit):35kgs\nMarginal Allow.for luggage:10kgs\n ");
}

private void label4_Click(object sender, EventArgs e)


{
MessageBox.Show("<Western Railway
:www.westernrailwayindia.com>\n<Eastern Railway
:www.easternrailway.gov.in>\n<Northern Railway
:www.uttarrailway.com>\n<South Eastern Railway
:www.serailway.com>\n<Southern Railway :www.srailway.corn>\n<Central
Railway :www.centralrailwayonline.com> ");
}

private void label5_Click(object sender, EventArgs e)


{

19
MessageBox.Show("To get maximum benefit and save on
cancellation charges,\npassengers are requested to cancel their
ticket\n within the prescribed ime limits.\nTime-Limits
are:-\n\nDistance of Journey\t\tTime Limit for
Cancellation\n\t\t\t\t(After the sche.depat.train)\n\nUp
to200Kms\t\t\t\t3hrs\n201to500kms\t\t\t\t6hrs\nOver
500kms\t\t\t\t12hrs\n\nThe fare you paid for your ticket will be
refunded \nafter deducting cancellation charges.The amount deducted\n
is based on the time of cancellation and status of your ticket.\n*For
Cancellation of conformed tickets more than 24 hrs.\nbefore the
scheduled departure of the train,\nthe minimu charges are:-\n\nFlat
Cancellation charge per passenger\t\tTicket-
status\n\n\tRs.70/-\t\t\t\tI-AC/EC\n\tRs.60/-\t\t\t\tCC,FC,II-
ac,3AC\n\tRs.40/-\t\t\t\tSL\n\tRs.20/-\t\t\t\tII-CL\n\n*For
cancellation confirmed ticket less than 24hrs & upto 4 hrs\n before the
sheduled dept.of train the cancellation charges\nwill be 25% of total
fare paid by you.\n*To conformed ticket less than 4 hrsbefore the
sheduled dept.of train\nand upto the prescribed time limits as
mentioned earlier.the cancellation\ncharges will be 50% of total fare
paid by you. ");
}

private void label6_Click(object sender, EventArgs e)


{
MessageBox.Show("Indian Railway provide the HILL-
RAILWAYS...\nThese are the Services:\n\tKalka-Shimla
Railway\t\tNilgiri_Mountain Railway\n\tDarjeeling_Himalayan
Railway\t\tMatheran_Light Railway\n\tKangra_Valley Railway");
}

private void Form3_Load(object sender, EventArgs e)


{
label2.Text = "*Genral_information:-";
label3.Text = "*Luggage_details:-";
label4.Text = "*Railway Websites:-";
label5.Text = "*Refunds_Rules:-";
label6.Text = "*Hill_Railway Services:-";
label1.Text = "RAILWAY-INFORMATIONS";
label8.Text = "SEMESTER :- ";
label9.Text = " B ";
label10.Text = "BATCH_CODE :- ";
label11.Text = "";
label12.Text = "FACULTY :- ";
label13.Text = "Mr. Pankaj Sir ";
label14.Text = "Created by :- ";
label15.Text = "Dheeraj Raj";

private void button1_Click(object sender, EventArgs e)


{
Form4 f4 = new Form4();
f4.Show();
this.Close();
}
}
}

20
**************

Form4.cs [Design]

Form4.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Railway_project
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
}

private void button9_Click(object sender, EventArgs e)


{
Form1 f1 = new Form1();

21
f1.Show();
this.Close();

private void Form4_Load(object sender, EventArgs e)


{
label1.Text = "Details....";
button7.Enabled = false;
}

private void button1_Click(object sender, EventArgs e)


{
Form5 F5 = new Form5();
F5.Show();
this.Close();
}

private void button2_Click(object sender, EventArgs e)


{
Form6 f6 = new Form6();
f6.Show();
this.Close();
}

private void button3_Click(object sender, EventArgs e)


{
Form7 f7 = new Form7();
f7.Show();
this.Close();
}

private void button4_Click(object sender, EventArgs e)


{
Form9 f9 = new Form9();
f9.Show();
this.Close();
}

private void button5_Click(object sender, EventArgs e)


{
Form10 f10 = new Form10();
f10.Show();
this.Close();
}

private void button6_Click(object sender, EventArgs e)


{
Form11 f11 = new Form11();
f11.Show();
this.Close();
}

private void button7_Click(object sender, EventArgs e)


{
Form12 f12 = new Form12();
f12.Show();

22
this.Close();
}

private void button8_Click(object sender, EventArgs e)


{
Form13 f13 = new Form13();
f13.Show();
this.Close();
}
}
}
***********

Form5.cs[Design]

Form5.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;

23
using System.Windows.Forms;
using System.Data.Odbc;
using System.Data.SqlClient;

namespace Railway_project

{
public partial class Form5 : Form
{
public Form5()
{
InitializeComponent();
}
//DataTable dt;
DataRow dr;
private void button1_Click(object sender, EventArgs e)
{
string code;
code = textBox1.Text;
dr = db1DataSet1.Tables["TRAIN_INFO"].Rows.Find(code);
label1.Text = dr[0].ToString();
label2.Text = dr[1].ToString();
//label36.Text = dr[2].ToString();
label3.Text = dr[2].ToString();
label4.Text = dr[4].ToString();
label5.Text = dr[6].ToString();
label6.Text = dr[8].ToString();
label7.Text = dr[10].ToString();

label8.Text = dr[12].ToString();//
label9.Text = dr[14].ToString();
label10.Text = dr[16].ToString();
label11.Text = dr[18].ToString();
label12.Text = dr[20].ToString();
label13.Text = dr[22].ToString();
label14.Text = dr[24].ToString();
label15.Text = dr[26].ToString();
//label16.Text = dr[16].ToString();--
label23.Text = dr[3].ToString(); //ok
label24.Text = dr[5].ToString();
label25.Text = dr[7].ToString();
label26.Text = dr[9].ToString();
label27.Text = dr[11].ToString();
label28.Text = dr[13].ToString();//
label29.Text = dr[15].ToString();
label30.Text = dr[17].ToString();
label31.Text = dr[19].ToString();
label32.Text = dr[21].ToString();
label33.Text = dr[23].ToString();
label34.Text = dr[25].ToString();
textBox1.Clear();
textBox1.Focus();

private void Form5_Load(object sender, EventArgs e)


{

24
// TODO: This line of code loads data into the
'db1DataSet1.TRAIN_INFO' table. You can move, or remove it, as needed.
this.tRAIN_INFOTableAdapter1.Fill(this.db1DataSet1.TRAIN_IN
FO);

// TODO: This line of code loads data into the


'db1DataSet.TRAIN_INFO' table. You can move, or remove it, as needed.
this.tRAIN_INFOTableAdapter.Fill(this.db1DataSet.TRAIN_INFO
);
tableLayoutPanel1.Visible = false;
tableLayoutPanel2.Visible = false;
tableLayoutPanel3.Visible = false;
tableLayoutPanel4.Visible = false;
tableLayoutPanel5.Visible = false;
dataGridView1.Visible=false ;
//label1.Visible = false; label2.Visible = false;

private void radioButton1_CheckedChanged(object sender,


EventArgs e)
{
textBox1.Text = "xxxx";
tableLayoutPanel1.Visible = true;
tableLayoutPanel2.Visible = true ;
tableLayoutPanel3.Visible = true ;
tableLayoutPanel4.Visible = true ;
tableLayoutPanel5.Visible = true ;
dataGridView1.Visible = true;
//button1.Enabled = true;
label16.Text = "Search Train_Number :";
label17.Text = "Train_Number : ";
label18.Text = "Train_Name : ";
label35.Text = "Services :";
label19.Text = "Stations "; label20.Text = "Time ";
label21.Text = "Stations "; label22.Text = "Time ";
label4.Text = ""; label8.Text = ""; label11.Text = "";
label2.Text = "";
label5.Text = ""; label9.Text = ""; label13.Text = "";
label14.Text = "";
label6.Text = ""; label10.Text = ""; label5.Text = "";
label7.Text = ""; label1.Text = ""; label2.Text = "";
label3.Text = "";
}

private void button2_Click(object sender, EventArgs e)


{

Form4 f4 = new Form4();


f4.Show();
this.Close();
}

}
}

25
***********

Form6.cs[Design]

Form6.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.Odbc;

namespace Railway_project
{
public partial class Form6 : Form
{
public Form6()
{
InitializeComponent();
}

26
private void button1_Click(object sender, EventArgs e)

{
string code = textBox1.Text;
OdbcConnection cn = new OdbcConnection();
cn.ConnectionString = "Dsn=MS ACCESS
Database;dbq=C:/New_Project/db1.mdb;derived=25;fil=MS Access";
cn.Open();
OdbcCommand cmd = new OdbcCommand(" select * from
train_status where train_no='" + code + "'", cn); // where
train_no='" + code + "'", cn);
//cmd.ExecuteNonQuery();
OdbcDataReader dr=cmd.ExecuteReader ();
dr.Read ();
label1.Text =dr[0].ToString ();
label2.Text =dr[1].ToString ();
label3.Text =dr[2].ToString ();
label4.Text =dr[3].ToString ();
label5.Text =dr[4].ToString ();
label6.Text =dr[5].ToString ();
label7.Text =dr[6].ToString ();
label19.Text = dr[7].ToString();
label20.Text = dr[8].ToString();
cn.Close();
}

private void Form6_Load(object sender, EventArgs e)


{
// TODO: This line of code loads data into the
'db1DataSet8.TRAIN_INFO' table. You can move, or remove it, as needed.
this.tRAIN_INFOTableAdapter.Fill(this.db1DataSet8.TRAIN_INF
O);
// TODO: This line of code loads data into the
'db1DataSet8.TRAIN_STATUS' table. You can move, or remove it, as needed.
//->this.tRAIN_STATUSTableAdapter.Fill(this.db1DataSet8.TRA
IN_STATUS);
label15.Text ="Train_Status..";
label16.Text = "Enter the Train_No.:";
label9 .Text ="Train_No.";
label10 .Text ="I-AC";
label11 .Text ="II-AC";
label12 .Text ="III-AC";
label13 .Text ="CC";
label14 .Text ="EC-EX";
label8.Text = "FC"; label17.Text = "SL"; label18.Text =
"II-C";

private void button3_Click(object sender, EventArgs e)


{
Form4 f4 = new Form4();
f4.Show();
this.Close();
}

27
private void button2_Click(object sender, EventArgs e)

{
textBox1.Text = "";
label1 . Text = "";
label2 .Text = "";
label3 .Text = "";
label4 .Text = "";
label5 .Text = "";
label6 .Text = "";
label7.Text = "";
}
}
}
***********
Form7.cs[Design]

Form7.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

28
using System.Data.Odbc;
using System.Data.SqlClient;

namespace Railway_project
{
public partial class Form7 : Form
{
static int a=0,b=0,c=0,d=0,e1=0,f=0,g=0,h=0;
public Form7()
{
InitializeComponent();
}
DataTable dt;
DataRow dr;
string code,code1;
private void button1_Click(object sender, EventArgs e)
{
//tableLayoutPanel1.Visible = true ;
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
textBox6.Text = "";
textBox7.Text = "";
textBox8.Text = "";
textBox9.Text = "";
textBox10.Text = "";
textBox11.Text = "";
textBox12.Text = "";
textBox13.Text = "";
textBox14.Text = "";
comboBox1.Text = "";
comboBox2.Text = "";
comboBox3.Text = "";
comboBox4.Text = "";
comboBox5.Text = "";
comboBox6.Text = "";
comboBox7.Text = "";
textBox3.Focus();
int ctr, ctr1, len, len1;
string codval,codval1;
dt = db1DataSet7.Tables["RESERVATIONS"];
len = dt.Rows.Count - 1;
len1 = dt.Rows.Count - 1; //001002
dr = dt.Rows[len];
dr = dt.Rows[len1];
code = dr["PNR-NO"].ToString();
code1 = dr["TICKET-NO"].ToString();
codval = code.Substring(1, 3);
codval1 = code1.Substring(1, 3);
ctr = Convert.ToInt32(codval);
ctr1 = Convert.ToInt32(codval1);
if ((ctr >= 1) && (ctr < 9))
{
ctr = ctr + 1;
textBox1.Text ="000"+ ctr;
}
else if ((ctr >= 9) && (ctr < 99))

29
{
ctr = ctr + 1;
textBox1.Text = "00" + ctr;
}
else if (ctr >= 99)
{
ctr = ctr + 1;
textBox1.Text = "0"+ctr;//.ToString ();
}
button4.Enabled = true;
if ((ctr1 >= 1) && (ctr1 < 9))
{
ctr1 = ctr1 + 1;
textBox2.Text = "001" + ctr1;
}
else if ((ctr1 >= 9) && (ctr1 < 99))
{
ctr = ctr1 + 1;
textBox2.Text = "01" + ctr1;
}
else if (ctr1 >= 99)
{
ctr1 = ctr1 + 1;
textBox2.Text = "1" + ctr1;
}
button1.Enabled = false;
}

private void button5_Click(object sender, EventArgs e)


{
Form8 f8 = new Form8();
f8.Show();
this.Close();
}

private void button2_Click(object sender, EventArgs e)


{
textBox8.Text =
DateTime.Now.AddDays(10).ToShortDateString();
textBox13.Text = DateTime.Now.ToShortDateString();
textBox14.Text = DateTime.Now.ToShortTimeString();
}

private void button4_Click(object sender, EventArgs e)


{
dt = db1DataSet7.Tables["RESERVATIONS"];
dr = dt.NewRow();
dr[0] = textBox1.Text;
dr[1] = textBox2.Text;
dr[2] = textBox3.Text;
dr[3] = textBox4.Text;
dr[4] = comboBox1.SelectedItem;
dr[5] = comboBox2.SelectedItem;
dr[6] = comboBox3.SelectedItem;
dr[7] = textBox5.Text;
dr[8] = textBox6.Text;

30
dr[9] = textBox7.Text;
dr[10] = textBox8.Text;
dr[11] = textBox9.Text;
dr[12] = comboBox4.SelectedItem;
dr[13] = comboBox5.SelectedItem;
dr[14] = comboBox6.SelectedItem;
dr[15] = textBox10.Text;
dr[16] = textBox11.Text;
dr[17] = comboBox7.SelectedItem;
dr[18] = textBox12.Text;
dr[19] = textBox13.Text;
dr[20] = textBox14.Text;
dt.Rows.Add(dr);
rESERVATIONSTableAdapter.Update(db1DataSet7);
textBox1.Text = System.Convert.ToString(dr[0]);
textBox2.Text = System.Convert.ToString(dr[1]);
this.rESERVATIONSTableAdapter.Fill(this.db1DataSet7.RESERVA
TIONS);
button1.Enabled = true;
}

private void button3_Click(object sender, EventArgs e)


{
string code = textBox3.Text;
OdbcConnection cn = new OdbcConnection();
//cn.ConnectionString = "Dsn= MS Access
Database;dbq=F:/New_Project/db1.mdb;derived=25;fil=MS Access";
cn.ConnectionString = "Dsn=MS ACCESS
Database;dbq=C:/New_Project/db1.mdb;derived=25;fil=MS Access";
cn.Open();
OdbcCommand cmd=new OdbcCommand ("select * from train_fare
where train_no='"+code+"'",cn);
OdbcDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
MessageBox.Show("TRAIN_NO. :" + dr[0] + "\t\t" + "I-
AC : " + dr[1] + "\t" + "II-AC : " + dr[2] + "\t" + "III-AC : " + dr[3]
+ "\t" + "CC: " + dr[4] + "\t\n\n" + "EC/EX: " + dr[5] + "\t\t" + "FC: "
+ dr[6] + "\t\t" + "SL: " + dr[7] + "\t" + "II-CL: " + dr[8]);
}
cn.Close();
}

private void button6_Click(object sender, EventArgs e)


{
string code = textBox3.Text;
OdbcConnection cn = new OdbcConnection();
//cn.ConnectionString = "Dsn= MS Access
Database;dbq=F:/New_Project/db1.mdb;derived=25;fil=MS Access";
cn.ConnectionString = "Dsn=MS ACCESS
Database;dbq=C:/New_Project/db1.mdb;derived=25;fil=MS Access";
cn.Open();
OdbcCommand cmd = new OdbcCommand("select * from
train_status where train_no='" + code + "'", cn);
OdbcDataReader dr = cmd.ExecuteReader();
while (dr.Read())

31
{
MessageBox.Show("TRAIN_NO. :" + dr[0] + "\t " + " I-
AC : " + dr[1] + "\t\t" + " II-AC : " + dr[2] + "\t\n" + "III-AC :" +
dr[3] + "\t\t" + " CC: " + dr[4] + "\t\t" + " EC/EX: " + dr[5] + "\t\t"
+ " FC: " + dr[6] + "\t\n" + "SL:" + dr[7] + "\t\t" + "II-CL:" + dr[8]);
}
cn.Close();
}

private void button7_Click(object sender, EventArgs e)


{
string code = comboBox3.SelectedItem.ToString();
if (code == "I-AC" && a <= 6)
{
a = a + 1; ;
textBox5.Text = a.ToString();
textBox6.Text = a.ToString();
//textBox7.Text = "A2";
if (a <= 6)
{
textBox7.Text = "1A1";
//textBox7.Text = "1A2";
}
//a1 = a;
if (a >= 6)
{
textBox7.Text = "1A2";
a = 0;
a = a + 1;
textBox5.Text = a.ToString();
textBox6.Text = a.ToString();

}
}

if (code == "II-AC" && b <= 5)


{
b = b + 1; ;
textBox5.Text = b.ToString();
textBox6.Text = b.ToString();
//textBox7.Text = "A2";
if (b <= 5)
{
textBox7.Text = "2A1";

if (b >= 5)
{
textBox7.Text = "2A2";
b = 0;
b = b + 1;
textBox5.Text = b.ToString();
textBox6.Text = b.ToString();

32
}
if (code == "III-AC" && c <= 5)
{
c = c + 1;
textBox5.Text = c.ToString();
textBox6.Text = c.ToString();
//textBox7.Text = "A3";
if (c <= 5)
{
textBox7.Text = "3A1";

if (c >= 5)
{
textBox7.Text = "3A2";
c = 0;
c = c + 1;
textBox5.Text = c.ToString();
textBox6.Text = c.ToString();
}
//compl;
}
if (code == "CC" && d <= 5)
{
d = d + 1; ;
textBox5.Text = d.ToString();
textBox6.Text = d.ToString();
textBox7.Text = "C1";
}
if (code == "EC-EX" && e1 <= 5)
{
e1 = e1 + 1;
textBox5.Text = e1.ToString();
textBox6.Text = e1.ToString();
textBox7.Text = "E1";
}
if (code == "FC" && f <= 5)
{
f = f + 1; ;
textBox5.Text = f.ToString();
textBox6.Text = f.ToString();
textBox7.Text = "1S1";
}
if (code == "SL" && g <= 5)
{
g = g + 1;
textBox5.Text = g.ToString();
textBox6.Text = g.ToString();
textBox7.Text = "GEN";
}
if (code == "II-C" && h <= 5)
{
h = h + 1; ;
textBox5.Text = h.ToString();
textBox6.Text = h.ToString();

33
textBox7.Text = "2S1";
}
}

private void Form7_Load(object sender, EventArgs e)


{
// TODO: This line of code loads data into the
'db1DataSet7.RESERVATIONS' table. You can move, or remove it, as needed.
this.rESERVATIONSTableAdapter.Fill(this.db1DataSet7.RESERVA
TIONS);
// TODO: This line of code loads data into the
'db1DataSet7.RESERVATIONS' table. You can move, or remove it, as needed.
this.rESERVATIONSTableAdapter.Fill(this.db1DataSet7.RESERVA
TIONS);
// tableLayoutPanel1.Visible = false;
button4.Enabled = false; //textBox1.Text = "";
textBox1.Enabled = false;
textBox2.Enabled = false;
textBox6.Enabled = false;
textBox5.Enabled = false;
textBox7.Enabled = false; textBox8.Enabled = false;
textBox13.Enabled = false; textBox14.Enabled = false;
}

private void button8_Click(object sender, EventArgs e)


{
Form4 f4 = new Form4();
f4.Show();
this.Close();
}

}
}
***********

Form8.cs[Design]

34
Form8.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient ;

namespace Railway_project
{
public partial class Form8 : Form
{
public Form8()
{
InitializeComponent();
}

DataRow dr;
private void button1_Click(object sender, EventArgs e)
{
tableLayoutPanel1.Visible = true ;
//string code = textBox1.Text;
string code = textBox1.Text;
dr = db1DataSet6.Tables["reservations"].Rows.Find(code);

35
label1.Text = dr[0].ToString();
label2.Text = dr[2].ToString();
label3.Text = dr[10].ToString();
label4.Text = "-";// dr[7].ToString();
label5.Text = dr[14].ToString();
label6.Text = dr[1].ToString();
label7.Text = dr[6].ToString();
label8.Text = dr[4].ToString();
label9.Text = dr[5].ToString();
label10.Text = dr[9].ToString();
label11.Text = dr[8].ToString();
label12.Text = dr[7].ToString();
label13.Text = dr[13].ToString();
label14.Text = dr[12].ToString();
label15.Text = dr[18].ToString();
label16.Text = dr[3].ToString();
label17.Text = dr[4].ToString();
label18.Text = dr[10].ToString();
}

private void button3_Click(object sender, EventArgs e)


{
Form4 f4 = new Form4();
f4.Show();
this.Close();
}

private void Form8_Load(object sender, EventArgs e)


{
// TODO: This line of code loads data into the
'db1DataSet6.RESERVATIONS' table. You can move, or remove it, as needed.
this.rESERVATIONSTableAdapter.Fill(this.db1DataSet6.RESERVA
TIONS);
// TODO: This line of code loads data into the
'db1DataSet6.RESERVATIONS' table. You can move, or remove it, as needed.
this.rESERVATIONSTableAdapter.Fill(this.db1DataSet6.RESERVA
TIONS);
label19.Text = "PNR-NO."; label20.Text = "TRAIN-NO.";
label21.Text = "DATE"; label22.Text = "K.M.";
label23.Text = "PERSONAL-STATUS"; label24.Text = "TICKET-
NO."; label25.Text = "JOURNEY CUM RESERVATION TICKET"; label26.Text =
"CLASS";
label27.Text = "COUCH"; label28.Text = "SEAT"; label29.Text
= "BIRTH"; label30.Text = "SEX";
label31.Text = "AGE"; label32.Text = "AMOUNT"; label33.Text
= "Enter the PNR-No."; textBox1.Text = "0000";//label34.Text = "";

label1.Text = "";
label2.Text = "";
label3.Text = "";

36
label4.Text = "-";// dr[7].ToString();
label5.Text = "";
label6.Text = "";
label7.Text = "";
label8.Text = "";
label9.Text = "";
label10.Text = "";
label11.Text = "";
label12.Text = "";
label13.Text = "";
label14.Text = "";
label15.Text = "";
label16.Text = "";
label17.Text = "";
label18.Text = "";
tableLayoutPanel1.Visible = false;
}

private void button2_Click(object sender, EventArgs e)


{
/*printDialog1.Document = printDocument1;
DialogResult res = printDialog1.ShowDialog();
if (res == DialogResult.OK)
printDocument1.Print();*/
//printDialog1.ShowDialog();
PrintDialog p = new PrintDialog();
p.ShowDialog();
}
}
}
***********

Form9.cs[Design]

37
Form9.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient ;

namespace Railway_project
{
public partial class Form9 : Form
{
public Form9()
{
InitializeComponent();
}
DataRow dr;
private void button1_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox1.Focus();
textBox1.Text = "0000";
label1.Text = ""; label2.Text = ""; label3.Text = "";
label4.Text = ""; label5.Text = ""; label6.Text = "";
label7.Text = ""; label8.Text = ""; label9.Text = "";

38
label10.Text = ""; label11.Text = ""; label12.Text = "";
}

private void button4_Click(object sender, EventArgs e)


{
Form4 f4 = new Form4();
f4.Show();
this.Close();
}

private void Form9_Load(object sender, EventArgs e)


{
// TODO: This line of code loads data into the
'db1DataSet4.RESERVATIONS' table. You can move, or remove it, as needed.
this.rESERVATIONSTableAdapter.Fill(this.db1DataSet4.RESERVA
TIONS);
// TODO: This line of code loads data into the
'db1DataSet4.RESERVATIONS' table. You can move, or remove it, as needed.
this.rESERVATIONSTableAdapter.Fill(this.db1DataSet4.RESERVA
TIONS);
label25.Text = "Cancellation_Details";
label26.Text = "Enter the PNR_Number: ";
textBox1.Text = "0000";
}

private void button2_Click(object sender, EventArgs e)


{
string code = textBox1.Text;
dr = db1DataSet4.Tables["reservations"].Rows.Find(code);
label1.Text =dr[0].ToString ();
label2.Text =dr[1].ToString ();
label3.Text =dr[2].ToString ();
label4.Text =dr[10].ToString ();
label5.Text =dr[4].ToString ();
label6.Text =dr[5].ToString ();
label7.Text =dr[11].ToString ();
label8.Text = dr[12].ToString();
label9.Text = dr[15].ToString();
label10.Text = dr[6].ToString();
label11.Text = dr[7].ToString();
label12.Text = dr[13].ToString();
}

private void button3_Click(object sender, EventArgs e)


{
string code = textBox1.Text;
dr = db1DataSet4.Tables["reservations"].Rows.Find(code);
dr.Delete();
rESERVATIONSTableAdapter.Update(db1DataSet4);
MessageBox.Show("1 Record deleted...");
}
}
}

***********
Form10.cs[Design]

39
Form10.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data .Odbc ;
using System.Data.SqlClient;

namespace Railway_project
{
public partial class Form10 : Form
{
public Form10()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)


{
label2.Text = "Enter the Train_No.";
label3.Text = "I_AC";
label4.Text = "II_AC.";

40
label5.Text = "III_AC";
label6.Text = "CC";
label7.Text = "EC_EX";
label8.Text = "FC.";
label9.Text = "SL";
label10.Text = "II_Class";
tableLayoutPanel2.Visible = true ;
tableLayoutPanel3.Visible = true ;
tableLayoutPanel4.Visible = true ;
string code=textBox1.Text ;
string a = textBox2.Text;
string b = textBox3.Text;
string c = textBox4.Text;
string d = textBox5.Text;
string e1 = textBox6.Text;
string f = textBox7.Text;
string g = textBox8.Text;
string h = textBox9.Text;
OdbcConnection cn = new OdbcConnection();
cn.ConnectionString = "Dsn=MS ACCESS
Database;dbq=C:/New_Project/db1.mdb;derived=25;fil=MS Access";
cn.Open();
OdbcCommand cmd=new OdbcCommand ("update train_status set
I_AC='" + a + "',II_AC='" + b +
"',III_AC='"+c+"',CC='"+d+"',EC_EX='"+e1+"',FC='"+f+"',SL='"+g+"',II_CL
='"+h+"' where train_no='"+code+"'",cn); // where train_no='" +
code + "'", cn);
cmd.ExecuteNonQuery ();
cn.Close ();
}

private void dataGridView1_CellContentClick(object sender,


DataGridViewCellEventArgs e)
{

private void button2_Click(object sender, EventArgs e)


{
Form4 f4 = new Form4();
f4.Show();
this.Close();
}

private void Form10_Load(object sender, EventArgs e)


{
// TODO: This line of code loads data into the
'db1DataSet3.TRAIN_STATUS' table. You can move, or remove it, as needed.
label11.Text = "Enter the Train_Number :";
tableLayoutPanel2.Visible = false;
tableLayoutPanel3.Visible = false;
tableLayoutPanel4.Visible = false;
tableLayoutPanel5.Visible = false;
}

private void button3_Click(object sender, EventArgs e)


{

41
tableLayoutPanel5.Visible = true;
label12.Text = "Train_No.";
label13.Text = "I_AC";
label14.Text = "II_AC.";
label15.Text = "III_AC";
label16.Text = "CC";
label17.Text = "EC_EX";
label18.Text = "FC.";
label19.Text = "SL";
label20.Text = "II_Class";
//label12.Text = "Train_No.";
string code = textBox11.Text;
OdbcConnection cn = new OdbcConnection();
cn.ConnectionString = "Dsn=MS ACCESS
Database;dbq=C:/New_Project/db1.mdb;derived=25;fil=MS Access";
cn.Open();
OdbcCommand cmd = new OdbcCommand("select * from
train_status where train_no='" + code + "'", cn);//update train_status
set I_AC='" + a + "',II_AC='" + b + "',III_AC='" + c + "',CC='" + d +
"',EC_EX='" + e1 + "',FC='" + f + "',SL='" + g + "',II_CL='" + h + "'
where train_no='" + code + "'", cn); // where train_no='" +
code + "'", cn);
//cmd.ExecuteNonQuery();

OdbcDataReader dr = cmd.ExecuteReader();
dr.Read();
//label20.Text = dr[0].ToString();
label21.Text = dr[0].ToString();
label22.Text = dr[1].ToString();
label23.Text = dr[2].ToString();
label24.Text = dr[3].ToString();
label25.Text = dr[4].ToString();
label26.Text = dr[5].ToString();
label27.Text = dr[6].ToString();
label28.Text = dr[7].ToString();
label29.Text = dr[8].ToString();
cn.Close();

}
}
}
***********

Form11.cs[Design]

42
Form11.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace Railway_project
{
public partial class Form11 : Form
{
public Form11()
{
InitializeComponent();
}
DataRow dr;
private void button1_Click(object sender, EventArgs e)
{
tableLayoutPanel1.Visible = true;
string code = textBox1.Text;
dr = db1DataSet5.Tables["reservations"].Rows.Find(code);
label1.Text = dr[0].ToString();
label2.Text = dr[2].ToString();
label3.Text = dr[3].ToString();

43
label4.Text = dr[4].ToString();
label5.Text = dr[5].ToString();
label6.Text = dr[6].ToString();
label7.Text = dr[7].ToString();
label8.Text = dr[10].ToString();
label9.Text = dr[11].ToString();
label10.Text = dr[13].ToString();
label11.Text = dr[17].ToString();
//label12.Text = dr[11].ToString();
}

private void button2_Click(object sender, EventArgs e)


{
Form4 f4 = new Form4();
f4.Show();
this.Close();
}

private void Form11_Load(object sender, EventArgs e)


{
// TODO: This line of code loads data into the
'db1DataSet5.RESERVATIONS' table. You can move, or remove it, as needed.
this.rESERVATIONSTableAdapter.Fill(this.db1DataSet5.RESERVA
TIONS);
// TODO: This line of code loads data into the
'db1DataSet5.RESERVATIONS' table. You can move, or remove it, as needed.
this.rESERVATIONSTableAdapter.Fill(this.db1DataSet5.RESERVA
TIONS);
tableLayoutPanel1.Visible = false;
label23.Text = "Enter the PNR_No.";
textBox1.Text = "0000";
}
}
}

***********

Form13.cs[Design]

44
Form13.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.Odbc;
using System.Data.SqlClient;

namespace Railway_project
{
public partial class Form13 : Form
{
public Form13()
{
InitializeComponent();
}
DataTable dt;
DataRow dr;
private void button1_Click(object sender, EventArgs e)
{
dt = db1DataSet2.Tables["day-to-day"];
// dt = db1DataSet2.Tables["_DAY_TO_DAY"];
dr = dt.NewRow();
dr[0]=textBox2.Text;

45
dr[1]=textBox3.Text;
dr[2]=textBox4.Text;
dr[3]=textBox5.Text;
dr[4]=textBox6.Text;
dr[5] = textBox7.Text;
dr[6] = textBox8.Text;
dt.Rows.Add(dr);
dAY_TO_DAYTableAdapter.Update(db1DataSet2);
this.dAY_TO_DAYTableAdapter.Fill(this.db1DataSet2._DAY_TO_D
AY);
MessageBox.Show("1 Record added..");

private void button2_Click(object sender, EventArgs e)


{
Form4 f4 = new Form4();
f4.Show();
this.Close();
}

private void Form13_Load(object sender, EventArgs e)


{

// TODO: This line of code loads data into the


'db1DataSet2._DAY_TO_DAY' table. You can move, or remove it, as needed.
this.dAY_TO_DAYTableAdapter.Fill(this.db1DataSet2._DAY_TO_D
AY);
//tableLayoutPanel2.Visible = false;
textBox2.Focus();
label1.Text = "Day-To-Day Report";
label3.Text = "Train_No.";
label4.Text = "Train_Name";
label5.Text = "Arrival";
label6.Text = "Departure";
label7.Text = "Time";
label8.Text = "Boarding";
label9.Text = "Destination";
textBox6.Text = "0";
textBox2.Text = "xxx";
textBox6.Enabled = false;

private void button3_Click(object sender, EventArgs e)


{

textBox2.Focus();
textBox2.Text = ""; textBox3.Text = "";
textBox4.Text = ""; textBox5.Text = "";
textBox6.Text = ""; textBox7.Text = "";
textBox8.Text = "";
textBox6.Text = DateTime.Now.ToString();
}

private void button4_Click(object sender, EventArgs e)


{

46
string c = textBox2.Text;
dr = db1DataSet2.Tables["day-to-day"].Rows.Find(c);
dr.Delete();
dAY_TO_DAYTableAdapter.Update(db1DataSet2);
MessageBox.Show("1 Record deleted..");
}

}
***********

Program.cs
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace Railway_project
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
*************

[6] Sample Output

47
48
49
50
51
52
53
54
55
56
57
58
59
60
[7] Future scope

At present this project has has a few drawbacks like fare


calculations, seat, coach, berth number and reserving tickets
according to the passenger’s will. (*currently tickets are reserved
for 10 days in advance)

In future we hope to modify more user friendly projects in


INDIAN RAILWAY. And include more services such as:
1. Tatkal services
2. Fare calculations
3. Calculate unique seat Coach and berth number
4. Print the reservation chart.

We will also like to include more train details like:


1. Different types of trains running from 1 stn to another.
2. Specific stn report.
3. Photo gallery.
4. Records of Local and Metro Rail.

61
[8] Conclusions

INDIAN RAILWAY Project is used for


performing many operations such as
search operations, search status (train
information), saves passenger’s details,
updated train_status and insert the day-to-
day report. But still there are many
drawbacks which in future we hope to
solve them

62
[9] Bibliography

Websites:
1. For info regarding Indian railways…
http://www.indianrailways.gov.in
(including it’s sub-sites)
2. For Information regarding tutorials, Software
Engg., Backgrnd images, etc….
http://www.google.com
(and it’s link pages.)
3. For Knowledge on C#,VC#, MS ACCESS-2K3, MS SQL-2K…..
http://www.msn.com
(and it’s link pages.)

Books:-
1. Name: GUI Applications Development using .NET
Framework (GNIIT)
Author: NIIT ltd.
2. Name: Database using Microsoft SQL Server(GNIIT).
Author: ……..
Database Applications using ADO.NET (GNIIT).
World Book CD 1999.
MS Access2003

63
END OF THE PROJECT

64

S-ar putea să vă placă și