ibrad(keshtopur)-dotnet c#-gr48

32
.NET PROJECT ON e-CAR RENTAL SYSTEM USING ASP.NET, ADO.NET AND SQL SERVER Group Members: Saikat Samanta, ACADEMY OF TECHNOLOGY,131690110172 Sanchari Roy, ACADEMY OF TECHNOLOGY,131690110175 . Udita Roy, ACADEMY OF TECHNOLOGY,131690110186 Document sign date :Feb 3, 2015

Upload: saikat-samanta

Post on 15-Aug-2015

29 views

Category:

Documents


0 download

TRANSCRIPT

.NET PROJECT ON e-CAR RENTAL SYSTEM USING ASP.NET, ADO.NET AND SQL SERVER

Group Members:

Saikat Samanta, ACADEMY OF TECHNOLOGY,131690110172

Sanchari Roy, ACADEMY OF TECHNOLOGY,131690110175

. Udita Roy, ACADEMY OF TECHNOLOGY,131690110186

Document sign date :Feb 3, 2015

TABLE OF CONTENTS

ACKNOWLEDGEMENT

PROJECT OBJECTIVE

PROJECT SCOPE

DATABASE DESIGN

APPLICATION WORKFLOW

SCREENSHOTS

FUTURE SCOPE OF IMPROVEMENTS

CODE

CERTIFICATE

Document sign date :Feb 3, 2015

ACKNOWLEDGEMENT

We take this opportunity to express my profound gratitude and deep regards to my faculty Mr. KAUSHIK GHOSH for his exemplary guidance, monitoring and constant encouragement throughout the course of this project. The blessing, help and guidance given by him time to time shall carry me a long way in the journey of life on which I am about to embark. We are obliged to our project team members for the valuable information provided by them in their respective fields. We are also grateful for everyone’s cooperation during the period of our assignment.

Document sign date :Feb 3, 2015

Administrator
Pencil

PROJECT OBJECTIVE

This Application is a web-based system for vehicle reservation

management.

This program allows the company as an independent auto-rental firm to

implement an online reservation system through the website without

significant investment in a large, complex tailored system.

Before the customers may have received information through emails, online

forms, phone calls, people contacting you… and any other manner making

management frustrating. This is all about to change when you register with

our system.

our system is a COMPLETE booking management system.

One of the key elements of the system is its fluidity and speed. Rates are

passed instantly and the customer can easily make his or her choice.

Although the system is a ready-made system, it is also completely

customisable and adaptable to each and every client's exclusive needs

(company specifics, visual characteristics, data, design, etc.). Individuality is

the key and a chance for breakthrough in this highly competitive business.

Instant rate quotation, customised approach, adaptable design and an

unbelievable price make the system, the only one in its business.

Being the system of today, it will be the system for future.

This Application exhibits all those characteristics that make web-based

systems the most popular:

Easy to manage

Low maintenance cost

Stable and secure

Fast and reliable access from any location

Maintenance from any location

Online, 24 hours a day – for bookings and/or for changes

Part of an international car rental Global Distribution System (GDS)

and implementing the similar concepts in our system.

Document sign date :Feb 3, 2015

Administrator
Pencil

Required Understanding

This System may be technologically advanced, but it is incredibly

simple to use – both for the company and the customers. No

technical staff or programmers are required.

This Application have two types of Users:

1. The Company

2. Customers

1. The COMPANY

The Company means the organization which is

responsible for the booking and management purpose.

The facilities that the Company is going to avail from this

application are illustrated below:

First and Foremost benefit is that the company can keep

the record/track of the cars present in the garage.

Keeping track of the cars means:

Specification of the cars(type-AC or Non AC),

Status Of the Car(Available or Unavailable).

Even the basic details of the car like colour, car plate no,

license no. & all such information can be stored.

The Company can check regular bookings by the customers

and manage them accordingly.

The system will manage inventory which means that the

company can add, delete or update the records of the car

present in the garage.

Let us suppose a new car comes to the garage, then this

new car will be added to the record. If a car is booked, its

