Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Microsoft C# Professional Projects - Premier Press.pdf
Скачиваний:
177
Добавлен:
24.05.2014
Размер:
14.65 Mб
Скачать
dtReserva-

518 Project 4 CREATING AN AIRLINE RESERVATION PORTAL

The ConfirmRes.aspx Form

The ConfirmRes.aspx form is used for confirming the reservation of customers. The form queries the ticket number specified by the user against the

tions database. If the ticket number is valid, the data of journey is retrieved from the database to ensure that the flight has not already departed. If both the conditions, validity of ticket number and nondeparture of flight, are fulfilled, the ticket is confirmed and the customer is informed about the same.The code for the Click

event of the Submit form, which enables you to confirm a reservation, is given as

follows:

 

 

 

private void btnConfirm_Click(object sender, System.EventArgs e)

{

 

 

 

Y

 

 

L

 

lblMessage.Text=””;

 

 

 

F

 

lblDetails.Visible=false;

 

M

 

 

sqlConnection1.Open();

 

 

dataSet21.Clear();

 

 

 

sqlDataAdapter1.SelectComAmand.Parameters[0].Value=txtTNo.Text.Trim();

 

sqlDataAdapter1.Fill(dataSet21, “TicketDetails”);

 

 

E

 

 

sqlConnection1.Close();

 

 

 

T

 

 

 

if (dataSet21.Tables[“TicketDetails”].Rows.Count==0)

{

lblMessage.Text=”Invalid ticket number.”; return;

}

else

{

string DateOfFlight; DateOfFlight=dataSet21.Tables[“TicketDetails”].Rows[0][2].ToString();

if (Convert.ToDateTime(DateOfFlight) < Convert.ToDateTime(DateTime.Today

.ToShortDateString()))

{

lblMessage.Text=”The flight has already departed”; return;

}

else

{

sqlConnection1.Open(); sqlDataAdapter1.UpdateCommand.Parameters[0].Value= txtTNo.Text.Trim();

Team-Fly®