2. Modify default.aspx and about.aspx. Add some information about the web site.



Similar documents
Tutorial #1: Getting Started with ASP.NET

Expanded contents. Section 1. Chapter 2. The essence off ASP.NET web programming. An introduction to ASP.NET web programming

1.264 Lecture 19 Web database: Forms and controls

2. Unzip the file using a program that supports long filenames, such as WinZip. Do not use DOS.

DNNCentric Custom Form Creator. User Manual

Building A Very Simple Web Site

Shop by Manufacturer Custom Module for Magento

Walkthrough: Creating and Using an ASP.NET Web Service in Visual Web Developer

Work with the MiniBase App

Mail Merge Microsoft Word and Excel Queries Scott Kern Senior Consultant

Results CRM 2012 User Manual

IST 195 Lab 11: MS Access

Clock Link Installation Guide. Detailed brief on installing Clock Link

2012 Teklynx Newco SAS, All rights reserved.

Hands-On Lab. Building a Data-Driven Master/Detail Business Form using Visual Studio Lab version: Last updated: 12/10/2010.

The software shall provide the necessary tools to allow a user to create a Dashboard based on the queries created.

Appendix A How to create a data-sharing lab

PDG Software. Site Design Guide

Egnyte for Salesforce v2.1 Administrator s Guide

emarketing Manual- Creating a New

SOS SO S O n O lin n e lin e Bac Ba kup cku ck p u USER MANUAL

Microsoft Access 2010 handout

Visual COBOL ASP.NET Shopping Cart Demonstration

How To Sync Between Quickbooks And Act

Personal Portfolios on Blackboard

Intellect Platform - Tables and Templates Basic Document Management System - A101

INSTALLATION AND SETUP HANDBOOK OF PAYU LATAM s PLUGIN FOR WOOCOMMERCE

Magento Extension Point of Sales User Manual Version 1.0

Magento Extension for Add Multiple Products by Capacity Web Solutions

Create a New Database in Access 2010

Mail Merge. Course Description. Objectives: Design a Main Document. Design a Data Source. Directories. Merge the Main Document with the Data

SAP BusinessObjects Business Intelligence (BI) platform Document Version: 4.1, Support Package Report Conversion Tool Guide

Learn how to create web enabled (browser) forms in InfoPath 2013 and publish them in SharePoint InfoPath 2013 Web Enabled (Browser) forms

Bookstore Application: Client Tier

Result Entry by Spreadsheet User Guide

This document details the following four steps in setting up a Web Server (aka Internet Information Services -IIS) on Windows XP:

BulkSMS Text Messenger Product Manual

SQL Server Database Web Applications

MONAHRQ Installation Permissions Guide. Version 2.0.4

Installation instructions for MERLIN Dashboard

MAGENTO THEME SHOE STORE

Hands-On Lab. Client Workflow. Lab version: Last updated: 2/23/2011

Lab: Data Backup and Recovery in Windows XP

BID2WIN Workshop. Advanced Report Writing

Check out our website!

Virtual Office Remote Installation Guide

for Sage 100 ERP Business Insights Overview Document

Decision Support AITS University Administration. Web Intelligence Rich Client 4.1 User Guide

Vector HelpDesk - Administrator s Guide

NetIQ. How to guides: AppManager v7.04 Initial Setup for a trial. Haf Saba Attachmate NetIQ. Prepared by. Haf Saba. Senior Technical Consultant

Magento Theme Instruction

SAHARA DIGITAL8 RESPONSIVE MAGENTO THEME

Resources You can find more resources for Sync & Save at our support site:

Monthly Payroll to Finance Reconciliation Report: Access and Instructions

System Administration and Log Management

ImageNow Interact for Microsoft SharePoint Installation, Setup, and User Guide

Form Master User Manual

ProxiBlue Gift Promotions

Technical Support Set-up Procedure

Introduction to Microsoft Access 2003

Microsoft Access 2007

How To Create A Powerpoint Intelligence Report In A Pivot Table In A Powerpoints.Com