Document sign date :Feb 3, 2015

Administrator
Sticky Note
Understanding Requirement
Administrator
Pencil

status will be updated to Unavailable. As such it helps in

the management process.

Fares can be calculated from the rate of the booked

vehicle(previously assigned by the company) and the

information conveyed by the driver based on the number of

kilometres travelled.

2. CUSTOMERS

The facilities that the Customers is going to avail from this

application are illustrated below:

Registered Customers who will visit the site –can book

online, then follow the simple point-and-click instructions

until their booking is made! If you wish it, the system will

automatically send the customer emails confirming the booking

– and it will be logged in the system.

The customer can book any type of car according to the required

specification from any location.

Let us take an example: If the customer is in the office and

urgently needs to take a flight, then without making any extra

effort of travelling to the cab, can rather book a vehicle online.

So the system is very convenient.

They can check the availability of the cars present in the garage.

e.g.: If a car is already booked and if another customer try to

book the same car the system will show 'Unavailable'.

Henceforth, there will be no dispute in booking process.

The customers will have a comfortable luxuries experience as

they can specify the specification of the car they require as

they can choose the details while booking.

Document sign date :Feb 3, 2015

Administrator
Pencil

PROJECT SCOPE

e- Car Rental System has a vast scope in pragmatic world. Thus the utilisation of this application helps the Customer by allowing services for online booking and helps the Administrator for managing inventory. The scope of this project is illustrated below: 1. The system will be available on an online platform for 24x7 access to the both the customer and the administrator.

2. A customer can book a car from anywhere at any instant of time, only condition being the person has a net connection.

3. The administrator can keep a track of the records of what is going on in the site and handle all the details and group them accordingly.

4. The system supports online booking thereby reducing a great deal of human efforts.

5. The administrator finds it easy to maintain and arrange the records as searching and sorting is easy online. This also reduces discrepancy because the administrator has to just go through the entered records in the computer rather than going through piles of record books.

6. The system is also User friendly as one who has never done online booking will also be able to understand the criteria and perform the required job.

Document sign date :Feb 3, 2015

Administrator
Pencil

DATABASE DESIGN

Document sign date :Feb 3, 2015

Administrator
Pencil

Document sign date :Feb 3, 2015

Administrator
Pencil

Application Work Flow

New User Registered Customer & Administrator

/

DetailsEdit.

aspx

availablecars.

aspx

bookacars.aspx

.

Fm1.aspx

Register.aspx LogIn

RegSuccessful.aspx

finalcancel.aspx

.

cancelbook.

aspx

Document sign date :Feb 3, 2015

Administrator
Pencil

AddCar

.aspx

Customers

.aspx viewall.aspx

Modify.

aspx

Password.aspx

PassConfirmer.aspx

Update &

Save

LogOut.aspx

bookfare.

aspx

LogOut.aspx

fare.aspx

HOME.aspx

Document sign date :Feb 3, 2015

Administrator
Pencil

Screenshots

Document sign date :Feb 3, 2015

Administrator
Pencil

Document sign date :Feb 3, 2015

Document sign date :Feb 3, 2015

Administrator
Pencil

SCOPE OF IMPROVEMENT

We could have send a confirmation SMS to the customer displaying their Auto generation ID because

SMS is a more reliable way for storing and transferring of data. In our project we have just generated

the ID and shown in the monitor which doesn’t remain for longer duration and the data can even be

lost or may be read by some other user hence, is inconvenient. As the customer logs in, the availability of cars could be shown that the car is available or not.

Similarly if the administrator logs in he/she can see the status of bookings meaning number of

bookings which are open, close or is waiting. Though we have showed the administrator the open and

close bookings but we failed to show the waiting status. And the administrator has to click some

button to view the details, if it could be shown just after login it would have been better. It would have been better if we used Google maps to generate and calculate fare. It could also be used

to track the cab so this application would be very benefitial.

Document sign date :Feb 3, 2015

Administrator
Pencil

Code

