COMP3241 E-Commerce Technologies Richard Henson University of Worcester October 2012.

Slides:



Advertisements
Similar presentations
MWD1001 Website Production Using JavaScript with Forms.
Advertisements

1 Chapter 12 Working With Access 2000 on the Internet.
Using Visual Basic 6.0 to Create Web-Based Database Applications
Creating Web Page Forms. Objectives Describe how Web forms can interact with a server-based program Insert a form into a Web page Create and format a.
Tutorial 6 Working with Web Forms
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
XP New Perspectives on Microsoft Access 2002 Tutorial 71 Microsoft Access 2002 Tutorial 7 – Integrating Access With the Web and With Other Programs.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
XP Tutorial 6New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Creating Web Page Forms Designing a Product Registration Form Tutorial.
XP Tutorial 6New Perspectives on HTML and XHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
Advanced Web 2012 Lecture 4 Sean Costain PHP Sean Costain 2012 What is PHP? PHP is a widely-used general-purpose scripting language that is especially.
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
Classroom User Training June 29, 2005 Presented by:
COMP3121 E-Commerce Technologies Richard Henson University of Worcester November 2010.
Server-side Scripting Powering the webs favourite services.
COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Lecturer: Ghadah Aldehim
COMP3241 E-Commerce Technologies Richard Henson University of Worcester November 2012.
COMP3121 E-Commerce Technologies Richard Henson University of Worcester November 2012.
Jonathan Westlake, ed: Nic Shulver JSP, Structure and JavaBeans JSP models Assignment context “Register as a member of the site/show member details/update.
Using Visual Basic 6.0 to Create Web-Based Database Applications
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
M1G Introduction to Database Development 6. Building Applications.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
1 In the good old days... Years ago… the WWW was made up of (mostly) static documents. –Each URL corresponded to a single file stored on some hard disk.
COMP3121 E-Commerce Technologies Richard Henson University of Worcester November 2011.
COMP3241 E-Commerce Technologies Richard Henson University of Worcester October 2014.
Management Information Systems MS Access MS Access is an application software that facilitates us to create Database Management Systems (DBMS)
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
COMP3121 E-Commerce Technologies Richard Henson University of Worcester October 2010.
COMP3241 E-Business Technologies Richard Henson University of Worcester October 2014.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
MS Access 2007 Management Information Systems 1. Overview 2  What is MS Access?  Access Terminology  Access Window  Database Window  Create New Database.
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
Forms and Server Side Includes. What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses.
COMP3241 E-Business Technologies Richard Henson University of Worcester October 2012.
ITCS373: Internet Technology Lecture 5: More HTML.
Creating PHPs to Insert, Update, and Delete Data CS 320.
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
® Microsoft Office 2013 Access Creating a Database.
Creating Web Page Forms. Introducing Web Forms Web forms collect information from users Web forms include different control elements including: –Input.
Java server pages. A JSP file basically contains HTML, but with embedded JSP tags with snippets of Java code inside them. A JSP file basically contains.
3 Copyright © 2004, Oracle. All rights reserved. Working in the Forms Developer Environment.
COMP3121 E-Business Technologies Richard Henson University of Worcester November 2011.
BlackBerry Applications using Microsoft Visual Studio and Database Handling.
COMP3121 E-Commerce Technologies Richard Henson University of Worcester November 2010.
COMP3121 E-Commerce Technologies Richard Henson University of Worcester November 2011.
COMP3241 E-Commerce Technologies Richard Henson University of Worcester November 2014.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
IST 220 – Intro to Databases Lecture 2 Touring Microsoft Access.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
COMP3241 E-Commerce Technologies Richard Henson University of Worcester December 2014.
1 UNIT 13 The World Wide Web. Introduction 2 The World Wide Web: ▫ Commonly referred to as WWW or the Web. ▫ Is a service on the Internet. It consists.
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
XP Tutorial 6New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
COMP3121 E-Commerce Technologies Richard Henson University of Worcester December 2009.
IST 220 – Intro to Databases
COMP3241 E-Commerce Technologies
Tutorial 7 – Integrating Access With the Web and With Other Programs
COMP3357 Managing Cyber Risk
Presentation transcript:

