Vous êtes sur la page 1sur 142

IT404.

NET Wu Jian Min

150100000698

Advanced Diploma in Information Technology

Project Documentation
ADIT IT404.NET
Visual Basic.NET

Project Title: BabyItem Website

Name: Wu Jian Min Student ID: 150100000698 Class: IT404.NET Visual Basic.NET Country: Brunei Darussalam Lecturer Name: Ms. Grace N. Balayan

Wu Jian Min Page 1

IT404.NET Wu Jian Min

150100000698

Contents
1. Proposal

Page

1.1 Introduction ...................................................................................................................3 1.2 Problem background.....................................................................................................4 1.3 Proposed system and Objective.....................................................................................5 1.4 Hardware and Software Requirement............................................................................6 2. Interface Design and Input screen................................................................................7 3. Data Design.................................................................................................................. 18 4. Procedural Design........................................................................................................23 5. Development (Program Listing HTML + VB code).................................................30 6. Testing 6.1 Test Plan........................................................................................................................113 6.2 Test Case.......................................................................................................................114 6.3 Test Log........................................................................................................................135 7. Implementation.............................................................................................................136 8. Conclusion.....................................................................................................................138 9. Reference.......................................................................................................................139

Wu Jian Min Page 2

IT404.NET Wu Jian Min

150100000698

1. Proposal 1.1 Introduction

Your Baby Is Our Concern Shop is selling variety of baby item products, such as strollers, car seats and seating. It was set up in 1990 by Mr. Goh. It is located in Bandar Seri Begawan, Brunei Darussalam. The shop carries many famous brands of baby item products. Those products have high quality control and are approved by the government. The baby item products will let your baby comfortable and safety. The shops layout of Your Baby Is Our Concern Shop is very organized. Different baby item products are categorized in different department. Every baby item product has provided display and instruction for a customer to understand what it used for and how to use properly. Many customers are willing to buy baby item products from Your Baby Is Our Concern Shop because of its guarantee. Mr. Goh is planning to open a second shop in Time Square Mall. He hopes he is able to make a new breakthrough in his new shop. He wants to let more customers to know about his products, so that he is trying to broaden his market. Therefore, Mr. Goh has contacted me to help him to improve his current shop.

Wu Jian Min Page 3

IT404.NET Wu Jian Min 1.2. Problem Background

150100000698

I began to get more information from the shop by asking some customers about their requirements. Besides, I began to collect some information for each product about their usages.

There are 5 employees running the shop. Due to the increasing of customers, it is difficult for employees to serve them all. After a survey, the Your Baby Is Our Concern Shop has a few problems currently such as:

Customers may have difficulties with transportation. Do not provide any suggestion box for customers. Some customers do not have enough free time to go to buy baby item during office hours. It does not open 24 hours to sever customers

Wu Jian Min Page 4

IT404.NET Wu Jian Min 1.3. Proposed System and Objective

150100000698

I am planning to make an attractive website to improve the shop. The website is convenient for customers and the employees of Your Baby Is Our Concern Shop. Customers can know more about baby item information and function through the website. Customers can gain more knowledge about new baby item or other baby item products. Customers can trust to use those products for their little baby. This website is able to operate 24 hours and 7 days a week. Customers can send feedbacks or comments about the products. Customers can place any order in any time through website. This website can update easily The main benefit of the website is to find the information of the baby item products easily and quickly to order the baby item products. The website is user friendly. Customers can surf the website any time. Customers also can quickly know about new arrival of baby item products.

Wu Jian Min Page 5

IT404.NET Wu Jian Min

150100000698

1.4. Hardware and Software Requirement

Hardware requirement:
Screen Resolution 1024 by 768 pixels, 16 bit or 32 bit color quality or higher resolution Monitor Window XP or higher operating system

Memory (RAM) of 1GB Minimum requirements.


CPU: Pentium 3 or higher Optical Mouse 104-key Windows keyboard DVD multi recorder 700 MB CD-ROM

Software requirement
Internet Explorer 8 / Google Chrome / Mozilla Firefox Microsoft visual web developer 2008 Express Edition

Wu Jian Min Page 6

IT404.NET Wu Jian Min

150100000698

2. Interface Design and Input screen


Home Page (Home.aspx)
Banner
Img Btn1 Img Btn2 Img Btn3 Img Btn4 Img Btn5

Calendar

Title Introduction

Log In Form Shop Picture

Faceboo k logo Label

Wu Jian Min Page 7

IT404.NET Wu Jian Min Baby Item Page (BabyItem.aspx)


Banner
Img Btn1 Img Btn2 Img Btn3

150100000698

Img Btn4

Img Btn5

Calendar

Label 1

Drop down list

Brand Picture Log In Form Baby Item Picture

Faceboo k logo Label

Wu Jian Min Page 8

IT404.NET Wu Jian Min Car Seat Page (CarSeatPage.aspx)


Banner
Img Btn1 Img Btn2 Img Btn3

150100000698

Img Btn4

Img Btn5

Calendar

Car Seat Title Data List 1

Log In Form

Faceboo k logo Label

Wu Jian Min Page 9

IT404.NET Wu Jian Min Stroller Page (StrollerPage.aspx)

150100000698

Banner
Img Btn1 Img Btn2 Img Btn3 Img Btn4 Img Btn5

Calendar

Stroller Title Data List 1

Log In Form

Faceboo k logo Label

Wu Jian Min Page 10

IT404.NET Wu Jian Min Seating Page (SeatingPage.aspx)

150100000698

Banner
Img Btn1 Img Btn2 Img Btn3 Img Btn4 Img Btn5

Calendar

Seating Title Data List 1

Log In Form

Faceboo k logo Label

Wu Jian Min Page 11

IT404.NET Wu Jian Min Feedback Page (FeedbackPage.aspx)

150100000698

Banner
Img Btn1 Img Btn2 Img Btn3 Img Btn4 Img Btn5

Calendar

Feedback Title Feedback Form

Log In Form

Faceboo k logo Label

Wu Jian Min Page 12

IT404.NET Wu Jian Min Contact Us Page (ContactUs.aspx)


Banner
Img Btn1 Img Btn2 Img Btn3

150100000698

Img Btn4

Img Btn5

Calendar

Contact Us Title Contact Us Information

Log In Form

Faceboo k logo Label

Wu Jian Min Page 13

IT404.NET Wu Jian Min Member List Database Page (Database Form.aspx)


Banner
Img Btn1 Img Btn2 Img Btn3

150100000698

Img Btn4

Img Btn5

Calendar Labe GridView Log In Form

Drop Down List

Faceboo k logo Label

Wu Jian Min Page 14

IT404.NET Wu Jian Min CarSeat Database Page (CarSeat_Database.aspx)


Banner
Img Btn1 Img Btn2 Img Btn3 Img Btn4

150100000698

Img Btn5

Calendar

Title GridView

Log In Form

Form

Faceboo k logo Label

Wu Jian Min Page 15

IT404.NET Wu Jian Min Stroller Database Page (Stroller_Database.aspx)

150100000698

Banner
Img Btn1 Img Btn2 Img Btn3 Img Btn4 Img Btn5

Calendar

Title GridView

Log In Form

Form

Faceboo k logo Label

Wu Jian Min Page 16

IT404.NET Wu Jian Min Seating Database Page (Seating_Database.aspx)


Banner
Img Btn1 Img Btn2 Img Btn3 Img Btn4

150100000698

Img Btn5

Calendar

Title GridView

Log In Form

Form

Faceboo k logo Label

Wu Jian Min Page 17

IT404.NET Wu Jian Min

150100000698

3. Data Design
Member Table

Columns name UserId

Data type uniqueidentifier

Primary key Yes

Foreign key No

Description It is the member unique ID.

FirstName

varchar(MAX)

No

No

It is used to record the first name of member.

LastName

varchar(MAX)

No

No

It is used to record the last name of member.

Gender

varchar(MAX)

No

No

It is used to identify the gender of member.

DateOfBirth

varchar(MAX)

No

No

It is used to identify the age of member.

Nationality

varchar(MAX)

No

No

It is used to identify the nationality of member

HP

varchar(MAX)

No

No

It is used to record the Handphone of member.

CurrentAddress

varchar(MAX)

No

No

It is used to record the current address of member.

CarSeat Table

Wu Jian Min Page 18

IT404.NET Wu Jian Min

150100000698

Columns name ProductID

Data type int

Primary key Yes

Foreign key No

Description It is the product unique ID.

ProductName

varchar(MAX)

No

No

It is used to record the first name of member.

Brand

varchar(MAX)

No

No

It is used to record the brand of product.

Color

varchar(MAX)

No

No

It is used to record the color of product.

Specifications

Text

No

No

It is used to describe every product.

OriginalPrice

varchar(MAX)

No

No

It is used to record the usual price of product.

Offer

varchar(MAX)

No

No

It is used to record the offer percent for every product.

FinialPrice

varchar(MAX)

No

No

It is used to show the offer price of every product.

Image

varchar(MAX)

No

No

It is used to show the image of every product.

Wu Jian Min Page 19

IT404.NET Wu Jian Min Stroller Table

150100000698

Columns name ProductID

Data type int

Primary key Yes

Foreign key No

Description It is the product unique ID.

ProductName

varchar(MAX)

No

No

It is used to record the first name of member.

Brand

varchar(MAX)

No

No

It is used to record the brand of product.

Color

varchar(MAX)

No

No

It is used to record the color of product.

Specifications

Text

No

No

It is used to describe every product.

OriginalPrice

varchar(MAX)

No

No

It is used to record the usual price of product.

Offer

varchar(MAX)

No

No

It is used to record the offer percent for every product.

FinialPrice

varchar(MAX)

No

No

It is used to show the offer price of every product.

Image

varchar(MAX)

No

No

It is used to show the image of every product.

Wu Jian Min Page 20

IT404.NET Wu Jian Min Seating Table

150100000698

Columns name ProductID

Data type int

Primary key Yes

Foreign key No

Description It is the product unique ID.

ProductName

varchar(MAX)

No

No

It is used to record the first name of member.

Brand

varchar(MAX)

No

No

It is used to record the brand of product.

Color

varchar(MAX)

No

No

It is used to record the color of product.

Specifications

Text

No

No

It is used to describe every product.

OriginalPrice

varchar(MAX)

No

No

It is used to record the usual price of product.

Offer

varchar(MAX)

No

No

It is used to record the offer percent for every product.

FinialPrice

varchar(MAX)

No

No

It is used to show the offer price of every product.

Image

varchar(MAX)

No

No

It is used to show the image of every product.

Wu Jian Min Page 21

IT404.NET Wu Jian Min Checkout Table

150100000698

Columns name ID

Data type int

Primary key No

Foreign key No

Description It is the checkout table ID.

Checkout_ID

varchar(MAX)

No

No

It is used to tracking the name of product.

Quantity

varchar(MAX)

No

No

It is used to record the quantity of product that customer order.

Price

varchar(MAX)

No

No

It is used to record the total price.

UserId

varchar(MAX)

No

No

It is used to identify the id of customer.

Wu Jian Min Page 22

IT404.NET Wu Jian Min

150100000698

4. Procedural Design
Pseudo code Main Do CALL menu Selection End Do Module Menu Selection Do CALL menu screen Do while choice not equal 0 Get choice DO CASE Choice 1 Do CALL HOME End Do Choice 2 Do CALL BABY ITEM End Do Choice 3 Do CALL ORDER End Do Choice 4 Do
Wu Jian Min Page 23

IT404.NET Wu Jian Min CALL FEEDBACK End Do Choice 5 Do CALL CONTACT US End Do End Case End Do End Do Module Menu Home Do Display information End Do Module Menu Baby Item Do CALL show screen Do while choice not equal 0 Get choice Do Case Choice 1 Do call car seat page End Do Choice 2 Do call stroller page End Do Choice 3
Wu Jian Min Page 24

150100000698

IT404.NET Wu Jian Min Do call seating page End Do End Case End Do End Do Module Log In Do Call show log in screen Do while choice not equal 0 Get choice Do Case Choice 1 Do Call Username and Password End Do Choice 2 Do Call Sign Up End Do Choice 3 Do Call Log in End Do Module Add Cart Do Call Show Screen Do while choice not equal 0 Get choice Do Case Choice 1
Wu Jian Min Page 25

150100000698

IT404.NET Wu Jian Min Do call yes End Do Choice 2 Do call no End do End Case End Do End Do Module Order Do Call show screen Call Input String for Product Name Call Input Number for Quantity Call Input Currency for Price Call Proceed To Check End Do Module Proceed To Check Do Call show screen Call Input String for Credit Card Type Call Input String for Card Holder Name Call Input String for Valid From Call Input String for Expiry Date Call Input String for Issue Number Call Input String for Security Code Call Input String for Address
Wu Jian Min Page 26

150100000698

IT404.NET Wu Jian Min Call Input String for Postcode Call Input String for Country Call Input String for Telephone Do while choice not equal 0 Get choice Do case 1 Choice 1 Do call yes End Do Do call no End Do End Do Module Feedback Do Call show screen Call Input String for First Name Call Input String for Last Name Call Input String for Gender Call Input String for Email Address Call Input String for Telephone Call Input String for Hand phone Call Input String for Comment Do while choice not equal 0 Get choice Do case 1 Choice 1
Wu Jian Min Page 27

150100000698

IT404.NET Wu Jian Min Do call Send End Do Do call Cancel End Do End Do Module contact us Do Call show screen End Do

150100000698

Wu Jian Min Page 28

IT404.NET Wu Jian Min

150100000698

Star t Log In

Home page

BabyItem page

Order page Proceed To Check

Feedback page Feedback Form

Contact Us page Contact Us Form

CarSeat page

Stroller page

Seating page

Add product to your shopping cart? Yes

Order page

Wu Jian Min Page 29

IT404.NET Wu Jian Min

150100000698

5. Development (Program Listing HTML + VB code)


MasterDesign.Master Source
<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="MasterDesign.master.vb" Inherits="BabyAge.MasterDesign" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title></title> <asp:ContentPlaceHolder ID="head" runat="server"> </asp:ContentPlaceHolder> <style type="text/css"> .style1 { width: 903px; height: 970px; } .style2 { width: 903px; height: 129px; } .style4 { width: 903px; height: 40px; } .style5 { width: 250px; } .style6 { width: 653px; height: 970px; } .style7 { width: 903px; height: 30px; } </style>

</head> <body background="../images/bg%20img.jpg" style="background-position: center top; background-attachment: scroll; background-repeat: repeat-y; text-align: center; height: 1000px; "> <form id="form1" runat="server"> <div> <table class="style2" align="center"> <tr>

Wu Jian Min Page 30

IT404.NET Wu Jian Min


<td class= "style2" valign="top">

150100000698

<asp:ImageButton ID="ImageButton1" runat="server" Height="129px" ImageUrl="~/images/baby banner.jpg" Width="903px" /> </td> </tr> </table> <table class="style4" align="center"> <tr> <td align="left"> <asp:ImageButton ID="btnHomeImg" runat="server" Height="40px" ImageUrl="~/images/Home button.jpg" PostBackUrl="~/Webpages/Home.aspx" Width="175px" /> <asp:ImageButton ID="btnBabyItemImg" runat="server" Height="40px" ImageUrl="~/images/Baby Item button.jpg" Width="175px" PostBackUrl="~/Webpages/BabyItem.aspx" /> <asp:ImageButton ID="btnOrderImg" runat="server" Height="40px" ImageUrl="~/images/Order button.jpg" Width="175px" PostBackUrl="~/Webpages/Order.aspx" Enabled="False" /> <asp:ImageButton ID="btnFeedbackImg" runat="server" Height="40px" ImageUrl="~/images/Feedback button.jpg" Width="175px" PostBackUrl="~/Webpages/FeedbackPage.aspx" /> <asp:ImageButton ID="btnContactUsImg" runat="server" Height="40px" ImageUrl="~/images/Contact us button.jpg" Width="175px" PostBackUrl="~/Webpages/ContactUs.aspx" /> </td> </tr> </table> <table class="style1" align="center"> <tr> <td class= "style5" valign="top"> <br/><br/> <asp:Calendar ID="Calendar1" runat="server" BackColor="#FFFFCC" BorderColor="#FFCC66" BorderWidth="1px" DayNameFormat="Shortest" Font-Names="Verdana" Font-Size="8pt" ForeColor="#663399" Height="200px" ShowGridLines="True" Width="220px"> <SelectedDayStyle BackColor="#CCCCFF" Font-Bold="True" /> <SelectorStyle BackColor="#FFCC66" /> <TodayDayStyle BackColor="#FFCC66" ForeColor="White" /> <OtherMonthDayStyle ForeColor="#CC9966" /> <NextPrevStyle Font-Size="9pt" ForeColor="#FFFFCC" /> <DayHeaderStyle BackColor="#FFCC66" Font-Bold="True" Height="1px" /> <TitleStyle BackColor="#990000" Font-Bold="True" FontSize="9pt" ForeColor="#FFFFCC" /> </asp:Calendar>

Wu Jian Min Page 31

IT404.NET Wu Jian Min

150100000698