Registration.aspx using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; namespace p1 { public partial class Reg : System.Web.UI.Page { protected void Button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=ecrsdb;Integrated Security=True;Pooling=False"); SqlCommand cmd=new SqlCommand("Select * From Customer", con); con.Open(); SqlDataReader dr= cmd.ExecuteReader(); int count=0; while(dr.Read()) { count++; } count++; if(Name.Text!="") { Session["cid"]= Name.Text.Substring(0, 2) + Mobile.Text.Substring(6, 4) + count.ToString(); } con.Close(); SqlConnection con1 = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=ecrsdb;Integrated Security=True;Pooling=False"); SqlCommand cmd1 = new SqlCommand("Insert into Customer Values(@name,@address,@mobile,@email,@uid,@password,@customerid)",con1); cmd1.Parameters.AddWithValue("@name", Name.Text); cmd1.Parameters.AddWithValue("@address", Address.Text); cmd1.Parameters.AddWithValue("@mobile", Mobile.Text); cmd1.Parameters.AddWithValue("@email", Email.Text); cmd1.Parameters.AddWithValue("@uid", UID.Text); if (Password.Text == Confirm.Text) { cmd1.Parameters.AddWithValue("@password", Password.Text); } cmd1.Parameters.AddWithValue("@customerid", Session["cid"].ToString()); con1.Open(); cmd1.ExecuteNonQuery(); con1.Close();

Document sign date :Feb 3, 2015

Administrator
Pencil

Response.Redirect("RegSuccessful.aspx"); } } }

RegSuccessful.aspx using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace p1 { public partial class RegSuccessful : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Label3.Text = "You Have Successfully Completed Your Registration!"; Label4.Text = "Please Use Your UserId & Password To LogIn."; Label5.Text = "USER ID: " + Session["cid"].ToString(); } protected void Button1_Click(object sender, EventArgs e) { Response.Redirect("Fm1.aspx"); } } }

LogInA.aspx using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace p1 { public partial class LogInA : System.Web.UI.Page { protected void Button1_Click(object sender, EventArgs e) { Response.Redirect("AddCar.aspx"); } protected void Button2_Click(object sender, EventArgs e) { Response.Redirect("Modify.aspx"); }

Document sign date :Feb 3, 2015

protected void Button3_Click(object sender, EventArgs e) { Response.Redirect("GenerateFare.aspx"); } protected void Button4_Click(object sender, EventArgs e) { Response.Redirect("Customers.aspx"); } } }

