Code Examples
  Home arrow Code Examples arrow WAP Ticket Booking System by Jignesh Desai
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
CODE EXAMPLES

WAP Ticket Booking System by Jignesh Desai
By: aspfree
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 85
    2000-08-29

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT



    WAP Ticket Booking System




    Jignesh Desai


    Address : C/204 Patel Nagar, Kandivali (w), Mumbai 400067, India.
    Email : codehunt@yahoo.com
    Tel : 863 83 99
    Topic Title : "Muna Mobile"
    Topic Description : Movie Tickets Booking System on Mobile Phone written in ASP and WAP. Tested on Nokia's and Phone's simulator.
    Level : (Advanced) Assumed you are aware of ASP and WML
    Here we will see a nice, simple example of how a user can book a movie tickets through his mobile phone. We are going to use ASP and Access database to retrieve and store information. No Registration is required.

    Take a look on Database structure first. (Tickets.mdb)

    We have 4 Tables,
    [Movie : Stores Movie names and stars in movie, Unique movieId(Auto Number Field).]
    [Theater : Stores Theater names each one uniquely identified by theaterid (Auto Number Field).]
    [Shows : Theaters running particular movies and its timings, seats availability and per ticket price, MovieId and TheaterId as Foreign Keys. Each show identified as Showid (Auto Number Field)].
    [Booking : Unique booking id generated for each booking done. you also store name, phone number and number of seats booked of the users.

    Here is the Relational Structure and Sample Data Used for Demo




    Before writing code understand basic

    For demo you can put all this .wml and .asp files in to one directory and map it as a virtual directory is IIS. Since it uses DSN-less connection put database also in the same directory.
    When you call or redirect to .asp file your asp file should generate WML code instead of HTML, because that is what your w@p enable device or simulator would understand. This can be done by first throwing W@P’s mime-types from an ASP program. The following lines should be included in your ASP program as it is.

    <%Response.ContentType="text/vnd.wap.wml"%>
    <%Response.write("<?xml version=""1.0""?><!DOCTYPE wml PUBLIC ""-//WAPFORUM//DTD WML 1.1//EN"" ""http://www.wapforum.org/DTD/wml_1.1.xml"">")%>

    After this you can throw any WML content. First line is important as browser sould know what type of data is going to come.

    Passing parameters to ASP program
    At time you accept input from the user which needs to be pass to an ASPprogram. Here are WML statements to pass parameters in a name valuepair to your ASP program.Using your <go> tag you call your nextWML DECK or an ASP program. Right !.

    <do type="accept" label="Select Movie">
    <go href="theaters.asp" method="get" >
    <postfield name="mid" value="$(mid)" />
    </go>
    </do>


    Here you can also specify method ( ie. GET/POST although POST is notsupported by few devices we will use GET Method ) and the parametersyou want to pass by using <postfield> tag. <postfield> tagrequires name and value attributes.
    That's enough to proceed

    Here is the entire code with explanation

    This is the initial screen which stays for few seconds and then redirects you to movie.asp

    munamobile.wml

    <wml>
    <card ontimer="movie.asp">
    <timer value="30"/>
    <p align="center">
    Welcome to Muna-Mobile<br/><br/><img src="movie.bmp"alt="logo" /><br/>Movie Ticket<br/>Booking System !
    </p>
    </card>
    </wml>


    This page give list of all Movies available in the system, and user toselect one. It lists movies as choices, <select and option> tags.Before sending any output it send appropriate mime type by settingcontent type property

    movie.asp

    <%Response.ContentType="text/vnd.wap.wml"%>
    <%Response.write("<?xml version=""1.0""?><!DOCTYPE wml PUBLIC ""-//WAPFORUM//DTD WML 1.1//EN"" ""http://www.wapforum.org/DTD/wml_1.1.xml"">")%>
    <wml>
    <card>
    <p align="right">Running <img src="movie.bmp" alt="logo" /></p><p>
    <%
    dim sql
    set conn = server.createobject("adodb.connection")
    set rs = server.createobject("adodb.recordset")
    conn.Provider = "Microsoft.Jet.OLEDB.4.0"
    conn.ConnectionString = "Data Source=" & Server.MapPath ("tickets.mdb")
    conn.open
    sql="movie"
    rs.open sql, conn, 2, 2
    %>
    <select name="mid" title="Movies">
    <%Do while not rs.eof%>
    <option value="<%=rs("movieid")%>"><%=rs("title")%> [<%=rs("staring")%>]</option>
    <%
    rs.movenext
    loop
    rs.Close
    %>
    </select>
    </p>
    <do type="accept" label="Select Movie">
    <go href="theaters.asp" method="get" >
    <postfield name="mid" value="$(mid)" />
    </go>
    </do>

    </card>
    </wml>

    After select desired movie, program show the list of theaters running selected movie.

    theaters.asp

    <%Response.ContentType="text/vnd.wap.wml"%>
    <%Response.write("<?xml version=""1.0""?><!DOCTYPE wmlPUBLIC ""-//WAPFORUM//DTD WML 1.1//EN""""http://www.wapforum.org/DTD/wml_1.1.xml"">")%>
    <wml>
    <card>
    <p>
    Currently Running in
    <%
    dim sql
    set conn = server.createobject("adodb.connection")
    set rs = server.createobject("adodb.recordset")
    conn.Provider = "Microsoft.Jet.OLEDB.4.0"
    conn.ConnectionString = "Data Source=" & Server.MapPath ("tickets.mdb")
    conn.open
    sql="Select theaterid , name from theater where theaterid in (selecttheterid from shows where movieid = " & Request.QueryString("mid")& ")"
    rs.open sql, conn, 2, 2
    %>
    <select name="tid" title="Theaters">
    <%Do while not rs.eof%>
    <option value="<%=rs("theaterid")%>"><%=rs("name")%></option>
    <%
    rs.movenext
    loop
    rs.Close
    %>
    </select>
    </p>
    <do type="accept" label="Theater ?">
    <go href="shows.asp" method="get">
    <postfield name="tid" value="$(tid)" />
    <postfield name="mid" value="<%=Request.QueryString("mid")%>" />
    </go>
    </do>
    </card>
    </wml>

    Once theater is select program show the available show timings and ask user to select one.

    shows.asp

    <%dim sql
    set conn = server.createobject("adodb.connection")
    set rs = server.createobject("adodb.recordset")
    conn.Provider = "Microsoft.Jet.OLEDB.4.0"
    conn.ConnectionString = "Data Source=" & Server.MapPath ("tickets.mdb")
    conn.open
    sql="Select * from shows where movieid = "&Request.QueryString("mid") &" and theterid = "&Request.QueryString("tid")
    rs.open sql, conn, 2, 2
    %>
    <%Response.ContentType="text/vnd.wap.wml"%>
    <%Response.write("<?xml version=""1.0""?><!DOCTYPE wmlPUBLIC ""-//WAPFORUM//DTD WML 1.1//EN""""http://www.wapforum.org/DTD/wml_1.1.xml"">")%>
    <wml>
    <card>
    <p>
    Shows Available At :
    <select name="showid" title="Show Times">
    <%Do while not rs.eof%>
    <option value="<%=rs("showid")%>"> <%=rs("time")%>[<%=rs("seatsavailable")%>]Seats </option>
    <%
    rs.movenext
    loop
    rs.Close
    %>
    </select>
    </p>
    <do type="accept" label="Show ?" >
    <go href="bookseats.asp" method="get">
    <postfield name="showid" value="$(showid)" />
    </go>
    </do>
    </card>
    </wml>

    Oncewe know for which show he wants to book tickets, show him details ofwhat he has selected till now plus price per ticket and ask him howmany he wants to book ?.

    bookseats.asp

    <%Response.ContentType="text/vnd.wap.wml"%>
    <%Response.write("<?xml version=""1.0""?><!DOCTYPE wmlPUBLIC ""-//WAPFORUM//DTD WML 1.1//EN""""http://www.wapforum.org/DTD/wml_1.1.xml"">")%>
    <wml>
    <card>
    <p>
    <%
    dim sql
    set conn = server.createobject("adodb.connection")
    set rs = server.createobject("adodb.recordset")
    conn.Provider = "Microsoft.Jet.OLEDB.4.0"
    conn.ConnectionString = "Data Source=" & Server.MapPath ("tickets.mdb")
    conn.open
    sql="SELECT shows.showid, shows.movieid, shows.theterid, shows.time,shows.seatsavailable, shows.price, movie.title, theater.name FROMtheater INNER JOIN (movie INNER JOIN shows ON movie.movieid =shows.movieid) ON theater.theaterid = shows.theterid WHERE ((showid="&Request.QueryString("showid") &"))"
    rs.open sql, conn, 2, 2
    %>
    Rs <%=rs("price")%>/- Per Ticket <br/>
    Movie: <%=rs("title")%> <br/>
    Loc: <%=rs("name")%> <br/>
    Time: <%=rs("time")%> <br/>
    Book Seats ? : <input name="nooftickets" format="2N" />
    </p>
    <do type="accept">
    <go href="confirmbooking.asp" method="get">
    <postfield name="showid" value="<%=Request.QueryString("showid")%>" />
    <postfield name="nooftickets" value="$(nooftickets)" />
    </go>
    </do>
    </card>
    </wml>

    Get his Confirmation

    confirmbooking.asp

    <%Response.ContentType="text/vnd.wap.wml"%>
    <%Response.write("<?xml version=""1.0""?><!DOCTYPE wmlPUBLIC ""-//WAPFORUM//DTD WML 1.1//EN""""http://www.wapforum.org/DTD/wml_1.1.xml"">")%>
    <wml>
    <card>
    <p>
    <%
    dim sql
    set conn = server.createobject("adodb.connection")
    set rs = server.createobject("adodb.recordset")
    conn.Provider = "Microsoft.Jet.OLEDB.4.0"
    conn.ConnectionString = "Data Source=" & Server.MapPath ("tickets.mdb")
    conn.open
    sql="SELECT shows.showid, shows.movieid, shows.theterid, shows.time,shows.seatsavailable, shows.price, movie.title, theater.name FROMtheater INNER JOIN (movie INNER JOIN shows ON movie.movieid =shows.movieid) ON theater.theaterid = shows.theterid WHERE ((showid="&Request.QueryString("showid") &"))"
    rs.open sql, conn, 2, 2
    %>
    Rs <%=rs("price")%>/- Per Ticket <br/>
    Movie: <%=rs("title")%> <br/>
    Loc: <%=rs("name")%> <br/>
    Time: <%=rs("time")%> <br/>
    Seats Booked : <%=Request.QueryString("nooftickets")%> <br/>
    Cost : <%=rs("price")*Request.QueryString("nooftickets")%>
    </p>
    <do type="accept" label="Confirm">
    <go href="orderidthanks.asp" method="get">
    <postfield name="showid" value="<%=Request.QueryString("showid")%>" />
    <postfield name="nooftickets" value="<%=Request.QueryString("nooftickets")%>" />
    </go>
    </do>
    </card>
    </wml>

    Oneconfirmation is done make entry in the database, reduce seatsavailability and show him his booking-id and other message. and thenredirect him back to home page.

    orderidthanks.asp

    <%Response.ContentType="text/vnd.wap.wml"%>
    <%Response.write("<?xml version=""1.0""?><!DOCTYPE wmlPUBLIC ""-//WAPFORUM//DTD WML 1.1//EN""""http://www.wapforum.org/DTD/wml_1.1.xml"">")%>
    <wml>
    <card>
    <p align="center">
    <%
    dim sql , rf
    dim orderid
    set conn = server.createobject("adodb.connection")
    set rs = server.createobject("adodb.recordset")
    set rs2 = server.createobject("adodb.recordset")
    conn.Provider = "Microsoft.Jet.OLEDB.4.0"
    conn.ConnectionString = "Data Source=" & Server.MapPath ("tickets.mdb")
    conn.open
    sql="booking"
    rs.open sql, conn, 2, 2
    rs.AddNew
    rs("showid") = Request.QueryString("showid")
    rs("seatsbooked") = Request.QueryString("nooftickets")
    rs("name") = Request.QueryString("uname")
    rs("telno") = Request.QueryString("telno")
    rs.Update
    orderid = rs("bookingid")
    Response.Write "Your Ticket is confirmed and your bookingid = " &orderid
    rs.Close

    sqltext = "Update shows set seatsavailable = seatsavailable -"&Request.QueryString("nooftickets") &" where showid= "&Request.QueryString("showid")
    set rs2 = conn.Execute(sqltext, rf)

    %>

    </p>
    <do type="accept" label="OK">
    <go href="WP_BOOKMARK#thanks" />
    </do>
    </card>


    <card id="thanks" ontimer="munamobile.wml">
    <timer name="timer1" value="50" />
    <p align="center">
    Thanks You can Collect your ticket from the theater 40 min prior to movie time<br/> Booking-id= <%=orderid%>
    </p>
    <do type="accept" label="Redirecting..">
    <go href="munamobile.wml" />
    </do>
    </card>
    </wml>


    That's All Folks, Download the code and Enjoy !



    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Code Examples Articles
    More By aspfree

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! Achieving True Agility -- How process can change the behavior of your tools

    Achieving true agility is a never-ending effort. We will showcase how you can become agile incrementally, a few practices at the time.Which practices should any agile team strive to adopt? What additional practices should you consider based on your needs to scale? Adopting practices are however made much easier with the right tool support. What about if your tools adapt to your practices? We will take a look at how the Jazz technology can be leveraged to make your process change the behavior of your tools.
    FREE! Go There Now!


    NEW! Best practices for software analysis: An introduction to the IBM Rational Software Analyzer application

    This whitepaper presents the benefits of successfully introducing static analysis into your organization using IBM Rational Software Analyzer. Additionally, it identifies some common pitfalls that can hinder the effective use of static analysis tooling as well as presents 10 simple strategies designed to help you quickly realize the value of static analysis using Rational Software Analyzer.
    FREE! Go There Now!


    NEW! Best Practices in Integrated Requirements Management

    Poor Requirements Management capabilities in an Enterprise have been linked to excessive project failures, escalating IT costs, and failure to deliver competitive advantage into the marketplace. Join Brianna M Smith from IBM Rational and learn about how successful organizations align IT and Business stakeholders through collaborative processes and tools for effective requirements management, and how an integrated approach across the IT lifecycle can provide unparalleled visibility and traceability to ensure that project teams are delivering on the business vision by "doing the right things" and "doing things right."
    FREE! Go There Now!


    NEW! Download the free Web Application Security eKit

    Discover how IBM Rational AppScan Standard Edition can help you detext vulnerabilities in your web applications in the Web Application Security eKit. IBM Rational AppScan is a leading suite of automated web application security solutions that scan and test for common Web application vulnerabilities. The new Web Application Security eKit provides you with valuable resources, including white papers, demos, and additional information on the benefits of testing your Web applications.
    FREE! Go There Now!


    NEW! Evaluate IBM Rational Developer for System i V7.1

    Download a free trial version of IBM Rational Developer for System i V7.1, which provides a complete development environment for traditional i5/OS application development. IBM Rational Developer for System i is a new eclipse-based workstation offering for i5/OS application development that provides a comprehensive Integrated Development Environment for edit/compile/debug of traditional RPG/COBOL/C/C++ i5/OS applications.
    FREE! Go There Now!


    NEW! Hello World: Monitor a simple business process using WebSphere Business Monitor V6.0.2

    This tutorial shows new users of IBM WebSphere Business Monitor Version 6.0.2 how to perform the "Hello World" equivalent for monitoring business process applications. It is intended to help you get familiar with the capabilities of the product.
    FREE! Go There Now!


    NEW! Rational 'Talks to You' Teleconference Series

    This Fall, IBM Rational talks to you directly through a special teleconference series giving you access to the best minds in IBM Rational - product experts and market thought leaders who will answer your questions during these pre-scheduled telephone conference calls. Register today!
    FREE! Go There Now!


    NEW! Rational Talks to You:Per Kroll on Rational Method Composer Plug-in customization

    Join this Rational Talks to You teleconference on December 11 at 1:00 pm ET to get tips on building your own plugins with Rational Method Composer. Get your questions answered!
    FREE! Go There Now!


    NEW! Run your first CICS application on a PC using TXSeries for Windows

    Learn the basics of the IBM Customer Information Control System (CICS). With a hands-on exercise, learn how to get your first CICS application up and running on your desktop using TXSeries V6.1 for Windows. The tutorial shows you how to download and install a free trial version of TXSeries V6.1.
    FREE! Go There Now!


    NEW! Trial download: IBM Rational Performance Tester V7.0.1

    Get a free trial download of the latest version of IBM Rational Performance Tester V7.0.1, a load and performance testing solution for teams concerned about the scalability of their Web-based applications. Combining multiple ease-of-use features with granular detail, Rational Performance Tester simplifies the test-creation, load-generation and data-collection processes that help teams ensure the ability of their applications to accommodate required user loads.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    CODE EXAMPLES ARTICLES

    - Bipartite Graphs
    - Connectivity in Graphs
    - The Ford-Fulkerson Algorithm
    - Critical Paths
    - The Bellman-Ford and Roy-Floyd Algorithms
    - Shortest Path Algorithms in Graphs
    - Minimum Spanning Tree
    - Articulation Edges and Vertexes
    - Circles and Connectivity in Graphs
    - Depth-First Search in Graphs
    - Breadth-First Search in Graphs
    - The Prufer Code and the Floyd-Warshall Algor...
    - An Insight into Graphs
    - Coding a Custom Object with WSC
    - Creating a Custom Object with WSC





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek