Professional Documents
Culture Documents
Airline Implementation:
<%
dim conn,rs
set conn=server.createobject("ADODB.Connection")
set rs=server.createobject("ADODB.RecordSet")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\students\batch2\wml\database.mdb;Persist Security Info=False"
%>
1. Reservation:
Select Source:
<select name="source">
<%
rs.open "select distinct source,destination from flight_info",conn
while not rs.EOF
%>
<option value="<%=rs.fields("source")%>" ><%=rs.fields("source")%></option>
<%
rs.movenext
wend
%>
</select>
Select Destination:
<select name="destination">
<%
while not rs.EOF
%>
<option value="<%=rs.fields("Destination")%>" >
<%=rs.fields("Destination")%></option>
<%
rs.movenext
wend
%>
</select>
<anchor>
Ok
<go href="http://www.neccse.com:8080/wapbatch/wml/airreservationok.asp"
method="post">
<postfield name="source" value="$(source)"/>
<postfield name="destination" value="$(destination)"/>
</go>
</anchor>
In the airreservationok.asp we retrieve the values sent by the clients with the
help of the following code:
After getting source and destination retrieve corresponding dates and flight
numbers from the database. For this we open the database as follows:
If the recordset object is set to end of file(eof) then display that there are no
flights. Otherwise display flight dates and numbers similar to the above code.
Request the Credit Card Number, No. of kids, children, adult from the user and
send it to checkdatabase.asp page.
if flightfound="true" then
if sumnumber<=total_seats then
rs.open "select amount from fare_amount where category='kid'"
kidamount=cint(rs.fields("amount"))
rs.close
rs.open "select amount from fare_amount where category='child'"
childamount=cint(rs.fields("amount"))
rs.close
sumamount=cint(kidnumber)*cint(kidamount)+
cint(childnumber)*cint(childamount)+
cint(adultnumber)*cint(adultamount)
sumamount=sumamount+journeyamount
end if
rs.movenext
wend
rs.movefirst
end if
if found="true" then
response.write "Kid Number = "&kidnumber&" <br/>"
response.write "Child Number = "&childnumber&" <br/>"
response.write "Adult Number = "&adultnumber&" <br/>"
response.write "Kid Amount = Rs."&kidamount&" <br/>"
response.write "Child Amount =Rs."&childamount&" <br/>"
response.write "Adult Amount =Rs. "&adultamount&" <br/>"
if ccur(finalcreditamount-sumamount)<500 then
response.write "Sufficient amount is not available in your account"
else
commandob.activeconnection=conn
commandob.commandtext="update credit_info set “ & _
“balance='"&ccur(finalcreditamount-sumamount)& _
"' where creditcardnumber='"&creditcardnumber&"'"
commandob.commandtype=adCmdText
commandob.execute numofrec
commandob.commandtext="select * from credit_info"
commandob.commandtype=adCmdText
response.write "<br/>Amount Rs."&sumamount& _
" is debited from your account"
dim randnumber
while valuesetted="false"
randomize
randnumber=cstr(Rnd*999999*10)
commandob.commandtext="select userid from bank “ & _
“where userid='"&randnumber&"'"
commandob.commandtype=adCmdText
set objrs=commandob.execute
if objrs.eof then
commandob.commandtext="insert into bank
(userid,credit_number)”&_
“ values
"&cstr(left(randnumber,5))&"','"&cstr(creditcardnumber)&"')"
commandob.commandtype=adCmdText
commandob.execute
valuesetted="true"
end if
wend
commandob.commandtype=adCmdText
commandob.execute
commandob.commandtext="insert into reserved_info”&_
“(flight_number,userid,source,destination) values”&_
“('"&cstr(flight_number)&"','"&cstr(left(randnumber,5))&_
"','"&cstr(source)&"','"&cstr(destination)&"')"
commandob.commandtype=adCmdText
commandob.execute
commandob.commandtext="update flight_info set “&_
“total_seats='"&cint(total_seats-sumnumber)& _
"' where flight_number='"&flight_number&"'"
commandob.commandtype=adCmdText
commandob.execute
else
response.write "Credit card number is invalid"
end if
else
response.write "Sufficient number of seats are not available"
end if
Cancellation:
In Cancellation the user must give the user id given as part of Reservation. This
will be sent to to rnovalid.asp page.
<% response.contenttype="text/vnd.wap.wml"%>
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="aircancellation" title="Cancellation">
<p>Enter Reservation number<br/></p>
<go href="http://www.neccse.com:8080/wapbatch/wml/rnovalid.asp"
method="post">
<postfield name="rno" value="$(rno)"/>
</go>
</anchor>
<a
href="http://www.neccse.com:8080/wapbatch/wml/services.asp#airinfo">Cancel
</a>
</p>
</card>
</wml>
We initially check whether user exists in the database or not. If the user
enters invalid User id then we will display a page stating that the user is not a
valid user.
Otherwise we contact the database to give creditcardnumber, number of kids,
children, adult and ticket cost for their journey. Amount is calculated from these
and will be debited from his/her account. This is informed to him/her. Then
information is updated and deleted from the database.
<% response.contenttype="text/vnd.wap.wml"%>
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<!--#include file="datasourcecode.asp"-->
<!-- METADATA TYPE="typelib" FILE="C:\Program Files\Common
Files\System\ado\msado15.dll"-->
<card id="validation_cancellation" title="Cancellation">
<p>
<%
dim rno,kidnumber,childnumber,adultnumber,kidamount,
dim childamount,adultamount,sumamount,sumnumber
dim commandob,objrs,flight_number
dim creditcardnumber,userid,balance,source,
dim destination,total_seats,journeyamount
set commandob=server.createobject("ADODB.Command")
set objrs=server.createobject("ADODB.RecordSet")
rno=cstr(request.form.item("rno"))
userid=cstr(rno)
commandob.activeconnection=conn
commandob.commandtype=adCmdText
commandob.commandtext="select amount from fare_amount where
category='kid'"
set objrs=commandob.execute
kidamount=ccur(objrs.fields("amount"))
commandob.commandtext="select amount from fare_amount where
category='child'"
set objrs=commandob.execute
childamount=ccur(objrs.fields("amount"))
commandob.execute
commandob.commandtext="delete from fare where “&_
“userid='"&cstr(userid)&"'"
commandob.execute
commandob.commandtext="delete from reserved_info where”&_
“userid='"&cstr(userid)&"'"
commandob.execute
Seaports Implementation:
Connection variables and database is as follows:
<%
dim conn1,rs1
set conn1=server.createobject("ADODB.Connection")
set rs1=server.createobject("ADODB.RecordSet")
conn1.open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\students\batch2\wml\shipdatabase.mdb;Persist Security Info=False"
%>
Seaport Reservation:
Seaport Cancellation:
Here, the user needs to enter his user id and container id for cancellation.
Once he/she enter correct numbers values are retrieved from the database and
additions/subtractions are performed. Here, we cost charges based on space
and weight collectively.
rno=cstr(request.form.item("rno"))
cno=cstr(request.form.item("cno"))
commandob.activeconnection=conn1
commandob.commandtype=adCmdText
commandob.commandtext="select * from reserved_info where
userid='"&cstr(rno)&"' and containernumber='"&cstr(cno)&"'"
set objrs=commandob.execute
if objrs.eof then
response.write "Invalid User Id"
else
valuesetted="true"
space2=(objrs.fields("space1"))
weight2=(objrs.fields("weight"))
shipnumber=cstr(objrs.fields("shipnumber"))
creditcardnumber=cstr(objrs.Fields("creditcardnumber"))
cargo_type=cstr(objrs.fields("cargo_type"))
end if
sumamount=ccur(15000)
elseif(cint(space2)>=251 and cint(space2)<=500 )then
sumamount=ccur(50000)
else
sumamount=ccur(250000)
end if