AddCar.aspx using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; namespace p1 { public partial class AddCar : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { CarType.Items.Add("--Select--"); CarType.Items.Add("SEDAN"); CarType.Items.Add("FAMILY SALON"); CarType.Items.Add("SUV"); CarType.Items.Add("HUTCH BACK"); Cooling.Items.Add("--Select--"); Cooling.Items.Add("AC"); Cooling.Items.Add("Non-AC"); } protected void Button1_Click(object sender, EventArgs e) { SqlConnection con=new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=ecrsdb;Integrated Security=True;Pooling=False"); SqlCommand cmd=new SqlCommand("Insert Into CarDetails Values(@carname,@reg,@cartype,@cool,@cardesc,@rate,@status)",con); cmd.Parameters.AddWithValue("@carname",carname.Text); cmd.Parameters.AddWithValue("@reg",regno.Text); cmd.Parameters.AddWithValue("@cartype", CarType.SelectedItem.ToString()); cmd.Parameters.AddWithValue("@cool", Cooling.SelectedItem.ToString()); cmd.Parameters.AddWithValue("@cardesc",description.Text); cmd.Parameters.AddWithValue("@rate",rate.Text); cmd.Parameters.AddWithValue("@status","AVAILABLE"); con.Open(); cmd.ExecuteNonQuery(); con.Close(); addout.Text="RECORD ADDED SUCCESSFULLY!"; carname.Text=""; regno.Text="";

Document sign date :Feb 3, 2015

Administrator
Pencil

description.Text=""; rate.Text=""; } protected void Button2_Click(object sender, EventArgs e) { Response.Redirect("LogInA.aspx"); }

Modify.aspx using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; namespace p1 { public partial class Modify : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { GetData(); BindData(); } } private void GetData() { SqlConnection con=new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=ecrsdb;Integrated Security=True;Pooling=False"); SqlDataAdapter da=new SqlDataAdapter("Select * From CarDetails", con); DataSet ds= new DataSet(); da.Fill(ds,"CarDetails"); DataTable dt=ds.Tables[0]; Session["da"]=da; Session["dt"]=dt; } private void BindData() { GridView1.DataSource=(DataTable)Session["dt"]; GridView1.DataBind(); } protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { TextBox CarName = ((TextBox)(GridView1.Rows[e.RowIndex].FindControl("TextBox1"))); ((DataTable)Session["dt"]).Rows[e.RowIndex][0] = CarName.Text; TextBox RegNo = ((TextBox)(GridView1.Rows[e.RowIndex].FindControl("TextBox2"))); ((DataTable)Session["dt"]).Rows[e.RowIndex][1] = RegNo.Text;

Document sign date :Feb 3, 2015

TextBox CarType = ((TextBox)(GridView1.Rows[e.RowIndex].FindControl("TextBox3"))); ((DataTable)Session["dt"]).Rows[e.RowIndex][2] = CarType.Text; TextBox Cooling = ((TextBox)(GridView1.Rows[e.RowIndex].FindControl("TextBox4"))); ((DataTable)Session["dt"]).Rows[e.RowIndex][3] = Cooling.Text; TextBox CarDescp = ((TextBox)(GridView1.Rows[e.RowIndex].FindControl("TextBox5"))); ((DataTable)Session["dt"]).Rows[e.RowIndex][4] = CarDescp.Text; TextBox Rate = ((TextBox)(GridView1.Rows[e.RowIndex].FindControl("TextBox6"))); ((DataTable)Session["dt"]).Rows[e.RowIndex][5] = Rate.Text; TextBox Status = ((TextBox)(GridView1.Rows[e.RowIndex].FindControl("TextBox7"))); ((DataTable)Session["dt"]).Rows[e.RowIndex][6] = Status.Text; SqlCommandBuilder cb = new SqlCommandBuilder((SqlDataAdapter)Session["da"]); ((SqlDataAdapter)Session["da"]).Update((DataTable)Session["dt"]); GetData(); GridView1.EditIndex = -1; BindData(); } protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) { GridView1.EditIndex = -1; BindData(); } protected void GridView1_RowEditing1(object sender, GridViewEditEventArgs e) { GridView1.EditIndex = e.NewEditIndex; BindData(); } protected void Button3_Click1(object sender, EventArgs e) { Response.Redirect("LogInA.aspx"); } } }

Viewall.aspx using System; usingSystem.Collections.Generic; usingSystem.Linq; usingSystem.Web; usingSystem.Web.UI; usingSystem.Web.UI.WebControls; usingSystem.Data; usingSystem.Data.SqlClient; namespaceecrs { publicpartialclassfarecalc : System.Web.UI.Page { protectedvoidPage_Load(object sender, EventArgs e) {

Document sign date :Feb 3, 2015

Administrator
Pencil

if (!IsPostBack) {

GetData(); BindData();

} }

privatevoidGetData() { SqlConnection con2 = newSqlConnection("Data Source=.\\sqlexpress;InitialCatalog=aot;Integrated Security=True;Pooling=False"); SqlDataAdapterbo = newSqlDataAdapter("select * from book", con2); DataSet ds = newDataSet(); bo.Fill(ds, "book"); DataTabledtt = ds.Tables[0]; Session["aa"] = bo; Session["dttba"] = dtt; }

privatevoidBindData() { GridView1.DataSource = (DataTable)Session["dttba"]; GridView1.DataBind(); } } } Customers.aspx using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; namespace p1 { public partial class Customers : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { GetData(); BindData(); } } private void GetData() { SqlConnection con = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=ecrsdb;Integrated Security=True;Pooling=False"); SqlDataAdapter da = new SqlDataAdapter("Select * from Customer", con); DataSet ds = new DataSet(); da.Fill(ds, "Customer"); DataTable dt = ds.Tables[0];

Document sign date :Feb 3, 2015

Administrator
Pencil

Session["d"] = da; Session["dtb"] = dt; } private void BindData() { GridView.DataSource = (DataTable)Session["dtb"]; GridView.DataBind(); } protected void Button2_Click(object sender, EventArgs e) { Response.Redirect("LogInA.aspx"); } } }