COMP3241 E-Commerce Technologies Richard Henson University of Worcester October 2012

Week 5: Database Design, Server Scripting and Forms Design for Shopping Cart Systems n Objectives:  Ensure that a consistent data model has been designed as an essential first stage in development  Explain the.net coding required to trap data from HTML forms and write data to specified data fields  Explain the use of asp.net web controls with HTML to allow parameter passing between pages  Create product pages that can pass on data

Resolving the Products- Customers relationship n Many databases have failed through lack of knowledge of entity modelling… Product Customer many:many relationship…!!!

Link Entity… n Many:many  can be “programmed” from scratch n Not allowed in Relational Databases…  Need a link entity… ProductXYZ (order?)Customer

Is one more entity enough? n One customer makes the order  Can make multiple orders  1:many relationship n One or more products make up the order  product and order still many:many n Product & Order need a further entity

Shopping Cart Entities n All of this needs to be reflected in shopping cart database design (discuss…)

Possible basic data (entity) model for a Shopping System customer Order line order product No entity relationships shown! Where does Shopping Cart fit?

Possible Data Model with entities/attributes added

Testing the Logical Design with Physical Data… n It works on paper… n But a practical working model is needed:  create database tables  link them together, according to the Entity model you created  populate the tables with trial data of an appropriate format  make sure all is consistent

Creating the Physical Database from a Logical Design n Popular options for small(ish) databases:  Microsoft Access »only Access 2000 onwards properly SQL compliant  MySQL »originally shareware for Unix »Also available for Windows n Popular options for larger databases:  SQLServer  ORACLE

Essential attributes for Orders Entity n n Like all entities in an entity model…   needs a primary key attribute (orderno.)   needs a foreign key to link with an attribute in another entity » »which attribute?

Essential attributes for Orderline Entity n n Primary key attribute? n n Foreign key to link to another entity…   again… which one? n n Each orderline contains other data that needs to be saved in attribute(s) to complete the order. Which attributes?

Completing the Data model n n Server scripts will use data from one/more entities   essential that attributes for entities correctly identified n n How can any gaps in the data model be filled in?   important that this is completed before programming starts…

Role of Server Scripting in creating Product Pages n After the database has been thoughtfully designed…  it needs to be physically implemented n Server behaviours with appropriate embedded SQL are then required for:  picking the right data out of the remote database  writing data to the appropriate locations in HTML pages on the local client browser

Local storage of “remote” data n Asp.net supports local storage of data through the use of datasets  a local copy of various data fields held on one or more data tables on the remote database  simply a local copy of various data fields held on one or more data tables on the remote database  each field becomes a variable in local memory n The dataset fields map directly onto the fields in the remote database  new data can therefore always be stored locally until the appropriate server command is made that writes it to the remote database

The Dataset Display (one record) n As you have seen, VWD facilitates the set up of datasets & datagrids n Can then be used to display dataset data on a HTML page, as the shopping cart  a from/further control can be used to create a HTML table for displaying a single record  a navigation bar object can then be added and used to navigate to other records

HTML forms and Web forms n HTML forms work at the client end…  collect data in a structured way  store it as pre-defined data type with specific field name, initially on the local machine n Web forms are asp.net constructs  easily created in Visual Studio using.net toolbox  don’t use HTML… in this module we’ll be sticking with HTML forms

Care with mapping of data within a HTML form n Structure of a HTML form:  Get/Post tell page where to send the data  text boxes/fieldnames for adding data  button(s) to trigger the sending of data to the location specified by get or post… n Data added to the form can be sent to:  address  URL of a web server

HTML forms Input-Output syntax n Basic structure: … n Basic structure: … n Within the form definition, ACTIONpoints to a URL that will accept the supplied information and do something with it n Within the form definition, ACTION points to a URL that will accept the supplied information and do something with it  it is up to the web server at that website to deduce the type of script from its suffix  the web server then needs to use appropriate software to process it

HTML forms Input-Output syntax n Also within the form definition, METHODtells the form how to send its data fields back to the script: n Also within the form definition, METHOD tells the form how to send its data fields back to the script:  POST sends all the information from the form separately from the URL string »could be used with mailto  GET attaches the information from the form to the end of the URL string (max 255 characters)