<br /><br /> <asp:Label ID="lblwelcome" runat="server" Text="Welcome:" Visible="False"></asp:Label> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;<asp:LoginName ID="LoginName1" runat="server" /> &nbsp;&nbsp;&nbsp;&nbsp; <asp:LoginStatus ID="LoginStatus1" runat="server" LogoutPageUrl="~/Webpages/Home.aspx" Visible="False" /> <br /> <asp:Login ID="Login1" runat="server" BackColor="#FFFBD6" BorderColor="#FFDFAD" BorderPadding="4" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#333333" Height="172px" TextLayout="TextOnTop" Width="213px" style="margin-bottom: 0px"> <TextBoxStyle Font-Size="0.8em" /> <LoginButtonStyle BackColor="White" BorderColor="#CC9966" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" FontSize="0.8em" ForeColor="#990000" /> <LayoutTemplate> <table border="0" cellpadding="4" cellspacing="0" style="border-collapse:collapse;"> <tr> <td> <table border="0" cellpadding="0" style="height:172px;width:213px;"> <tr> <td align="center" style="color:White;backgroundcolor:#990000;font-size:0.9em;font-weight:bold;"> Log In</td> </tr> <tr> <td> <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label> </td> </tr> <tr> <td> <asp:TextBox ID="UserName" runat="server" Font-Size="0.8em"></asp:TextBox> <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName" ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="ctl00$Login1">*</asp:RequiredFieldValidator> </td> </tr> <tr> <td> <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label> </td> </tr>

Wu Jian Min Page 32

IT404.NET Wu Jian Min


<tr> <td>

150100000698

<asp:TextBox ID="Password" runat="server" Font-Size="0.8em" TextMode="Password"></asp:TextBox> <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password" ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="ctl00$Login1">*</asp:RequiredFieldValidator> </td> </tr> <tr> <td> <asp:CheckBox ID="RememberMe" runat="server" Text="Remember me next time." /> </td> </tr> <tr> <td align="center" style="color:Red;"> <asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal> </td> </tr> <tr> <td align="left"> <asp:Button ID="Button1" runat="server" BackColor="White" BorderColor="#CC9966" BorderStyle="Solid" BorderWidth="1px" CommandName="SignUp" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#990000" onclick="Button1_Click" Text="Sign Up" ValidationGroup="ct100$SignUp" PostBackUrl="~/Webpages/Registration.aspx" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:Button ID="LoginButton" runat="server" BackColor="White" BorderColor="#CC9966" BorderStyle="Solid" BorderWidth="1px" CommandName="Login" Font-Names="Verdana" FontSize="0.8em" ForeColor="#990000" Text="Log In" ValidationGroup="ctl00$Login1" /> </td> </tr> </table> </td> </tr> </table>

</LayoutTemplate>

Wu Jian Min Page 33

IT404.NET Wu Jian Min

150100000698

<InstructionTextStyle Font-Italic="True" ForeColor="Black" /> Size="0.9em" <TitleTextStyle BackColor="#990000" Font-Bold="True" Font-

ForeColor="White" /> </asp:Login> <br /> <br /> <asp:HyperLink ID="HyperLinkDB" runat="server" NavigateUrl="~/Webpages/Database Form.aspx" Visible="False">Manage Database</asp:HyperLink> <br /> <br /> <asp:ImageButton ID="ImageButton2" runat="server" Height="92px" ImageUrl="~/images/Facebook.gif" Width="93px" /> <br /> <asp:Label ID="Label1" runat="server" ForeColor="#CC6600" Text="Join Us On Facebook"></asp:Label> </td> <td class= "style6" valign="top"> <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> </td> </tr> </table> <table class="style7" align="center"> <tr> <td class= "style7" valign="top"> <p><font color="#CC6600">(c) 2006-2009 Your Baby Is Our Concern Inc.</font></p> </td> </tr> </table> </div> </form> </body> </html>

Wu Jian Min Page 34

IT404.NET Wu Jian Min vb code


Public Partial Class MasterDesign Inherits System.Web.UI.MasterPage

150100000698

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim membershipUser As MembershipUser = Membership.GetUser() If Context.User.Identity.IsAuthenticated Then If Context.User.IsInRole("admin") Then lblwelcome.Visible = True LoginStatus1.Visible = True HyperLinkDB.Visible = True btnOrderImg.Enabled = True ElseIf Context.User.IsInRole("members") Then lblwelcome.Visible = True LoginStatus1.Visible = True HyperLinkDB.Visible = False btnOrderImg.Enabled = True Else lblwelcome.Visible = False LoginStatus1.Visible = False HyperLinkDB.Visible = False btnOrderImg.Enabled = False End If End If If membershipUser IsNot Nothing Then Dim loggedinuser As String = Membership.GetUser().ToString() LoginName1.ID = loggedinuser Else LoginName1.ID = "" End If End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) End Sub End Class

Wu Jian Min Page 35

IT404.NET Wu Jian Min Home.aspx Source

150100000698

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Webpages/MasterDesign.Master" CodeBehind="Home.aspx.vb" Inherits="BabyAge.Home" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <table style = "width: 600px"><tr><td></td></tr> <tr><td><p style = "text-align:justify"><font size="5" color="#CC6600"><b><i> Welcome To Your Baby Is Our Concern Shop </b></i></font></p></td></tr><tr><td> <p style = "text-align:justify"><font size="5" color="#CC6600"> Your Baby Is Our Concern Shop is selling variety of baby item products, such as strollers, car seats and seating. It was set up in 1990 by Mr. Goh. It is located in Bandar Seri Begawan, Brunei Darussalam. The shop carries many famous brands of baby item products. Those products have high quality control and are approved by the government. The baby item products will let your baby comfortable and safety. </font></p> </td></tr> <tr><td> <asp:Image ID="Image1" runat="server" ImageUrl="~/images/your baby is our concern.jpg" /> </td></tr> </table> </asp:Content>

Wu Jian Min Page 36

IT404.NET Wu Jian Min BabyItem.aspx Source

150100000698

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Webpages/MasterDesign.Master" CodeBehind="BabyItem.aspx.vb" Inherits="BabyAge.BabyItem" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <table style="width: 600px"> <tr><td></td></tr> <tr><td></td></tr> <tr><td> <asp:Label ID="lblSelectCatergory" runat="server" Text="Selet A Catergory:" ForeColor="#CC6600"></asp:Label> &nbsp; <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" ForeColor="#CC6600"> <asp:ListItem Selected="True">Please Select A Catergory</asp:ListItem> <asp:ListItem>CarSeatPage</asp:ListItem> <asp:ListItem>StrollerPage</asp:ListItem> <asp:ListItem>SeatingPage</asp:ListItem> </asp:DropDownList> </td></tr> <tr><td align="left"> <asp:Label ID="Label2" runat="server" Font-Italic="True" FontSize="X-Large" ForeColor="#CC6600" Text="Brand"></asp:Label> </td></tr> <tr><td> <img src="../images/brand.jpg" style="width: 660px; height: 60px" /></td></tr> <tr><td></td></tr> <tr><td></td></tr> <tr><td></td></tr> <tr><td align="left"> <asp:Image ID="Image1" runat="server" Height="239px" ImageUrl="~/images/CarSeatPic/Chicco Vector Car Seat.jpg" Width="221px" /> <asp:Image ID="Image2" runat="server" Height="239px" ImageUrl="~/images/SeatingPic/Combi High Chair Rashule Width="204px" /> <asp:Image ID="Image3" runat="server" Height="239px" ImageUrl="~/images/StrollerPic/Capella Improve Version S705style="margin-top: 0px" Width="199px" /> </td></tr> </table> </asp:Content>

DX.jpg"

12.jpg"

vb code
Wu Jian Min Page 37

IT404.NET Wu Jian Min


Public Partial Class BabyItem Inherits System.Web.UI.Page

150100000698

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles DropDownList1.SelectedIndexChanged 'Place this in the main menu Dim Link As String = DropDownList1.SelectedValue.ToString() + ".aspx" Response.Redirect(Link) End Sub End Class

Wu Jian Min Page 38

IT404.NET Wu Jian Min CarSeatPage.aspx Source

150100000698

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Webpages/MasterDesign.Master" CodeBehind="CarSeatPage.aspx.vb" Inherits="BabyAge.CarSeatPage" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <table style="width: 614px"> <tr><td class="style8"> </td> </tr> <tr><td class="style8"> Size="Larger" <asp:Label ID="lblCarSeat" runat="server" FontForeColor="#CC6600" Text="Car Seat"></asp:Label> </td> </tr> <tr><td class="style8"> <asp:DataList ID="DataList1" runat="server" CellPadding="4" DataKeyField="ProductID" DataSourceID="SqlDataSource1" ForeColor="#333333" RepeatColumns="2"> <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <AlternatingItemStyle BackColor="White" /> <ItemStyle BackColor="#FFFBD6" ForeColor="#333333" /> <SeparatorStyle Font-Bold="False" Font-Italic="False" FontOverline="False" Font-Strikeout="False" Font-Underline="False" /> <SelectedItemStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" /> <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <ItemTemplate> <table><tr><td style = "width : 248px"> &nbsp;<asp:Label ID="ProductNameLabel" runat="server" Text='<%# Eval("ProductName") %>' ForeColor="#CC6600" /> </td></tr> <caption> <br /> <tr> <td style = "width : 248px"> Height="157px" Eval("Image") + ".jpg"%>' </td> </tr> <caption> <asp:Image ID="Image1" runat="server" ImageUrl='<%#"~/images/CarSeatPic/" + Width="168px" />

Wu Jian Min Page 39

IT404.NET Wu Jian Min


<br /> <br /> <tr> <td>

150100000698

ProductID: <asp:Label ID="ProductIDLabel" runat="server" ForeColor="#CC6600" Text='<%# Eval("ProductID") %>' /> <br /> Brand: <asp:Label ID="BrandLabel" runat="server" ForeColor="#CC6600" Text='<%# Eval("Brand") %>' /> <br /> Color: <asp:Label ID="ColorLabel" runat="server" ForeColor="#CC6600" Text='<%# Eval("Color") %>' /> <br /> OriginalPrice:&nbsp; <asp:Label ID="lbldollar" runat="server" ForeColor="Red" Text="$"></asp:Label> <asp:Label ID="OriginalPriceLabel" runat="server" ForeColor="#CC6600" Text='<%# Eval("OriginalPrice") %>' Font-Strikeout="True" /> <br /> Percent Offer: <asp:Label ID="OfferLabel" runat="server" ForeColor="#CC6600" Text='<%# Eval("Offer") %>' /> <asp:Label ID="lblpercent" runat="server" ForeColor="Red" Text="%"></asp:Label> <br /> Offer Price:&nbsp; <asp:Label ID="lbldollar0" runat="server" ForeColor="Red" Text="$"></asp:Label> <asp:Label ID="FinialPriceLabel" runat="server" ForeColor="#CC6600" Text='<%# Eval("FinialPrice") %>' /> <br /> Specifications:<br /> &nbsp;<asp:Label ID="SpecificationsLabel" runat="server" ForeColor="#CC6600" Text='<%# Eval("Specifications") %>' /> <br /> </td> </tr> <tr><td> <asp:ImageButton ID="btnAddCart" runat="server" ImageUrl="~/images/add cart.jpg" style="height: 23px" /> </td></tr> </caption>

CommandName="AddToCart"

Wu Jian Min Page 40

IT404.NET Wu Jian Min

150100000698

</caption> </table> </ItemTemplate> </asp:DataList> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [ProductID], [ProductName], [Brand], [Color], [Specifications], [OriginalPrice], [Offer], [FinialPrice], [Image] FROM [CarSeatTable]"> </asp:SqlDataSource> </td> </tr> </table> </asp:Content>