Login.aspx using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; namespace p1 { public partial class WebForm2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=ecrsdb;Integrated Security=True;Pooling=False"); SqlDataAdapter da = new SqlDataAdapter("Select * From Customer", con); DataSet ds = new DataSet(); da.Fill(ds, "Customer"); DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { if (Session["usid"].ToString() == dr[6].ToString()) { Label3.Text = dr[0].ToString(); } } } protected void Button1_Click(object sender, EventArgs e) { Response.Redirect("DetailsEdit.aspx"); } protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Response.Redirect("AvailableBook.aspx"); } } }

DetailsEdit.aspx

Document sign date :Feb 3, 2015

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; namespace p1 { public partial class DetailsEdit : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SqlConnection con = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=ecrsdb;Integrated Security=True;Pooling=False"); SqlDataAdapter da = new SqlDataAdapter("Select * from Customer", con); DataSet ds = new DataSet(); da.Fill(ds, "Customer"); DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { if (Session["usid"].ToString() == dr[6].ToString()) { Name.Text = dr[0].ToString(); Address.Text = dr[1].ToString(); Mobile.Text = dr[2].ToString(); Email.Text = dr[3].ToString(); UID.Text = dr[4].ToString(); } } } } protected void Button2_Click(object sender, EventArgs e) { Name.ReadOnly = false; Address.ReadOnly = false; Mobile.ReadOnly = false; Email.ReadOnly = false; UID.ReadOnly = false; } protected void Button3_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=ecrsdb;Integrated Security=True;Pooling=False"); SqlDataAdapter da = new SqlDataAdapter("Select * from Customer", con); DataSet ds = new DataSet(); da.Fill(ds, "Customer"); DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { if (Session["usid"].ToString() == dr[6].ToString()) { dr.BeginEdit(); dr[0] = Name.Text; dr[1] = Address.Text;

Document sign date :Feb 3, 2015

Administrator
Pencil

dr[2] = Mobile.Text; dr[3] = Email.Text; dr[4] = UID.Text; } } Name.ReadOnly = false; Address.ReadOnly = false; Mobile.ReadOnly = false; Email.ReadOnly = false; UID.ReadOnly = false; SqlCommandBuilder cb = new SqlCommandBuilder(da); da.Update(dt); } protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Response.Redirect("Password.aspx"); } } }

Password.aspx using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; namespace p1 { public partial class Password : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=ecrsdb;Integrated Security=True;Pooling=False"); SqlDataAdapter da = new SqlDataAdapter("Select * from Customer", con); DataSet ds = new DataSet(); da.Fill(ds, "Customer"); DataTable dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { if (Old.Text != "") { if (Old.Text == dr[5].ToString()) { if (New.Text == NewConfirm.Text) { dr[5] = New.Text; } else {

Document sign date :Feb 3, 2015

Administrator
Pencil

Label3.Text = "New Password & Confirm Password DoNot Match"; } } else { Label4.Text = "Enter Correct Old Password!"; } } SqlCommandBuilder cb = new SqlCommandBuilder(da); da.Update(dt); } } protected void Button2_Click(object sender, EventArgs e) { Response.Redirect("Login.aspx"); } protected void Button1_Click(object sender, EventArgs e) { Response.Redirect("PassConfirmer.aspx"); } } }

PassConfirmer.aspx using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace p1 { public partial class PassConfirmer : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Label3.Text = "Password Changed!"; Label4.Text = "Use the Reset Password For Next LogIn."; } protected void Button2_Click(object sender, EventArgs e) { Response.Redirect("Login.aspx"); } } }