HOW TO CREATE AN HTML5 JEOPARDY- STYLE GAME IN CAPTIVATE

Virtual Communities Operations Manual

Building A Very Simple Website

ORACLE BUSINESS INTELLIGENCE WORKSHOP

Acclipse Document Manager

Invoice Quotation and Purchase Orders Maker

Lab - Data Backup and Recovery in Windows XP

Merging Labels, Letters, and Envelopes Word 2013

Chapter 10 Encryption Service

1.5 MONITOR. Schools Accountancy Team INTRODUCTION

Trial version of GADD Dashboards Builder

Version USER GUIDE

-lead Grabber Business 2010 User Guide

CAMPAIGNS...5 LIST BUILDER FORMS...

ONE POS User Manual. A brief hand guide for ONE ERP POS SYSTEM MYIT SOLUTION. Latest update on: 03/09/12

ultimo theme Update Guide Copyright Infortis All rights reserved

Online shopping store

INSTALLATION AND SETUP HANDBOOK OF PAYU LATAM s PLUGIN FOR WOOCOMMERCE

Using Adobe Dreamweaver CS4 (10.0)

Ingeniux 8 CMS Web Management System ICIT Technology Training and Advancement (training@uww.edu)

Configuration Guide. Remote Backups How-To Guide. Overview

Install MS SQL Server 2012 Express Edition

User s Guide. Version 2.1

Access II 2007 Workshop

Pharmacy Affairs Branch. Website Database Downloads PUBLIC ACCESS GUIDE

SQL Server Database Administration and Design By Dave Peru, October 2011

Magento Theme Instruction

ProjectWise Explorer V8i User Manual for Subconsultants & Team Members

ultimo theme Update Guide Copyright Infortis All rights reserved

SQL Server Setup for Assistant/Pro applications Compliance Information Systems

LICENTIA. Nuntius. Magento Marketing Extension REVISION: SEPTEMBER 21, 2015 (V1.8.1)

VP-ASP Shopping Cart Quick Start (Free Version) Guide Version 6.50 March

Improved Navigation Magento Extension User Guide

Sales Person Commission

2009 Braton Groupe sarl, All rights reserved.

Microsoft Expression Web

Learning Services IT Guide. Access 2013

FrontPage 2003: Forms

Transcription:

This was a fully function Shopping Cart website, which was hosted on the university s server, which I no longer can access. I received an A on this assignment. The directions are listed below for your reference and overview. Shopping Cart Instructions Setup Database / Edit & Delete Products Create a new ASP.Net Web Site on your local machine. Name it ShopCart. A. Run the application. Register a user with the login links. B. Refresh the App_Data folder in the Solution Explorer. You will see a ASPNETDB.MDF SQL server File. C. Inspect the layout of the database created for you in the Server Explorer. D. Inspect the other aspx files created for you. 1. Create a Master Page (site.master) A. Download a web page design, unzip it, and copy the files to the Solution Explorer. B. Merge the index.html (from the downloaded site) with site.master Make sure to keep the following code in the header: <asp:contentplaceholder ID="HeadContent" runat="server"> </asp:contentplaceholder> Make sure to keep the following code in the main content area of the body: <div id="content"> <form id="form1" runat="server">