Modular Development of Applications: “code” files in HTML n Existing good code recycled whenever possible…  useful for portability (no point in rewriting…) n Several ways to use settings/code text file called within first.aspx page:  SSI Include global.asax  “code behind” css n Also possible to associate “ready to run” compiled code  “toolbox” controls & “assemblies”

The Server-Side #Include (SSI) Directive n Saved as a.inc file  used with multiple asp(x) pages n Syntax: »#INCLUDE directive and either “VIRTUAL” or “FILE” keyword placed inside what would normally be HTML comment tags, with file=“filename” »e.g: »e.g:

Using Server Scripting to Create the Shopping System n Product Information stored on database n Script connects to database n Products can all be displayed on a page n Very useful for users to “click to buy”? n How can clicking behaviour be recorded?  coded into the product page & shopping cart  where shopping cart logic comes in very very handy…

“Shopping Cart” control n A “ready assembled” web control…  sets up the fields that will be used to store the shopping data n Could have been set up as a code behind file  lot of coding…  why bother if someone has perfected it already!  also, needs to be used by many.aspx pages

“Shopping Cart” control n Better off as an assembly  apart from accessed by multiple.aspx pages… »needs to be as fast as possible! n Structure: assemblies added to the App_Data folder  need to be formally included with a page using  need to be formally included with a page using .dll suffix standard for “C” dynamic linked libraries

A pre-compiled cart control n Not only has someone written the C# code for a shopping cart for you…  it has already been compiled as well!  found on RH’s website as part of WebXelCart.dll n Contains dataset fields used with specific field and parameter names  need to mesh with corresponding fields on: »product pages… »cart display page

“Click to buy” Scripting n Product page itself needs to be capable of displaying multiple records  associated ProductID value for a row relates to the record displayed n Of all available web controls…  “Repeater” control achieves this display most effectively

Effect of “Click to Buy” n The “add” function is built into a pre-written page called AddfromDatabase.aspx n This page has no HTML (and therefore no display… but it triggers an SQL query to:  pick up this variable value  send the value to the server as ProductID  collect the product description and price fields  save all three values to the dataset

Passing the Product ID Parameter Product Page Add from DB scripts Product ID value sent as e.g. “ProdID” fields extracted from remote database Shopping Cart Remote DB

Parameter Passing between Pages (1) n “Click to buy” is one of the more effective tricks of server scripting pages with multiple records (!) n How can a click on a hyperlink send a parameter that adds a series of correct values to the cart? ? ?

Parameter Passing (2) n Simple (!) The page uses HTML “get” logic based on a hyperlink used with “?” n Variable name defined in “get” part  corresponds to the primary key in “products” n Role of hyperlink:  picks up the primary key value  allocates this value to the variable used to get the data from the database e.g. ProdID

“Add to Cart” control n This contains the logic to make “click to cart” actually happen  other values such as quantity can then be added to the dataset  dataset record will be equivalent to an “orderline”  values for other products can then be stored in the same dataset but with different orderline values n In any case, the result should be a display of the shopping cart contents

Displaying the Cart Contents n Another carefully designed web page that displays the cart contents and does some simple calculations  download as cart.aspx  not too different from the product page  uses a repeater and an HTML table to display products data  differences: »the data is displayed from the cart not the products table »line total and grand total fields used to display each item total, and sum total of all line totals

Typical RAD tool “errors”… n MUCH can go wrong…!!! n Before embarking on shopping cart development…  need to make sure all local/remote web server settings are correct  screen fields and db fields must use the same format »mustn’t use “reserved words” or punctuation, inc spaces  users must have sufficient access rights to write to the database »this especially includes the “IIS process” user  major adjustments may be needed in response to a minor change in design… »TRUE OF MOST SOFTWARE DEVELOPMENT PROJECTS… »all the more reason to get the design right…

Anything else? n One other thing that still need to be covered theoretically is the “C#” code behind model… n Next week… (!)

Thanks for listening… n Over the next few weeks, we’ll work on the coding to put this into practice…