vb code
Imports System.Data.SqlClient Partial Public Class CarSeatPage Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Private Sub DataList1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles DataList1.ItemCommand Dim currentUser As MembershipUser = Membership.GetUser() Dim currentUserId As Guid = CType(currentUser.ProviderUserKey, Guid) Dim Order As String = DataList1.SelectedIndex Order = e.Item.ItemIndex Dim Item_ID As String = DirectCast(DataList1.Items(Order).FindControl("ProductNameLabel"), Label).Text Dim Item_Price As String = DirectCast(DataList1.Items(Order).FindControl("FinialPriceLabel"), Label).Text If MsgBox("Would you like to add this to cart?", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Add To Cart?") = MsgBoxResult.No Then Exit Sub End If If e.CommandName = "AddToCart" Then Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim insertSql As String = "INSERT INTO Checkout(Checkout_ID, Quantity, Price, UserId) VALUES (@Checkout_ID, @Quantity, @Price, @UserId)" Using myConnection As New SqlConnection(connectionString)

Wu Jian Min Page 41

IT404.NET Wu Jian Min

150100000698

myConnection.Open() Dim myCommand As New SqlCommand(insertSql, myConnection) myCommand.Parameters.AddWithValue("@Checkout_ID", Item_ID.ToString) myCommand.Parameters.AddWithValue("@Quantity", "1") myCommand.Parameters.AddWithValue("@Price", Item_Price.ToString) myCommand.Parameters.AddWithValue("@UserId", currentUserId.ToString) myCommand.ExecuteNonQuery() myConnection.Close() End Using End If End Sub Private Sub DataList1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles DataList1.ItemDataBound Dim membershipUser As MembershipUser = Membership.GetUser() Dim BT As ImageButton = TryCast(e.Item.FindControl("btnAddCart"), ImageButton) If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then

BT.Visible = True End If End Sub End Class

Wu Jian Min Page 42

IT404.NET Wu Jian Min StrollerPage.aspx Source

150100000698

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Webpages/MasterDesign.Master" CodeBehind="StrollerPage.aspx.vb" Inherits="BabyAge.StrollerPage" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <table style="width: 614px"> <tr> <td class="style8"> </td> </tr> <tr> <td class="style8"> <asp:Label ID="lblStroller" runat="server" FontSize="Larger" ForeColor="#CC6600" Text="Stroller"></asp:Label> </td> </tr> <tr> <td class="style8"> <asp:DataList ID="DataList1" runat="server" CellPadding="4" DataKeyField="ProductID" DataSourceID="SqlDataSource1" ForeColor="#333333" RepeatColumns="2"> <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <AlternatingItemStyle BackColor="White" /> <ItemStyle BackColor="#FFFBD6" ForeColor="#333333" /> <SeparatorStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" /> <SelectedItemStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" /> <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <ItemTemplate> <table><tr><td style = "width : 248px"> <asp:Label ID="ProductNameLabel" runat="server" Text='<%# Eval("ProductName") %>' /> <br /> </td></tr> <tr><td> Height="157px" Eval("Image") + ".jpg"%>' <asp:Image ID="Image1" runat="server" ImageUrl='<%#"~/images/StrollerPic/" +

Width="168px" /> <br /> &nbsp;ProductID: <asp:Label ID="ProductIDLabel" runat="server" Text='<%# Eval("ProductID") %>' /> <br /> Brand:

Wu Jian Min Page 43

IT404.NET Wu Jian Min

150100000698

<asp:Label ID="BrandLabel" runat="server" Text='<%# Eval("Brand") %>' /> <br /> Color: <asp:Label ID="ColorLabel" runat="server" Text='<%#

Eval("Color") %>' />

<br /> OriginalPrice: <asp:Label ID="lbldollar" runat="server" ForeColor="Red" Text="$"></asp:Label> &nbsp;<asp:Label ID="OriginalPriceLabel" runat="server" Text='<%# Eval("OriginalPrice") %>' FontStrikeout="True" /> <br /> Offer: <asp:Label ID="OfferLabel" runat="server" Text='<%# Eval("Offer") %>' /> <asp:Label ID="lblpercent" runat="server" ForeColor="Red" Text="%"></asp:Label> <br /> FinialPrice: <asp:Label ID="lbldollar0" runat="server" ForeColor="Red" Text="$"></asp:Label> <asp:Label ID="FinialPriceLabel" runat="server" Text='<%# Eval("FinialPrice") %>' /> <br /> Specifications:<br /> &nbsp;<asp:Label ID="SpecificationsLabel" runat="server" Text='<%# Eval("Specifications") %>' /> <br /> <br /> </td></tr> <tr><td> <asp:ImageButton ID="btnAddCart" runat="server" ImageUrl="~/images/add cart.jpg" CommandName="AddToCart" /> </td></tr></table> </ItemTemplate> </asp:DataList> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [ProductID], [ProductName], [Brand], [Color], [Specifications], [OriginalPrice], [Offer], [FinialPrice], [Image] FROM [Stroller]"> </asp:SqlDataSource> </td> </tr> </table> </asp:Content>

Wu Jian Min Page 44

IT404.NET Wu Jian Min vb code

150100000698

Imports System.Data.SqlClient Partial Public Class StrollerPage Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Private Sub DataList1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles DataList1.ItemCommand Dim currentUser As MembershipUser = Membership.GetUser() Dim currentUserId As Guid = CType(currentUser.ProviderUserKey, Guid) Dim Order As String = DataList1.SelectedIndex Order = e.Item.ItemIndex Dim Item_ID As String = DirectCast(DataList1.Items(Order).FindControl("ProductNameLabel"), Label).Text Dim Item_Price As String = DirectCast(DataList1.Items(Order).FindControl("FinialPriceLabel"), Label).Text If MsgBox("Would you like to add this to cart?", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Add To Cart?") = MsgBoxResult.No Then Exit Sub End If If e.CommandName = "AddToCart" Then Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim insertSql As String = "INSERT INTO Checkout(Checkout_ID, Quantity, Price, UserId) VALUES (@Checkout_ID, @Quantity, @Price, @UserId)" Using myConnection As New SqlConnection(connectionString) myConnection.Open() Dim myCommand As New SqlCommand(insertSql, myConnection) ' myCommand.Parameters.AddWithValue("@ID", "@ID+1") myCommand.Parameters.AddWithValue("@Checkout_ID", Item_ID.ToString) myCommand.Parameters.AddWithValue("@Quantity", "1") myCommand.Parameters.AddWithValue("@Price", Item_Price.ToString) myCommand.Parameters.AddWithValue("@UserId", currentUserId.ToString) myCommand.ExecuteNonQuery() myConnection.Close() End Using End If End Sub

Wu Jian Min Page 45

IT404.NET Wu Jian Min

150100000698

Private Sub DataList1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles DataList1.ItemDataBound Dim membershipUser As MembershipUser = Membership.GetUser() Dim BT As ImageButton = TryCast(e.Item.FindControl("btnAddCart"), ImageButton) If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then

BT.Visible = True End If End Sub End Class

Wu Jian Min Page 46

IT404.NET Wu Jian Min SeatingPage.aspx Source

150100000698

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Webpages/MasterDesign.Master" CodeBehind="SeatingPage.aspx.vb" Inherits="BabyAge.SeatingPage" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <table style="width: 614px"> <tr> <td class="style8"> </td> </tr> <tr> <td class="style8" align="center"> <asp:Label ID="lblSeating" runat="server" FontSize="Larger" ForeColor="#CC6600" Text="Seating"></asp:Label> </td> </tr> <tr> <td class="style8"> <asp:DataList ID="DataList1" runat="server" CellPadding="4" DataKeyField="ProductID" DataSourceID="SqlDataSource1" ForeColor="#333333" RepeatColumns="2"> <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <AlternatingItemStyle BackColor="White" /> <ItemStyle BackColor="#FFFBD6" ForeColor="#333333" /> <SeparatorStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" /> <SelectedItemStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" /> <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <ItemTemplate> <table><tr><td style = "width : 248px"> <asp:Label ID="ProductNameLabel" runat="server" Text='<%# Eval("ProductName") %>' /> <br /> </td></tr> <tr><td> <asp:Image ID="Image1" runat="server" Height="157px" ImageUrl='<%#"~/images/SeatingPic/" + Eval("Image") + ".jpg"%>' Width="168px" /> <br /> ProductID: <asp:Label ID="ProductIDLabel" runat="server" Text='<%# Eval("ProductID") %>' /> <br /> Brand:

Wu Jian Min Page 47

IT404.NET Wu Jian Min

150100000698

<asp:Label ID="BrandLabel" runat="server" Text='<%# Eval("Brand") %>' /> <br /> Color: <asp:Label ID="ColorLabel" runat="server" Text='<%#

Eval("Color") %>' />

<br /> OriginalPrice: <asp:Label ID="lbldollar" runat="server" ForeColor="Red" Text="$"></asp:Label> &nbsp;<asp:Label ID="OriginalPriceLabel" runat="server" Text='<%# Eval("OriginalPrice") %>' /> <br /> Offer: <asp:Label ID="OfferLabel" runat="server" Text='<%# Eval("Offer") %>' /> <asp:Label ID="lblpercent" runat="server" ForeColor="Red" Text="%"></asp:Label> <br /> FinialPrice: <asp:Label ID="lbldollar0" runat="server" ForeColor="Red" Text="$"></asp:Label> &nbsp;<asp:Label ID="FinialPriceLabel" runat="server" Text='<%# Eval("FinialPrice") %>' /> <br /> Specifications: <br /> <asp:Label ID="SpecificationsLabel" runat="server" Text='<%# Eval("Specifications") %>' /> <br /> <br /> </td></tr> <tr><td> <asp:ImageButton ID="btnAddCart" runat="server" ImageUrl="~/images/add cart.jpg"

CommandName="AddToCart" />

</td></tr> </table> </ItemTemplate> </asp:DataList> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [ProductName], [ProductID], [Brand], [Color], [OriginalPrice], [Offer], [FinialPrice], [Specifications], [Image] FROM [SeatingTable]"> </asp:SqlDataSource> </td> </tr> </table> </asp:Content>

vb code
Imports System.Data.SqlClient

Wu Jian Min Page 48

IT404.NET Wu Jian Min


Partial Public Class SeatingPage Inherits System.Web.UI.Page

150100000698

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Private Sub DataList1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles DataList1.ItemCommand Dim currentUser As MembershipUser = Membership.GetUser() Dim currentUserId As Guid = CType(currentUser.ProviderUserKey, Guid) Dim Order As String = DataList1.SelectedIndex Order = e.Item.ItemIndex Dim Item_ID As String = DirectCast(DataList1.Items(Order).FindControl("ProductNameLabel"), Label).Text Dim Item_Price As String = DirectCast(DataList1.Items(Order).FindControl("FinialPriceLabel"), Label).Text If MsgBox("Would you like to add this to cart?", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Add To Cart?") = MsgBoxResult.No Then Exit Sub End If If e.CommandName = "AddToCart" Then Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim insertSql As String = "INSERT INTO Checkout(Checkout_ID, Quantity, Price, UserId) VALUES (@Checkout_ID, @Quantity, @Price, @UserId)" Using myConnection As New SqlConnection(connectionString) myConnection.Open() Dim myCommand As New SqlCommand(insertSql, myConnection) ' myCommand.Parameters.AddWithValue("@ID", "@ID+1") myCommand.Parameters.AddWithValue("@Checkout_ID", Item_ID.ToString) myCommand.Parameters.AddWithValue("@Quantity", "1") myCommand.Parameters.AddWithValue("@Price", Item_Price.ToString) myCommand.Parameters.AddWithValue("@UserId", currentUserId.ToString) myCommand.ExecuteNonQuery() myConnection.Close() End Using End If End Sub Private Sub DataList1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles DataList1.ItemDataBound

Wu Jian Min Page 49

IT404.NET Wu Jian Min

150100000698

Dim membershipUser As MembershipUser = Membership.GetUser() Dim BT As ImageButton = TryCast(e.Item.FindControl("btnAddCart"), ImageButton) If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then

BT.Visible = True End If End Sub End Class

Wu Jian Min Page 50

IT404.NET Wu Jian Min CarSeat_Database.aspx Source

150100000698

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Webpages/MasterDesign.Master" CodeBehind="CarSeat_Database.aspx.vb" Inherits="BabyAge.CarSeat_Database" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> <style type="text/css"> .style8 { width: 478px; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <table style="width: 614px"> <tr><td class="style8"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Label ID="lblCarSeatInformation" runat="server" Font-Names="Arial" Font-Size="X-Large" ForeColor="#CC6600" Text="Car Seat Information"></asp:Label> </td></tr> <tr><td class="style8"> </td></tr> <tr><td class="style8"> </td></tr> <tr><td class="style8"> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" CellPadding="2" DataKeyNames="ProductID" DataSourceID="SqlDataSource1" EmptyDataText="There are no data records to display." ForeColor="#333333" Height="186px" style="margin-right: 0px" Width="603px" FontSize="Smaller" PageSize="2"> <RowStyle BackColor="#FFFBD6" ForeColor="#333333" /> <Columns> <asp:CommandField ShowSelectButton="True" /> <asp:BoundField DataField="ProductID" HeaderText="ProductID" ReadOnly="True" SortExpression="ProductID" /> <asp:BoundField DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName" /> <asp:BoundField DataField="Brand" HeaderText="Brand" SortExpression="Brand" /> <asp:BoundField DataField="OriginalPrice" HeaderText="OriginalPrice" SortExpression="OriginalPrice" /> <asp:BoundField DataField="Offer" HeaderText="Offer" SortExpression="Offer" />

Wu Jian Min Page 51

IT404.NET Wu Jian Min

150100000698

<asp:BoundField DataField="FinialPrice" HeaderText="FinialPrice" SortExpression="FinialPrice" /> <asp:BoundField DataField="Color" HeaderText="Color" SortExpression="Color" /> <asp:BoundField DataField="Specifications" HeaderText="Specifications" SortExpression="Specifications" /> <asp:BoundField DataField="Image" HeaderText="Image" SortExpression="Image" /> </Columns> <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" /> <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" /> <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <AlternatingRowStyle BackColor="White" /> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" DeleteCommand="DELETE FROM [CarSeatTable] WHERE [ProductID] = @ProductID" InsertCommand="INSERT INTO [CarSeatTable] ([ProductID], [ProductName], [Brand], [Color], [Specifications], [OriginalPrice], [Offer], [FinialPrice], [Image]) VALUES (@ProductID, @ProductName, @Brand, @Color, @Specifications, @OriginalPrice, @Offer, @FinialPrice, @Image)" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT [ProductID], [ProductName], [Brand], [Color], [Specifications], [OriginalPrice], [Offer], [FinialPrice], [Image] FROM [CarSeatTable]" UpdateCommand="UPDATE [CarSeatTable] SET [ProductName] = @ProductName, [Brand] = @Brand, [Color] = @Color, [Specifications] = @Specifications, [OriginalPrice] = @OriginalPrice, [Offer] = @Offer, [FinialPrice] = @FinialPrice, [Image] = @Image WHERE [ProductID] = @ProductID"> <DeleteParameters> <asp:Parameter Name="ProductID" Type="String" /> </DeleteParameters> <InsertParameters> <asp:Parameter Name="ProductID" Type="String" /> <asp:Parameter Name="ProductName" Type="String" /> <asp:Parameter Name="Brand" Type="String" /> <asp:Parameter Name="Color" Type="String" /> <asp:Parameter Name="Specifications" Type="String" /> <asp:Parameter Name="OriginalPrice" Type="String" /> <asp:Parameter Name="Offer" Type="String" /> <asp:Parameter Name="FinialPrice" Type="String" /> <asp:Parameter Name="Image" Type="String" /> </InsertParameters> <UpdateParameters> <asp:Parameter Name="ProductName" Type="String" /> <asp:Parameter Name="Brand" Type="String" /> <asp:Parameter Name="Color" Type="String" /> <asp:Parameter Name="Specifications" Type="String" />

Wu Jian Min Page 52

IT404.NET Wu Jian Min

150100000698

<asp:Parameter Name="OriginalPrice" Type="String" /> <asp:Parameter Name="Offer" Type="String" /> <asp:Parameter Name="FinialPrice" Type="String" /> <asp:Parameter Name="Image" Type="String" /> <asp:Parameter Name="ProductID" Type="String" /> </UpdateParameters> </asp:SqlDataSource> </td></tr> <tr><td align = "left" class="style8" > <asp:Label ID="lblProductID" runat="server" Text="Product ID: "></asp:Label> &nbsp;&nbsp;&nbsp;&nbsp; <asp:TextBox ID="txtProductID" runat="server"></asp:TextBox> </td></tr> <tr align = "left"><td class="style8"> <asp:Label ID="lblProductName" runat="server" Text="Product Name: "></asp:Label> <asp:TextBox ID="txtProductName" runat="server" Width="208px"></asp:TextBox> </td></tr> <tr align = "left"><td class="style8"> <asp:Label ID="lblBrand" runat="server" Text="Brand: "></asp:Label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:TextBox ID="txtBrand" runat="server"></asp:TextBox> </td></tr> <tr align = "left"><td class="style8"> <asp:Label ID="lblOriginalPrice" runat="server" Text="Original Price: "></asp:Label> &nbsp; <asp:TextBox ID="txtOriginalPrice" runat="server"></asp:TextBox> </td></tr> <tr align = "left"><td class="style8"> <asp:Label ID="lblOffer" runat="server" Text="Percent Offer: "></asp:Label> &nbsp; <asp:TextBox ID="txtOffer" runat="server" Width="102px"></asp:TextBox> &nbsp;<asp:Label ID="Label2" runat="server" Font-Size="Larger" ForeColor="Red" Text="%"></asp:Label> </td></tr> <tr align = "left"><td class="style8"> <asp:Label ID="lblFinialPrice" runat="server" Text="Offer Price: "></asp:Label> &nbsp;&nbsp;&nbsp;&nbsp; <asp:TextBox ID="txtFinialPrice" runat="server" Width="132px"></asp:TextBox> &nbsp; <asp:Button ID="Button3" runat="server" Text="Calculate" Width="68px" /> </td></tr> <tr align = "left"><td class="style8">

Wu Jian Min Page 53

IT404.NET Wu Jian Min

150100000698

<asp:Label ID="lblColor" runat="server" Text="Color: "></asp:Label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:TextBox ID="txtColor" runat="server" Width="208px"></asp:TextBox> </td></tr> <tr align = "left"><td class="style8" valign="middle"> <asp:Label ID="lblSpecifications" runat="server" Text="Specifications: "></asp:Label> &nbsp;<asp:TextBox ID="txtSpecifications" runat="server" TextMode="MultiLine" Width="213px" Height="83px"></asp:TextBox> &nbsp; </td></tr> <tr align = "left"><td class="style8"> <asp:Label ID="lblImage" runat="server" Text="Image: "></asp:Label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:FileUpload ID="FileUpload1" runat="server" /> &nbsp; </td></tr> <tr align = "left"><td class="style8"> Record" <asp:Label ID="lblInsertNewRecord" runat="server" Text="Insert New ForeColor="#CC6600"></asp:Label> </td></tr> <tr align = "left"><td class="style8"> <asp:Button ID="btnAdd" runat="server" Text="Add" Width="94px" /> &nbsp;&nbsp; <asp:Button ID="btnSave" runat="server" Text="Save" Width="94px" /> &nbsp;&nbsp; <asp:Button ID="btnClear" runat="server" Text="Cancel" Width="94px" /> </td></tr> <tr align = "left"><td class="style8"> <asp:Label ID="lblUpdateExistingRecord" runat="server" ForeColor="#CC6600" Text="Update Existing Record"></asp:Label> </td></tr> <tr align = "left"><td class="style8" > <asp:Button ID="btnEdit" runat="server" Text="Edit" Width="94px"/> &nbsp;&nbsp; <asp:Button ID="btnUpdate" runat="server" Text="Save" Width="94px"/> &nbsp;&nbsp; <asp:Button ID="btnCancel" runat="server" Text="Cancel" Width="94px"/> </td></tr> <tr align = "left"><td class="style8"> <asp:Label ID="lblDeleteExistingRecord" runat="server" ForeColor="#CC6600" Text="Delete Existing Record"></asp:Label> </td></tr> <tr align = "left"><td class="style8"> <asp:Button ID="btnDelete" runat="server" Text="Delete" Width="94px" />

Wu Jian Min Page 54

IT404.NET Wu Jian Min


&nbsp;&nbsp;

150100000698

<asp:Button ID="btnCancelDelete" runat="server" Text="Cancel" Width="94px"/> </td></tr> <tr><td class="style8" align="right"> <asp:Button ID="Button4" runat="server" Text="Back to main menu" PostBackUrl="~/Webpages/Database Form.aspx" Width="160px" />

</td></tr> </table> </asp:Content>

vb code
Imports System Imports System.Data Imports System.Configuration Imports System.Web Imports System.Web.Security Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.WebControls.WebParts Imports System.Web.UI.HtmlControls Imports System.Data.SqlClient Partial Public Class CarSeat_Database Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'Disable the textbox txtProductID.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtProductName.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False 'Disable the button btnEdit.Enabled = False btnUpdate.Enabled = False btnClear.Enabled = False btnCancel.Enabled = False btnDelete.Enabled = False btnCancelDelete.Enabled = False 'btnClearSearch.Enabled = False End Sub Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSave.Click Dim strMessage As String = ""

Wu Jian Min Page 55

IT404.NET Wu Jian Min

150100000698

Dim imgup As FileUpload = FileUpload1 Dim fileNameWithoutExtension As String = System.IO.Path.GetFileNameWithoutExtension(imgup.FileName) If MsgBox("Do You Want To Save This Record?", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Save") = MsgBoxResult.No Then btnSave.Enabled = False btnClear.Enabled = False btnAdd.Enabled = True GridView1.DataBind() Exit Sub End If 'This will show error message if a user does not key in a character If txtProductID.Text = String.Empty Then strMessage = "Product No is blank. Please fill in." End If If txtProductName.Text = String.Empty Then If strMessage <> String.Empty Then strMessage += vbCrLf & "Product Name is blank. Please fill in." Else strMessage += "Product Name is blank. Please fill in." End If End If If txtBrand.Text = String.Empty Then If strMessage <> String.Empty Then strMessage += vbCrLf & "Brand is blank. Please fill in." Else strMessage += "Brand is blank. Please fill in." End If End If If txtOriginalPrice.Text = String.Empty Then If strMessage <> String.Empty Then strMessage += vbCrLf & "Original Price is blank. Please fill in." Else strMessage += "Original Price is blank. Please fill in." End If End If If txtColor.Text = String.Empty Then If strMessage <> String.Empty Then strMessage += vbCrLf & "Color is blank. Please fill in." Else strMessage += "Color is blank. Please fill in." End If End If If txtSpecifications.Text = String.Empty Then If strMessage <> String.Empty Then strMessage += vbCrLf & "Specifications is blank. Please fill in."

Wu Jian Min Page 56

IT404.NET Wu Jian Min


Else

150100000698

strMessage += "Specifications is blank. Please fill in." End If End If If strMessage <> "" Then MsgBox(strMessage) Exit Sub End If If imgup.HasFile = False Then fileNameWithoutExtension = "Not Available!" End If Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim insertSql As String = "INSERT INTO CarSeatTable(ProductID, ProductName, Brand, Color, Specifications, OriginalPrice, Offer, FinialPrice, Image) VALUES (@ProductID, @ProductName, @Brand, @Color, @Specifications, @OriginalPrice, @Offer, @FinialPrice, @Image)" Using myConnection As New SqlConnection(connectionString) myConnection.Open() Dim myCommand As New SqlCommand(insertSql, myConnection) myCommand.Parameters.AddWithValue("@ProductID", txtProductID.Text) myCommand.Parameters.AddWithValue("@ProductName", txtProductName.Text) myCommand.Parameters.AddWithValue("@Brand", txtBrand.Text) myCommand.Parameters.AddWithValue("@Color", txtColor.Text) myCommand.Parameters.AddWithValue("@Specifications", txtSpecifications.Text) myCommand.Parameters.AddWithValue("@OriginalPrice", txtOriginalPrice.Text) myCommand.Parameters.AddWithValue("@Offer", txtOffer.Text) myCommand.Parameters.AddWithValue("@FinialPrice", txtFinialPrice.Text) myCommand.Parameters.AddWithValue("@Image", fileNameWithoutExtension.ToString()) myCommand.ExecuteNonQuery() myConnection.Close() End Using 'Inform the user that a record has been save MsgBox("A New Record Has Successfully Been Inserted", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation, "Success!") 'Clear the textbox txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty

Wu Jian Min Page 57

IT404.NET Wu Jian Min


'Disable the textbox txtProductID.Enabled = False txtProductName.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False End Sub

150100000698

Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnAdd.Click 'Clear the textbox txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty 'Enable the textbox txtProductID.Enabled = True txtProductName.Enabled = True txtBrand.Enabled = True txtColor.Enabled = True txtFinialPrice.Enabled = True txtOffer.Enabled = True txtOriginalPrice.Enabled = True txtSpecifications.Enabled = True FileUpload1.Enabled = True btnSave.Enabled = True btnClear.Enabled = True btnAdd.Enabled = False End Sub Protected Sub Gridview1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles GridView1.SelectedIndexChanged txtProductID.Text = GridView1.SelectedRow.Cells(1).Text txtProductName.Text = GridView1.SelectedRow.Cells(2).Text txtBrand.Text = GridView1.SelectedRow.Cells(3).Text txtColor.Text = GridView1.SelectedRow.Cells(7).Text txtOriginalPrice.Text = GridView1.SelectedRow.Cells(4).Text txtOffer.Text = GridView1.SelectedRow.Cells(5).Text txtFinialPrice.Text = GridView1.SelectedRow.Cells(6).Text txtSpecifications.Text = GridView1.SelectedRow.Cells(8).Text 'lblOldValue.Text = GridView1.SelectedRow.Cells(11).Text 'Enable the Edit button and Delete button but Disable the btnUpdate btnEdit.Enabled = True btnUpdate.Enabled = False btnDelete.Enabled = True btnCancelDelete.Enabled = True

Wu Jian Min Page 58

IT404.NET Wu Jian Min


'Disable the Add button btnAdd.Enabled = False btnSave.Enabled = False btnClear.Enabled = False 'Disable the textboxes txtProductID.Enabled = False txtProductName.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False End Sub

150100000698

Protected Sub btnUpdate_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnUpdate.Click If MsgBox("Do You Want To Save This Record?", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Update!") = MsgBoxResult.No Then btnEdit.Enabled = True btnUpdate.Enabled = False btnDelete.Enabled = True Exit Sub End If Dim imgup As FileUpload = FileUpload1 Dim fileNameWithoutExtension As String = System.IO.Path.GetFileNameWithoutExtension(imgup.FileName) 'If imgup.HasFile = False Then 'fileNameWithoutExtension = lblOldValue.Text 'End If Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim UpdateSql As String = "UPDATE CarSeatTable SET ProductName = @ProductName, Brand = @Brand, Color = @Color, Specifications = @Specifications, OriginalPrice = @OriginalPrice, Offer = @Offer, FinialPrice = @FinialPrice, Image = @Image WHERE ProductID = @ProductID" Using myConnection As New SqlConnection(connectionString) myConnection.Open() Dim myCommand As New SqlCommand(UpdateSql, myConnection) myCommand.Parameters.AddWithValue("@ProductID", txtProductID.Text) myCommand.Parameters.AddWithValue("@ProductName", txtProductName.Text) myCommand.Parameters.AddWithValue("@Brand", txtBrand.Text) myCommand.Parameters.AddWithValue("@Color", txtColor.Text) myCommand.Parameters.AddWithValue("@Specifications", txtSpecifications.Text) myCommand.Parameters.AddWithValue("@OriginalPrice", txtOriginalPrice.Text) myCommand.Parameters.AddWithValue("@Offer", txtOffer.Text)

Wu Jian Min Page 59

IT404.NET Wu Jian Min

150100000698

myCommand.Parameters.AddWithValue("@FinialPrice", txtFinialPrice.Text) myCommand.Parameters.AddWithValue("@Image", fileNameWithoutExtension.ToString()) myCommand.ExecuteNonQuery() myConnection.Close() End Using 'Informs the user that the a record has been save MsgBox("Record Has Successfully Been Updated", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation, "Success!") GridView1.DataBind() 'Clear the textbox txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty 'Enable and Disable the Add button btnAdd.Enabled = True btnSave.Enabled = False btnClear.Enabled = False End Sub Protected Sub btnClear_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnClear.Click 'Clear the textboxes txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty 'Disable the textboxes txtProductID.Enabled = False txtProductName.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False 'Disable Edit button btnEdit.Enabled = False btnUpdate.Enabled = False btnCancel.Enabled = False

Wu Jian Min Page 60

IT404.NET Wu Jian Min


'Disable Delete button btnDelete.Enabled = False 'Enable and Disable the Add button btnAdd.Enabled = True btnSave.Enabled = False btnClear.Enabled = False End Sub

150100000698

Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnCancel.Click 'Clear the textboxes txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty 'Disable the textboxes txtProductID.Enabled = False txtProductName.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False 'Disable Edit button btnEdit.Enabled = False btnUpdate.Enabled = False btnCancel.Enabled = False 'Disable Delete button btnDelete.Enabled = False 'Enable and Disable the Add button btnAdd.Enabled = True btnSave.Enabled = False btnClear.Enabled = False End Sub Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnDelete.Click Dim imgup As FileUpload = FileUpload1 Dim fileNameWithoutExtension As String = System.IO.Path.GetFileNameWithoutExtension(imgup.FileName) If MsgBox("Do You Want To Delete This Record?", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Delete?") = MsgBoxResult.No Then btnDelete.Enabled = True btnEdit.Enabled = True Exit Sub End If

Wu Jian Min Page 61

IT404.NET Wu Jian Min

150100000698

If imgup.HasFile = False Then fileNameWithoutExtension = "Not Available!" End If Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim deleteSql As String = "DELETE FROM CarSeatTable WHERE ProductID = @ProductID" Using myConnection As New SqlConnection(connectionString) myConnection.Open() Dim myCommand As New SqlCommand(deleteSql, myConnection) myCommand.Parameters.AddWithValue("@ProductID", txtProductID.Text) myCommand.ExecuteNonQuery() myConnection.Close() End Using 'Informs the user that the a record has been save MsgBox("Record Has Been Deleted.", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation, "Success!") GridView1.DataBind() 'Clear the textboxes txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty 'Disable the textboxes txtProductID.Enabled = False txtProductName.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False 'Disable Edit button btnEdit.Enabled = False btnUpdate.Enabled = False btnCancel.Enabled = False 'Disable Delete button btnDelete.Enabled = False 'Enable and Disable the Add button btnAdd.Enabled = True btnSave.Enabled = False btnClear.Enabled = False

Wu Jian Min Page 62

IT404.NET Wu Jian Min

150100000698

End Sub Protected Sub btnEdit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnEdit.Click 'Enable the textbox txtProductID.Enabled = True txtProductName.Enabled = True txtBrand.Enabled = True txtColor.Enabled = True txtFinialPrice.Enabled = True txtOffer.Enabled = True txtOriginalPrice.Enabled = True txtSpecifications.Enabled = True FileUpload1.Enabled = True 'Enable and Disable the Save button btnEdit.Enabled = False btnUpdate.Enabled = True btnCancel.Enabled = True 'Disable the Add button btnAdd.Enabled = False btnSave.Enabled = False btnClear.Enabled = False End Sub Protected Sub btnCancelDelete_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnCancelDelete.Click btnAdd.Enabled = True btnDelete.Enabled = False btnEdit.Enabled = False 'Clear the textboxes txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty 'Disable the textboxes txtProductID.Enabled = False txtProductName.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False 'Disable Edit button btnEdit.Enabled = False btnUpdate.Enabled = False btnCancel.Enabled = False 'Disable Delete button

Wu Jian Min Page 63

IT404.NET Wu Jian Min


btnDelete.Enabled = False 'Enable and Disable the Add button btnAdd.Enabled = True btnSave.Enabled = False btnClear.Enabled = False End Sub

150100000698

Protected Sub Button3_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button3.Click txtFinialPrice.Text = txtOriginalPrice.Text * (1 - txtOffer.Text / 100) 'Enable the textbox txtProductID.Enabled = True txtProductName.Enabled = True txtBrand.Enabled = True txtColor.Enabled = True txtFinialPrice.Enabled = True txtOffer.Enabled = True txtOriginalPrice.Enabled = True txtSpecifications.Enabled = True FileUpload1.Enabled = True 'Enable the Add button btnAdd.Enabled = False btnSave.Enabled = True btnClear.Enabled = True 'Disable and enable Edit button btnEdit.Enabled = False btnUpdate.Enabled = True btnCancel.Enabled = True End Sub End Class

Wu Jian Min Page 64

IT404.NET Wu Jian Min Stroller_Database.aspx Source

150100000698

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Webpages/MasterDesign.Master" CodeBehind="Stroller_Database.aspx.vb" Inherits="BabyAge.Stroller_Database" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> <style type="text/css"> .style8 { width: 478px; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <table style="width: 614px"> <tr> <td class="style8"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Label ID="lblStrollerInformation" runat="server" Font-Names="Arial" Font-Size="X-Large" ForeColor="#CC6600" Text="Stroller Information"></asp:Label> </td> </tr> <tr> <td class="style8"> </td> </tr> <tr> <td class="style8"> </td> </tr> <tr> <td class="style8"> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" CellPadding="2" DataKeyNames="ProductID" DataSourceID="SqlDataSource1" EmptyDataText="There are no data records to display." ForeColor="#333333" Height="186px" style="margin-right: 0px" Width="603px" FontSize="Smaller" PageSize="2"> <RowStyle BackColor="#FFFBD6" ForeColor="#333333" /> <Columns> <asp:CommandField ShowSelectButton="True" /> <asp:BoundField DataField="ProductID" HeaderText="ProductID" ReadOnly="True" SortExpression="ProductID" /> <asp:BoundField DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName" />

Wu Jian Min Page 65

IT404.NET Wu Jian Min

150100000698

<asp:BoundField DataField="Brand" HeaderText="Brand" SortExpression="Brand" /> <asp:BoundField DataField="OriginalPrice" HeaderText="OriginalPrice" SortExpression="OriginalPrice" /> <asp:BoundField DataField="Offer" HeaderText="Offer" SortExpression="Offer" /> <asp:BoundField DataField="FinialPrice" HeaderText="FinialPrice" SortExpression="FinialPrice" /> <asp:BoundField DataField="Color" HeaderText="Color" SortExpression="Color" /> <asp:BoundField DataField="Specifications" HeaderText="Specifications" SortExpression="Specifications" /> <asp:BoundField DataField="Image" HeaderText="Image" SortExpression="Image" /> </Columns> <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" /> <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" /> <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <AlternatingRowStyle BackColor="White" /> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT [ProductID], [ProductName], [Brand], [OriginalPrice], [Offer], [FinialPrice], [Color], [Specifications], [Image] FROM [Stroller]"> </asp:SqlDataSource> </td> </tr> <tr> <td align = "left" class="style8" > <asp:Label ID="lblProductID" runat="server" Text="Product ID: "></asp:Label> &nbsp;&nbsp;&nbsp;&nbsp; <asp:TextBox ID="txtProductID" runat="server"></asp:TextBox> </td> </tr> <tr align = "left"> <td class="style8"> <asp:Label ID="lblProductName" runat="server" Text="Product Name: "></asp:Label> <asp:TextBox ID="txtProductName" runat="server" Width="208px"></asp:TextBox> </td> </tr> <tr align = "left"> <td class="style8">

Wu Jian Min Page 66

IT404.NET Wu Jian Min

150100000698

<asp:Label ID="lblBrand" runat="server" Text="Brand: "></asp:Label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:TextBox ID="txtBrand" runat="server"></asp:TextBox> </td> </tr> <tr align = "left"> <td class="style8"> <asp:Label ID="lblOriginalPrice" runat="server" Text="Original Price: "></asp:Label> &nbsp; <asp:TextBox ID="txtOriginalPrice" runat="server"></asp:TextBox> </td> </tr> <tr align = "left"> <td class="style8"> <asp:Label ID="lblOffer" runat="server" Text="Percent Offer: "></asp:Label> &nbsp; <asp:TextBox ID="txtOffer" runat="server" Width="102px"></asp:TextBox> &nbsp;<asp:Label ID="Label2" runat="server" Font-Size="Larger" ForeColor="Red" Text="%"></asp:Label> </td> </tr> <tr align = "left"> <td class="style8"> <asp:Label ID="lblFinialPrice" runat="server" Text="Offer Price: "></asp:Label> &nbsp;&nbsp;&nbsp;&nbsp; <asp:TextBox ID="txtFinialPrice" runat="server" Width="132px"></asp:TextBox> &nbsp; <asp:Button ID="Button3" runat="server" Text="Calculate" Width="68px" /> </td> </tr> <tr align = "left"> <td class="style8"> <asp:Label ID="lblColor" runat="server" Text="Color: "></asp:Label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:TextBox ID="txtColor" runat="server" Width="208px"></asp:TextBox> </td> </tr> <tr align = "left"> <td class="style8" valign="middle"> <asp:Label ID="lblSpecifications" runat="server" Text="Specifications: "></asp:Label> &nbsp;<asp:TextBox ID="txtSpecifications" runat="server" TextMode="MultiLine" Width="213px" Height="83px"></asp:TextBox> &nbsp; </td>

Wu Jian Min Page 67

IT404.NET Wu Jian Min

150100000698

</tr> <tr align = "left"> <td class="style8"> <asp:Label ID="lblImage" runat="server" Text="Image: "></asp:Label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:FileUpload ID="FileUpload1" runat="server" /> &nbsp; </td> </tr> <tr align = "left"> <td class="style8"> <asp:Label ID="lblInsertNewRecord" runat="server" Text="Insert New Record" ForeColor="#CC6600"></asp:Label> </td> </tr> <tr align = "left"> <td class="style8"> <asp:Button ID="btnAdd" runat="server" Text="Add" Width="94px" /> &nbsp;&nbsp; <asp:Button ID="btnSave" runat="server" Text="Save" Width="94px" /> &nbsp;&nbsp; <asp:Button ID="btnClear" runat="server" Text="Cancel" Width="94px" /> </td> </tr> <tr align = "left"> <td class="style8"> <asp:Label ID="lblUpdateExistingRecord" runat="server" ForeColor="#CC6600" Text="Update Existing Record"></asp:Label> </td> </tr> <tr align = "left"> <td class="style8" > <asp:Button ID="btnEdit" runat="server" Text="Edit" Width="94px"/> &nbsp;&nbsp; <asp:Button ID="btnUpdate" runat="server" Text="Save" Width="94px"/> &nbsp;&nbsp; <asp:Button ID="btnCancel" runat="server" Text="Cancel" Width="94px"/> </td> </tr> <tr align = "left"> <td class="style8"> <asp:Label ID="lblDeleteExistingRecord" runat="server" ForeColor="#CC6600" Text="Delete Existing Record"></asp:Label> </td> </tr> <tr align = "left"> <td class="style8"> <asp:Button ID="btnDelete" runat="server" Text="Delete" Width="94px" />

Wu Jian Min Page 68

IT404.NET Wu Jian Min


&nbsp;&nbsp;

150100000698

<asp:Button ID="btnCancelDelete" runat="server" Text="Cancel" Width="94px"/> </td> </tr> <tr><td class="style8" align="right"> <asp:Button ID="Button4" runat="server" Text="Back to main menu" PostBackUrl="~/Webpages/Database Form.aspx" Width="160px" />

</td></tr> </table> </asp:Content>

vb code
Imports System Imports System.Data Imports System.Configuration Imports System.Web Imports System.Web.Security Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.WebControls.WebParts Imports System.Web.UI.HtmlControls Imports System.Data.SqlClient Partial Public Class Stroller_Database Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'Disable the textbox txtProductID.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtProductName.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False 'Disable the button btnEdit.Enabled = False btnUpdate.Enabled = False btnClear.Enabled = False btnCancel.Enabled = False btnDelete.Enabled = False btnCancelDelete.Enabled = False 'btnClearSearch.Enabled = False End Sub Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSave.Click Dim strMessage As String = "" Dim imgup As FileUpload = FileUpload1

Wu Jian Min Page 69

IT404.NET Wu Jian Min

150100000698

Dim fileNameWithoutExtension As String = System.IO.Path.GetFileNameWithoutExtension(imgup.FileName) If MsgBox("Do You Want To Save This Record?", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Save") = MsgBoxResult.No Then btnSave.Enabled = False btnClear.Enabled = False btnAdd.Enabled = True GridView1.DataBind() Exit Sub End If 'This will show error message if a user does not key in a character If txtProductID.Text = String.Empty Then strMessage = "Product No is blank. Please fill in." End If If txtProductName.Text = String.Empty Then If strMessage <> String.Empty Then strMessage += vbCrLf & "Product Name is blank. Please fill strMessage += "Product Name is blank. Please fill in." End If End If If txtBrand.Text = String.Empty Then If strMessage <> String.Empty Then strMessage += vbCrLf & "Brand is blank. Please fill in." Else strMessage += "Brand is blank. Please fill in." End If End If If txtOriginalPrice.Text = String.Empty Then If strMessage <> String.Empty Then strMessage += vbCrLf & "Original Price is blank. Please fill in." Else strMessage += "Original Price is blank. Please fill in." End If End If If txtColor.Text = String.Empty Then If strMessage <> String.Empty Then strMessage += vbCrLf & "Color is blank. Please fill in." Else strMessage += "Color is blank. Please fill in." End If End If If txtSpecifications.Text = String.Empty Then If strMessage <> String.Empty Then strMessage += vbCrLf & "Specifications is blank. Please fill in." Else Else

in."

Wu Jian Min Page 70

IT404.NET Wu Jian Min

150100000698

strMessage += "Specifications is blank. Please fill in." End If End If If strMessage <> "" Then MsgBox(strMessage) Exit Sub End If If imgup.HasFile = False Then fileNameWithoutExtension = "Not Available!" End If Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim insertSql As String = "INSERT INTO Stroller(ProductID, ProductName, Brand, Color, Specifications, OriginalPrice, Offer, FinialPrice, Image) VALUES (@ProductID, @ProductName, @Brand, @Color, @Specifications, @OriginalPrice, @Offer, @FinialPrice, @Image)" Using myConnection As New SqlConnection(connectionString) myConnection.Open() Dim myCommand As New SqlCommand(insertSql, myConnection) myCommand.Parameters.AddWithValue("@ProductID", txtProductID.Text) myCommand.Parameters.AddWithValue("@ProductName", txtProductName.Text) myCommand.Parameters.AddWithValue("@Brand", txtBrand.Text) myCommand.Parameters.AddWithValue("@Color", txtColor.Text) myCommand.Parameters.AddWithValue("@Specifications", txtSpecifications.Text) myCommand.Parameters.AddWithValue("@OriginalPrice", txtOriginalPrice.Text) myCommand.Parameters.AddWithValue("@Offer", txtOffer.Text) myCommand.Parameters.AddWithValue("@FinialPrice", txtFinialPrice.Text) myCommand.Parameters.AddWithValue("@Image", fileNameWithoutExtension.ToString()) myCommand.ExecuteNonQuery() myConnection.Close() End Using 'Inform the user that a record has been save MsgBox("A New Record Has Successfully Been Inserted", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation, "Success!") 'Clear the textbox txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty

Wu Jian Min Page 71

IT404.NET Wu Jian Min


'Disable the textbox txtProductID.Enabled = False txtProductName.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False End Sub

150100000698

Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnAdd.Click 'Clear the textbox txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty 'Enable the textbox txtProductID.Enabled = True txtProductName.Enabled = True txtBrand.Enabled = True txtColor.Enabled = True txtFinialPrice.Enabled = True txtOffer.Enabled = True txtOriginalPrice.Enabled = True txtSpecifications.Enabled = True FileUpload1.Enabled = True btnSave.Enabled = True btnClear.Enabled = True btnAdd.Enabled = False End Sub Protected Sub Gridview1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles GridView1.SelectedIndexChanged txtProductID.Text = GridView1.SelectedRow.Cells(1).Text txtProductName.Text = GridView1.SelectedRow.Cells(2).Text txtBrand.Text = GridView1.SelectedRow.Cells(3).Text txtColor.Text = GridView1.SelectedRow.Cells(7).Text txtOriginalPrice.Text = GridView1.SelectedRow.Cells(4).Text txtOffer.Text = GridView1.SelectedRow.Cells(5).Text txtFinialPrice.Text = GridView1.SelectedRow.Cells(6).Text txtSpecifications.Text = GridView1.SelectedRow.Cells(8).Text 'lblOldValue.Text = GridView1.SelectedRow.Cells(11).Text 'Enable the Edit button and Delete button but Disable the btnUpdate btnEdit.Enabled = True btnUpdate.Enabled = False btnDelete.Enabled = True btnCancelDelete.Enabled = True 'Disable the Add button

Wu Jian Min Page 72

IT404.NET Wu Jian Min


btnAdd.Enabled = False btnSave.Enabled = False btnClear.Enabled = False 'Disable the textboxes txtProductID.Enabled = False txtProductName.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False End Sub

150100000698

Protected Sub btnUpdate_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnUpdate.Click If MsgBox("Do You Want To Save This Record?", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Update!") = MsgBoxResult.No Then btnEdit.Enabled = True btnUpdate.Enabled = False btnDelete.Enabled = True Exit Sub End If Dim imgup As FileUpload = FileUpload1 Dim fileNameWithoutExtension As String = System.IO.Path.GetFileNameWithoutExtension(imgup.FileName) 'If imgup.HasFile = False Then 'fileNameWithoutExtension = lblOldValue.Text 'End If Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim UpdateSql As String = "UPDATE Stroller SET ProductName = @ProductName, Brand = @Brand, Color = @Color, Specifications = @Specifications, OriginalPrice = @OriginalPrice, Offer = @Offer, FinialPrice = @FinialPrice, Image = @Image WHERE ProductID = @ProductID" Using myConnection As New SqlConnection(connectionString) myConnection.Open() Dim myCommand As New SqlCommand(UpdateSql, myConnection) myCommand.Parameters.AddWithValue("@ProductID", txtProductID.Text) myCommand.Parameters.AddWithValue("@ProductName", txtProductName.Text) myCommand.Parameters.AddWithValue("@Brand", txtBrand.Text) myCommand.Parameters.AddWithValue("@Color", txtColor.Text) myCommand.Parameters.AddWithValue("@Specifications", txtSpecifications.Text) myCommand.Parameters.AddWithValue("@OriginalPrice", txtOriginalPrice.Text) myCommand.Parameters.AddWithValue("@Offer", txtOffer.Text) myCommand.Parameters.AddWithValue("@FinialPrice", txtFinialPrice.Text)

Wu Jian Min Page 73

IT404.NET Wu Jian Min

150100000698

myCommand.Parameters.AddWithValue("@Image", fileNameWithoutExtension.ToString()) myCommand.ExecuteNonQuery() myConnection.Close() End Using 'Informs the user that the a record has been save MsgBox("Record Has Successfully Been Updated", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation, "Success!") GridView1.DataBind() 'Clear the textbox txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty End Sub Protected Sub btnClear_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnClear.Click 'Clear the textboxes txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty 'Disable the textboxes txtProductID.Enabled = False txtProductName.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False 'Disable Edit button btnEdit.Enabled = False btnUpdate.Enabled = False btnCancel.Enabled = False 'Disable Delete button btnDelete.Enabled = False 'Enable and Disable the Add button btnAdd.Enabled = True btnSave.Enabled = False

Wu Jian Min Page 74

IT404.NET Wu Jian Min


btnClear.Enabled = False End Sub

150100000698

Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnCancel.Click 'Clear the textboxes txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty 'Disable the textboxes txtProductID.Enabled = False txtProductName.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False 'Disable Edit button btnEdit.Enabled = False btnUpdate.Enabled = False btnCancel.Enabled = False 'Disable Delete button btnDelete.Enabled = False 'Enable and Disable the Add button btnAdd.Enabled = True btnSave.Enabled = False btnClear.Enabled = False End Sub Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnDelete.Click Dim imgup As FileUpload = FileUpload1 Dim fileNameWithoutExtension As String = System.IO.Path.GetFileNameWithoutExtension(imgup.FileName) If MsgBox("Do You Want To Delete This Record?", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Delete?") = MsgBoxResult.No Then btnDelete.Enabled = True btnEdit.Enabled = True Exit Sub End If If imgup.HasFile = False Then fileNameWithoutExtension = "Not Available!" End If

Wu Jian Min Page 75

IT404.NET Wu Jian Min

150100000698

Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim deleteSql As String = "DELETE FROM Stroller WHERE ProductID = @ProductID" Using myConnection As New SqlConnection(connectionString) myConnection.Open() Dim myCommand As New SqlCommand(deleteSql, myConnection) myCommand.Parameters.AddWithValue("@ProductID", txtProductID.Text) myCommand.ExecuteNonQuery() myConnection.Close() End Using 'Informs the user that the a record has been save MsgBox("Record Has Been Deleted.", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation, "Success!") GridView1.DataBind() 'Clear the textboxes txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty 'Disable the textboxes txtProductID.Enabled = False txtProductName.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False 'Disable Edit button btnEdit.Enabled = False btnUpdate.Enabled = False btnCancel.Enabled = False 'Disable Delete button btnDelete.Enabled = False 'Enable and Disable the Add button btnAdd.Enabled = True btnSave.Enabled = False btnClear.Enabled = False End Sub Protected Sub btnEdit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnEdit.Click 'Enable the textbox

Wu Jian Min Page 76

IT404.NET Wu Jian Min


txtProductID.Enabled = True txtProductName.Enabled = True txtBrand.Enabled = True txtColor.Enabled = True txtFinialPrice.Enabled = True txtOffer.Enabled = True txtOriginalPrice.Enabled = True txtSpecifications.Enabled = True FileUpload1.Enabled = True 'Enable and Disable the Save button btnEdit.Enabled = False btnUpdate.Enabled = True btnCancel.Enabled = True

150100000698

'Disable the Add button btnAdd.Enabled = False btnSave.Enabled = False btnClear.Enabled = False End Sub Protected Sub btnCancelDelete_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnCancelDelete.Click btnAdd.Enabled = True btnDelete.Enabled = False btnEdit.Enabled = False 'Clear the textboxes txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty 'Disable the textboxes txtProductID.Enabled = False txtProductName.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False 'Disable Edit button btnEdit.Enabled = False btnUpdate.Enabled = False btnCancel.Enabled = False 'Disable Delete button btnDelete.Enabled = False 'Enable and Disable the Add button btnAdd.Enabled = True btnSave.Enabled = False

Wu Jian Min Page 77

IT404.NET Wu Jian Min


btnClear.Enabled = False End Sub

150100000698

Protected Sub Button3_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button3.Click txtFinialPrice.Text = txtOriginalPrice.Text * (1 - txtOffer.Text / 100) 'Enable the textbox txtProductID.Enabled = True txtProductName.Enabled = True txtBrand.Enabled = True txtColor.Enabled = True txtFinialPrice.Enabled = True txtOffer.Enabled = True txtOriginalPrice.Enabled = True txtSpecifications.Enabled = True FileUpload1.Enabled = True 'Enable the Add button btnAdd.Enabled = False btnSave.Enabled = True btnClear.Enabled = True End Sub End Class

Wu Jian Min Page 78

IT404.NET Wu Jian Min Seating_Database.aspx Source

150100000698

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Webpages/MasterDesign.Master" CodeBehind="Seating_Database.aspx.vb" Inherits="BabyAge.Seating_Database" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> <style type="text/css"> .style8 { width: 478px; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <table style="width: 614px"> <tr> <td class="style8"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Label ID="lblSeatingInformation" runat="server" FontNames="Arial" Font-Size="X-Large" ForeColor="#CC6600" Text="Seating Information"></asp:Label> </td> </tr> <tr> <td class="style8"> </td> </tr> <tr> <td class="style8"> </td> </tr> <tr> <td class="style8"> <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" CellPadding="2" DataKeyNames="ProductID" DataSourceID="SqlDataSource1" EmptyDataText="There are no data records to display." ForeColor="#333333" Height="186px" style="margin-right: 0px" Width="603px" FontSize="Smaller" PageSize="2"> <RowStyle BackColor="#FFFBD6" ForeColor="#333333" /> <Columns> <asp:CommandField ShowSelectButton="True" /> <asp:BoundField DataField="ProductID" HeaderText="ProductID" ReadOnly="True" SortExpression="ProductID" /> <asp:BoundField DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName" />

Wu Jian Min Page 79

IT404.NET Wu Jian Min

150100000698

<asp:BoundField DataField="Brand" HeaderText="Brand" SortExpression="Brand" /> <asp:BoundField DataField="OriginalPrice" HeaderText="OriginalPrice" SortExpression="OriginalPrice" /> <asp:BoundField DataField="Offer" HeaderText="Offer" SortExpression="Offer" /> <asp:BoundField DataField="FinialPrice" HeaderText="FinialPrice" SortExpression="FinialPrice" /> <asp:BoundField DataField="Color" HeaderText="Color" SortExpression="Color" /> <asp:BoundField DataField="Specifications" HeaderText="Specifications" SortExpression="Specifications" /> <asp:BoundField DataField="Image" HeaderText="Image" SortExpression="Image" /> </Columns> <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" /> <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" /> <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" /> <AlternatingRowStyle BackColor="White" /> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT [ProductID], [ProductName], [Brand], [OriginalPrice], [Offer], [FinialPrice], [Color], [Specifications], [Image] FROM [SeatingTable]"> </asp:SqlDataSource> </td> </tr> <tr> <td align = "left" class="style8" > <asp:Label ID="lblProductID" runat="server" Text="Product ID: "></asp:Label> &nbsp;&nbsp;&nbsp;&nbsp; <asp:TextBox ID="txtProductID" runat="server"></asp:TextBox> </td> </tr> <tr align = "left"> <td class="style8"> <asp:Label ID="lblProductName" runat="server" Text="Product Name: "></asp:Label> <asp:TextBox ID="txtProductName" runat="server" Width="208px"></asp:TextBox> </td> </tr> <tr align = "left"> <td class="style8">

Wu Jian Min Page 80

IT404.NET Wu Jian Min

150100000698

<asp:Label ID="lblBrand" runat="server" Text="Brand: "></asp:Label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:TextBox ID="txtBrand" runat="server"></asp:TextBox> </td> </tr> <tr align = "left"> <td class="style8"> <asp:Label ID="lblOriginalPrice" runat="server" Text="Original Price: "></asp:Label> &nbsp; <asp:TextBox ID="txtOriginalPrice" runat="server"></asp:TextBox> </td> </tr> <tr align = "left"> <td class="style8"> <asp:Label ID="lblOffer" runat="server" Text="Percent Offer: "></asp:Label> &nbsp; <asp:TextBox ID="txtOffer" runat="server" Width="102px"></asp:TextBox> &nbsp;<asp:Label ID="Label2" runat="server" Font-Size="Larger" ForeColor="Red" Text="%"></asp:Label> </td> </tr> <tr align = "left"> <td class="style8"> <asp:Label ID="lblFinialPrice" runat="server" Text="Offer Price: "></asp:Label> &nbsp;&nbsp;&nbsp;&nbsp; <asp:TextBox ID="txtFinialPrice" runat="server" Width="132px"></asp:TextBox> &nbsp; <asp:Button ID="Button3" runat="server" Text="Calculate" Width="68px" /> </td> </tr> <tr align = "left"> <td class="style8"> <asp:Label ID="lblColor" runat="server" Text="Color: "></asp:Label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:TextBox ID="txtColor" runat="server" Width="208px"></asp:TextBox> </td> </tr> <tr align = "left"> <td class="style8" valign="middle"> <asp:Label ID="lblSpecifications" runat="server" Text="Specifications: "></asp:Label> &nbsp;<asp:TextBox ID="txtSpecifications" runat="server" TextMode="MultiLine" Width="213px" Height="83px"></asp:TextBox> &nbsp; </td>

Wu Jian Min Page 81

IT404.NET Wu Jian Min

150100000698

</tr> <tr align = "left"> <td class="style8"> <asp:Label ID="lblImage" runat="server" Text="Image: "></asp:Label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <asp:FileUpload ID="FileUpload1" runat="server" /> &nbsp; </td> </tr> <tr align = "left"> <td class="style8"> <asp:Label ID="lblInsertNewRecord" runat="server" Text="Insert New Record" ForeColor="#CC6600"></asp:Label> </td> </tr> <tr align = "left"> <td class="style8"> <asp:Button ID="btnAdd" runat="server" Text="Add" Width="94px" /> &nbsp;&nbsp; <asp:Button ID="btnSave" runat="server" Text="Save" Width="94px" /> &nbsp;&nbsp; <asp:Button ID="btnClear" runat="server" Text="Cancel" Width="94px" /> </td> </tr> <tr align = "left"> <td class="style8"> <asp:Label ID="lblUpdateExistingRecord" runat="server" ForeColor="#CC6600" Text="Update Existing Record"></asp:Label> </td> </tr> <tr align = "left"> <td class="style8" > <asp:Button ID="btnEdit" runat="server" Text="Edit" Width="94px"/> &nbsp;&nbsp; <asp:Button ID="btnUpdate" runat="server" Text="Save" Width="94px"/> &nbsp;&nbsp; <asp:Button ID="btnCancel" runat="server" Text="Cancel" Width="94px"/> </td> </tr> <tr align = "left"> <td class="style8"> <asp:Label ID="lblDeleteExistingRecord" runat="server" ForeColor="#CC6600" Text="Delete Existing Record"></asp:Label> </td> </tr> <tr align = "left"> <td class="style8"> <asp:Button ID="btnDelete" runat="server" Text="Delete" Width="94px" />

Wu Jian Min Page 82

IT404.NET Wu Jian Min


&nbsp;&nbsp;

150100000698

<asp:Button ID="btnCancelDelete" runat="server" Text="Cancel" Width="94px"/> </td> </tr> <tr> <td class="style8" align = "right"> menu" Width="160px" /> </td> </tr> </table> </asp:Content> <asp:Button ID="Button4" runat="server" Text="Back to main PostBackUrl="~/Webpages/Database Form.aspx"

vb code
Imports System Imports System.Data Imports System.Configuration Imports System.Web Imports System.Web.Security Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.WebControls.WebParts Imports System.Web.UI.HtmlControls Imports System.Data.SqlClient Partial Public Class Seating_Database Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'Disable the textbox txtProductID.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtProductName.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False 'Disable the button btnEdit.Enabled = False btnUpdate.Enabled = False btnClear.Enabled = False btnCancel.Enabled = False btnDelete.Enabled = False btnCancelDelete.Enabled = False 'btnClearSearch.Enabled = False End Sub

Wu Jian Min Page 83

IT404.NET Wu Jian Min

150100000698

Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSave.Click Dim strMessage As String = "" Dim imgup As FileUpload = FileUpload1 Dim fileNameWithoutExtension As String = System.IO.Path.GetFileNameWithoutExtension(imgup.FileName) If MsgBox("Do You Want To Save This Record?", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Save") = MsgBoxResult.No Then btnSave.Enabled = False btnClear.Enabled = False btnAdd.Enabled = True GridView1.DataBind() Exit Sub End If 'This will show error message if a user does not key in a character If txtProductID.Text = String.Empty Then strMessage = "Product No is blank. Please fill in." End If If txtProductName.Text = String.Empty Then If strMessage <> String.Empty Then strMessage += vbCrLf & "Product Name is blank. Please fill strMessage += "Product Name is blank. Please fill in." End If End If If txtBrand.Text = String.Empty Then If strMessage <> String.Empty Then strMessage += vbCrLf & "Brand is blank. Please fill in." Else strMessage += "Brand is blank. Please fill in." End If End If If txtOriginalPrice.Text = String.Empty Then If strMessage <> String.Empty Then strMessage += vbCrLf & "Original Price is blank. Please fill in." Else strMessage += "Original Price is blank. Please fill in." End If End If If txtColor.Text = String.Empty Then If strMessage <> String.Empty Then strMessage += vbCrLf & "Color is blank. Please fill in." Else strMessage += "Color is blank. Please fill in." End If End If If txtSpecifications.Text = String.Empty Then Else

in."

Wu Jian Min Page 84

IT404.NET Wu Jian Min

150100000698

fill in."

If strMessage <> String.Empty Then strMessage += vbCrLf & "Specifications is blank. Please Else

strMessage += "Specifications is blank. Please fill in." End If End If If strMessage <> "" Then MsgBox(strMessage) Exit Sub End If If imgup.HasFile = False Then fileNameWithoutExtension = "Not Available!" End If Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim insertSql As String = "INSERT INTO SeatingTable(ProductID, ProductName, Brand, Color, Specifications, OriginalPrice, Offer, FinialPrice, Image) VALUES (@ProductID, @ProductName, @Brand, @Color, @Specifications, @OriginalPrice, @Offer, @FinialPrice, @Image)" Using myConnection As New SqlConnection(connectionString) myConnection.Open() Dim myCommand As New SqlCommand(insertSql, myConnection) myCommand.Parameters.AddWithValue("@ProductID", txtProductID.Text) myCommand.Parameters.AddWithValue("@ProductName", txtProductName.Text) myCommand.Parameters.AddWithValue("@Brand", txtBrand.Text) myCommand.Parameters.AddWithValue("@Color", txtColor.Text) myCommand.Parameters.AddWithValue("@Specifications", txtSpecifications.Text) myCommand.Parameters.AddWithValue("@OriginalPrice", txtOriginalPrice.Text) myCommand.Parameters.AddWithValue("@Offer", txtOffer.Text) myCommand.Parameters.AddWithValue("@FinialPrice", txtFinialPrice.Text) myCommand.Parameters.AddWithValue("@Image", fileNameWithoutExtension.ToString()) myCommand.ExecuteNonQuery() myConnection.Close() End Using 'Inform the user that a record has been save MsgBox("A New Record Has Successfully Been Inserted", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation, "Success!") 'Clear the textbox txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty

Wu Jian Min Page 85

IT404.NET Wu Jian Min


txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty 'Disable the textbox txtProductID.Enabled = False txtProductName.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False End Sub

150100000698

Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnAdd.Click 'Clear the textbox txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty 'Enable the textbox txtProductID.Enabled = True txtProductName.Enabled = True txtBrand.Enabled = True txtColor.Enabled = True txtFinialPrice.Enabled = True txtOffer.Enabled = True txtOriginalPrice.Enabled = True txtSpecifications.Enabled = True FileUpload1.Enabled = True btnSave.Enabled = True btnClear.Enabled = True btnAdd.Enabled = False End Sub Protected Sub Gridview1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles GridView1.SelectedIndexChanged txtProductID.Text = GridView1.SelectedRow.Cells(1).Text txtProductName.Text = GridView1.SelectedRow.Cells(2).Text txtBrand.Text = GridView1.SelectedRow.Cells(3).Text txtColor.Text = GridView1.SelectedRow.Cells(7).Text txtOriginalPrice.Text = GridView1.SelectedRow.Cells(4).Text txtOffer.Text = GridView1.SelectedRow.Cells(5).Text txtFinialPrice.Text = GridView1.SelectedRow.Cells(6).Text txtSpecifications.Text = GridView1.SelectedRow.Cells(8).Text 'lblOldValue.Text = GridView1.SelectedRow.Cells(11).Text 'Enable the Edit button and Delete button but Disable the btnUpdate btnEdit.Enabled = True btnUpdate.Enabled = False

Wu Jian Min Page 86

IT404.NET Wu Jian Min


btnDelete.Enabled = True btnCancelDelete.Enabled = True 'Disable the Add button btnAdd.Enabled = False btnSave.Enabled = False btnClear.Enabled = False 'Disable the textboxes txtProductID.Enabled = False txtProductName.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False End Sub

150100000698

Protected Sub btnUpdate_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnUpdate.Click If MsgBox("Do You Want To Save This Record?", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Update!") = MsgBoxResult.No Then btnEdit.Enabled = True btnUpdate.Enabled = False btnDelete.Enabled = True Exit Sub End If Dim imgup As FileUpload = FileUpload1 Dim fileNameWithoutExtension As String = System.IO.Path.GetFileNameWithoutExtension(imgup.FileName) 'If imgup.HasFile = False Then 'fileNameWithoutExtension = lblOldValue.Text 'End If Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim UpdateSql As String = "UPDATE SeatingTable SET ProductName = @ProductName, Brand = @Brand, Color = @Color, Specifications = @Specifications, OriginalPrice = @OriginalPrice, Offer = @Offer, FinialPrice = @FinialPrice, Image = @Image WHERE ProductID = @ProductID" Using myConnection As New SqlConnection(connectionString) myConnection.Open() Dim myCommand As New SqlCommand(UpdateSql, myConnection) myCommand.Parameters.AddWithValue("@ProductID", txtProductID.Text) myCommand.Parameters.AddWithValue("@ProductName", txtProductName.Text) myCommand.Parameters.AddWithValue("@Brand", txtBrand.Text) myCommand.Parameters.AddWithValue("@Color", txtColor.Text) myCommand.Parameters.AddWithValue("@Specifications", txtSpecifications.Text)

Wu Jian Min Page 87

IT404.NET Wu Jian Min

150100000698

myCommand.Parameters.AddWithValue("@OriginalPrice", txtOriginalPrice.Text) myCommand.Parameters.AddWithValue("@Offer", txtOffer.Text) myCommand.Parameters.AddWithValue("@FinialPrice", txtFinialPrice.Text) myCommand.Parameters.AddWithValue("@Image", fileNameWithoutExtension.ToString()) myCommand.ExecuteNonQuery() myConnection.Close() End Using 'Informs the user that the a record has been save MsgBox("Record Has Successfully Been Updated", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation, "Success!") GridView1.DataBind() 'Clear the textbox txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty End Sub Protected Sub btnClear_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnClear.Click 'Clear the textboxes txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty 'Disable the textboxes txtProductID.Enabled = False txtProductName.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False 'Disable Edit button btnEdit.Enabled = False btnUpdate.Enabled = False btnCancel.Enabled = False 'Disable Delete button

Wu Jian Min Page 88

IT404.NET Wu Jian Min


btnDelete.Enabled = False 'Enable and Disable the Add button btnAdd.Enabled = True btnSave.Enabled = False btnClear.Enabled = False End Sub

150100000698

Protected Sub btnCancel_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnCancel.Click 'Clear the textboxes txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty 'Disable the textboxes txtProductID.Enabled = False txtProductName.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False 'Disable Edit button btnEdit.Enabled = False btnUpdate.Enabled = False btnCancel.Enabled = False 'Disable Delete button btnDelete.Enabled = False 'Enable and Disable the Add button btnAdd.Enabled = True btnSave.Enabled = False btnClear.Enabled = False End Sub Protected Sub btnDelete_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnDelete.Click Dim imgup As FileUpload = FileUpload1 Dim fileNameWithoutExtension As String = System.IO.Path.GetFileNameWithoutExtension(imgup.FileName) If MsgBox("Do You Want To Delete This Record?", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Delete?") = MsgBoxResult.No Then btnDelete.Enabled = True btnEdit.Enabled = True Exit Sub End If

Wu Jian Min Page 89

IT404.NET Wu Jian Min

150100000698

If imgup.HasFile = False Then fileNameWithoutExtension = "Not Available!" End If Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim deleteSql As String = "DELETE FROM SeatingTable WHERE ProductID = @ProductID" Using myConnection As New SqlConnection(connectionString) myConnection.Open() Dim myCommand As New SqlCommand(deleteSql, myConnection) myCommand.Parameters.AddWithValue("@ProductID", txtProductID.Text) myCommand.ExecuteNonQuery() myConnection.Close() End Using 'Informs the user that the a record has been save MsgBox("Record Has Been Deleted.", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation, "Success!") GridView1.DataBind() 'Clear the textboxes txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty 'Disable the textboxes txtProductID.Enabled = False txtProductName.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False 'Disable Edit button btnEdit.Enabled = False btnUpdate.Enabled = False btnCancel.Enabled = False 'Disable Delete button btnDelete.Enabled = False 'Enable and Disable the Add button btnAdd.Enabled = True btnSave.Enabled = False btnClear.Enabled = False End Sub

Wu Jian Min Page 90

IT404.NET Wu Jian Min

150100000698

Protected Sub btnEdit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnEdit.Click 'Enable the textbox txtProductID.Enabled = True txtProductName.Enabled = True txtBrand.Enabled = True txtColor.Enabled = True txtFinialPrice.Enabled = True txtOffer.Enabled = True txtOriginalPrice.Enabled = True txtSpecifications.Enabled = True FileUpload1.Enabled = True 'Enable and Disable the Save button btnEdit.Enabled = False btnUpdate.Enabled = True btnCancel.Enabled = True 'Disable the Add button btnAdd.Enabled = False btnSave.Enabled = False btnClear.Enabled = False End Sub Protected Sub btnCancelDelete_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnCancelDelete.Click btnAdd.Enabled = True btnDelete.Enabled = False btnEdit.Enabled = False 'Clear the textboxes txtProductID.Text = String.Empty txtProductName.Text = String.Empty txtBrand.Text = String.Empty txtColor.Text = String.Empty txtFinialPrice.Text = String.Empty txtOffer.Text = String.Empty txtOriginalPrice.Text = String.Empty txtSpecifications.Text = String.Empty 'Disable the textboxes txtProductID.Enabled = False txtProductName.Enabled = False txtBrand.Enabled = False txtColor.Enabled = False txtFinialPrice.Enabled = False txtOffer.Enabled = False txtOriginalPrice.Enabled = False txtSpecifications.Enabled = False FileUpload1.Enabled = False 'Disable Edit button btnEdit.Enabled = False btnUpdate.Enabled = False btnCancel.Enabled = False 'Disable Delete button btnDelete.Enabled = False

Wu Jian Min Page 91

IT404.NET Wu Jian Min


'Enable and Disable the Add button btnAdd.Enabled = True btnSave.Enabled = False btnClear.Enabled = False End Sub

150100000698

Protected Sub Button3_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button3.Click txtFinialPrice.Text = txtOriginalPrice.Text * (1 - txtOffer.Text / 100) 'Enable the textbox txtProductID.Enabled = True txtProductName.Enabled = True txtBrand.Enabled = True txtColor.Enabled = True txtFinialPrice.Enabled = True txtOffer.Enabled = True txtOriginalPrice.Enabled = True txtSpecifications.Enabled = True FileUpload1.Enabled = True 'Enable the Add button btnAdd.Enabled = False btnSave.Enabled = True btnClear.Enabled = True End Sub End Class

Wu Jian Min Page 92

IT404.NET Wu Jian Min Registration.aspx Source

150100000698

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Webpages/MasterDesign.Master" CodeBehind="Registration.aspx.vb" Inherits="BabyAge.Registration" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <asp:CreateUserWizard ID="CreateUserWizard1" runat="server"> <WizardSteps> <asp:CreateUserWizardStep runat="server"> <ContentTemplate> <table border="0"> <tr> <td align="center" colspan="2"> Sign Up for Your New Account</td> </tr> <tr> <td align="right"> <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label> </td> <td> <asp:TextBox ID="UserName" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName" ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator> </td> </tr> <tr> <td align="right"> <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label> </td> <td> <asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox> <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password" ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator> </td> </tr> <tr> <td align="right"> <asp:Label ID="ConfirmPasswordLabel" runat="server" AssociatedControlID="ConfirmPassword">Confirm Password:</asp:Label> </td>

Wu Jian Min Page 93

IT404.NET Wu Jian Min


<td>

150100000698

<asp:TextBox ID="ConfirmPassword" runat="server" TextMode="Password"></asp:TextBox> <asp:RequiredFieldValidator ID="ConfirmPasswordRequired" runat="server" ControlToValidate="ConfirmPassword" ErrorMessage="Confirm Password is required." ToolTip="Confirm Password is required." ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator> </td> </tr> <tr> <td align="right"> <asp:Label ID="EmailLabel" runat="server" AssociatedControlID="Email">E-mail:</asp:Label> </td> <td> <asp:TextBox ID="Email" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="EmailRequired" runat="server" ControlToValidate="Email" ErrorMessage="Email is required." ToolTip="E-mail is required." ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator> </td> </tr> <tr> <td align="right"> <asp:Label ID="QuestionLabel" runat="server" AssociatedControlID="Question">Security Question:</asp:Label> </td> <td> <asp:TextBox ID="Question" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="QuestionRequired" runat="server" ControlToValidate="Question" ErrorMessage="Security question is required." ToolTip="Security question is required." ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator> </td> </tr> <tr> <td align="right"> <asp:Label ID="AnswerLabel" runat="server" AssociatedControlID="Answer">Security Answer:</asp:Label> </td> <td> <asp:TextBox ID="Answer" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="AnswerRequired" runat="server" ControlToValidate="Answer" ErrorMessage="Security answer is required." ToolTip="Security answer is required." ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator> </td>

Wu Jian Min Page 94

IT404.NET Wu Jian Min

150100000698

runat="server"

</tr> <tr> <td align="center" colspan="2"> <asp:CompareValidator ID="PasswordCompare"

ControlToCompare="Password" ControlToValidate="ConfirmPassword" Display="Dynamic" ErrorMessage="The Password and Confirmation Password must match." ValidationGroup="CreateUserWizard1"></asp:CompareValidator> </td> </tr> <tr> <td align="center" colspan="2" style="color: Red;"> <asp:Literal ID="ErrorMessage" runat="server" EnableViewState="False"></asp:Literal> </td> </tr> </table> </ContentTemplate> </asp:CreateUserWizardStep> <asp:WizardStep runat="server" AllowReturn="False" StepType="Step" Title="AddDetails" ID="AddDetails"> <asp:Label ID="lblFN" runat="server" Text="First Name: "></asp:Label> <asp:TextBox ID="txtFN" runat="server" AutoCompleteType="FirstName"></asp:TextBox> <br /> <asp:Label ID="lblLN" runat="server" Text="Last Name:"></asp:Label> &nbsp;<asp:TextBox ID="txtLN" runat="server" AutoCompleteType="LastName"></asp:TextBox> <br /> <asp:Label ID="lblGender" runat="server" Text="Gender: "></asp:Label> <asp:RadioButtonList ID="rblGender" runat="server" RepeatDirection="Horizontal"> <asp:ListItem>Male</asp:ListItem> <asp:ListItem>Female</asp:ListItem> </asp:RadioButtonList> <asp:Label ID="lblDOB" runat="server" Text="Date Of Birth: "></asp:Label> <asp:TextBox ID="txtDOB" runat="server"></asp:TextBox> <br /> <br /> <asp:Label ID="lblNationality" runat="server" Text="Nationality: "></asp:Label> <asp:TextBox ID="txtNationality" runat="server"></asp:TextBox> <br /> <asp:Label ID="lblHP" runat="server" Text="HandPhone No: "></asp:Label> <asp:TextBox ID="txtHP" runat="server" Wrap="False" AutoCompleteType="HomePhone"></asp:TextBox> <br /> <asp:Label ID="lblCA" runat="server" Text="Current Address: "></asp:Label>

Wu Jian Min Page 95

IT404.NET Wu Jian Min

150100000698

<asp:TextBox ID="txtCA" runat="server" TextMode="MultiLine"></asp:TextBox> </asp:WizardStep> <asp:CompleteWizardStep runat="server"> <ContentTemplate> <table border="0"> <tr> <td align="center" colspan="2"> Complete</td> </tr> <tr> <td> Your account has been successfully created.</td> </tr> <tr> <td align="right" colspan="2"> <asp:Button ID="ContinueButton" runat="server" CausesValidation="False" CommandName="Continue" Text="Continue" ValidationGroup="CreateUserWizard1" PostBackUrl="~/Webpages/Home.aspx" /> </td> </tr> </table> </ContentTemplate> </asp:CompleteWizardStep> </WizardSteps> </asp:CreateUserWizard>

</asp:Content>

vb code
Imports System.Data.SqlClient Partial Public Class Registration Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Private Sub CreateUserWizard1_ActiveStepChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CreateUserWizard1.ActiveStepChanged If CreateUserWizard1.ActiveStep.Title = "Complete" Then Dim Settings As WizardStep = CType(CreateUserWizard1.FindControl("AddDetails"), WizardStep) TextBox) TextBox) Dim FirstName As TextBox = CType(Settings.FindControl("txtFN"), Dim LastName As TextBox = CType(Settings.FindControl("txtLN"),

Dim Gender As RadioButtonList = CType(Settings.FindControl("rblGender"), RadioButtonList)

Wu Jian Min Page 96

IT404.NET Wu Jian Min

150100000698

Dim DateOfBirth As TextBox = CType(Settings.FindControl("txtDOB"), TextBox) Dim Nationality As TextBox = CType(Settings.FindControl("txtNationality"), TextBox) Dim HP As TextBox = CType(Settings.FindControl("txtHP"), TextBox) Dim CurrentAddress As TextBox = CType(Settings.FindControl("txtCA"), TextBox) Dim newUser As MembershipUser = Membership.GetUser(CreateUserWizard1.UserName) Dim newUserId As Guid = CType(newUser.ProviderUserKey, Guid) Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim insertSql As String = "INSERT INTO Member(UserId, FirstName, LastName, Gender, DateOfBirth, Nationality, HP, CurrentAddress) VALUES (@UserId, @FirstName, @LastName, @Gender, @DateOfBirth, @Nationality, @HP, @CurrentAddress)" Using myConnection As New SqlConnection(connectionString) myConnection.Open() Dim myCommand As New SqlCommand(insertSql, myConnection) myCommand.Parameters.AddWithValue("@UserId", newUserId) myCommand.Parameters.AddWithValue("@FirstName", FirstName.Text.Trim()) myCommand.Parameters.AddWithValue("@LastName", LastName.Text.Trim()) myCommand.Parameters.AddWithValue("@Gender", Gender.SelectedValue.Trim()) myCommand.Parameters.AddWithValue("@DateOfBirth", DateOfBirth.Text.Trim()) myCommand.Parameters.AddWithValue("@Nationality", Nationality.Text.Trim()) myCommand.Parameters.AddWithValue("@HP", HP.Text.Trim()) myCommand.Parameters.AddWithValue("@CurrentAddress", CurrentAddress.Text.Trim()) myCommand.ExecuteNonQuery() myConnection.Close() End Using Roles.AddUserToRole(CreateUserWizard1.UserName, "members") End If End Sub End Class

Wu Jian Min Page 97

IT404.NET Wu Jian Min Database Form.aspx Source

150100000698

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Webpages/MasterDesign.Master" CodeBehind="Database Form.aspx.vb" Inherits="BabyAge.Database_Form" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <table style="width: 614px"> <tr> <td class="style8"> <asp:Label ID="lblSelectdatabase" runat="server" Text="Selet database: "></asp:Label> <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"> <asp:ListItem Selected="True">Please Select A Catergory</asp:ListItem> <asp:ListItem>CarSeat_Database</asp:ListItem> <asp:ListItem>Stroller_Database</asp:ListItem> <asp:ListItem>Seating_Database</asp:ListItem> </asp:DropDownList> </td></tr> <tr> <td class="style8"> </td></tr> <tr> <td class="style8"> Size="Large" <asp:Label ID="lblMemberInformation" runat="server" FontForeColor="#CC6600" Text="Member List"></asp:Label> </td></tr> <tr> <td class="style8"> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" AllowPaging="True" PageSize="5"> <Columns> <asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName"></asp:BoundField> <asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" /> <asp:BoundField DataField="Gender" HeaderText="Gender" SortExpression="Gender" /> <asp:BoundField DataField="DateOfBirth" HeaderText="DateOfBirth" SortExpression="DateOfBirth" /> <asp:BoundField DataField="Nationality" HeaderText="Nationality" SortExpression="Nationality" /> <asp:BoundField DataField="HP" HeaderText="HP" SortExpression="HP"

/>

<asp:BoundField DataField="CurrentAddress" HeaderText="CurrentAddress" SortExpression="CurrentAddress" /> </Columns>

Wu Jian Min Page 98

IT404.NET Wu Jian Min

150100000698

</asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [FirstName], [LastName], [Gender], [DateOfBirth], [Nationality], [HP], [CurrentAddress] FROM [Member]"> </asp:SqlDataSource> </td></tr></table> </asp:Content>

vb code

Imports System.Data Imports System.Configuration Imports System.Web Imports System.Web.Security Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.WebControls.WebParts Imports System.Web.UI.HtmlControls Imports System.Data.SqlClient Partial Public Class Database_Form Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles DropDownList1.SelectedIndexChanged 'Place this in the main menu Dim Link As String = DropDownList1.SelectedValue.ToString() + ".aspx" Response.Redirect(Link) End Sub End Class

Wu Jian Min Page 99

IT404.NET Wu Jian Min Order.aspx Source

150100000698

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Webpages/MasterDesign.Master" CodeBehind="Order.aspx.vb" Inherits="BabyAge.Order" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <table><tr><td> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataSourceID="SqlDataSource1" Width="550px" DataKeyNames="ID"> <RowStyle BackColor="White" ForeColor="#330099" /> <Columns> <asp:BoundField DataField="Checkout_ID" HeaderText="Product Name" SortExpression="Checkout_ID" /> <asp:TemplateField HeaderText="Quantity" SortExpression="Quantity"> <EditItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Quantity") %>'></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("Quantity") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Price" SortExpression="Price"> <EditItemTemplate> <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Price") %>'></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label2" runat="server" Text='<%# Bind("Price") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="Total_Price" HeaderText="Total_Price" SortExpression="Total_Price" Visible="False" /> <asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" Visible="False" /> <asp:BoundField DataField="UserId" HeaderText="UserId" SortExpression="UserId" Visible="False" /> </Columns> <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" /> <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" /> <EmptyDataTemplate> There is nothing is your cart. </EmptyDataTemplate>

Wu Jian Min Page 100

IT404.NET Wu Jian Min

150100000698

<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" /> <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" /> </asp:GridView> </td></tr> <tr><td> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"

SelectCommand="SELECT [Checkout_ID], [Quantity], [Price], [Total_Price], [ID], [UserId] FROM [Checkout] WHERE ([UserId] = @UserId)" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"> <SelectParameters> <asp:ControlParameter ControlID="GridView1" Name="UserId" PropertyName="SelectedValue" Type="Object" /> </SelectParameters> </asp:SqlDataSource> </td></tr> <tr><td align=right> <asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="0" DataSourceID="SqlDataSource1" GridLines="None" Height="16px" ShowFooter="True" style="marginbottom: 0px" Width="92px" PageSize="1" DataKeyNames="ID"> <RowStyle BackColor="White" ForeColor="#330099" /> <Columns> <asp:BoundField DataField="Checkout_ID" HeaderText="Checkout_ID" SortExpression="Checkout_ID" Visible="False" /> <asp:BoundField DataField="Quantity" HeaderText="Quantity" SortExpression="Quantity" Visible="False" /> <asp:TemplateField HeaderText="Total Price" SortExpression="Price"> <EditItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Total_Price") %>'></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("Total_Price") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" Visible="False" /> <asp:BoundField DataField="UserId" HeaderText="UserId" SortExpression="UserId" Visible="False" /> </Columns> <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="right" Wrap="True" /> <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />

Wu Jian Min Page 101

IT404.NET Wu Jian Min

150100000698

<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" /> <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" /> </asp:GridView> </td></tr> <tr><td align=right> <asp:Button ID="btnCheckout" runat="server" Text="Proceed To Check" /> </td></tr></table> </asp:Content>

vb code
Imports System.Data.SqlClient Partial Public Class Order Inherits System.Web.UI.Page ' Declare variable used to store value of Total Private TotalPrice As Decimal = CDec(0.0) Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Protected Sub SqlDataSource1_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles SqlDataSource1.Selecting Dim currentUser As MembershipUser = Membership.GetUser() Dim currentUserId As Guid = CType(currentUser.ProviderUserKey, Guid) e.Command.Parameters("@UserId").Value = currentUserId End Sub Private Sub GridView3_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView3.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then TotalPrice += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Price")) ElseIf e.Row.RowType = DataControlRowType.Footer Then e.Row.Cells(2).Text = String.Format("{0:c}", TotalPrice) End If End Sub Protected Sub btnCheckout_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnCheckout.Click If GridView1.Rows.Count = 0 Then 'Informs the user that the a record has been save MsgBox("There is nothing in your shopping cart.", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "RangerAmouries") Else Response.Redirect("Proceed_Order.aspx") End If End Sub End Class

Wu Jian Min Page 102

IT404.NET Wu Jian Min Proceed_Order.aspx Source

150100000698

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Webpages/MasterDesign.Master" CodeBehind="Proceed_Order.aspx.vb" Inherits="BabyAge.Proceed_Order" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> <style type="text/css"> .style71 { width: 587px; } .style72 { height: 4px; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <table class="style71" style="margin-left: 25px"> <tr> <td colspan="2"> <asp:Label ID="Label17" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="X-Large" Text="Credit/debit card"></asp:Label> </td> </tr> <tr> <td> <asp:Label ID="Label6" runat="server" Text="Credit Card Type:"></asp:Label> </td> <td> <asp:DropDownList ID="DropDownList1" runat="server"> <asp:ListItem>Visa</asp:ListItem> <asp:ListItem>Master Card</asp:ListItem> <asp:ListItem>American Express</asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td class="style72"> <asp:Label ID="Label7" runat="server" Text="CardHolder Name:"></asp:Label> </td> <td class="style72"> <asp:TextBox ID="txtName" runat="server" Width="297px"></asp:TextBox> </td> </tr> <tr> <td> <asp:Label ID="Label8" runat="server" Text="Valid From:"></asp:Label> </td>

Wu Jian Min Page 103

IT404.NET Wu Jian Min


<td>

150100000698

<asp:DropDownList ID="DropDownList3" runat="server"> <asp:ListItem>- -</asp:ListItem> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> <asp:ListItem>4</asp:ListItem> <asp:ListItem>5</asp:ListItem> <asp:ListItem>6</asp:ListItem> <asp:ListItem>7</asp:ListItem> <asp:ListItem>8</asp:ListItem> <asp:ListItem>9</asp:ListItem> <asp:ListItem>10</asp:ListItem> <asp:ListItem>11</asp:ListItem> <asp:ListItem>12</asp:ListItem> <asp:ListItem>13</asp:ListItem> <asp:ListItem>14</asp:ListItem> <asp:ListItem>15</asp:ListItem> <asp:ListItem>16</asp:ListItem> <asp:ListItem>17</asp:ListItem> <asp:ListItem>18</asp:ListItem> <asp:ListItem>19</asp:ListItem> <asp:ListItem>20</asp:ListItem> <asp:ListItem>21</asp:ListItem> <asp:ListItem>22</asp:ListItem> <asp:ListItem>23</asp:ListItem> <asp:ListItem>24</asp:ListItem> <asp:ListItem>25</asp:ListItem> <asp:ListItem>26</asp:ListItem> <asp:ListItem>27</asp:ListItem> <asp:ListItem>28</asp:ListItem> <asp:ListItem>29</asp:ListItem> <asp:ListItem>30</asp:ListItem> <asp:ListItem>31</asp:ListItem> </asp:DropDownList> <asp:DropDownList ID="DropDownList4" runat="server"> <asp:ListItem>- -</asp:ListItem> <asp:ListItem>01</asp:ListItem> <asp:ListItem>02</asp:ListItem> <asp:ListItem>03</asp:ListItem> <asp:ListItem>04</asp:ListItem> <asp:ListItem>05</asp:ListItem> <asp:ListItem>06</asp:ListItem> <asp:ListItem>07</asp:ListItem> <asp:ListItem>08</asp:ListItem> <asp:ListItem>09</asp:ListItem> <asp:ListItem>10</asp:ListItem> <asp:ListItem>11</asp:ListItem> <asp:ListItem>12</asp:ListItem> </asp:DropDownList> <asp:DropDownList ID="DropDownList5" runat="server"> <asp:ListItem>- - - -</asp:ListItem> <asp:ListItem>2001</asp:ListItem> <asp:ListItem>2002</asp:ListItem> <asp:ListItem>2003</asp:ListItem> <asp:ListItem>2004</asp:ListItem> <asp:ListItem>2005</asp:ListItem> <asp:ListItem>2006</asp:ListItem> <asp:ListItem>2007</asp:ListItem>

Wu Jian Min Page 104

IT404.NET Wu Jian Min

150100000698

<asp:ListItem>2008</asp:ListItem> <asp:ListItem>2009</asp:ListItem> <asp:ListItem>2010</asp:ListItem> <asp:ListItem>2011</asp:ListItem> <asp:ListItem>2012</asp:ListItem> <asp:ListItem>2013</asp:ListItem> <asp:ListItem>2014</asp:ListItem> <asp:ListItem>2015</asp:ListItem> <asp:ListItem>2016</asp:ListItem> <asp:ListItem>2017</asp:ListItem> <asp:ListItem>2018</asp:ListItem> <asp:ListItem>2019</asp:ListItem> <asp:ListItem>2020</asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td> <asp:Label ID="Label9" runat="server" Text="Expiry Date:"></asp:Label> </td> <td> <asp:DropDownList ID="DropDownList9" runat="server"> <asp:ListItem>- -</asp:ListItem> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> <asp:ListItem>4</asp:ListItem> <asp:ListItem>5</asp:ListItem> <asp:ListItem>6</asp:ListItem> <asp:ListItem>7</asp:ListItem> <asp:ListItem>8</asp:ListItem> <asp:ListItem>9</asp:ListItem> <asp:ListItem>10</asp:ListItem> <asp:ListItem>11</asp:ListItem> <asp:ListItem>12</asp:ListItem> <asp:ListItem>13</asp:ListItem> <asp:ListItem>14</asp:ListItem> <asp:ListItem>15</asp:ListItem> <asp:ListItem>16</asp:ListItem> <asp:ListItem>17</asp:ListItem> <asp:ListItem>18</asp:ListItem> <asp:ListItem>19</asp:ListItem> <asp:ListItem>20</asp:ListItem> <asp:ListItem>21</asp:ListItem> <asp:ListItem>22</asp:ListItem> <asp:ListItem>23</asp:ListItem> <asp:ListItem>24</asp:ListItem> <asp:ListItem>25</asp:ListItem> <asp:ListItem>26</asp:ListItem> <asp:ListItem>27</asp:ListItem> <asp:ListItem>28</asp:ListItem> <asp:ListItem>29</asp:ListItem> <asp:ListItem>30</asp:ListItem> <asp:ListItem>31</asp:ListItem> </asp:DropDownList> <asp:DropDownList ID="DropDownList10" runat="server"> <asp:ListItem>- -</asp:ListItem> <asp:ListItem>1</asp:ListItem>

Wu Jian Min Page 105

IT404.NET Wu Jian Min

150100000698

<asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> <asp:ListItem>4</asp:ListItem> <asp:ListItem>5</asp:ListItem> <asp:ListItem>6</asp:ListItem> <asp:ListItem>7</asp:ListItem> <asp:ListItem>8</asp:ListItem> <asp:ListItem>9</asp:ListItem> <asp:ListItem>10</asp:ListItem> <asp:ListItem>11</asp:ListItem> <asp:ListItem>12</asp:ListItem> <asp:ListItem>13</asp:ListItem> <asp:ListItem>14</asp:ListItem> <asp:ListItem>15</asp:ListItem> <asp:ListItem>16</asp:ListItem> <asp:ListItem>17</asp:ListItem> <asp:ListItem>18</asp:ListItem> <asp:ListItem>19</asp:ListItem> <asp:ListItem>20</asp:ListItem> <asp:ListItem>21</asp:ListItem> <asp:ListItem>22</asp:ListItem> <asp:ListItem>23</asp:ListItem> <asp:ListItem>24</asp:ListItem> <asp:ListItem>25</asp:ListItem> <asp:ListItem>26</asp:ListItem> <asp:ListItem>27</asp:ListItem> <asp:ListItem>28</asp:ListItem> <asp:ListItem>29</asp:ListItem> <asp:ListItem>30</asp:ListItem> <asp:ListItem>31</asp:ListItem> </asp:DropDownList> <asp:DropDownList ID="DropDownList11" runat="server"> <asp:ListItem>- - - -</asp:ListItem> <asp:ListItem>2001</asp:ListItem> <asp:ListItem>2002</asp:ListItem> <asp:ListItem>2003</asp:ListItem> <asp:ListItem>2004</asp:ListItem> <asp:ListItem>2005</asp:ListItem> <asp:ListItem>2006</asp:ListItem> <asp:ListItem>2007</asp:ListItem> <asp:ListItem>2008</asp:ListItem> <asp:ListItem>2009</asp:ListItem> <asp:ListItem>2010</asp:ListItem> <asp:ListItem>2011</asp:ListItem> <asp:ListItem>2012</asp:ListItem> <asp:ListItem>2013</asp:ListItem> <asp:ListItem>2014</asp:ListItem> <asp:ListItem>2015</asp:ListItem> <asp:ListItem>2016</asp:ListItem> <asp:ListItem>2017</asp:ListItem> <asp:ListItem>2018</asp:ListItem> <asp:ListItem>2019</asp:ListItem> <asp:ListItem>2020</asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td>

Wu Jian Min Page 106

IT404.NET Wu Jian Min

150100000698

<asp:Label ID="Label10" runat="server" Text="Issue Number:"></asp:Label> </td> <td> <asp:TextBox ID="txtIssueNo" runat="server" Width="37px"></asp:TextBox> <asp:Label ID="Label20" runat="server" Font-Size="Smaller" Text="*(Only American Express. Just Put '0' For Other Credit Type)"></asp:Label> </td> </tr> <tr> <td> <asp:Label ID="Label11" runat="server" Text="Security Code:"></asp:Label> </td> <td> <asp:TextBox ID="txtCV2" runat="server" Width="50px"></asp:TextBox> <asp:Label ID="Label12" runat="server" Font-Size="Smaller" Text="* The Rightmost Three Digits Printed On The Signature sSrip"></asp:Label> </td> </tr> <tr> <td> &nbsp;</td> <td> &nbsp;</td> </tr> <tr> <td colspan="2"> <asp:Label ID="Label18" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="X-Large" Text="Billing Address"></asp:Label> </td> </tr> <tr> <td> <asp:Label ID="Label13" runat="server" Text="Address:"></asp:Label> </td> <td> <asp:TextBox ID="txtAddress1" runat="server" Height="53px" TextMode="MultiLine" Width="313px"></asp:TextBox> </td> </tr> <tr> <td> <asp:Label ID="Label14" runat="server" Text="PostCode:"></asp:Label> </td> <td> <asp:TextBox ID="txtPostcode" runat="server" Width="89px"></asp:TextBox> </td> </tr> <tr>

Wu Jian Min Page 107

IT404.NET Wu Jian Min


<td>

150100000698

<asp:Label ID="Label15" runat="server" Text="Country:"></asp:Label> </td> <td> <asp:DropDownList ID="DropDownList2" runat="server"> <asp:ListItem>Brunei Darussalam</asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td> <asp:Label ID="Label16" runat="server" Text="Telephone:"></asp:Label> </td> <td> <asp:TextBox ID="txtTelephone" runat="server" Width="182px"></asp:TextBox> </td> </tr> <tr> <td> &nbsp;</td> <td> &nbsp;</td> </tr> <tr> <td> &nbsp;</td> <td align="center"> <asp:Button ID="btnConfirm" runat="server" Text="Confirm Order" /> </td> </tr> <tr> <td> &nbsp;</td> <td> &nbsp;</td> </tr> <tr> <td colspan="2"> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataSourceID="SqlDataSource1" Width="550px" DataKeyNames="ID"> <RowStyle BackColor="White" ForeColor="#330099" /> <Columns> <asp:BoundField DataField="Checkout_ID" HeaderText="Product Name" SortExpression="Checkout_ID" /> <asp:TemplateField HeaderText="Quantity" SortExpression="Quantity"> <EditItemTemplate> <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Quantity") %>'></asp:TextBox> </EditItemTemplate> <ItemTemplate>

Wu Jian Min Page 108

IT404.NET Wu Jian Min

150100000698

<asp:Label ID="Label2" runat="server" Text='<%# Bind("Quantity") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Price" SortExpression="Price"> <EditItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Price") %>'></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("Price") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="UserId" HeaderText="UserId" SortExpression="UserId" Visible="False" /> <asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" Visible="False" /> </Columns> <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" /> <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" /> <EmptyDataTemplate> There is nothing is your cart. </EmptyDataTemplate> <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" /> <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" /> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"

SelectCommand="SELECT [Checkout_ID], [Quantity], [Price], [UserId], [ID] FROM [Checkout] WHERE ([UserId] = @UserId)" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"> <SelectParameters> <asp:ControlParameter ControlID="GridView1" Name="UserId" PropertyName="SelectedValue" Type="Object" /> </SelectParameters> </asp:SqlDataSource> </td> </tr> </table> </asp:Content>

vb code
Imports System.Data.SqlClient Partial Public Class Proceed_Order Inherits System.Web.UI.Page

Wu Jian Min Page 109

IT404.NET Wu Jian Min

150100000698

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Protected Sub SqlDataSource1_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles SqlDataSource1.Selecting Dim currentUser As MembershipUser = Membership.GetUser() Dim currentUserId As Guid = CType(currentUser.ProviderUserKey, Guid) e.Command.Parameters("@UserId").Value = currentUserId End Sub Protected Sub btnConfirm_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnConfirm.Click Dim currentUser As MembershipUser = Membership.GetUser() Dim currentUserId As Guid = CType(currentUser.ProviderUserKey, Guid) Dim strMessage As String = ""

If txtName.Text = String.Empty Then If strMessage <> String.Empty Then strMessage += vbCrLf & "Please fill in your full name as stated in your card." Else strMessage += "Please fill in your full name as stated in your card." End If End If If txtIssueNo.Text = String.Empty Then If strMessage <> String.Empty Then strMessage += vbCrLf & "Your Issue Number is blank. Please fill in." Else strMessage += "Your Issue Number is blank. Please fill in." End If End If If txtCV2.Text = String.Empty Then If strMessage <> String.Empty Then strMessage += vbCrLf & "You have not key in your security code. Please fill in." Else strMessage += "You have not key in your security code. Please fill in." End If End If If txtAddress1.Text = String.Empty Then If strMessage <> String.Empty Then strMessage += vbCrLf & "Please fill in your billing address." Else strMessage += "Please fill in your billing address." End If End If

Wu Jian Min Page 110

IT404.NET Wu Jian Min

150100000698

If txtPostcode.Text = String.Empty Then If strMessage <> String.Empty Then strMessage += vbCrLf & "Please fill in your Postcode." Else strMessage += "Please fill in your Postcode." End If End If If txtTelephone.Text = String.Empty Then If strMessage <> String.Empty Then strMessage += vbCrLf & "Your telephone number is blank. Please fill in." Else strMessage += "Your telephone number is blank. Please fill in." End If End If If strMessage <> "" Then MsgBox(strMessage) Exit Sub End If Dim connectionString As String = ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString Dim deleteSql As String = "DELETE FROM Checkout WHERE UserId = @UserId" Using myConnection As New SqlConnection(connectionString) myConnection.Open() Dim myCommand As New SqlCommand(deleteSql, myConnection) myCommand.Parameters.AddWithValue("@UserId", currentUserId) myCommand.ExecuteNonQuery() myConnection.Close() End Using 'Informs the user that the a record has been save MsgBox("Thank you for shopping at Your Baby Is Our Concern. We will email you your invoice.", MsgBoxStyle.MsgBoxSetForeground + MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation, "Your Baby Is Our Concern") GridView1.DataBind() Response.Redirect("Home.aspx") End Sub End Class

Wu Jian Min Page 111

IT404.NET Wu Jian Min FeedbackPage.aspx Source

150100000698

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Webpages/MasterDesign.Master" CodeBehind="FeedbackPage.aspx.vb" Inherits="BabyAge.FeedbackPage" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> <script language="javascript" type="text/javascript"> // <!CDATA[ function Submit1_onclick() { window.alert("Thank you! We will take note your comments!") } function Reset1_onclick() { window.alert("Are you sure you want to cancel?") } // ]]> </script> <style type="text/css"> #Submit1 { width: 56px; } </style> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <p style="text-align:center;"> <asp:Label ID="Label2" runat="server" Font-Italic="True" Font-Size="XXLarge" ForeColor="#CC6600" Text="Feedback"></asp:Label> <hr /></p> <form name="Feedback" action="mailto:phyllismin@hotmail.com" method="post"> <table> <tr> <td><b>First Name:</b></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" size="30" name="FN" onfocus="ClearFirstName()"/><font color="red">*</font></td> </tr> <tr> <td><b>Last Name:</b></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" size="30" name="LN" onfocus="ClearLastName()" /><font color="red">*</font></td> </tr> <tr> <td><b>Gender:</b></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="sex" value="male" />Male&nbsp;&nbsp;<input type="radio" name="sex" value="male" />Female</td> </tr>

Wu Jian Min Page 112

IT404.NET Wu Jian Min

150100000698

<tr> <td><b>Email Address:</b></td> <td>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<input type="text" size="30" name="email" onfocus="ClearEmail()" /><font color="red">*</font></td> </tr> <tr> <td><b>Telephone:</b></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" size="30" name="TEL" onfocus="ClearTelephone()" /></td> </tr> <tr> <td><b>HandPhone:</b></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" size="30" name="HP" onfocus="ClearHandPhone()" /></td> </tr> <tr> <td><b>Comment:</b></td> <td>&nbsp;&nbsp;&nbsp;&nbsp;<textarea rows=5 cols=25 onfocus="ClearID()">Write your comments here</textarea><font color="red">*</font></td> <br /><br /> </tr> <tr><td> &nbsp;</td> <td align="center"> <input id="Submit1" type="submit" value="send" name="button" onclick="return Submit1_onclick()" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input id="Reset1" type="reset" value="cancel" onclick="return Reset1_onclick()" /> </td></tr> </table> </form>

</asp:Content>

Wu Jian Min Page 113

IT404.NET Wu Jian Min ContactUs.aspx Source

150100000698

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Webpages/MasterDesign.Master" CodeBehind="ContactUs.aspx.vb" Inherits="BabyAge.ContactUs" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <table><tr><td style= "width : 590px" align="left"> <asp:Label ID="lblContactUs" runat="server" Font-Size="Larger" ForeColor="#CC6600" Text="Contact Us"></asp:Label> </td></tr> <tr><td align="left"> <asp:Label ID="lblAddress" runat="server" Text="Address: No 15, simpang 11-22-33, Time Square, Brunei"></asp:Label> </td></tr> <tr><td align="left"> <asp:Label ID="lblTelnFax" runat="server" Text="TEL: 2888888 2555555"></asp:Label> </td></tr> <tr><td align="left"> <asp:Label ID="lblEmail" runat="server" Text="E-mail: BeautyFE@hotmail.com"></asp:Label> </td></tr> <tr><td align="left"> <asp:Label ID="lblMap" runat="server" Text="Check Map below:" ForeColor="#CC6600"></asp:Label> </td></tr> <tr><td align="left"> <img src="../images/map.jpg" style="width: 620px; height: 369px" /></td></tr> </table> </asp:Content> Fax:

Wu Jian Min Page 114

IT404.NET Wu Jian Min

150100000698

6. Testing
Test Plan Test Case 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 Objective
To log in as an admin account, Manage database will be appeared. To log in as a member account, Manage database wont be appeared. To register a new account To add a new car seat product To save a new car seat product To confirm to save a new car seat product To edit a car seat product To save that record has been edited. To confirm to save that record has been edited. To delete a record To confirm to delete a record To return to main menu of database To test Order menu is disabled before login To test Order menu is enabled after login as a member To test Order menu is enabled after login as a member To check the product that you have added in your shopping cart To go to order process To fill in all the information and confirm order To go to feedback page To fill in the information in feedback page and send it Cancel to send the information about feedback.

Wu Jian Min Page 115

IT404.NET Wu Jian Min Test Case


Test Case Objectives Test Data Expected Result Actual Result Conclusion 1

150100000698

To log in as an admin account, Manage database will be appeared. Username: admin, Password: admin@@ A link Manage database should be appeared. Refer to screen capture Actual result matched expected result

Before

After

Wu Jian Min Page 116

IT404.NET Wu Jian Min

150100000698

Test Case Objectives Test Data Expected Result Actual Result Conclusion

2 To log in as a member account, Manage database wont be appeared. E.g. Username: donut, Password: donut@@ A link Manage database shouldnt be appeared. Refer to screen capture Actual result matched expected result

After

Before

Wu Jian Min Page 117

IT404.NET Wu Jian Min

150100000698

Test Case Objectives Test Data Expected Result Actual Result Conclusion

3 To register a new account Click Sign Up button Registration Page should be appeared. Refer to screen capture Actual result matched expected result

After

Before

Wu Jian Min Page 118

IT404.NET Wu Jian Min

150100000698

Test Case Objectives Test Data Expected Result Actual Result Conclusion

4 To add a new car seat product Click Add button All textboxes are enabled. Refer to screen capture Actual result matched expected result

Before

After

Wu Jian Min Page 119

IT404.NET Wu Jian Min


Test Case Objectives Test Data Expected Result Actual Result Conclusion 5 To save a new car seat product Click Save button

150100000698

A message Do You Want to Save This Record? will be prompted. Refer to screen capture Actual result matched expected result

Before

After

Wu Jian Min Page 120

IT404.NET Wu Jian Min


Test Case Objectives Test Data Expected Result 6 To confirm to save a new car seat product Click Yes button

150100000698

A message A New Record has successfully been inserted? will be prompted. Refer to screen capture Actual result matched expected result

Actual Result Conclusion

Before

After

Wu Jian Min Page 121

IT404.NET Wu Jian Min


Test Case Objectives Test Data Expected Result Actual Result Conclusion 7 To edit a car seat product Click Edit button All textboxes are enabled. Refer to screen capture Actual result matched expected result

150100000698

Before

After

Wu Jian Min Page 122

IT404.NET Wu Jian Min


Test Case Objectives Test Data Expected Result Actual Result Conclusion 8 To save that record has been edited. Click Save button

150100000698

A message Do You Want to Save This Record? will be prompted. Refer to screen capture Actual result matched expected result

Before

After

Wu Jian Min Page 123

IT404.NET Wu Jian Min


Test Case Objectives Test Data Expected Result 9

150100000698

To confirm to save that record has been edited. Click Yes button A message A New Record has successfully been updated? will be prompted. Refer to screen capture Actual result matched expected result

Actual Result Conclusion

Before

After

Wu Jian Min Page 124

IT404.NET Wu Jian Min


Test Case Objectives Test Data Expected Result Actual Result Conclusion 10 To delete a record Click Delete button

150100000698

A message Do You Want To Delete This Record? will be prompted. Refer to screen capture Actual result matched expected result

Before

After

Wu Jian Min Page 125

IT404.NET Wu Jian Min


Test Case Objectives Test Data Expected Result Actual Result Conclusion 11 To confirm to delete a record Click Yes button

150100000698

A message Record Has Been Deleted. will be prompted. Refer to screen capture Actual result matched expected result

Before

After

Wu Jian Min Page 126

IT404.NET Wu Jian Min


Test Case Objectives Test Data Expected Result Actual Result Conclusion 12 To return to main menu of database Click Back To Main Menu button The main database page will be appeared. Refer to screen capture Actual result matched expected result

150100000698

Before

After

Wu Jian Min Page 127

IT404.NET Wu Jian Min


Test Case Objectives Test Data Expected Result Actual Result Conclusion 13

150100000698

To test Order menu is disabled before login Click Order button Nothing change Refer to screen capture Actual result matched expected result

Before

After

Wu Jian Min Page 128

IT404.NET Wu Jian Min


Test Case Objectives Test Data Expected Result Actual Result Conclusion 14

150100000698

To test Order menu is enabled after login as a member Click Order button Order Page will be appeared. Refer to screen capture Actual result matched expected result

Before

After

Wu Jian Min Page 129

IT404.NET Wu Jian Min


Test Case Objectives Test Data Expected Result Actual Result Conclusion 15

150100000698

To add product that you want to shopping cart Click Add button below each product A message Would you like to add this to cart? will be prompted. Refer to screen capture Actual result matched expected result

Before

After

Wu Jian Min Page 130

IT404.NET Wu Jian Min


Test Case Objectives Test Data Expected Result Actual Result Conclusion 16

150100000698

To check the product that you have added in your shopping cart Click Order button to go to order page A list of products that you have added are in your shopping cart Refer to screen capture Actual result matched expected result

Before

After

Wu Jian Min Page 131

IT404.NET Wu Jian Min


Test Case Objectives Test Data Expected Result Actual Result Conclusion 17 To go to order process Click Process To Check button The order process page will be appeared Refer to screen capture Actual result matched expected result

150100000698

Before

After

Wu Jian Min Page 132

IT404.NET Wu Jian Min


Test Case Objectives Test Data Expected Result Actual Result Conclusion 18

150100000698

To fill in all the information and confirm order Click Confirm Order button A message will be prompted. Refer to screen capture Actual result matched expected result

Before

After

Wu Jian Min Page 133

IT404.NET Wu Jian Min


Test Case Objectives Test Data Expected Result Actual Result Conclusion 19 To go to feedback page Click Feedback button Feedback page will be appeared Refer to screen capture Actual result matched expected result

150100000698

Before

After

Wu Jian Min Page 134

IT404.NET Wu Jian Min


Test Case Objectives Test Data Expected Result 20

150100000698

To fill in the information in feedback page and send it Click Send button A message Thank you ! We will take note your comments. will be prompted. Refer to screen capture Actual result matched expected result

Actual Result Conclusion

Before

After

Wu Jian Min Page 135

IT404.NET Wu Jian Min


Test Case Objectives Test Data Expected Result Actual Result Conclusion 21

150100000698

Cancel to send the information about feedback. Click Cancel button A message Are you sure you want to cancel? will be prompted. Refer to screen capture Actual result matched expected result

Before

After

Wu Jian Min Page 136

IT404.NET Wu Jian Min Test Log Test Case 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 Result Successful Successful Successful Successful Successful Successful Successful Successful Successful Successful Successful Successful Successful Successful Successful Successful Successful Successful Successful Successful Successful

150100000698

Wu Jian Min Page 137

IT404.NET Wu Jian Min

150100000698

7. Implementation
User Guide
1. Insert CD into CD-ROM. Open the CD and look for [BabyAge] folder. Run the [BabyAge] SLN File.

2. Double click

on the Solution Explorer and click

3. Now you can see it is running by the web browser. 4. To register a new account. Click Sign Up button on log in form.

To fill in registration information.

Wu Jian Min Page 138

IT404.NET Wu Jian Min

150100000698

5. To add some products to shopping cart. For example: add car seat product to shopping cart. Go to Car Seat Product Page and click Add button.

Go Order Page to check the products that you added in the shopping cart.

To confirm that you want to order these products. Click Process to Check button.

6. To manage database, you need to log in as an admin firstly. Username: admin


Wu Jian Min Page 139

Password: admin@@

IT404.NET Wu Jian Min

150100000698

7. After logging in as an admin account, click Manage database link.

Wu Jian Min Page 140

IT404.NET Wu Jian Min

150100000698

8. Conclusion
Strengthen 1. This program is user friendly. It is easy to add, edit and delete database. 2. This program is easy for customer to order online any time. 3. This program is secure to protect database. 4. The design of this program is pure and simple. Weakness 1. Customers can not view larger picture for every product. 2. Customers cannot be acknowledged any events. Enhancement 1. Making picture become larger that customers can view easily. 2. Add music as background.

Wu Jian Min Page 141

IT404.NET Wu Jian Min

150100000698

9. Reference
1. http://www.youtube.com/watch?v=HRjZ_0JpO2M 2. http://www.youtube.com/watch?v=x8D7HqB-glQ 3. http://www.youtube.com/watch?v=mtl0T8Nvuac 4. http://www.youtube.com/watch?v=SFQ-H6uhthI

Wu Jian Min Page 142

Vous aimerez peut-être aussi