<asp:contentplaceholder ID="MainContent" runat="server"/> </form> </div> Modify the location of the style sheet, Add the login division, change the title, etc. C. Make a backup of the site.master when you get it set up correctly. 2. Modify default.aspx and about.aspx. Add some information about the web site. 3. Make a directory called /ProductImages. Copy your product images to this folder. 4. Maintain Products / Edit and DeleteA. Create an admin folder B. Create a default.aspx file under the admin folder, linking it to the Master Page (site.master) C. Create a Products table in ASPNETDB.MDF (Right click on Tables, Add New Table) a. Minimum Fields (set all text fields sizes as small as needed): ID (Right click on it to Set Primary Key) (Go to the properties and set Identity Specification -> (Is Identity) to YES Category Product Price Description Image (This field need to be long enough to hold a file name starting with ~/ProductImages/) b. Save the table as Products. Add some data. (To add data, right click on table ->Show Table Data) Image values needs to be in the form of ~/ProductImages/some.jpg D. Drag the SQLDataSource into the ContentPlaceHolder on the /admin/default.aspx page Configure the datasource (Rename SQLDataSource1 to datamaintainproducts) 1. Pull down and choose the ASPNETDB.MDF database in the APP_DATA folder 2. Have the wizard create the Connection String by clicking NEXT

3. Choose the Products table 4. Specify columns from a table or view. Select * for all fields. 5. Click the Order by button to specify how the data should be sorted (Category/Product) 6. Click the Advanced tab and click the checkbox to create all of the CRUD SQL 7. Continue with the Wizard (Next ). Click on Test Query if you want. Finish the Wizard. E. Drag the GridView into the ContentPlaceHolder Set up the GridView (Name it gveditdeleteproducts) Choose Data Source as datamaintainproducts 1. Enable Paging, Sorting, Editing, Deleting 2. Choose Edit Columns 3. Delete the ID and Image fields from the Selected fields 4. Add an ImageField from the available fields From its properties: Set DataImageUrlField -> Image Styles -> ControlStyle ->Height / Width to set image size 5. Set the DataFormatString on the Price field to 0:c 6. Modyify the ButtonType on the CommandField, if desired 7. Highlight the CommandField and click on Convert this field to a Template Field 8. Click OK to exit the Edit Columns. Choose Auto Format the Grid 9. Add the Image field to the GridView s properties DataKeyName (with the ID) 10. Go to the source view, and find the gveditdeleteproducts code. Modify the following code: <asp:button ID="Button2" runat="server" CausesValidation="False" OnClientClick="return confirm('are you sure you want to Delete?')" CommandName="Delete" Text="Delete" /> by adding the OnClientClick="return confirm('are you sure you want to Delete?')" phrase. You should now be able to Edit and Delete products.

Maintain Products - Insert/ Add New 1. Drag a button to the ContentPlaceHolder for Add New Product (btnaddnewproduct) 2. Drag the DetailsView (dvaddproduct) into the Content Panel -- Choose Data Source as datamaintainproducts -- Enable Inserting -- Edit Fields ID - InsertVisible = False Convert the Image field to a Template Field OK to close Edit Fields -- Edit Templates (*****InsertItem Template -- Choose from drop down list) Remove the Text Field Drag the fileupload into the template - Auto Format the Details View 5. Program the following events: [End Template Editing] protected void Page_Load(object sender, EventArgs e) gveditdeleteproducts.visible = true; dvaddproduct.visible = false; btnaddnewproduct.visible = true; protected void btnaddnewproduct_click(object sender, EventArgs e) btnaddnewproduct.visible = false; gveditdeleteproducts.visible = false; dvaddproduct.visible = true; dvaddproduct.changemode(detailsviewmode.insert); //put into insert mode protected void dvaddproduct _ItemInserted(object sender, DetailsViewInsertedEventArgs e) btnaddnewproduct.visible = true; gveditdeleteproducts.visible = true; gveditdeleteproducts.databind(); //Refresh the data dvaddproduct.visible = false; protected void dvaddproduct _ItemInserting(object sender, DetailsViewInsertEventArgs e) FileUpload flup = (FileUpload)(dvAddProduct.FindControl("FileUpload1")); if (flup.hasfile) datamaintainproducts.insertparameters["image"].defaultvalue = "~/ProductImages/" + flup.filename; string filepath = Server.MapPath("~/ProductImages/" + flup.filename); flup.saveas(filepath); else datamaintainproducts.insertparameters["image"].defaultvalue= "~/ProductImages/noimage.jpg"; You should now be able to Add products and upload images.

Modify the Menu on Master Page to list distinct brands from the database. 1. Drag the SQLDataSource into the Master Page (site.master). Make sure it is not in the ContentPlaceHolder Configure the datasource (rename it to dataproductcategories) - Pull down and choose Connection String (Connection to ASPNETDB.MDF) - Specify a custom SQL statement or stored procedure (Get a distinct list of Categories) Click checkbox on Category and checkbox on Return only unique rows, Clock on Order By an choose Category Statement should look like this: SELECT Distinct Category FROM Products ORDER BY Category 2. Place a Data Repeater into your menu where you want a list of Categories Goal: Make the menu choice go to shop.aspx and pass a QueryString variable called Category. Go to the Source page and insert an item template similar to: <asp:repeater ID="Repeater1" runat="server" DataSourceID="dataProductCategories"> <itemtemplate> <li> <a href="/shopcart/shop.aspx?category=<%# DataBinder.Eval(Container.DataItem, "Category") %>" > </a> </li> </itemtemplate> </asp:repeater> <%# DataBinder.Eval(Container.DataItem, "Category") %> Shop.aspx 1. Create a /shop.aspx web form and apply the master page 2. Drag the SQLDataSource into the ContentPlaceHolder on the shop.aspx page Configure the datasource (Rename to dataproductsbycategory) - Pull down and choose Connection String (Connection to ASPNETDB.MDF) - Specify columns from a table or view. Select * for all fields. - Click the Where button to specify column Category = the QueryString Category (set a default) - Click the Order by button to specify how the data should be sorted (by Product?) 3. Drag the GridView into the ContentPlaceHolder Set up the GridView (Rename to gvproductsbycategory) Choose Data Source as dataproductsbycategory Enable Paging Edit Columns Change the Image to an ImageField as was done on the admin page (E.4. on page 2) Add a HyperLink Field. Change the Text property to View - Set the DataNavigateURLFIeld to ID

- Set the DataNavigateURLFormatString to ShowDetails.aspx?ID=0 Create the ShowDetails.aspx File on your own. Use a DetailsView (name it dvproduct) and an SQLDataSource that uses the ID QueryString variable passed from shop.asp. Leave room for a form that will allow the user to type in a Quantity to add to the cart.

Add to Cart / View Cart 1. On ShowDetails.aspx Create a place to enter the quantity and add to cart. Type in the word Quantity and next to it add a Text Box (used to enter the quantity name this txtquantity) Copy the following validation directly under the txtquantitiy in the code (Omit the textbox in the copy) <asp:textbox ID="txtQuantity" runat="server">0</asp:textbox> <asp:regularexpressionvalidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtQuantity" ErrorMessage="Enter only Numbers" ValidationExpression="[0-9]*"></asp:RegularExpressionValidator> Add a button (btnaddtocart / Add to Cart) Add to the dvproduct, DataKeyNames: ID, Category, Product, Price (These are used to get the values for the cookies in the code below) Program the button click event for btnaddtocart to create the cookie and redirect to ViewCart.aspx protected void btnaddtocart_click(object sender, EventArgs e) HttpCookie mycookie = new HttpCookie(dvProduct.DataKey.Value.ToString()); mycookie["category"] = dvproduct.datakey["category"].tostring(); mycookie["product"]= dvproduct.datakey["product"].tostring(); mycookie["quantity"] = txtquantity.text; mycookie["price"] = dvproduct.datakey["price"].tostring(); mycookie.expires = DateTime.Now.AddDays(1d); Response.Cookies.Add(myCookie); Response.Redirect("ViewCart.aspx", true); 2. Create a new web form: ViewCart.aspx From the toolbox, drag a TABLE to the ContentPlaceHolder. Name it tblcart. Go to the Rows property (Collection). Add 1 row. Go to the Cells property (Collection) of the Row and add 5 columns. Label the by setting the Text property of columns (0-4) with Category, Product, Price, Quantity, Total Below the table, type in the words Order Total: and next to it add from the toolbox a Label (call it lblordertotal)

Program the Page Load event with the following: protected void Page_Load(object sender, EventArgs e) double total = 0.0; double price = 0.0; int quantity = 0; System.Collections.Specialized.NameValueCollection UserInfoCookieCollection; for(int i = 0; i< Request.Cookies.Count ; i++) UserInfoCookieCollection = Request.Cookies[i].Values; price = Convert.ToDouble(Server.HtmlDecode(UserInfoCookieCollection["Price"])); quantity = Convert.ToInt16(Server.HtmlDecode(UserInfoCookieCollection["Quantity"])); TableRow tr = new TableRow(); TableCell tccategory = new TableCell(); TableCell tcproduct = new TableCell(); TableCell tcquantity = new TableCell(); TableCell tcprice = new TableCell(); TableCell tcproducttotal = new TableCell(); tccategory.text = Server.HtmlDecode(UserInfoCookieCollection["Category"]); tr.cells.add(tccategory); tcproduct.text= Server.HtmlDecode(UserInfoCookieCollection["Product"]); tr.cells.add(tcproduct); tcprice.text = String.Format("0:c", price); tcprice.horizontalalign = HorizontalAlign.Right; tr.cells.add(tcprice); tcquantity.text= Convert.ToString(quantity); tr.cells.add(tcquantity); tcproducttotal.text = String.Format("0:c", quantity * price); tcproducttotal.horizontalalign = HorizontalAlign.Right; tr.cells.add(tcproducttotal); if (quantity!= 0 ) tblcart.rows.add(tr); total = total + quantity*price; lblordertotal.text = String.Format("0:c", total); Play with the format the table to make it look good! Add a button (btnclearcart) to ViewCart.aspx with a Clear Cart caption. Program the click event for the button. protected void btnclearcart_click(object sender, EventArgs e) HttpCookie acookie; string cookiename; int limit = Request.Cookies.Count; for (int i = 0; i < limit; i++) cookiename = Request.Cookies[i].Name;

acookie = new HttpCookie(cookieName); acookie.expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(aCookie); Response.Redirect("ViewCart.aspx", true);

Ad Rotator Right click on App_Data folder, Add New Item, XML File. Name it Ads.xml. Copy the following code and paste it in the XML File. Modify as necessary. <?xml version="1.0" encoding="utf-8"?> <Advertisements> <Ad> <ImageUrl>images/titleist.jpg</ImageUrl> <NavigateUrl>http://www.titleist.com</NavigateUrl> <AlternateText>Titleist Golf Balls</AlternateText> <Keyword>Titleist</Keyword> <Impressions>25</Impressions> </Ad> <Ad> <ImageUrl>images/nike.jpg</ImageUrl> <NavigateUrl>http://www.nike.com</NavigateUrl> <AlternateText>Nike Golf Balls</AlternateText> <Keyword>Nike</Keyword> <Impressions>25</Impressions> </Ad> <Ad> <ImageUrl>images/precept.jpg</ImageUrl> <NavigateUrl>http://precept.com</NavigateUrl> <AlternateText>Precept Golf Balls</AlternateText> <Keyword>Precept</Keyword> <Impressions>50</Impressions> </Ad> </Advertisements> On the Master Page, Drag an XML datasource to the page (XMLDataSource1). Make sure you did not put it into the ContentPlaceHolder. Configure the datasource to point to App_Data/Ads.xml. On the Master Page, Drag an AddRotator to the page. Make sure you did not put it into the ContentPanel. Set its datasource to XMLDataSource1.

Your final directory structure should look like the following: Folders that were added: /images, /ProductImages, /Admin Files that were added: /Admin/Default.aspx, /Shop.aspx, /ShowDetails.aspx, /ViewCart.aspx The /index.html file came from the downloaded web design. Once merged into site.master, the file is no longer needed. You may or may not need the /Styles folder.

PUBLISHING THE WEB SITE Modify Links Before publishing, links in site.master may need to be modified. All links in the format of <a href= /ShopCart/Default.aspx > will need to be changed to <a href= /yourid/shopcart/default.aspx > This will adjust the links as necessary to run from the server configuration that we have. Publish the web site by going to Build -> Publish Web Site. Type in the Target location as shown on the back Window in the diagram below.

Double click the dot-dot-dot to get the top Window.