chapter one 1 introduction 1 - teknikbelgeler.com...5 2.3.1.2 size of applications asp.net is good...
TRANSCRIPT
1
CHAPTER ONE
1 INTRODUCTION
This chapter contains information about problem definition , purpose of the project
and organization of the thesis.
1.1 Problem Definition, Significance and Motivation
Theater ticket sale system is basically made for providing the customer anytime and
anywhere service for buying the seat in the theatre and gather information about theater
events online. The member can easily see the theater events released and the make the
choice.
1.2 Purpose of the Project
This project is aimed to provide the customers facility to buy tickets for theater
events online, through which they can buy tickets anytime, anywhere.
1.3 Organization of the Thesis
Chapter 1 contains information about problem definition,signifcance, purpose of the
project and organization of the thesis.
Chapter 2 enlightens ASP.NET.MVC pattern.
Chapter 3 enlightens ENTITY Framework.
Chapter 4 elaborates the system design decisions of this project.
Chapter 5 enlightens structure of the database used in the project.
Chapter 6 contains information about interface design of web pages.
Chapter 7 contains information about using technologies and tools in the project.
Chapter 8 contains screenshots from webpages in the project.
Chapter 9 gives extensive information about the project timeline and time sharing of
project.
2
Chapter 10 discusses the results of the project, and offers recommendations to take
advantage of this work.
Last chapter, enlightens the originality of this project and innovative aspect of our
study.
CHAPTER TWO
2 ASP.MVC.NET
The MVC pattern was invented by Trygve Reenskaug while he was a visiting
scientist at the Smalltalk group at the famed Xerox Palo Alto Research Center. He wrote
his first paper on MVC in 1978. He originally called it the Thing Model View Editor
pattern, but he quickly changed the name of the pattern to the Model View Controller
pattern.
Reenskaug was trying to solve the problem of representing (modeling) complex real
world systems such as “the design and construction of a major bridge, a power station
or an off-shore oil production platform.” A human has a mental model of these systems
and a computer has a digital model. How do you bridge the gap between the mental
model and digital model?
2.1 Mvc Architecture
Mvc architecture separates the application into three components which consists of
Model ,View and Controller . MVC is a triangle architecture.
Figure 1:Mvc architecture
3
2.1.1 Model
Classes that represent the problem domain. These classes have code and logic to
serialize and de-serialize the data into dedicated data stores as well as do validation and
domain-specific logic. In ASP.NET MVC, this is the place for ORM or Data Access
frameworks to do their magic.
2.1.2 View
The Views folder stores the files (HTML files) related to the display of the
application (the user interfaces). These files may have the extensions html, asp, aspx,
cshtml, and vbhtml, depending on the language content.
2.1.3 Controller
The class that manages the relationship between View and the Model. It is also
responsible for accepting requests from the User and deciding which View to serve up if
any.
2.2 How ASP.NET MVC Works
The working mechanism of the ASP.NET.MVC is explained as follows:
1) User makes the request for some resource in server (by putting some URL in the
browser).
2) Request comes to controller first (routing engine is the one who is responsible
for deciding which request will be handled by which controller.).
3) Controller if required talk to model for data.
4) Model operates on database (or on some other data sources) and return data (in
form of business objects) to controller.
5) Controller chooses the appropriate view (like say Customer view which will may
contain some html tables, drop downs, textboxes…).
6) Controller passes the data (model data retrieved in step 4) to chosen view(in step
5), where data will be populated.
4
7) Controller sends back view to the user.
Figure 2:Asp.net.mvc working mechanism
2.3 Why ASP.NET Web Forms and Why ASP.NET MVC?
Each can be the “best choice” for a particular solution depending on the requirements
of the application and the background of the team members involved. When facing a
decision to choose between ASP.NET Web Forms or ASP.NET MVC it is important to
know that neither technology is meant to replace the other.
Two important factors we should consider while making the choice is
1) Rapid application development :If we want to develop anything rapidly
ASP.NET Web Forms is the only chance we are having, we can’t even consider for
ASP.NET MVC for RAD. (Reasons for RAD may be anything like client is not paying
too much, or application is going to be used for only one or two months and won’t
require much maintenance.)
2) Unit Testing :If automatic unit testing is most important factor for you MVC
will be best for you.
2.3.1 Comparision of ASP.NET and ASP.NET.MVC
2.3.1.1 Separation of Concerns
No separation of concerns. As we discussed that every page (.aspx) has its own
controller in ASP.NET Web Forms.
Very clean separation of concerns. View and Controller are neatly separate in
ASP.NET.MVC
5
2.3.1.2 Size of Applications
ASP.NET is good for small scale applications with limited team size.
ASP.NET.MVC is better for large-scale applications where different teams are
working together.
2.3.1.3 Page Life Cycle
ASP.NET WebForms model follows a Page Life cycle.
No Page Life cycle like WebForms. Request cycle is simple in ASP.NET MVC
model.
2.3.1.4 Controller Approach
ASP.NET Web Forms use Page controller pattern approach for rendering layout. In
this approach, every page has its own controller, i.e., code-behind file that processes the
request.
ASP.NET MVC uses Front Controller approach. That approach means a common
controller for all pages processes the requests.
2.3.1.5 Testing
Because of every page and its own controller behavior, automated testing is really
difficult in ASP.NET.Web Forms.
Testability is a key feature in ASP.NET MVC. Test driven development is quite
simple using this approach.
2.3.1.6 ViewState
ASP.NET MVC does not use View State to record state information whereas ASP.NET
web form uses View State to record state information.
2.4 Bundling and Minification
2.4.1 Bundling
Bundling is a feature in ASP.NET.MVC that makes it easy to combine or bundle
multiple files into a single file. You can create CSS, JavaScript and other bundles.
Fewer files means fewer HTTP requests and that can improve first page load
performance.
6
2.4.2 Minification
Minification performs a variety of different code optimizations to scripts or css, such
as removing unnecessary white space and comments and shortening variable names to
one character.
2.4.3 Usage of Bundling & Minification in my Project
Definitions of bundles(script or style) is made in bundle.config file in app_start
folder in the project.
2.4.3.1 Script Bundle Definition
bundles.Add(new ScriptBundle("~/bundles/ErrorPage").Include(
"~/Common/js/pages/ErrorPage.js"
));
@Scripts.Render("~/bundles/ErrorPage")
Figure 3:Script bundle definition
2.4.3.2 Style Bundle Definition
bundles.Add(new StyleBundle("~/Common/DataTables").Include(
"~/Common/DataTables-
1.10.3/media/css/jquery.dataTables.css",
"~/Common/DataTables-
1.10.3/extensions/TableTools/css/dataTables.tableTools.css",
"~/Common/DataTables-
1.10.3/extensions/ColReorder/css/dataTables.colReorder.css",
"~/Common/DataTables-
1.10.3/extensions/FixedColumns/css/dataTables.fixedColumns.css",
"~/Common/css/dataTables.bootstrap.css",
"~/Common/css/contentpage.css"
));
Figure 4:Style bundle definition
7
Usage of Bundles in Views:@Styles.Render("~/Common/DataTables")
2.5 ASP.NET MVC - Routing
Routing within the ASP.NET MVC framework serves two main purposes:
It matches incoming requests that would not otherwise match a file on the file system
and maps the requests to a controller action.
It constructs outgoing URLs that correspond to controller actions
The most basic version of this convention would be a URL as follows:
http://mydomain/controllername/methodname
A typical MVC project defines a Global.asx file, which contains a single method in
Application_Start folder. Within this method, calls are made to various configuration
methods to set up the application's working state. One of these calls is to the
RegisterRoutes method of the RouteConfig class found in the App_Start folder of the
project.
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Member", action =
"mainpage", id = UrlParameter.Optional }
);}}
Figure 5:Route config
In the above, a route template named "Default" is added to the routes collection. The
items in curly braces enclose Route Parameters, and are represented by the parameter
name as a placeholder between the curly braces. Route Segments are separated by
8
forward slashes (much like a standard URL). Notice how the implied relative URL our
route specifies matches the MVC convention:
~/{controller}/{action}
Route parameters can be named just about anything, however ASP.NET recognizes a
few special route parameter names, in particular {controller} and {action} , and treats
them differently than other route parameters.
2.6 Custom Authorize Attribute
Authorization: It is a process of verification that verifies “What to do” (It confirms
you are permissible to do (or not to do) that).
I create TheaterAuthorize class that inherits from the standard
System.Web.Mvc.AuthorizeAttribute class in my project.
public class TheaterAuthorize:AuthorizeAttribute
{ protected override bool AuthorizeCore(HttpContextBase httpContext)
{
var userSession = httpContext.Session["userSession"];
if (userSession == null)
{ return false; }
return true; }
protected override void HandleUnauthorizedRequest(AuthorizationContext
filterContext)
{
filterContext.Result = new RedirectResult("/admin/login");
}
}
Figure 6:Authorize attribute
9
I override two methods of Authorize Attribute class.
AuthorizeCore method is called to know whether the user is authenticated and
authorized to access the controller or action. The method returns false if the
authorization fails and is it is then the HandleUnAuthorizeRequest method is called.
I use TheaterAuthorize attribute in my admin controller class.
[TheaterAuthorize]
public ActionResult VenueList(){}.
[TheaterAuthorize]
public ActionResult GetVenue(String id)
Figure 7:Usage of authorize attribute
CHAPTER THREE
3 ENTITY FRAMEWORK
Entity Framework is an Object Relational Mapper (ORM). It basically generates
business objects and entities according to the database tables and provides the
mechanism for:
1) Performing basic CRUD (Create, Read, Update, Delete) operations.
2) Easily managing "1 to 1", "1 to many", and "many to many" relationships.
Ability to have inheritance relationships between entities.
10
3.1 Entity Framework Architecture
Figure 8:Entity framework architecture
EDM (Entity Data Model): EDM consist three main parts- Conceptual model,
Mapping and Storage model.
Conceptual Model: The conceptual model contains the model classes and their
relationships. This will be independent from our database table design.
Storage Model: Storage model is the database design model which includes tables,
views, stored procedures and their relationships and keys.
Mapping: Mapping consist information about how the conceptual model is mapped
to storage model.
LINQ to Entities:LINQ to Entities is a query language used to write queries against
the object model. It returns entities, which are defined in the conceptual model. We can
use our LINQ skills here.
11
Entity SQL: Entity SQL is another query language just like LINQ to Entities.
However, it is a little more difficult than L2E and also the developer will need to learn it
separately.
Object Service:Object service is a main entry point for accessing data from the
database and to return it back. Object service is responsible for materialization, which is
process of converting data returned from entity client data provider (next layer) to an
entity object structure.
Entity Client Data Provider: The main responsibility of this layer is to convert L2E
or Entity SQL queries into a SQL query which is understood by the underlying
database. It communicates with the ADO.Net data provider which in turn sends or
retrieves data from database.
ADO.Net Data Provider: This layer communicates with database using standard
ADO.Net
3.2 Advantages of Entity Framework
1) We can have all data access logic written in higher level languages.
2) The conceptual model can be represented in a better way by using relationships
among entities.
3) The underlying data store can be replaced without much overhead since all data access
logic is present at a higher level.
3.3 Entity Framework Query Examples (My Project)
3.3.1 Select
var venues = from c in dbEntity.VENUES where c.DELETED==0 orderby c.VENUE_NAME
select c; ;
venueList = venues.ToList();
Figure 9:Select query in entity framework
12
3.3.2 Insert
DateTime currentTime = DateTime.Now;
InfoItem.TS_UPDATED = currentTime;
dbEntity.VENUES.Add(InfoItem);
dbEntity.SaveChanges();
Figure 10:Insert query in entity framework
3.3.3 Update
VENUE editVenue = new VENUE();
editVenue = (from c in dbEntity.VENUES where c.ID ==
InfoItem.ID select c).FirstOrDefault();
editVenue.VENUE_NAME = InfoItem.VENUE_NAME;
editVenue.VENUE_ADDRESS = InfoItem.VENUE_ADDRESS;
editVenue.VENUE_CITY = InfoItem.VENUE_CITY;
editVenue.VENUE_LATITUDE = InfoItem.VENUE_LATITUDE;
editVenue.VENUE_LONGTITUDE = InfoItem.VENUE_LONGTITUDE;
editVenue.VENUE_PARKINGINFO = InfoItem.VENUE_PARKINGINFO;
editVenue.VENUE_INFO = InfoItem.VENUE_INFO;
editVenue.LARGE_IMAGE_PATH = InfoItem.LARGE_IMAGE_PATH;
editVenue.SMALL_IMAGE_PATH = InfoItem.SMALL_IMAGE_PATH;
editVenue.VENUETRANSPORTATION = InfoItem.VENUETRANSPORTATION;
DateTime currentTime = DateTime.Now;
editVenue.TS_UPDATED = currentTime;
dbEntity.SaveChanges();
Figure 11:Update quuery in entity framework
13
3.3.4 Delete
VENUE deleteVenue = (from c in dbEntity.VENUES where c.ID ==
InfoItem.ID && c.DELETED==0 select c).FirstOrDefault();
deleteVenue.DELETED = 1;
//dbEntity.VENUES.Remove(deleteVenue);
dbEntity.SaveChanges();
Figure 12:Delete query in entity framework
3.3.5 Join
var events = from c in dbEntity.EVENTS join d in dbEntity.SALE_DATE on c.ID
equals d.EVENT_ID where c.VENUE_ID == IVenueId && c.DELETED==0 &&
d.DELETED==0 &&
currentTime<d.SALE_END_DATE orderby c.EVENT_NAME select c;
eventList = events.ToList();
Figure 13:Join query in entity framework
3.3.6 Select...from..where...In = Contains
Int32[] shoppingCarts = (from c in dbEntity.SHOPPING_CART where c.DELETED==0
select c.ID).ToArray();
List<CART_TICKETS> cartTicketList = (from c in dbEntity.CART_TICKETS
where c.DELETED == 0 && !shoppingCarts.Contains(c.SHOPPINGCART_ID) select
c).ToList();
Figure 14:Select...from..where...In = contains in entity framework
14
CHAPTER FOUR
4 SYSTEM DESIGN
Class Diagram of my project in Visual Studio 2012.Net.
Figure 15:Class diagram in visual studio.net
15
ADO.NET entity diagrams of database tables in my project.
Figure 16:Entity diagram in visual studio 2012
16
CHAPTER FIVE
5 DATA DESIGN
E-R diagrams of database tables in my project.
Figure 17:First E-R diagram
Figure 18:Second E-R diagram
17
Figure 19:Third E-R diagram
Figure 20:Fourth E-R diagram
18
CHAPTER SIX
6 INTERFACE DESIGN
User interference of this site will be designed on Visual Studio.NET platform by
using Html,Css(Bootstrap,Datatables) and ASP.NET.MVC. This website provides the
members facility to buy tickets for theater events online, through which they can buy
tickets anytime, anywhere. The member can easily see the theater events released and
the make the choice.The administrator can manage the contents of pages in the
member panel.
CHAPTER SEVEN
7 TECHNOLOGIES, TOOLS & LIBRARIES
7.1 Datatables
DataTables is a plug-in for the jQuery Javascript library. It is a highly flexible tool,
based upon the foundations of progressive enhancement, and will add advanced
interaction controls to any HTML table.
Figure 21:Datatables
19
7.1.1 Advantages of Datatables
1) Pagination, instant search and multi-column ordering
2) Supports almost any data source:DOM, Javascript, Ajax and server-side
processing
3) Easily theme-able: DataTables, jQuery UI, Bootstrap, Foundation
4) Wide variety of extensions inc. Editor, TableTools, FixedColumns and more
5) Extensive options and a beautiful, expressive API
6) Fully internationalisable
7) Professional quality: backed by a suite of 2900+ unit tests
8) Free open source software (MIT license)! Commercial support available.
9) Scrolling options for table viewport
10) Smart handling of column widths
11) State saving
12) Hidden columns
13) Dynamic creation of tables
14) Ajax auto loading of data
15) Custom DOM positioning
16) Single column filtering
17) Alternative pagination types
18) Non-destructive DOM interaction
19) Sorting column(s) highlighting
20) Advanced data source options
7.2 BootStrap
Bootstrap is the most popular HTML, CSS, and JS framework for developing
responsive, mobile first projects on the web.
20
CHAPTER EIGHT
8 IMPLEMENTATION
This project is consists of admin and member panels. In the admin panel,the
administrator can manage contents of theater evens,venues,theater tickets pages.In the
member panel ,visitors can see details of theater events and venues.Members can buy
theater tickets.
8.1 Admin Panel
1) Login page in admin panel is displayed in the following picture.
Figure 22:Login page in admin panel
2) Venues page in admin panel is displayed in the following picture.
Figure 23:Venues list page in admin panel
21
3) Available seats in venue salons is displayed in the following picture.
Figure 24:Seats in the venue salons in admin panel
4) Editing prices of ticket categories page in admin panel is displayed in the
following picture.
Figure 25:Editing ticket prices of events in admin panel
22
5) Editing status of seats of theater events page in admin panel is displaye in the
following picture.
Figure 26:Editing status of seats of events in admin panel
6) Editing ticket sale dates page in admin panel is displayed in the following
picture.
Figure 27:Editing ticket sale dates of events in admin panel
23
8.2 Member Panel
1) Main page in member panel is displayed in the following picture.
Figure 28:Main page in member panel
2) Venues page in member panel is displayed in the following picture.
Figure 29:Venues page in member panel
24
3) Event details page in the member panel is displayd in the following picture.
Figure 30: Event detail page in member panel
4) Seats of theater events page in member panel is displaye in the following
picture.
Figure 31:Seats of event in member panel
25
CHAPTER NINE
9 PROJECT TIMELINE
Task August September October November December January
Requirement
specification and
Analysis
Design
Test Cases
Coding with unit
testing
Testing
Documentation
Figure 32:Project timeline
CHAPTER TEN
10 PROJECT ORIGINALITY
10.1 Practically
The system is quite stable and can be operated by people with average
intelligence.
10.2 Efficiency
I tried to involve accuracy,timeliness and comprehensivnesess of the system
output.
26
10.3 Cost
It is desirable to aim for the system with a mininum cost subject to the
condition that it must satisfy the entire requirement .
CHAPTER ELEVEN
11 CONCLUSION
Use of this interface helps customer in having immediate information about
running movies and reserve their seat without wasting their precious time.
User friendly Interface also for the admin to manage content of theater
events,venues and tickets of theater events.
REFERENCES
[1]Leonardo Esposito (author of “Programming ASP.NET MVC” for Microsoft
Press as well as “Programming ASP.NET 4” and other bestselling books such as
“Microsoft .NET: Architecting Applications for the Enterprise”.),”10 Good Practices
for ASP.NET MVC Apps”, Code Magazine ,July 2013
[2] John V. Petersen, “ASP.NET MVC 4 Highlights - Part 2: Bundling and
Minification”,Code Magazine, June , 2012
[3] An Introduction to ASP.NET MVC,” ASP.NET MVC Framework Unleashed
Book ”,Stephen Walter
[4] ASP.NET Routing, “http://msdn.microsoft.com/”
[5]DataTables,www.datatables.net
[6]Bootstrap, http://getbootstrap.com/
[7] “The MVC Pattern and ASP.NET MVC - Back to Basics”,
http://www.dotnetcurry.com/, “Suprotim Agarwal”
[8]Bundling and Minification,www.asp.net,Rick Anderson
[9] Custom Authorization in MVC,www.c-sharpcorner.com,Anupma Singh