Cancelbook.aspx using System; usingSystem.Collections.Generic; usingSystem.Linq; usingSystem.Web;

Document sign date :Feb 3, 2015

usingSystem.Web.UI; usingSystem.Web.UI.WebControls; usingSystem.Data; usingSystem.Data.SqlClient; namespaceecrs { publicpartialclasscancelbook : System.Web.UI.Page { protectedvoidPage_Load(object sender, EventArgs e) { if (!IsPostBack) { GetData(); BindData(); } } privatevoidGetData() { SqlConnection con2 = newSqlConnection("Data Source=.\\sqlexpress;InitialCatalog=aot;Integrated Security=True;Pooling=False"); SqlCommandcmd = newSqlCommand("select custid,Regnocar,Doj,bookid from book where custid=@v1", con2); cmd.Parameters.AddWithValue("@v1", Session["u"].ToString()); SqlDataAdapter b = newSqlDataAdapter(cmd); DataSet ds = newDataSet(); b.Fill(ds, "book"); DataTabledtt = ds.Tables[0]; Session["boc"] = b; Session["dttboc"] = dtt; } privatevoidBindData() { GridView1.DataSource = (DataTable)Session["dttboc"]; GridView1.DataBind(); } protectedvoid GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "cancel") { int index = Convert.ToInt32(e.CommandArgument.ToString()); GridViewRow gr = GridView1.Rows[index]; stringcustid = ((Label)gr.FindControl("Label1")).Text; Session["cuid"] = custid; stringcregn = ((Label)gr.FindControl("Label2")).Text; Session["caregn"] = cregn; stringdoj = ((Label)gr.FindControl("Label3")).Text; Session["dooj"] = doj; string bid = ((Label)gr.FindControl("Label4")).Text; Session["boid"] = bid; Response.Redirect("WebForm2.aspx"); } } } }

Finalcancel.aspx using System; usingSystem.Collections.Generic;

Document sign date :Feb 3, 2015

Administrator
Pencil

usingSystem.Linq; usingSystem.Web; usingSystem.Web.UI; usingSystem.Web.UI.WebControls; usingSystem.Data; usingSystem.Data.SqlClient; namespaceecrs { publicpartialclassWebForm2 : System.Web.UI.Page { protectedvoidPage_Load(object sender, EventArgs e) { TextBox1.Text = Session["cuid"].ToString(); TextBox2.Text = Session["caregn"].ToString(); TextBox3.Text = Session["dooj"].ToString(); TextBox4.Text = Session["boid"].ToString(); } protectedvoid Button1_Click(object sender, EventArgs e) { SqlConnection con2 = newSqlConnection("Data Source=.\\sqlexpress;InitialCatalog=aot;Integrated Security=True;Pooling=False"); SqlCommand cmd2 = newSqlCommand("update book set Booking=@v1 where bookid=@v2", con2); cmd2.Parameters.AddWithValue("@v1", "CANCELLED"); cmd2.Parameters.AddWithValue("@v2", Session["boid"].ToString()); con2.Open(); cmd2.ExecuteNonQuery(); con2.Close(); } } }

AvailableCars.aspx using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; namespace p1 { public partial class AvailableBook : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { GetData(); BindData(); } } private void GetData() { SqlConnection con = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=ecrsdb;Integrated Security=True;Pooling=False");

Document sign date :Feb 3, 2015

Administrator
Pencil

SqlCommand cmd = new SqlCommand("Select * From CarDetails where Status=@var", con); cmd.Parameters.AddWithValue("@var", "AVAILABLE"); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds, "CarDetails"); DataTable dt = ds.Tables[0]; Session["dap"] = da; Session["dat"] = dt; } private void BindData() { GridViews.DataSource = (DataTable)Session["dat"]; GridViews.DataBind(); } protected void GridViews_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Booking") { int index = Convert.ToInt32(e.CommandArgument.ToString()); GridViewRow gr = GridViews.Rows[index]; string carname = ((Label)gr.FindControl("Label1")).Text; Session["carname"] = carname; string regno = ((Label)gr.FindControl("Label2")).Text; Session["regno"] = regno; string carcat = ((Label)gr.FindControl("Label3")).Text; Session["carcat"] = carcat; string cool = ((Label)gr.FindControl("Label4")).Text; Session["cool"] = cool; string status = ((Label)gr.FindControl("Label5")).Text; Session["status"] = status; string rate = ((Label)gr.FindControl("Label6")).Text; Session["rate"] = rate; string descp = ((Label)gr.FindControl("Label7")).Text; Session["descp"] = descp; Response.Redirect("Bookacar.aspx"); } } } }

Bookacar.aspx

using System; usingSystem.Collections.Generic; usingSystem.Linq; usingSystem.Web; usingSystem.Web.UI; usingSystem.Web.UI.WebControls; usingSystem.Data; usingSystem.Data.SqlClient; namespaceecrs { publicpartialclassbookacars : System.Web.UI.Page { protectedvoidPage_Load(object sender, EventArgs e) { TextBox7.Text = Session["regno"].ToString(); TextBox1.Text = Session["cat"].ToString(); TextBox2.Text = Session["carname"].ToString();

Document sign date :Feb 3, 2015

TextBox3.Text = Session["cool"].ToString(); TextBox4.Text = Session["rate"].ToString(); TextBox5.Text = Session["desc"].ToString(); } protectedvoid Button1_Click(object sender, EventArgs e) { SqlConnection con2 = newSqlConnection("Data Source=.\\sqlexpress;InitialCatalog=aot;Integrated Security=True;Pooling=False"); SqlCommand cmd2 = newSqlCommand("update carstat set status=@v1 where regno=@v2", con2); cmd2.Parameters.AddWithValue("@v1", "NOT AVAILABLE"); cmd2.Parameters.AddWithValue("@v2", TextBox7.Text); con2.Open(); cmd2.ExecuteNonQuery(); con2.Close(); SqlConnection con3 = newSqlConnection("Data Source=.\\sqlexpress;InitialCatalog=aot;Integrated Security=True;Pooling=False"); SqlCommand cmd3 = newSqlCommand("select * from book", con3); con3.Open(); SqlDataReaderdr = cmd3.ExecuteReader(); int count = 0; while (dr.Read()) { count++; } count++; con3.Close(); Label9.Text= count.ToString(); SqlConnection con = newSqlConnection("Data Source=.\\sqlexpress;InitialCatalog=aot;Integrated Security=True;Pooling=False"); SqlCommandcmd = newSqlCommand("Insert into book values (@cid,@carno,@doj,@skm,@ekm,@rate,@fa,@bs,@bid) ", con); cmd.Parameters.AddWithValue("@cid", Session["u"].ToString()); cmd.Parameters.AddWithValue("@carno", TextBox7.Text); cmd.Parameters.AddWithValue("@doj", TextBox6.Text); cmd.Parameters.AddWithValue("@skm", "0"); cmd.Parameters.AddWithValue("@ekm", "0"); cmd.Parameters.AddWithValue("@rate", TextBox4.Text); cmd.Parameters.AddWithValue("@fa", "0"); cmd.Parameters.AddWithValue("@bs", "OPEN"); cmd.Parameters.AddWithValue("@bid", int.Parse(Label9.Text)); con.Open(); cmd.ExecuteNonQuery(); con.Close(); Label8.Text = "BOOKED SUCCESSFULLY"; Label10.Text = "YOUR BOOKING ID IS"; Session["bid"] = int.Parse(Label9.Text); } } }

bookfare.aspx

Document sign date :Feb 3, 2015

Administrator
Pencil

using System; usingSystem.Collections.Generic; usingSystem.Linq; usingSystem.Web; usingSystem.Web.UI; usingSystem.Web.UI.WebControls; usingSystem.Data; usingSystem.Data.SqlClient; namespaceecrs { publicpartialclassbookfare : System.Web.UI.Page { protectedvoidPage_Load(object sender, EventArgs e) { if (!IsPostBack) { GetData(); BindData(); } } privatevoidGetData() { SqlConnection con2 = newSqlConnection("Data Source=.\\sqlexpress;InitialCatalog=aot;Integrated Security=True;Pooling=False"); SqlCommandcmd = newSqlCommand("select * from book where Booking=@v1", con2); cmd.Parameters.AddWithValue("@v1", "OPEN"); SqlDataAdapter b = newSqlDataAdapter(cmd); DataSet ds = newDataSet(); b.Fill(ds, "book"); DataTabledtt = ds.Tables[0]; Session["bo"] = b; Session["dttbo"] = dtt; } privatevoidBindData() { GridView1.DataSource = (DataTable)Session["dttbo"]; GridView1.DataBind(); } protectedvoid GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "fare") { int index = Convert.ToInt32(e.CommandArgument.ToString()); GridViewRow gr = GridView1.Rows[index]; stringcustid = ((Label)gr.FindControl("Label2")).Text; Session["cid"] = custid; stringcregn = ((Label)gr.FindControl("Label1")).Text; Session["cregn"] = cregn; stringdoj = ((Label)gr.FindControl("Label3")).Text; Session["doj"] = doj; string Rate = ((Label)gr.FindControl("Label5")).Text; Session["rate"] = Rate; string status = ((Label)gr.FindControl("Label7")).Text; Session["status"] = status; stringbookid = ((Label)gr.FindControl("Label4")).Text; Session["bookid"] = bookid;

Document sign date :Feb 3, 2015

Response.Redirect("fare.aspx"); } } } }

fare.aspx

using System; usingSystem.Collections.Generic; usingSystem.Linq; usingSystem.Web; usingSystem.Web.UI; usingSystem.Web.UI.WebControls; usingSystem.Data; usingSystem.Data.SqlClient; namespaceecrs { publicpartialclassfare : System.Web.UI.Page { protectedvoidPage_Load(object sender, EventArgs e) { if (!IsPostBack) { TextBox9.Text = Session["cid"].ToString(); TextBox2.Text = Session["cregn"].ToString(); TextBox3.Text = Session["doj"].ToString(); TextBox6.Text = Session["rate"].ToString(); TextBox8.Text = Session["status"].ToString(); TextBox10.Text = Session["bookid"].ToString(); } } protectedvoid Button1_Click(object sender, EventArgs e) { intskm, ekm, fare,rate; skm = int.Parse(TextBox4.Text); ekm = int.Parse(TextBox5.Text); rate = int.Parse(TextBox6.Text); fare = ((ekm - skm) * rate); TextBox7.Text = fare.ToString(); SqlConnection con = newSqlConnection("Data Source=.\\sqlexpress;InitialCatalog=aot;Integrated Security=True;Pooling=False"); SqlCommandcmd = newSqlCommand("update book set startkm=@v1,endkm=@v2,Totalfare=@v4,Booking=@v5 where bookid=@v3 ", con); cmd.Parameters.AddWithValue("@v1", TextBox4.Text); cmd.Parameters.AddWithValue("@v2", TextBox5.Text); cmd.Parameters.AddWithValue("@v3", TextBox10.Text); cmd.Parameters.AddWithValue("@v4", TextBox7.Text); cmd.Parameters.AddWithValue("@v5", TextBox8.Text); con.Open(); cmd.ExecuteNonQuery(); con.Close(); }

}

}

Document sign date :Feb 3, 2015

Administrator
Pencil

Certificate

This is to certify that Mr.SAIKAT SAMANTA, of, ACADEMY OF TECHNOLOGY registration number: 131690110172, has successfully completed a project on e-CAR RENTAL SYSTEM using .Net under the guidance of Mr.KAUSHIK GHOSH -------------------------------------------------------

KAUSHIK GHOSH Globsyn Finishing School (a division of Globsyn Skills)

Document sign date :Feb 3, 2015