SlideShare a Scribd company logo
Programmed By: Christopher Singleton ASP.Net, HTML, C# Date: 06/14/2016
User (Logged-In)User (Not Logged-In)
Purpose: Create an ASP.Net application web page
***User can Log-In (Update Log-In)
***User can create products.
***User can send purchase emails.
Note: Display of information during process.
Page 1
Create Log-In Show Newly Created Log-In
Update Log-In Show Updated Log-In
Log-In in the SQL Database (Shown Below)
Page 2
Create the Products in the SQL Database.
Show the Products created.
Product Clicked On
(Link to Product)
Page 3
Allow the User to Email a Receipt.
Page 4
<?xml version="1.0" encoding="utf-8"?>
<!--For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime targetFramework="4.5.2"/>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=&quot;Web&quot; /optionInfer+"/>
</compilers>
</system.codedom>
<appSettings>
<add key="connectionstring" value="Server=ServerNameSQLServerInstance; Database=PROG117DB; User Id=PROG117_web_user;
Password=abc123; Encrypt=True;TrustServerCertificate=True;Connection Timeout=30;"/>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/>
</appSettings>
</configuration>
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Master.master.cs" Inherits="PCPartsSuperStore.Master" %>
<!DOCTYPE html>
<meta charset="UTF-8">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>PC Super Store</title>
<asp:ContentPlaceHolder ID="head" runat="server"></asp:ContentPlaceHolder>
<link href="CSS/MasterStyle.css" rel="stylesheet" />
</head>
<body>
<%--Header--%>
<div id="header" runat="server">
<div class="HeaderText" style="text-align: center" runat="server" >
<asp:Label ID="lbl_HeaderText" Cssclass="LabelHeaderText" runat="server" >Advanced Computer Systems Company</asp:Label><br />
<asp:Label ID="lbl_SubHeaderText" CssClass="SubHeaderTxt" runat="server" >
"Where the future of innovations are yours!"</asp:Label>
</div>
</div>
<%--Navigation--%>
<div id="Navigation" runat="server">
<asp:HyperLink ID="newProducts" Cssclass="MasterLinks" runat="server" NavigateUrl ="~/productManagement/newProduct.aspx"
ToolTip="New Products" Text="New Products" ></asp:HyperLink><br /><br />
Master Page ASPX
Web Config File (SQL Database Connection)
Page 5
<asp:HyperLink ID="Products" Cssclass="MasterLinks" runat="server" NavigateUrl ="~/shopping/showAllProducts.aspx"
ToolTip="Products">Products</asp:HyperLink><br /><br />
<asp:HyperLink ID="Sale" Cssclass="MasterLinks" runat="server" ToolTip="Sale">Sale</asp:HyperLink><br /><br />
<asp:HyperLink ID="Featured" Cssclass="MasterLinks" runat="server" ToolTip="Featured">Featured</asp:HyperLink><br />
</div>
<%--Main Content--%>
<div id="Main" runat="server">
<asp:ContentPlaceHolder ID="cpd_Main" runat="server">
</asp:ContentPlaceHolder>
</div>
<%--footer--%>
<div id="footer" runat="server">
<div class="footerText">
<h3 class="footer"><strong>Advanced Computer Systems Company &nbsp;
<a href="mailto:chris.singleton@bellevuecollege.edu">Contact: Send an Email</a>
<span class="rights">&copy;All Rights Reserved 2016</span></strong></h3>
</div>
</div>
</body>
</html>
<%@ Page Title="PC Super Store" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="index.aspx.cs"
Inherits="PCPartsSuperStore.index" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpd_Main" runat="server">
<asp:Label ID="lbl_WelcomeUser" CssClass="WelcomeUser" runat="server" ></asp:Label>
<form id="formLogIn" runat="server" defaultfocus="txb_SignInUName">
<div class="SignInPos" runat="server">
<asp:TextBox ID="txb_SignInUName" Cssclass="BoxStyleLogIn" placeholder="User Name" runat ="server" required ="required"
></asp:TextBox><br />
<asp:TextBox ID="txb_SignInPWord" Cssclass="BoxStyleLogIn" placeholder="Password" runat ="server" required ="required"
></asp:TextBox><br />
<asp:Button ID="submitButton" Cssclass="submitButtonLogIn" runat="server" Text ="Submit" OnClick="submitButton_Click" />
</div>
</form>
<asp:HyperLink ID="SignUp" Cssclass="SignUp" runat="server" Target="_blank" NavigateUrl="~/userManagement/MakeUserLogIn.aspx" >
Sign up</asp:HyperLink>
<asp:HyperLink ID="UpdateUserInfo" Cssclass="UpdateUserInfo" runat="server" Target="_blank"
NavigateUrl="~/userManagement/UpdateUserLogIn.aspx" >Update Log-In</asp:HyperLink>
</asp:Content>
using System;
using System.Configuration;
using System.Data.SqlClient;
namespace PCPartsSuperStore
{
public partial class index : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
Master Page ASPX (Continued)
Index Page (C#)
Index page ASPX (HTML)
Page 6
{
//Don't allow the user to update any info until log-in.
UpdateUserInfo.Visible = false;
}
protected void submitButton_Click(object sender, System.EventArgs e)
{
//Pass the user's textbox inputs into variables.
string uName = Request.Form["ctl00$cpd_Main$txb_SignInUName"];
string pass = Request.Form["ctl00$cpd_Main$txb_SignInPWord"];
/*1. Open a connection using the connection string in the Web.config
file under AppSettings.*/
string connStr = ConfigurationManager.AppSettings["connectionString"];
SqlConnection conn = new SqlConnection(connStr);
conn.Open();
/* 2. Create a command that gets the firstName from the database
using a where clause from the user input using the SQL Server Database.
Then define the query with the connection.*/
string query = "SELECT [firstName], [id] FROM [dbo].[person]" +
"WHERE userName = '" + uName + "' AND password = '" + pass + "'";
SqlCommand cmd = new SqlCommand(query);
cmd.CommandType = System.Data.CommandType.Text;
cmd.Connection = conn;
/* 3. Create a reader, read the firstName and id into the variables as a string, then pass the variables
into session variables. Finally, display output to the label or textbox and hide the Log-In form.*/
SqlDataReader reader = cmd.ExecuteReader();
if (reader.Read())
{
string strfName = reader["firstName"].ToString();
string strID = reader["id"].ToString();
Session["firstName"] = strfName;
Session["userID"] = strID;
lbl_WelcomeUser.Text = "<spanIndex>Welcome</spanIndex> " + strfName + "<spanIndex>!</spanIndex>";
Form.Visible = false;
SignUp.Visible = false;
UpdateUserInfo.Visible = true;
}
else
{
txb_SignInUName.Text = "Log-In Failed!";
SignUp.Visible = true;
UpdateUserInfo.Visible = false;
}
//4. Close the connection.
conn.Close();
}
}
}
Index Page (C# Continued)
Page 7
<%@ Page Title="Create Log-In" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="MakeUserLogIn.aspx.cs"
Inherits="PCPartsSuperStore.userManagement.MakeUserLogIn" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpd_Main" runat="server">
<form id="formMULI" class="form" method="post" action="SecondPage.aspx" runat="server" defaultfocus="txb_FName" >
<!-- Display objects for input/output -->
<fieldset class="fieldsetMULI">
<legend class="LegendMULI">Create Log-In</legend>
<!-- flexbox both the textbox and labels together side by side -->
<div class="flexTBoxesWrapper">
<div class="flexText">
<asp:Label ID="lbl1_FName" Cssclass="LabelStyleMULI" runat="server" >First Name:</asp:Label><br />
<asp:Label ID="lbl1_LName" Cssclass="LabelStyleMULI" runat="server" >Last Name:</asp:Label><br />
<asp:Label ID="lbl1_UserName" Cssclass="LabelStyleMULI" runat="server" >User Name:</asp:Label><br />
<asp:Label ID="lbl1_Password" Cssclass="LabelStyleMULI" runat="server" >Password:</asp:Label><br />
<asp:Label ID="lbl1_Address" Cssclass="LabelStyleMULI" runat="server" >Address:</asp:Label><br />
<asp:Label ID="lbl1_Email" Cssclass="LabelStyleMULI" runat="server" >Email:</asp:Label><br />
<asp:Label ID="lbl1_PhoneNumber" Cssclass="LabelStyleMULI" runat="server" >Phone Number:</asp:Label>
</div>
<!-- Allow user input into the textboxes -->
<div class="flexTextBoxes">
<div id="FName"><asp:TextBox ID="txb_FName" Cssclass="BoxStyleMULI" placeholder="First Name" runat ="server"
required ="required" ></asp:TextBox><br /></div>
<div id="LName"><asp:TextBox ID="txb_LName" Cssclass="BoxStyleMULI" placeholder="Last Name" runat ="server"
required ="required" ></asp:TextBox><br /></div>
<div id="UName"><asp:TextBox ID="txb_UserName" Cssclass="BoxStyleMULI" placeholder="User Name" runat ="server"
required ="required" ></asp:TextBox><br /></div>
<div id="Pword"><asp:TextBox ID="txb_Password" Cssclass="BoxStyleMULI" placeholder="Password" runat ="server"
required ="true" ></asp:TextBox><br /></div>
<div id="Address"><asp:TextBox ID="txb_Address" Cssclass="BoxStyleMULI" placeholder="Address" runat ="server"
required ="required" ></asp:TextBox><br /></div>
<div id="Email"><asp:TextBox ID="txb_Email" Csstype="email" Cssclass="BoxStyleMULI" placeholder="Email"
runat ="server" required ="required" ></asp:TextBox><br /></div>
<div id="PNumber"><asp:TextBox ID="txb_PhoneNumber" Cssclass="BoxStyleMULI" placeholder="Phone Number"
runat ="server" required ="required" ></asp:TextBox></div>
</div>
</div>
<!-- User submits the input to the next page -->
<asp:Button ID="submitButton" Cssclass="submitButton" runat="server" Text ="Submit" OnClientClick="form.target ='_blank';"
PostBackUrl="~/userManagement/ShowUserLogInInfo.aspx" />
</fieldset>
</form>
</asp:Content>
Create User Log-In ASPX (HTML)
Page 8
<%@ Page Title="Show Log-In" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="ShowUserLogInInfo.aspx.cs"
Inherits="PCPartsSuperStore.userManagement.ShowUserLogInInfo" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpd_Main" runat="server">
<form id="formSULII" runat="server">
<fieldset class="fieldset1SULII">
<legend class="legendSULII">Newly Created Log-In Data</legend>
<!-- Labels to display the hard coded text using flexbox side by side again -->
<div class="flexLabelsWrapper">
<div class="flexTextLabels">
<asp:Label ID="lbl_FName" CSSclass="TextLabelsSULII" runat="server" >First Name:</asp:Label><br />
<asp:Label ID="lbl_LName" CSSclass="TextLabelsSULII" runat="server" >Last Name:</asp:Label><br />
<asp:Label ID="lbl_UserName" CSSclass="TextLabelsSULII" runat="server" >User Name:</asp:Label><br />
<asp:Label ID="lbl_Password" CSSclass="TextLabelsSULII" runat="server" >Password:</asp:Label><br />
<asp:Label ID="lbl_Address" CSSclass="TextLabelsSULII" runat="server" >Address:</asp:Label><br />
<asp:Label ID="lbl_Email" CSSclass="TextLabelsSULII" runat="server" >Email:</asp:Label><br />
<asp:Label ID="lbl_PhoneNumber" CSSclass="TextLabelsSULII" runat="server" >Phone Number:</asp:Label>
</div>
<!-- Use label ID to display the information being passed, Display in the label -->
<div class="flexPassedText">
<asp:Label ID="lbl2_fName" Cssclass="ResultTextStyleSULII" runat="server" ></asp:Label><br />
<asp:Label ID="lbl2_LName" Cssclass="ResultTextStyleSULII" runat="server" ></asp:Label><br />
<asp:Label ID="lbl2_UserName" Cssclass="ResultTextStyleSULII" runat="server" ></asp:Label><br />
<asp:Label ID="lbl2_Password" Cssclass="ResultTextStyleSULII" runat="server" ></asp:Label><br />
<asp:Label ID="lbl2_Address" Cssclass="ResultTextStyleSULII" runat="server" ></asp:Label><br />
<asp:Label ID="lbl2_Email" Cssclass="ResultTextStyleSULII" runat="server" ></asp:Label><br />
<asp:Label ID="lbl2_PhoneNumber" Cssclass="ResultTextStyleSULII" runat="server" ></asp:Label><br />
</div>
</div>
</fieldset>
<fieldset class="fieldset2SULII">
<legend class="legendSULII">Capture Row ID</legend>
<asp:Label ID="lbl_Identity" Cssclass="ResultTextStyleSULII" runat="server" ></asp:Label><br />
<asp:HyperLink ID="UpdateLogIn" runat="server" Target="_blank" NavigateUrl="~/userManagement/UpdateUserLogIn.aspx">
Update User Info</asp:HyperLink>
</fieldset>
</form>
</asp:Content>
Show User Log-In ASPX (HTML)
Page 9
using System;
using System.Configuration;
using System.Data.SqlClient;
namespace PCPartsSuperStore.userManagement
{
public partial class ShowUserLogInInfo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Pass the information from the text box to the variable.
string fName = Request.Form["ctl00$cpd_Main$txb_FName"];
string lName = Request.Form["ctl00$cpd_Main$txb_LName"];
string uName = Request.Form["ctl00$cpd_Main$txb_UserName"];
string pWord = Request.Form["ctl00$cpd_Main$txb_Password"];
string address = Request.Form["ctl00$cpd_Main$txb_Address"];
string email = Request.Form["ctl00$cpd_Main$txb_Email"];
string phone = Request.Form["ctl00$cpd_Main$txb_PhoneNumber"];
//Note: Request.Form["ctl00$cpd_main$txtBox"] instead of Request.Form["txtBox"] because of Master Page.
//Define the label object to display what is in the variable.
lbl2_fName.Text = fName;
lbl2_LName.Text = lName;
lbl2_UserName.Text = uName;
lbl2_Password.Text = pWord;
lbl2_Address.Text = address;
lbl2_Email.Text = email;
lbl2_PhoneNumber.Text = phone;
/*1. Open a connection using the connection string in the Web.config file under AppSettings.*/
string connStr = ConfigurationManager.AppSettings["connectionString"];
SqlConnection conn = new SqlConnection(connStr);
conn.Open();
/* 2. Create a command that inserts the data into the SQL Database using variables with values that shows as text in the labels.*/
string query = ("INSERT INTO [dbo].[person]([firstName],[lastName],[userName]" +
",[password],[address],[email],[phone]) VALUES (" +
" '" + fName + "'," +
" '" + lName + "'," +
" '" + uName + "'," +
" '" + pWord + "'," +
" '" + address + "'," +
" '" + email + "'," +
" '" + phone + "') SELECT SCOPE_IDENTITY(); ");
SqlCommand cmd = new SqlCommand(query);
cmd.CommandType = System.Data.CommandType.Text;
cmd.Connection = conn;
/* 3. Create a reader to read back the identity information, then close the connection after reading the column id into a variable.*/
SqlDataReader reader = cmd.ExecuteReader();
reader.Read();
string id = reader[0].ToString();
conn.Close();
//Take the id value and place it into text inside the label.
lbl_Identity.Text = "Dataset Created, Line ID: " + "<span>" + id + "</span>";
//Pass the Session Variable to the UpdateLogIn Page (Third Page).
Session["userID"] = id;
}
}
}
Show User Log-In (C#)
Page 10
<%@ Page Title="Update Log-In" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="UpdateUserLogIn.aspx.cs"
Inherits="PCPartsSuperStore.userManagement.UpdateUserLogIn" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpd_Main" runat="server">
<form id="formUULI" class="form" method="post" action="SecondPage.aspx" runat="server" defaultfocus="txbUpD_FName">
<!-- Display objects for input/output -->
<asp:Label ID="lbl_Directions" Cssclass="LabelStyleUULI" runat="server" >Please put in a new "User Name" and
"Email":</asp:Label><br />
<fieldset ID="fieldsetUULI">
<legend id="legendUULI" class="legendUULI">Update Log-In Information</legend>
<!-- flexbox both the textbox and labels together side by side -->
<div class="flexTBoxesWrapper">
<div class="flexText">
<asp:Label ID="lbl1_FName" Cssclass="LabelStyleUULI" runat="server" >First Name:</asp:Label><br />
<asp:Label ID="lbl1_LName" Cssclass="LabelStyleUULI" runat="server" >Last Name:</asp:Label><br />
<asp:Label ID="lbl1_UserName" Cssclass="LabelStyleUULI" runat="server" >User Name:</asp:Label><br />
<asp:Label ID="lbl1_Password" Cssclass="LabelStyleUULI" runat="server" >Password:</asp:Label><br />
<asp:Label ID="lbl1_Address" Cssclass="LabelStyleUULI" runat="server" >Address:</asp:Label><br />
<asp:Label ID="lbl1_Email" Cssclass="LabelStyleUULI" runat="server" >Email:</asp:Label><br />
<asp:Label ID="lbl1_PhoneNumber" Cssclass="LabelStyleUULI" runat="server" >Phone Number:</asp:Label>
</div>
<!-- Allow user input into the textboxes -->
<div class="flexTextBoxes">
<div id="FName"><asp:TextBox ID="txbUpD_FName" Cssclass="BoxStyleUULI" placeholder="First Name" runat ="server"
required ="required" ></asp:TextBox><br /></div>
<div id="LName"><asp:TextBox ID="txbUpD_LName" Cssclass="BoxStyleUULI" placeholder="Last Name" runat ="server"
required ="required" ></asp:TextBox><br /></div>
<div id="UName"><asp:TextBox ID="txbUpD_UserName" Cssclass="BoxStyleUULI" placeholder="User Name" runat ="server"
required ="required" ></asp:TextBox><br /></div>
<div id="Pword"><asp:TextBox ID="txbUpD_Password" Cssclass="BoxStyleUULI" placeholder="Password" runat ="server"
required ="true" ></asp:TextBox><br /></div>
<div id="Address"><asp:TextBox ID="txbUpD_Address" Cssclass="BoxStyleUULI" placeholder="Address" runat ="server"
required ="required" ></asp:TextBox><br /></div>
<div id="Email"><asp:TextBox ID="txbUpD_Email" Csstype="email" Cssclass="BoxStyleUULI" placeholder="Email"
runat ="server" required ="required" ></asp:TextBox><br /></div>
<div id="PNumber"><asp:TextBox ID="txbUpD_PhoneNumber" Cssclass="BoxStyleUULI" placeholder="Phone Number"
runat ="server" required ="required" ></asp:TextBox></div>
</div>
</div>
<!-- User submits the input to the next page -->
<asp:Button ID="submitButton" Cssclass="submitButton" runat="server" Text ="Submit" OnClientClick="form.target ='_blank';"
PostBackUrl="~/userManagement/UserUpdatedShowInfo.aspx" />
</fieldset>
</form>
</asp:Content>
Update Log-In ASPX (HTML)
Page 11
using System;
using System.Configuration;
using System.Data.SqlClient;
namespace PCPartsSuperStore.userManagement
{
public partial class UpdateUserLogIn : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
/*1. Get the Session User ID.*/
string id = Session["userID"].ToString();
/*2. Open a connection using the connection string in the Web.config file under AppSettings.*/
string connStr = ConfigurationManager.AppSettings["connectionString"];
SqlConnection conn = new SqlConnection(connStr);
conn.Open();
/* 3. Create a command that Selects all the data from the id row SQL Database using the where clause in showing
what row to select by using what is stored in the id variable.*/
string query = "SELECT * FROM [dbo].[person] WHERE id = " + id;
SqlCommand cmd = new SqlCommand(query);
cmd.CommandType = System.Data.CommandType.Text;
cmd.Connection = conn;
/* 4 Create a reader to read the line in the SQL database into the text boxes*/
SqlDataReader reader = cmd.ExecuteReader();
reader.Read();
/* 5. Show the info in the textboxes that need updating.*/
string fName = reader["firstName"].ToString();
string lName = reader["lastName"].ToString();
string uName = reader["userName"].ToString();
string pWord = reader["password"].ToString();
string address = reader["address"].ToString();
string email = reader["email"].ToString();
string phone = reader["phone"].ToString();
// 6. Close the connection.
conn.Close();
// 7. Show the variable information inside the text boxes.
txbUpD_FName.Text = fName;
txbUpD_LName.Text = lName;
txbUpD_UserName.Text = uName;
txbUpD_Password.Text = pWord;
txbUpD_Address.Text = address;
txbUpD_Email.Text = email;
txbUpD_PhoneNumber.Text = phone;
}
}
}
}
Update Log-In (C#)
Page 12
<%@ Page Title="Updated Log-In Info" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true"
CodeBehind="UserUpdatedShowInfo.aspx.cs" Inherits="PCPartsSuperStore.userManagement.UserUpdatedShowInfo" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpd_Main" runat="server">
<form id="formUUSI" class="form" runat="server">
<fieldset id="fieldset1UUSI" class="fieldset1UUSI">
<legend id="legend1UUSI" class="legendUUSI">Show Updated Log-In Information</legend>
<!-- Labels to display the hard coded text using flexbox side by side again -->
<div class="flexLabelsWrapper">
<div class="flexTextLabels">
<asp:Label ID="lbl2_FName" CSSclass="TextLabelsUUSI" runat="server" >First Name:</asp:Label><br />
<asp:Label ID="lbl2_LName" CSSclass="TextLabelsUUSI" runat="server" >Last Name:</asp:Label><br />
<asp:Label ID="lbl2_UserName" CSSclass="TextLabelsUUSI" runat="server" >User Name:</asp:Label><br />
<asp:Label ID="lbl2_Password" CSSclass="TextLabelsUUSI" runat="server" >Password:</asp:Label><br />
<asp:Label ID="lbl2_Address" CSSclass="TextLabelsUUSI" runat="server" >Address:</asp:Label><br />
<asp:Label ID="lbl2_Email" CSSclass="TextLabelsUUSI" runat="server" >Email:</asp:Label><br />
<asp:Label ID="lbl2_PhoneNumber" CSSclass="TextLabelsUUSI" runat="server" >Phone Number:</asp:Label>
</div>
<!-- Use label ID to display the information being passed, Display in the label -->
<div class="flexPassedText">
<asp:Label ID="lbl_fName" Cssclass="ResultTextStyleUUSI" runat="server" ></asp:Label><br />
<asp:Label ID="lbl_LName" Cssclass="ResultTextStyleUUSI" runat="server" ></asp:Label><br />
<asp:Label ID="lbl_UserName" Cssclass="ResultTextStyleUUSI" runat="server" ></asp:Label><br />
<asp:Label ID="lbl_Password" Cssclass="ResultTextStyleUUSI" runat="server" ></asp:Label><br />
<asp:Label ID="lbl_Address" Cssclass="ResultTextStyleUUSI" runat="server" ></asp:Label><br />
<asp:Label ID="lbl_Email" Cssclass="ResultTextStyleUUSI" runat="server" ></asp:Label><br />
<asp:Label ID="lbl_PhoneNumber" Cssclass="ResultTextStyleUUSI" runat="server" ></asp:Label><br />
</div>
</div>
</fieldset>
<fieldset id="fieldset2UUSI" class="fieldset2UUSI">
<legend id="legend2UUSI" class="legendUUSI">Capture Row ID</legend>
<asp:Label ID="lbl_Identity" Cssclass="ResultTextStyleUUSI" runat="server" ></asp:Label><br />
</fieldset>
</form>
</asp:Content>
Updated Log-In Info ASPX (HTML)
Page 13
using System;
using System.Configuration;
using System.Data.SqlClient;
namespace PCPartsSuperStore.userManagement
{
public partial class UserUpdatedShowInfo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Create the Variable for the Session.
string id = Session["userID"].ToString();
//Pass the information from the text box to the variable.
string strfName = Request.Form["ctl00$cpd_Main$txbUpD_FName"];
string strlName = Request.Form["ctl00$cpd_Main$txbUpD_LName"];
string struName = Request.Form["ctl00$cpd_Main$txbUpD_UserName"];
string strpWord = Request.Form["ctl00$cpd_Main$txbUpD_Password"];
string strAddress = Request.Form["ctl00$cpd_Main$txbUpD_Address"];
string strEmail = Request.Form["ctl00$cpd_Main$txbUpD_Email"];
string strPhone = Request.Form["ctl00$cpd_Main$txbUpD_PhoneNumber"];
//Define the label object to display what is in the variable.
lbl_fName.Text = strfName;
lbl_LName.Text = strlName;
lbl_UserName.Text = struName;
lbl_Password.Text = strpWord;
lbl_Address.Text = strAddress;
lbl_Email.Text = strEmail;
lbl_PhoneNumber.Text = strPhone;
/*1. Open a connection using the connection string in the Web.config file under AppSettings.*/
string connStr = ConfigurationManager.AppSettings["connectionString"];
SqlConnection conn = new SqlConnection(connStr);
conn.Open();
/* 2. Create a command that updates the data into the SQL Database using variables with values that shows as text
in the labels.*/
string query = "UPDATE [dbo].[person] SET" +
"[firstName]= '" + strfName + "'," +
"[lastName]= '" + strlName + "'," +
"[userName]= '" + struName + "'," +
"[password]= '" + strpWord + "'," +
"[address]= '" + strAddress + "'," +
"[email]= '" + strEmail + "'," +
"[phone]= '" + strPhone + "' WHERE id =" + id;
SqlCommand cmd = new SqlCommand(query);
cmd.CommandType = System.Data.CommandType.Text;
cmd.Connection = conn;
/* 3. Create a reader to read back the identity information, then close the connection after reading the column
id into a variable.*/
SqlDataReader reader = cmd.ExecuteReader();
reader.Read();
conn.Close();
//Take the id value and place it into text inside the label.
lbl_Identity.Text = "Dataset Updated, Line ID: " + "<spanUUSI>" + id + "</spanUUSI>";
}
}
}
Updated Log-In Info (C#)
Page 14
<%@ Page Title="Create Products" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="newProduct.aspx.cs"
Inherits="PCPartsSuperStore.productManagement.newProduct" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"></asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpd_Main" runat="server">
<asp:HyperLink ID="UpdateUserInfo" Cssclass="UpdateUserInfoNP" runat="server" Target="_blank"
NavigateUrl="~/userManagement/UpdateUserLogIn.aspx" >Update Log-In</asp:HyperLink>
<form id="formNP" class="form" method="post" runat="server" defaultfocus="txb_prodName" >
<!-- Display objects for input/output -->
<fieldset id="fieldset1NP" class="fieldset1NP">
<legend id="legendNP" class="legendNP">Create New Product</legend>
<!-- flexbox both the textbox and labels together side by side -->
<div class="flexTBoxesWrapper">
<div class="flexText">
<asp:Label ID="lbl1_prodName" Cssclass="LabelStyleNP" runat="server" >Product Name:</asp:Label><br />
<asp:Label ID="lbl1_prodDesc" Cssclass="LabelStyleNP" runat="server" >Product Description:</asp:Label><br />
<asp:Label ID="lbl1_prodPrice" Cssclass="LabelStyleNP" runat="server" >Product Price:</asp:Label><br />
<asp:Label ID="lbl1_prodAmount" Cssclass="LabelStyleNP" runat="server" >Product Amount:</asp:Label>
</div>
<!-- Allow user input into the textboxes and validate as needed. -->
<div class="flexTextBoxes">
<div id="pName"><asp:TextBox ID="txb_prodName" Cssclass="BoxStyleNP" placeholder="Product Name" runat ="server"
required ="required" ></asp:TextBox><br /></div>
<div id="pDesc"><asp:TextBox ID="txb_prodDesc" Cssclass="BoxStyleNP" placeholder="Product Description"
runat ="server" required ="required" ></asp:TextBox><br /></div>
<div id="pPrice"><asp:TextBox ID="txb_prodPrice" Cssclass="BoxStyleNP" placeholder="Product Price"
runat ="server" required ="required" ></asp:TextBox>
<asp:RegularExpressionValidator runat="server" ControlToValidate="txb_prodPrice"
ErrorMessage="*Not a valid price!" ValidationExpression="[+]?([.]d+|d+([.]d+)?)$"
></asp:RegularExpressionValidator>
<br />
</div>
<div id="pAmount">
<asp:TextBox ID="txb_prodAmount" Cssclass="BoxStyleNP" placeholder="Product Amount" runat ="server"
required ="true" ></asp:TextBox>
<asp:RegularExpressionValidator runat="server" ControlToValidate="txb_prodAmount"
ErrorMessage="*Only positive numbers!" ValidationExpression="^[1-9]d*$"
></asp:RegularExpressionValidator>
</div>
</div>
</div><br />
<asp:Label ID="lbl_Identity" Cssclass="ResultTextStyleNP" runat="server" ></asp:Label><br />
<!-- User submits the input to the next page -->
<asp:Button ID="submitButton" Cssclass="submitButton" runat="server" Text ="Submit" OnClick="submitButton_Click"
PostBackUrl="~/productManagement/newProduct.aspx"/>
</fieldset>
</form>
</asp:Content>
Create Products ASPX (HTML)
Page 15
using System;
using System.Configuration;
using System.Data.SqlClient;
namespace PCPartsSuperStore.productManagement
{
public partial class newProduct : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Check if the user is logged in.
if (Session["userID"] == null)
{
Response.Redirect("~/index.aspx");
}
}
protected void submitButton_Click(object sender, System.EventArgs e)
{
//Get the values from the user's product input boxes.
string prodName = txb_prodName.Text;
string prodDesc = txb_prodDesc.Text;
string prodPrice = txb_prodPrice.Text;
string prodAmount = txb_prodAmount.Text;
/*1. Open a connection using the connection string in the Web.config file under AppSettings.*/
string connStr = ConfigurationManager.AppSettings["connectionString"];
SqlConnection conn = new SqlConnection(connStr);
conn.Open();
//Create a query.
/* 2. Create a command that inserts the data into the SQL Database using variables with values that shows
as text in the labels.*/
string query = ("INSERT INTO [dbo].[products]([productName],[description],[price]" +
",[currentAmount]) VALUES (" +
" '" + prodName + "'," +
" '" + prodDesc + "'," +
" '" + prodPrice + "'," +
" '" + prodAmount + "') SELECT SCOPE_IDENTITY(); ");
SqlCommand cmd = new SqlCommand(query);
cmd.CommandType = System.Data.CommandType.Text;
cmd.Connection = conn;
/* 3. Create a reader to read back the identity information, then close the connection after reading the column id
into a variable.*/
SqlDataReader reader = cmd.ExecuteReader();
reader.Read();
string pid = reader[0].ToString();
conn.Close();
//Take the id value and place it into text inside the label.
lbl_Identity.Text = "Product: " + prodName + " created, Line ID: " + "<span>" + pid + "</span>";
//Clear the text boxes for the next input.
txb_prodName.Text = "";
txb_prodDesc.Text = "";
txb_prodPrice.Text = "";
txb_prodAmount.Text = "";
}
}
}
Create Products (C#) Page 16
<%@ Page Title="Available Products" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true"
CodeBehind="showAllProducts.aspx.cs" Inherits="PCPartsSuperStore.shopping.showAllProducts" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpd_Main" runat="server">
<asp:HyperLink ID="UpdateUserInfo" Cssclass="UpdateUserInfoAP" runat="server" Target="_blank"
NavigateUrl="~/userManagement/UpdateUserLogIn.aspx" >Update Log-In</asp:HyperLink>
<form id="formSAP" class="formSAP" method="post" runat="server" defaultfocus="prodName" >
<!-- Display objects for input/output -->
<fieldset id="fieldsetSAP" class="fieldsetSAP">
<legend id="legendSAP" class="legendSAP">Add Products to Shopping Cart</legend>
<!-- Show the table content -->
<div class="div_products" runat="server">
<asp:Label ID="div_products" Cssclass="ResultTextStyleSAP" runat="server" ></asp:Label><br />
</div>
<asp:Table runat="server" ID="tbl_Products">
<asp:TableRow>
<asp:TableCell CssClass="headCells">Product</asp:TableCell>
<asp:TableCell CssClass="headCellDesc">Description</asp:TableCell>
<asp:TableCell CssClass="headCells">Price</asp:TableCell>
<asp:TableCell CssClass="headCellBuyIt">Buy it</asp:TableCell>
</asp:TableRow>
</asp:Table>
</fieldset>
</form>
</asp:Content>
using System;
using System.Configuration;
using System.Data.SqlClient;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
namespace PCPartsSuperStore.shopping
{
public partial class showAllProducts : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Check if the user is logged in.
if (Session["userID"] == null)
{
Response.Redirect("~/index.aspx");
}
UpdateUserInfo.Visible = true;
/*1. Open a connection using the connection string in the Web.config file under AppSettings.*/
string connStr = ConfigurationManager.AppSettings["connectionString"];
SqlConnection conn = new SqlConnection(connStr);
conn.Open();
Show All Products ASPX (HTML)
Page 17
/* 2. Create a query that selects all the data from the SQL Database.*/
string query = ("SELECT * FROM [dbo].[products] WHERE currentAmount > 0");
SqlCommand cmd = new SqlCommand(query);
cmd.CommandType = System.Data.CommandType.Text;
cmd.Connection = conn;
//Read from the Database all the data.
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
string prodID = reader["pid"].ToString();
string prodName = reader["productName"].ToString();
string prodDesc = reader["description"].ToString();
string prodPrice = reader["price"].ToString();
//Create a table row.
TableRow tRow = new TableRow();
//Create a cell for the product name.
TableCell tcProdName = new TableCell();
tcProdName.Attributes.Add("class", "cells");
tcProdName.Text = prodName;
tRow.Cells.Add(tcProdName);
//Create a cell for Description.
TableCell tcProdDesc = new TableCell();
tcProdDesc.Attributes.Add("class", "cells");
tcProdDesc.Text = prodDesc;
tRow.Cells.Add(tcProdDesc);
//Create a cell for Price.
TableCell tcProdPrice = new TableCell();
tcProdPrice.Attributes.Add("class", "cells");
tcProdPrice.Text = "$" + prodPrice;
tRow.Cells.Add(tcProdPrice);
//Create a link.
HtmlAnchor link = new HtmlAnchor();
link.Attributes.Add("class", "cells");
link.HRef = "~/shopping/oneClickBuy.aspx?id=" + prodID;
link.InnerText = "OneClick Buy";
//Create a cell for Links.
TableCell tcBuy = new TableCell();
tcBuy.Attributes.Add("class", "cells");
tcBuy.Controls.Add(link);
tRow.Cells.Add(tcBuy);
//Add the Row to the Table.
tbl_Products.Rows.Add(tRow);
}
//Close the connection.
conn.Close();
}
}
}
Show All Products (C#)
Page 18
<%@ Page Title="One Click Buy" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="oneClickBuy.aspx.cs"
Inherits="PCPartsSuperStore.shopping.oneClickBuy" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"></asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpd_Main" runat="server">
<asp:HyperLink ID="UpdateUserInfoOCB" Cssclass="UpdateUserInfoOCB" runat="server" Target="_blank"
NavigateUrl="~/userManagement/UpdateUserLogIn.aspx" >Update Log-In</asp:HyperLink>
<form id="formOCB" class="form" method="post" runat="server" defaultfocus="prodName" >
<!-- Display objects for input/output -->
<fieldset class="fieldsetOCB">
<legend id="legendOCB">Thank You for Purchasing</legend>
<!-- Show the Thank You Message in the div. -->
<div id="div_purchase" runat="server">
</div>
</fieldset>
<asp:Button ID="submitButton" Cssclass="submitButton" runat="server" Text ="Email Receipt" OnClientClick="form.target ='_blank';"
PostBackUrl="~/WebEmail/WebMail.aspx" />
</form>
</asp:Content>
using System;
using System.Configuration;
using System.Data.SqlClient;
namespace PCPartsSuperStore.shopping
{
public partial class oneClickBuy : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Check if the user is logged in.
if (Session["userID"] == null)
{
Response.Redirect("~/index.aspx");
}
//Pass the Session userID to id when querying for the user.
string id = Session["userID"].ToString();
//Allow the user to update their info.
UpdateUserInfoOCB.Visible = true;
//Get the product from the query string.
string productID = Request.QueryString["id"].ToString();
/*1. Open a connection using the connection string in the Web.config
file under AppSettings.*/
string connStr = ConfigurationManager.AppSettings["connectionString"];
SqlConnection conn = new SqlConnection(connStr);
conn.Open();
One Click Buy ASPX (HTML)
One Click Buy (C#)
Page 19
/*2. Get the product information using a query string.*/
string query = ("SELECT * FROM [dbo].[products] WHERE pid =" + productID);
SqlCommand cmd = new SqlCommand(query);
cmd.CommandType = System.Data.CommandType.Text;
cmd.Connection = conn;
/*3. Read from the Database the Product Name and Product Price data that
you selected in the query with the pid that was filtered after opening
the new defined reader. Then close the reader to re-use it again.*/
SqlDataReader reader = cmd.ExecuteReader();
reader.Read();
string prodName = reader["productName"].ToString();
string prodPrice = reader["price"].ToString();
reader.Close();
/*4. Create a query with the user's First Name and Address based
on the user already logged on. Then execute and read the reader
once again from the database. After that close the reader.
Note: Do Not Close the Connection (Connection still open).*/
cmd.CommandText = "SELECT * FROM person WHERE id =" +id;
reader = cmd.ExecuteReader();
reader.Read();
string custName = reader["firstName"].ToString();
string custAddress = reader["address"].ToString();
string custEmail = reader["email"].ToString();
reader.Close();
/*5. Decrease the product from the selected pid (Product ID).
Then Close the Connection and display the thank you message.*/
cmd.CommandText = "UPDATE products SET currentAmount = (currentAmount-1)" +
" where pid =" + productID;
cmd.ExecuteNonQuery();
conn.Close();
//create a sesssion with info for emailing the customer.
Session["custName"] = custName;
Session["prodName"] = prodName;
Session["prodPrice"] = prodPrice;
Session["custAddress"] = custAddress;
//Send the customer's email info to the WebMail page.
Session["email"] = custEmail;
//Say thank you message and let the customer know about your interest in their purchase.
div_purchase.InnerHtml = "Hi <spanOCB><b>" + custName + "</b></spanOCB>," +
"<br/>Thank's for buying a <spanOCB><b>" + prodName + "</b></spanOCB>. Your " +
"credit card will be charged <spanOCB><b>$" + prodPrice + "</b></spanOCB> and your" +
" purchase will be shipped to <spanOCB><b>" + custAddress + "</b></spanOCB>." +
" Thanks for shopping with us. Come back soon. We like your money.";
}
}
}
One Click Buy (C# Continued)
Page 20
<%@ Page Title="Email Customer" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="WebMail.aspx.cs"
Inherits="PCPartsSuperStore.WebEmail.WebMail1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpd_Main" runat="server">
<form id="formWebMail" class="formWebMail" method="post" runat="server" defaultfocus="prodName" >
<fieldset class="WebMailHeader">
<legend class="legendWM">Please check your email:</legend>
<!-- Wrap the labels together -->
<div class="flexLabelsWrapper">
<div id="lbl_Email">
<asp:Label ID="lbl_WMText" CSSclass="lbl_WMText" runat="server" >Email Address:</asp:Label>
</div>
<div id="EmailAddress" class="EmailAddress" runat="server">
<asp:Label ID="lbl_WMAddress" CSSclass="WMAddress" runat="server" ></asp:Label>
</div>
</div>
</fieldset>
<!-- Display objects for input/output -->
<fieldset class="fieldsetWebMail">
<legend id="legendWM" class="legendWM">Your reciept has been sent.</legend>
<!-- Show the Thank You Message in the div. -->
<div id="div_purchase" runat="server">
</div>
</fieldset>
</form>
</asp:Content>
using System;
using System.Net;
using System.Net.Mail;
namespace PCPartsSuperStore.WebEmail
{
public partial class WebMail1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Check if the user is logged in.
if (Session["userID"] == null)
{
Response.Redirect("~/index.aspx");
}
/*1. Get the Session variables to display what is in the email.*/
string custName = (string)Session["custName"];
string prodName = (string)Session["prodName"];
string prodPrice = (string)Session["prodPrice"];
string custAddress = (string)Session["custAddress"];
Email Customer ASPX (HTML)
Email Customer (C#)
Page 21
/***************************************************************/
/***** Automatically gets the "to" email from the database *****/
/***************************************************************/
//Note: Database email must be a true email address in sending.
/*2. Get the Session variable for the customer email and display
it in the label. Then use the text in the label to send to the customer.*/
string custEmail = (string)Session["email"];
lbl_WMAddress.Text = custEmail.ToString();
/*3. Define the header of the email being sent.*/
string subject = "Thank you for shopping! (Test Email)";
/*4. Use what is in the label as an email address
of the user's email as a string and then define the body (message). */
string to = lbl_WMAddress.Text;
/***************************************************************/
/***************************************************************/
//Display what will be in the body of the email.
string body = "Hi <b>" + custName + "</ b >, <br/>Thank's for "+
"buying a <spanOCB><b>" + prodName + "</b></spanOCB>. Your credit card will be "+
"charged <spanOCB><b>$" + prodPrice + "</b></spanOCB> and your purchase will be shipped"+
" to <spanOCB><b>" + custAddress + "</b></spanOCB>."+
" Thanks for shopping with us. Come back soon. We like your money.";
/*5. Create a MailMessage object.*/
MailMessage mail = new MailMessage();
/***************************************************************/
/************************* Sender's Email **********************/
/***************************************************************/
/*6. Define what email address with password your sending from.
(Your own gmail credentials).*/
string senderEmail = "sender@gmail.com";
string senderPasswd = "sendersgmailpassword"; // a valid password for the email above*/
/***************************************************************/
/***************************************************************/
/*7. Define the objects of the email and link them to the variables as objects.*/
mail.From = new MailAddress(senderEmail);
mail.To.Add(to.ToString());
mail.Subject = subject;
mail.Body = body;
/*8. Allows HTML in the body.*/
mail.IsBodyHtml = true;
//Note: Code to add attachements, but not needed in this case(reference).
//mail.Attachments.Add(new Attachment("C:someFile.jpg"));
/*9. SMTP Client for gmail only. Other emails will have different
SMTP Client port numbers.*/
SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587); //Port 587
Email Customer (C# Continued)
Page 22
/*10. Set the credentials and secure socket link.*/
smtp.Credentials = new NetworkCredential(senderEmail, senderPasswd);
smtp.EnableSsl = true;
/*11. Sends the email.*/
smtp.Send(mail);
/*12. Display another message with the variables.*/
div_purchase.InnerHtml = "Hi <spanOCB><b>" + custName + "</b></spanOCB>," +
"<br/>Thank's for buying a <spanOCB><b>" + prodName + "</b></spanOCB>. Your " +
"credit card will be charged <spanOCB><b>$" + prodPrice + "</b></spanOCB> and your" +
" purchase will be shipped to <spanOCB><b>" + custAddress + "</b></spanOCB>." +
" Please check your email:<spanOCB><b> " + custEmail + " </spanOCB></b>for the receipt!";
}
}
}
/****************************WebEMail**************************/
.WMAddress { margin-left: 5px; }
.fieldsetWebMail { border-radius: 5px; width: 585px; height: auto; color: black; font-size: 21px; }
.legendWM { font-size: 24px; color: darkgreen; font-weight: bold; }
.formWebMail { background-color: #FAF0E6; font-family: Calibri, San-Serif, Helvetica; width: 625px; height: auto;
border: 3px solid rgba(255,255,255,.8); border-style: outset; border-radius: 25px; margin: 25px auto; padding: 25px; }
/****************************newProduct*************************/
#lbl1_prodDesc { position: relative; margin-right: 5px; }
.UpdateUserInfoNP { position: absolute; font-size: 24px; margin-left: -155px; margin-top: 380px; color: darkblue; }
.UpdateUserInfoNP:visited { color:mediumorchid; }
.BoxStyleNP { height: 21px; width: 225px; margin-top: 4px; margin-left: 5px; color: red; border-color: rgba(0,0,139,.9); }
.BoxStyleNP:hover { box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.05) inset, 0px 0px 8px rgba(82, 168, 236, 0.6); }
#fieldset1NP { border-radius: 5px; width: 715px; height: 230px; font-weight: bold; color: #4682B4; font-size: 21px; }
.flexTBoxesWrapper { position: relative; display: inline-flex; }
.LabelStyleNP { position: relative; font-size: 25px; color: #4682B4; }
#formNP { background-color: #FAF0E6; font-family: Calibri, San-Serif, Helvetica; width: 755px; height: 258px;
border: 3px solid rgba(255,255,255,.8); border-style: outset; border-radius: 25px; margin: 25px auto; padding: 25px; }
MasterStyle (CSS Style Sheet)
Page 23
.legendNP { color: red; font-size: 25px; }
span { color: darkblue; font-size: 25px; }
.submitButton { position: relative; height: 28px; width: 125px; margin-top: 18px; margin-bottom: 8px; background: rgba(0,125,0,.9);
margin-right: 20px; color: rgba(255,255,255,1); border-color: rgba(158,202,237,1); border-radius: 8px;
box-shadow: 0 0 10px rgba(158,202,237,1); outline: none; cursor: pointer; }
/**************************OneClickBuy*************************/
.UpdateUserInfoOCB { position: absolute; font-size: 24px; margin-left: -155px; margin-top: 380px; color: darkblue; }
.UpdateUserInfoOCB:visited { color:mediumorchid; }
.fieldsetOCB { border-radius: 5px; width: 585px; height: auto; color: black; font-size: 21px; }
#legendOCB { font-size: 24px; color: darkgreen; font-weight: bold; }
#formOCB { background-color: #FAF0E6; font-family: Calibri, San-Serif, Helvetica; width: 625px; height: auto;
border: 3px solid rgba(255,255,255,.8); border-style: outset; border-radius: 25px; margin: 25px auto; padding: 25px; }
spanOCB { font-size: 24px; color: cornflowerblue; font-weight: bold; }
/*****************************showAllProducts*******************/
.UpdateUserInfoAP { position: absolute; font-size: 24px; margin-left: -155px; margin-top: 380px; color: darkblue; }
.UpdateUserInfoAP:visited { color: mediumorchid; }
#fieldsetSAP { border-radius: 5px; width: 785px; height: auto; font-weight: bold; color: #4682B4; font-size: 21px; }
#formSAP { background-color: #FAF0E6; font-family: Calibri, San-Serif, Helvetica; width: 825px; height: auto;
border: 3px solid rgba(255,255,255,.8); border-style: outset; border-radius: 25px; margin: 25px auto; padding: 25px; }
.headCells { border: 1px solid white; background-color: darkolivegreen; color: darkseagreen; text-align: center; width: 150px; }
.headCellDesc { border: 1px solid white; background-color: darkolivegreen; color: darkseagreen; text-align: center; width: 295px; }
.headCellBuyIt { border: 1px solid white; background-color: darkolivegreen; color: darkseagreen; text-align: center; width: 165px; }
.cells { border: 1px solid black; background-color: darkseagreen; padding: 10px; }
.legendSAP { color: darkgreen; font-size: 25px; }
Page 24
/********************************ShowUserLogInInfo*************************/
.fieldset2SULII { border-radius: 5px; color: #4682B4; font-weight: bold; font-size: 21px; margin-left: 8px; width: 495px; }
spanSULII { color: red; font-weight: bold; font-size: 21px; }
.ResultTextStyleSULII { position: relative; color: red; }
#lbl_Identity { color: #4682B4; }
.fieldset1SULII { border-radius: 5px; width: 595px; height: 225px; font-weight: bold; color: #4682B4; font-size: 21px;
margin-left: 8px; }
#formSULII { background-color: #FAF0E6; font-family: Calibri, San-Serif, Helvetica; width: 645px; height: 365px;
border: 3px solid rgba(255,255,255,.8); border-style: outset; border-radius: 25px; margin: 25px auto; padding: 50px;}
.flexLabelsWrapper { position: relative; display: inline-flex; }
.TextLabelsSULII { color: #4682B4; font-weight: bold; margin-right: 5px; }
#lbl_PhoneNumber { margin-right: 5px;}
.legendSULII { color: red; font-size: 25px; }
.body { background-color: white; background-image: url('../img/X10DAX.png'); background-repeat: repeat;
font-family: Calibri, San-Serif, Helvetica, Arial; }
/******************************UserUpdatedShowInfo************************/
#fieldset2UUSI { border-radius: 5px; color: #4682B4; font-weight: bold; font-size: 21px; margin-left: 8px; width: 495px; }
spanUUSI { color: red; font-weight: bold; font-size: 25px; }
.ResultTextStyleUUSI { position: relative; color: red; font-size: 25px; margin-left: 25px; }
#lbl_Identity { color: #4682B4; }
#fieldset1UUSI { border-radius: 5px; width: 595px; height: 225px; font-weight: bold; color: #4682B4; font-size: 21px;
margin-left: 8px; }
#formUUSI { background-color: #FAF0E6; font-family: Calibri, San-Serif, Helvetica; width: 645px; height: 345px;
border: 3px solid rgba(255,255,255,.8); border-style: outset; border-radius: 25px; margin: 25px auto; padding: 50px; }
.flexLabelsWrapper { position: relative; display: inline-flex; }
.TextLabelsUUSI { color: #4682B4; font-weight: bold; margin-right: 5px; }
.legendUUSI { color: red; font-size: 25px; }
Page 25
body { background-color: white; background-repeat: repeat; font-family: Calibri, San-Serif, Helvetica, Arial; }
/***************************UpdateUserLogIn**********************/
#lbl1_PhoneNumber { position: relative; margin-right: 5px; }
.BoxStyleUULI { height: 21px; width: 265px; margin-top: 4px; color: red; border-color: rgba(0,0,139,.9); }
.BoxStyleUULI:hover { box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.05) inset, 0px 0px 8px rgba(82, 168, 236, 0.6); }
#fieldsetUULI { border-radius: 5px; width: 450px; height: 285px; font-weight: bold; color: #4682B4; font-size: 21px;
margin-left: 8px; }
.flexTBoxesWrapper { position: relative; display: inline-flex; }
.LabelStyleUULI { position: relative; font-size: 25px; color: #4682B4; }
#formUULI { background-color: #FAF0E6; font-family: Calibri, San-Serif, Helvetica; width: 500px; height: 345px;
border: 3px solid rgba(255,255,255,.8); border-style: outset; border-radius: 25px; margin: 25px auto; padding: 50px;}
#legendUULI { color: red; font-size: 25px; }
/**************************MakeUserLogIn************************/
#lbl1_PhoneNumber { position: relative; margin-right: 5px; }
.BoxStyleMULI { height: 21px; width: 265px; margin-top: 4px; color: red; border-color: rgba(0,0,139,.9); margin-left: 5px; }
.BoxStyleMULI:hover { box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.05) inset, 0px 0px 8px rgba(82, 168, 236, 0.6); }
.fieldsetMULI { border-radius: 5px; width: 450px; height: 285px; font-weight: bold; color: #4682B4; font-size: 21px;
margin-left: 8px; }
.flexTBoxesWrapper { position: relative; display: inline-flex; }
.LabelStyleMULI { position: relative; font-size: 25px; color: #4682B4; }
#formMULI { background-color: #FAF0E6; font-family: Calibri, San-Serif, Helvetica; width: 500px; height: 320px;
border: 3px solid rgba(255,255,255,.8); border-style: outset; border-radius: 25px; margin: 25px auto; padding: 50px;}
.LegendMULI { color: red; font-size: 25px; }
/*************************Index*************************/
.BoxStyleLogIn { height: 21px; width: 125px; margin-top: 4px; color: red; border-color: rgba(0,0,139,.9); }
#formLogIn { position: absolute; margin-top: 270px; }
Page 26
.BoxStyleLogIn:hover { box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.05) inset, 0px 0px 8px rgba(82, 168, 236, 0.6); }
.SignInPos { position: relative; background-color: white; font-family: Calibri, San-Serif, Helvetica; padding-top: 8px; width: 135px;
height: 115px; border-radius: 25px; padding-left: 5px; margin-left: 13px; border: solid; }
.WelcomeUser { position: absolute; margin-left: 25px; font-size: 24px; color: darkblue; }
spanIndex { color: cornflowerblue; }
#formLogIn { position: absolute; }
#txb_SignInUName { margin-bottom: 3px;}
#txb_SignInPWord { margin-bottom: 5px; }
.submitButtonLogIn { position: relative; height: 28px; width: 125px; margin-top: 18px; margin-bottom: 8px;
background: rgba(0,125,0,.9); margin-right: 20px; color: rgba(255,255,255,1); border-color: rgba(158,202,237,1);
border-radius: 8px; box-shadow: 0 0 10px rgba(158,202,237,1); outline: none; cursor: pointer; }
/**********************BaseStyle**********************/
#header { border: solid; color: black; border-radius: 25px; height: 225px; background-image: url('../img/Header.png');
background-clip: border-box; }
.LabelHeaderText { position: relative; color: white; font-size: 50px; font-weight: bold; }
.SubHeaderTxt { position: relative; color: white; font-size: 36px; font-weight: bold; }
.HeaderText { margin-top: 45px; text-shadow: 2px 2px #ff0000; }
#newProducts { position: absolute; font-size: 24px; margin-left: 25px; margin-top: 45px; color: darkblue; font-size: 24px;
cursor: pointer; }
#newProducts:visited { color: mediumorchid; }
#Products { position: absolute; font-size: 24px; margin-left: 25px; margin-top: 55px; color: darkblue; font-size: 24px;
cursor: pointer; }
#Products:visited { color: mediumorchid; }
#Sale { position: absolute; font-size: 24px; margin-left: 25px; margin-top: 65px; color: darkblue; font-size: 24px; cursor: pointer;}
#Featured { position: absolute; font-size: 24px; margin-left: 25px; margin-top: 75px; color: darkblue; font-size: 24px;
cursor: pointer; }
#Navigation { position: relative; float: left; border: solid; border-color: black; width: 175px; min-height: 605px;
border-radius: 25px; background-color: darkgreen; }
Page 27
.SignUp { position: absolute; font-size: 24px; margin-left: -155px; margin-top: 405px; color: darkblue; }
.SignUp:visited { color:mediumorchid; }
.UpdateUserInfo { position: absolute; font-size: 24px; margin-left: -155px; margin-top: 405px; color: darkblue; }
#footer { text-align: left; clear: both; padding-left: 65px; padding-bottom: 10px; height: 45px; color: white; border: solid;
border-color: black; background-color: darkgreen; border-color: black; border-radius: 25px; background-clip: border-box; }
.rights { float: right; padding-right: 65px; color: white; }
a { color: darkblue; }
.footerText { position: relative; }
Page 28

More Related Content

What's hot

Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Ayes Chinmay
 
Rails, Postgres, Angular, and Bootstrap: The Power Stack
Rails, Postgres, Angular, and Bootstrap: The Power StackRails, Postgres, Angular, and Bootstrap: The Power Stack
Rails, Postgres, Angular, and Bootstrap: The Power Stack
David Copeland
 
my test
my testmy test
my test
lu jimmy
 
Javascript: Ajax & DOM Manipulation v1.2
Javascript: Ajax & DOM Manipulation v1.2Javascript: Ajax & DOM Manipulation v1.2
Javascript: Ajax & DOM Manipulation v1.2
borkweb
 
E2 appspresso hands on lab
E2 appspresso hands on labE2 appspresso hands on lab
E2 appspresso hands on labNAVER D2
 
Javascript projects Course
Javascript projects CourseJavascript projects Course
Javascript projects Course
Laurence Svekis ✔
 
ملخص تقنية تصميم صفحات الويب - الوحدة الرابعة
ملخص تقنية تصميم صفحات الويب - الوحدة الرابعةملخص تقنية تصميم صفحات الويب - الوحدة الرابعة
ملخص تقنية تصميم صفحات الويب - الوحدة الرابعة
جامعة القدس المفتوحة
 
HTML5 - The 2012 of the Web - Adobe MAX
HTML5 - The 2012 of the Web - Adobe MAXHTML5 - The 2012 of the Web - Adobe MAX
HTML5 - The 2012 of the Web - Adobe MAXRobert Nyman
 
날로 먹는 Django admin 활용
날로 먹는 Django admin 활용날로 먹는 Django admin 활용
날로 먹는 Django admin 활용
KyeongMook "Kay" Cha
 
Penetration Testing with Improved Input Vector Identification
Penetration Testing with Improved Input Vector IdentificationPenetration Testing with Improved Input Vector Identification
Penetration Testing with Improved Input Vector Identification
Shauvik Roy Choudhary, Ph.D.
 
ملخص تقنية تصميم صفحات الويب - الوحدة الخامسة
ملخص تقنية تصميم صفحات الويب - الوحدة الخامسةملخص تقنية تصميم صفحات الويب - الوحدة الخامسة
ملخص تقنية تصميم صفحات الويب - الوحدة الخامسة
جامعة القدس المفتوحة
 
Intro to Javascript and jQuery
Intro to Javascript and jQueryIntro to Javascript and jQuery
Intro to Javascript and jQueryShawn Calvert
 
End-to-end testing with geb
End-to-end testing with gebEnd-to-end testing with geb
End-to-end testing with geb
Jesús L. Domínguez Muriel
 
JavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM ManipulationJavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM Manipulation
borkweb
 
Hdv309 - Real World Sandboxed Solutions
Hdv309 - Real World Sandboxed SolutionsHdv309 - Real World Sandboxed Solutions
Hdv309 - Real World Sandboxed Solutionswoutervugt
 

What's hot (19)

Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
 
lect4
lect4lect4
lect4
 
Rails, Postgres, Angular, and Bootstrap: The Power Stack
Rails, Postgres, Angular, and Bootstrap: The Power StackRails, Postgres, Angular, and Bootstrap: The Power Stack
Rails, Postgres, Angular, and Bootstrap: The Power Stack
 
my test
my testmy test
my test
 
Javascript: Ajax & DOM Manipulation v1.2
Javascript: Ajax & DOM Manipulation v1.2Javascript: Ajax & DOM Manipulation v1.2
Javascript: Ajax & DOM Manipulation v1.2
 
Intro to jQuery
Intro to jQueryIntro to jQuery
Intro to jQuery
 
E2 appspresso hands on lab
E2 appspresso hands on labE2 appspresso hands on lab
E2 appspresso hands on lab
 
Javascript projects Course
Javascript projects CourseJavascript projects Course
Javascript projects Course
 
ملخص تقنية تصميم صفحات الويب - الوحدة الرابعة
ملخص تقنية تصميم صفحات الويب - الوحدة الرابعةملخص تقنية تصميم صفحات الويب - الوحدة الرابعة
ملخص تقنية تصميم صفحات الويب - الوحدة الرابعة
 
HTML5 - The 2012 of the Web - Adobe MAX
HTML5 - The 2012 of the Web - Adobe MAXHTML5 - The 2012 of the Web - Adobe MAX
HTML5 - The 2012 of the Web - Adobe MAX
 
날로 먹는 Django admin 활용
날로 먹는 Django admin 활용날로 먹는 Django admin 활용
날로 먹는 Django admin 활용
 
Chat php
Chat phpChat php
Chat php
 
Penetration Testing with Improved Input Vector Identification
Penetration Testing with Improved Input Vector IdentificationPenetration Testing with Improved Input Vector Identification
Penetration Testing with Improved Input Vector Identification
 
ملخص تقنية تصميم صفحات الويب - الوحدة الخامسة
ملخص تقنية تصميم صفحات الويب - الوحدة الخامسةملخص تقنية تصميم صفحات الويب - الوحدة الخامسة
ملخص تقنية تصميم صفحات الويب - الوحدة الخامسة
 
Java Script
Java ScriptJava Script
Java Script
 
Intro to Javascript and jQuery
Intro to Javascript and jQueryIntro to Javascript and jQuery
Intro to Javascript and jQuery
 
End-to-end testing with geb
End-to-end testing with gebEnd-to-end testing with geb
End-to-end testing with geb
 
JavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM ManipulationJavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM Manipulation
 
Hdv309 - Real World Sandboxed Solutions
Hdv309 - Real World Sandboxed SolutionsHdv309 - Real World Sandboxed Solutions
Hdv309 - Real World Sandboxed Solutions
 

Viewers also liked

Vermogensplan Dhr Berenschot en Mevr de Laat vMichielVanVugt
Vermogensplan Dhr Berenschot en Mevr de Laat vMichielVanVugtVermogensplan Dhr Berenschot en Mevr de Laat vMichielVanVugt
Vermogensplan Dhr Berenschot en Mevr de Laat vMichielVanVugtMichiel Van Vugt
 
змајевање
змајевањезмајевање
змајевање
Nataša Majstrović
 
Achieving winter budget certainty
Achieving winter budget certainty Achieving winter budget certainty
Achieving winter budget certainty
Kate Flaherty
 
Crocus medical 2015 russian
Crocus medical   2015 russianCrocus medical   2015 russian
Crocus medical 2015 russian
Aleksandra Hohlova
 
Doc général Catalogue 2016 06 au 02 08 2016
Doc général Catalogue 2016 06 au 02 08 2016Doc général Catalogue 2016 06 au 02 08 2016
Doc général Catalogue 2016 06 au 02 08 2016
wellandyou
 
Waybook produits 2016
Waybook produits 2016Waybook produits 2016
Waybook produits 2016
wellandyou
 
How to share the whiteboard
How to share the whiteboardHow to share the whiteboard
How to share the whiteboard
Cimpeanemese
 
A Christmas carol
A Christmas carolA Christmas carol
A Christmas carol
kougiou
 
Embedding Good practices in eTwinning Projects
Embedding Good practices in eTwinning ProjectsEmbedding Good practices in eTwinning Projects
Embedding Good practices in eTwinning Projects
kougiou
 
An alternate view of the future
An alternate view of the futureAn alternate view of the future
An alternate view of the future
ProductNation/iSPIRT
 
Khalid Station (Logo Project)
Khalid Station (Logo Project)Khalid Station (Logo Project)
Khalid Station (Logo Project)
Ahmed Mohaisen
 
BOWLMOR - BIG DATA BOWLING
BOWLMOR - BIG DATA BOWLING BOWLMOR - BIG DATA BOWLING
BOWLMOR - BIG DATA BOWLING
BowlmorAMF
 
India stack - A detailed presentation
India stack - A detailed presentationIndia stack - A detailed presentation
India stack - A detailed presentation
indiastack
 
E twinning ambassador webinar about Doodle by Nataša Majstrović
E twinning ambassador webinar about Doodle by  Nataša MajstrovićE twinning ambassador webinar about Doodle by  Nataša Majstrović
E twinning ambassador webinar about Doodle by Nataša Majstrović
Nataša Majstrović
 

Viewers also liked (16)

Vermogensplan Dhr Berenschot en Mevr de Laat vMichielVanVugt
Vermogensplan Dhr Berenschot en Mevr de Laat vMichielVanVugtVermogensplan Dhr Berenschot en Mevr de Laat vMichielVanVugt
Vermogensplan Dhr Berenschot en Mevr de Laat vMichielVanVugt
 
змајевање
змајевањезмајевање
змајевање
 
General Plain
General PlainGeneral Plain
General Plain
 
Achieving winter budget certainty
Achieving winter budget certainty Achieving winter budget certainty
Achieving winter budget certainty
 
Crocus medical 2015 russian
Crocus medical   2015 russianCrocus medical   2015 russian
Crocus medical 2015 russian
 
Doc général Catalogue 2016 06 au 02 08 2016
Doc général Catalogue 2016 06 au 02 08 2016Doc général Catalogue 2016 06 au 02 08 2016
Doc général Catalogue 2016 06 au 02 08 2016
 
Waybook produits 2016
Waybook produits 2016Waybook produits 2016
Waybook produits 2016
 
How to share the whiteboard
How to share the whiteboardHow to share the whiteboard
How to share the whiteboard
 
A Christmas carol
A Christmas carolA Christmas carol
A Christmas carol
 
ASTRO 07 PROS IGRT
ASTRO 07 PROS IGRTASTRO 07 PROS IGRT
ASTRO 07 PROS IGRT
 
Embedding Good practices in eTwinning Projects
Embedding Good practices in eTwinning ProjectsEmbedding Good practices in eTwinning Projects
Embedding Good practices in eTwinning Projects
 
An alternate view of the future
An alternate view of the futureAn alternate view of the future
An alternate view of the future
 
Khalid Station (Logo Project)
Khalid Station (Logo Project)Khalid Station (Logo Project)
Khalid Station (Logo Project)
 
BOWLMOR - BIG DATA BOWLING
BOWLMOR - BIG DATA BOWLING BOWLMOR - BIG DATA BOWLING
BOWLMOR - BIG DATA BOWLING
 
India stack - A detailed presentation
India stack - A detailed presentationIndia stack - A detailed presentation
India stack - A detailed presentation
 
E twinning ambassador webinar about Doodle by Nataša Majstrović
E twinning ambassador webinar about Doodle by  Nataša MajstrovićE twinning ambassador webinar about Doodle by  Nataša Majstrović
E twinning ambassador webinar about Doodle by Nataša Majstrović
 

Similar to ASP.Net, move data to and from a SQL Server Database

QuickConnect
QuickConnectQuickConnect
QuickConnectAnnu G
 
Implementation of GUI Framework part3
Implementation of GUI Framework part3Implementation of GUI Framework part3
Implementation of GUI Framework part3
masahiroookubo
 
Rails GUI Development with Ext JS
Rails GUI Development with Ext JSRails GUI Development with Ext JS
Rails GUI Development with Ext JS
Martin Rehfeld
 
HTML5 - The 2012 of the Web
HTML5 - The 2012 of the WebHTML5 - The 2012 of the Web
HTML5 - The 2012 of the WebRobert Nyman
 
Login and Registration form using oop in php
Login and Registration form using oop in phpLogin and Registration form using oop in php
Login and Registration form using oop in php
herat university
 
.NET Fest 2017. Михаил Щербаков. Механизмы предотвращения атак в ASP.NET Core
.NET Fest 2017. Михаил Щербаков. Механизмы предотвращения атак в ASP.NET Core.NET Fest 2017. Михаил Щербаков. Механизмы предотвращения атак в ASP.NET Core
.NET Fest 2017. Михаил Щербаков. Механизмы предотвращения атак в ASP.NET Core
NETFest
 
Taking Web Apps Offline
Taking Web Apps OfflineTaking Web Apps Offline
Taking Web Apps OfflinePedro Morais
 
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013Kiril Iliev
 
Creating a Simple PHP and MySQL-Based Login System
Creating a Simple PHP and MySQL-Based Login SystemCreating a Simple PHP and MySQL-Based Login System
Creating a Simple PHP and MySQL-Based Login SystemAzharul Haque Shohan
 
JavaServer Pages
JavaServer Pages JavaServer Pages
JavaServer Pages
profbnk
 
WCMTL 15 - Create your own shortcode (Fr)
WCMTL 15 - Create your own shortcode (Fr)WCMTL 15 - Create your own shortcode (Fr)
WCMTL 15 - Create your own shortcode (Fr)
MichaelBontyes
 
Presentasi Kelompok 25 PW A+B
Presentasi Kelompok 25 PW A+BPresentasi Kelompok 25 PW A+B
Presentasi Kelompok 25 PW A+B
Hapsoro Permana
 
Tugas pw [kelompok 25]
Tugas pw [kelompok 25]Tugas pw [kelompok 25]
Tugas pw [kelompok 25]
guest0ad6a0
 
JavaScript Training
JavaScript TrainingJavaScript Training
JavaScript Training
Ramindu Deshapriya
 
Introduction to ReasonML
Introduction to ReasonMLIntroduction to ReasonML
Introduction to ReasonML
Riza Fahmi
 

Similar to ASP.Net, move data to and from a SQL Server Database (20)

QuickConnect
QuickConnectQuickConnect
QuickConnect
 
Implementation of GUI Framework part3
Implementation of GUI Framework part3Implementation of GUI Framework part3
Implementation of GUI Framework part3
 
Tutorial asp.net
Tutorial  asp.netTutorial  asp.net
Tutorial asp.net
 
Rails GUI Development with Ext JS
Rails GUI Development with Ext JSRails GUI Development with Ext JS
Rails GUI Development with Ext JS
 
HTML5 - The 2012 of the Web
HTML5 - The 2012 of the WebHTML5 - The 2012 of the Web
HTML5 - The 2012 of the Web
 
Login and Registration form using oop in php
Login and Registration form using oop in phpLogin and Registration form using oop in php
Login and Registration form using oop in php
 
.NET Fest 2017. Михаил Щербаков. Механизмы предотвращения атак в ASP.NET Core
.NET Fest 2017. Михаил Щербаков. Механизмы предотвращения атак в ASP.NET Core.NET Fest 2017. Михаил Щербаков. Механизмы предотвращения атак в ASP.NET Core
.NET Fest 2017. Михаил Щербаков. Механизмы предотвращения атак в ASP.NET Core
 
Taking Web Apps Offline
Taking Web Apps OfflineTaking Web Apps Offline
Taking Web Apps Offline
 
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
jsSaturday - PhoneGap and jQuery Mobile for SharePoint 2013
 
Soa lab 3
Soa lab 3Soa lab 3
Soa lab 3
 
Creating a Simple PHP and MySQL-Based Login System
Creating a Simple PHP and MySQL-Based Login SystemCreating a Simple PHP and MySQL-Based Login System
Creating a Simple PHP and MySQL-Based Login System
 
JavaServer Pages
JavaServer Pages JavaServer Pages
JavaServer Pages
 
Java script
Java scriptJava script
Java script
 
WCMTL 15 - Create your own shortcode (Fr)
WCMTL 15 - Create your own shortcode (Fr)WCMTL 15 - Create your own shortcode (Fr)
WCMTL 15 - Create your own shortcode (Fr)
 
Practica n° 7
Practica n° 7Practica n° 7
Practica n° 7
 
Presentasi Kelompok 25 PW A+B
Presentasi Kelompok 25 PW A+BPresentasi Kelompok 25 PW A+B
Presentasi Kelompok 25 PW A+B
 
Tugas pw [kelompok 25]
Tugas pw [kelompok 25]Tugas pw [kelompok 25]
Tugas pw [kelompok 25]
 
JavaScript Training
JavaScript TrainingJavaScript Training
JavaScript Training
 
Introduction to ReasonML
Introduction to ReasonMLIntroduction to ReasonML
Introduction to ReasonML
 
Vb.Net Web Forms
Vb.Net  Web FormsVb.Net  Web Forms
Vb.Net Web Forms
 

More from Christopher Singleton

HTML5 Programming, CSS style sheets
HTML5 Programming, CSS style sheetsHTML5 Programming, CSS style sheets
HTML5 Programming, CSS style sheets
Christopher Singleton
 
Using Inner-Joins (SQL)
Using Inner-Joins (SQL)Using Inner-Joins (SQL)
Using Inner-Joins (SQL)
Christopher Singleton
 
Inner joins
Inner joinsInner joins

More from Christopher Singleton (7)

HTML5 Programming, CSS style sheets
HTML5 Programming, CSS style sheetsHTML5 Programming, CSS style sheets
HTML5 Programming, CSS style sheets
 
Using Inner-Joins (SQL)
Using Inner-Joins (SQL)Using Inner-Joins (SQL)
Using Inner-Joins (SQL)
 
Inner joins
Inner joinsInner joins
Inner joins
 
RandomGuessingGame
RandomGuessingGameRandomGuessingGame
RandomGuessingGame
 
Bookstore-Project
Bookstore-ProjectBookstore-Project
Bookstore-Project
 
SSIS_Project
SSIS_ProjectSSIS_Project
SSIS_Project
 
CS_Resume
CS_ResumeCS_Resume
CS_Resume
 

Recently uploaded

Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Subhajit Sahu
 
Opendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptxOpendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptx
Opendatabay
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
ewymefz
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
ewymefz
 
一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单
ocavb
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
Subhajit Sahu
 
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
vcaxypu
 
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
oz8q3jxlp
 
Q1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year ReboundQ1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year Rebound
Oppotus
 
FP Growth Algorithm and its Applications
FP Growth Algorithm and its ApplicationsFP Growth Algorithm and its Applications
FP Growth Algorithm and its Applications
MaleehaSheikh2
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Boston Institute of Analytics
 
社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .
NABLAS株式会社
 
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
vcaxypu
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP
 
一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单
ewymefz
 
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
AbhimanyuSinha9
 
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
u86oixdj
 
The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
jerlynmaetalle
 
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
nscud
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
ewymefz
 

Recently uploaded (20)

Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
 
Opendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptxOpendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptx
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
 
一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
 
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
 
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
 
Q1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year ReboundQ1’2024 Update: MYCI’s Leap Year Rebound
Q1’2024 Update: MYCI’s Leap Year Rebound
 
FP Growth Algorithm and its Applications
FP Growth Algorithm and its ApplicationsFP Growth Algorithm and its Applications
FP Growth Algorithm and its Applications
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
 
社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .
 
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单
 
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
 
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
 
The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
 
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
 

ASP.Net, move data to and from a SQL Server Database

  • 1. Programmed By: Christopher Singleton ASP.Net, HTML, C# Date: 06/14/2016 User (Logged-In)User (Not Logged-In) Purpose: Create an ASP.Net application web page ***User can Log-In (Update Log-In) ***User can create products. ***User can send purchase emails. Note: Display of information during process. Page 1
  • 2. Create Log-In Show Newly Created Log-In Update Log-In Show Updated Log-In Log-In in the SQL Database (Shown Below) Page 2
  • 3. Create the Products in the SQL Database. Show the Products created. Product Clicked On (Link to Product) Page 3
  • 4. Allow the User to Email a Receipt. Page 4
  • 5. <?xml version="1.0" encoding="utf-8"?> <!--For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433--> <configuration> <system.web> <compilation debug="true" targetFramework="4.5.2"/> <httpRuntime targetFramework="4.5.2"/> </system.web> <system.codedom> <compilers> <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/> <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=&quot;Web&quot; /optionInfer+"/> </compilers> </system.codedom> <appSettings> <add key="connectionstring" value="Server=ServerNameSQLServerInstance; Database=PROG117DB; User Id=PROG117_web_user; Password=abc123; Encrypt=True;TrustServerCertificate=True;Connection Timeout=30;"/> <add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/> </appSettings> </configuration> <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Master.master.cs" Inherits="PCPartsSuperStore.Master" %> <!DOCTYPE html> <meta charset="UTF-8"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>PC Super Store</title> <asp:ContentPlaceHolder ID="head" runat="server"></asp:ContentPlaceHolder> <link href="CSS/MasterStyle.css" rel="stylesheet" /> </head> <body> <%--Header--%> <div id="header" runat="server"> <div class="HeaderText" style="text-align: center" runat="server" > <asp:Label ID="lbl_HeaderText" Cssclass="LabelHeaderText" runat="server" >Advanced Computer Systems Company</asp:Label><br /> <asp:Label ID="lbl_SubHeaderText" CssClass="SubHeaderTxt" runat="server" > "Where the future of innovations are yours!"</asp:Label> </div> </div> <%--Navigation--%> <div id="Navigation" runat="server"> <asp:HyperLink ID="newProducts" Cssclass="MasterLinks" runat="server" NavigateUrl ="~/productManagement/newProduct.aspx" ToolTip="New Products" Text="New Products" ></asp:HyperLink><br /><br /> Master Page ASPX Web Config File (SQL Database Connection) Page 5
  • 6. <asp:HyperLink ID="Products" Cssclass="MasterLinks" runat="server" NavigateUrl ="~/shopping/showAllProducts.aspx" ToolTip="Products">Products</asp:HyperLink><br /><br /> <asp:HyperLink ID="Sale" Cssclass="MasterLinks" runat="server" ToolTip="Sale">Sale</asp:HyperLink><br /><br /> <asp:HyperLink ID="Featured" Cssclass="MasterLinks" runat="server" ToolTip="Featured">Featured</asp:HyperLink><br /> </div> <%--Main Content--%> <div id="Main" runat="server"> <asp:ContentPlaceHolder ID="cpd_Main" runat="server"> </asp:ContentPlaceHolder> </div> <%--footer--%> <div id="footer" runat="server"> <div class="footerText"> <h3 class="footer"><strong>Advanced Computer Systems Company &nbsp; <a href="mailto:chris.singleton@bellevuecollege.edu">Contact: Send an Email</a> <span class="rights">&copy;All Rights Reserved 2016</span></strong></h3> </div> </div> </body> </html> <%@ Page Title="PC Super Store" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="PCPartsSuperStore.index" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="cpd_Main" runat="server"> <asp:Label ID="lbl_WelcomeUser" CssClass="WelcomeUser" runat="server" ></asp:Label> <form id="formLogIn" runat="server" defaultfocus="txb_SignInUName"> <div class="SignInPos" runat="server"> <asp:TextBox ID="txb_SignInUName" Cssclass="BoxStyleLogIn" placeholder="User Name" runat ="server" required ="required" ></asp:TextBox><br /> <asp:TextBox ID="txb_SignInPWord" Cssclass="BoxStyleLogIn" placeholder="Password" runat ="server" required ="required" ></asp:TextBox><br /> <asp:Button ID="submitButton" Cssclass="submitButtonLogIn" runat="server" Text ="Submit" OnClick="submitButton_Click" /> </div> </form> <asp:HyperLink ID="SignUp" Cssclass="SignUp" runat="server" Target="_blank" NavigateUrl="~/userManagement/MakeUserLogIn.aspx" > Sign up</asp:HyperLink> <asp:HyperLink ID="UpdateUserInfo" Cssclass="UpdateUserInfo" runat="server" Target="_blank" NavigateUrl="~/userManagement/UpdateUserLogIn.aspx" >Update Log-In</asp:HyperLink> </asp:Content> using System; using System.Configuration; using System.Data.SqlClient; namespace PCPartsSuperStore { public partial class index : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) Master Page ASPX (Continued) Index Page (C#) Index page ASPX (HTML) Page 6
  • 7. { //Don't allow the user to update any info until log-in. UpdateUserInfo.Visible = false; } protected void submitButton_Click(object sender, System.EventArgs e) { //Pass the user's textbox inputs into variables. string uName = Request.Form["ctl00$cpd_Main$txb_SignInUName"]; string pass = Request.Form["ctl00$cpd_Main$txb_SignInPWord"]; /*1. Open a connection using the connection string in the Web.config file under AppSettings.*/ string connStr = ConfigurationManager.AppSettings["connectionString"]; SqlConnection conn = new SqlConnection(connStr); conn.Open(); /* 2. Create a command that gets the firstName from the database using a where clause from the user input using the SQL Server Database. Then define the query with the connection.*/ string query = "SELECT [firstName], [id] FROM [dbo].[person]" + "WHERE userName = '" + uName + "' AND password = '" + pass + "'"; SqlCommand cmd = new SqlCommand(query); cmd.CommandType = System.Data.CommandType.Text; cmd.Connection = conn; /* 3. Create a reader, read the firstName and id into the variables as a string, then pass the variables into session variables. Finally, display output to the label or textbox and hide the Log-In form.*/ SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { string strfName = reader["firstName"].ToString(); string strID = reader["id"].ToString(); Session["firstName"] = strfName; Session["userID"] = strID; lbl_WelcomeUser.Text = "<spanIndex>Welcome</spanIndex> " + strfName + "<spanIndex>!</spanIndex>"; Form.Visible = false; SignUp.Visible = false; UpdateUserInfo.Visible = true; } else { txb_SignInUName.Text = "Log-In Failed!"; SignUp.Visible = true; UpdateUserInfo.Visible = false; } //4. Close the connection. conn.Close(); } } } Index Page (C# Continued) Page 7
  • 8. <%@ Page Title="Create Log-In" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="MakeUserLogIn.aspx.cs" Inherits="PCPartsSuperStore.userManagement.MakeUserLogIn" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="cpd_Main" runat="server"> <form id="formMULI" class="form" method="post" action="SecondPage.aspx" runat="server" defaultfocus="txb_FName" > <!-- Display objects for input/output --> <fieldset class="fieldsetMULI"> <legend class="LegendMULI">Create Log-In</legend> <!-- flexbox both the textbox and labels together side by side --> <div class="flexTBoxesWrapper"> <div class="flexText"> <asp:Label ID="lbl1_FName" Cssclass="LabelStyleMULI" runat="server" >First Name:</asp:Label><br /> <asp:Label ID="lbl1_LName" Cssclass="LabelStyleMULI" runat="server" >Last Name:</asp:Label><br /> <asp:Label ID="lbl1_UserName" Cssclass="LabelStyleMULI" runat="server" >User Name:</asp:Label><br /> <asp:Label ID="lbl1_Password" Cssclass="LabelStyleMULI" runat="server" >Password:</asp:Label><br /> <asp:Label ID="lbl1_Address" Cssclass="LabelStyleMULI" runat="server" >Address:</asp:Label><br /> <asp:Label ID="lbl1_Email" Cssclass="LabelStyleMULI" runat="server" >Email:</asp:Label><br /> <asp:Label ID="lbl1_PhoneNumber" Cssclass="LabelStyleMULI" runat="server" >Phone Number:</asp:Label> </div> <!-- Allow user input into the textboxes --> <div class="flexTextBoxes"> <div id="FName"><asp:TextBox ID="txb_FName" Cssclass="BoxStyleMULI" placeholder="First Name" runat ="server" required ="required" ></asp:TextBox><br /></div> <div id="LName"><asp:TextBox ID="txb_LName" Cssclass="BoxStyleMULI" placeholder="Last Name" runat ="server" required ="required" ></asp:TextBox><br /></div> <div id="UName"><asp:TextBox ID="txb_UserName" Cssclass="BoxStyleMULI" placeholder="User Name" runat ="server" required ="required" ></asp:TextBox><br /></div> <div id="Pword"><asp:TextBox ID="txb_Password" Cssclass="BoxStyleMULI" placeholder="Password" runat ="server" required ="true" ></asp:TextBox><br /></div> <div id="Address"><asp:TextBox ID="txb_Address" Cssclass="BoxStyleMULI" placeholder="Address" runat ="server" required ="required" ></asp:TextBox><br /></div> <div id="Email"><asp:TextBox ID="txb_Email" Csstype="email" Cssclass="BoxStyleMULI" placeholder="Email" runat ="server" required ="required" ></asp:TextBox><br /></div> <div id="PNumber"><asp:TextBox ID="txb_PhoneNumber" Cssclass="BoxStyleMULI" placeholder="Phone Number" runat ="server" required ="required" ></asp:TextBox></div> </div> </div> <!-- User submits the input to the next page --> <asp:Button ID="submitButton" Cssclass="submitButton" runat="server" Text ="Submit" OnClientClick="form.target ='_blank';" PostBackUrl="~/userManagement/ShowUserLogInInfo.aspx" /> </fieldset> </form> </asp:Content> Create User Log-In ASPX (HTML) Page 8
  • 9. <%@ Page Title="Show Log-In" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="ShowUserLogInInfo.aspx.cs" Inherits="PCPartsSuperStore.userManagement.ShowUserLogInInfo" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="cpd_Main" runat="server"> <form id="formSULII" runat="server"> <fieldset class="fieldset1SULII"> <legend class="legendSULII">Newly Created Log-In Data</legend> <!-- Labels to display the hard coded text using flexbox side by side again --> <div class="flexLabelsWrapper"> <div class="flexTextLabels"> <asp:Label ID="lbl_FName" CSSclass="TextLabelsSULII" runat="server" >First Name:</asp:Label><br /> <asp:Label ID="lbl_LName" CSSclass="TextLabelsSULII" runat="server" >Last Name:</asp:Label><br /> <asp:Label ID="lbl_UserName" CSSclass="TextLabelsSULII" runat="server" >User Name:</asp:Label><br /> <asp:Label ID="lbl_Password" CSSclass="TextLabelsSULII" runat="server" >Password:</asp:Label><br /> <asp:Label ID="lbl_Address" CSSclass="TextLabelsSULII" runat="server" >Address:</asp:Label><br /> <asp:Label ID="lbl_Email" CSSclass="TextLabelsSULII" runat="server" >Email:</asp:Label><br /> <asp:Label ID="lbl_PhoneNumber" CSSclass="TextLabelsSULII" runat="server" >Phone Number:</asp:Label> </div> <!-- Use label ID to display the information being passed, Display in the label --> <div class="flexPassedText"> <asp:Label ID="lbl2_fName" Cssclass="ResultTextStyleSULII" runat="server" ></asp:Label><br /> <asp:Label ID="lbl2_LName" Cssclass="ResultTextStyleSULII" runat="server" ></asp:Label><br /> <asp:Label ID="lbl2_UserName" Cssclass="ResultTextStyleSULII" runat="server" ></asp:Label><br /> <asp:Label ID="lbl2_Password" Cssclass="ResultTextStyleSULII" runat="server" ></asp:Label><br /> <asp:Label ID="lbl2_Address" Cssclass="ResultTextStyleSULII" runat="server" ></asp:Label><br /> <asp:Label ID="lbl2_Email" Cssclass="ResultTextStyleSULII" runat="server" ></asp:Label><br /> <asp:Label ID="lbl2_PhoneNumber" Cssclass="ResultTextStyleSULII" runat="server" ></asp:Label><br /> </div> </div> </fieldset> <fieldset class="fieldset2SULII"> <legend class="legendSULII">Capture Row ID</legend> <asp:Label ID="lbl_Identity" Cssclass="ResultTextStyleSULII" runat="server" ></asp:Label><br /> <asp:HyperLink ID="UpdateLogIn" runat="server" Target="_blank" NavigateUrl="~/userManagement/UpdateUserLogIn.aspx"> Update User Info</asp:HyperLink> </fieldset> </form> </asp:Content> Show User Log-In ASPX (HTML) Page 9
  • 10. using System; using System.Configuration; using System.Data.SqlClient; namespace PCPartsSuperStore.userManagement { public partial class ShowUserLogInInfo : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //Pass the information from the text box to the variable. string fName = Request.Form["ctl00$cpd_Main$txb_FName"]; string lName = Request.Form["ctl00$cpd_Main$txb_LName"]; string uName = Request.Form["ctl00$cpd_Main$txb_UserName"]; string pWord = Request.Form["ctl00$cpd_Main$txb_Password"]; string address = Request.Form["ctl00$cpd_Main$txb_Address"]; string email = Request.Form["ctl00$cpd_Main$txb_Email"]; string phone = Request.Form["ctl00$cpd_Main$txb_PhoneNumber"]; //Note: Request.Form["ctl00$cpd_main$txtBox"] instead of Request.Form["txtBox"] because of Master Page. //Define the label object to display what is in the variable. lbl2_fName.Text = fName; lbl2_LName.Text = lName; lbl2_UserName.Text = uName; lbl2_Password.Text = pWord; lbl2_Address.Text = address; lbl2_Email.Text = email; lbl2_PhoneNumber.Text = phone; /*1. Open a connection using the connection string in the Web.config file under AppSettings.*/ string connStr = ConfigurationManager.AppSettings["connectionString"]; SqlConnection conn = new SqlConnection(connStr); conn.Open(); /* 2. Create a command that inserts the data into the SQL Database using variables with values that shows as text in the labels.*/ string query = ("INSERT INTO [dbo].[person]([firstName],[lastName],[userName]" + ",[password],[address],[email],[phone]) VALUES (" + " '" + fName + "'," + " '" + lName + "'," + " '" + uName + "'," + " '" + pWord + "'," + " '" + address + "'," + " '" + email + "'," + " '" + phone + "') SELECT SCOPE_IDENTITY(); "); SqlCommand cmd = new SqlCommand(query); cmd.CommandType = System.Data.CommandType.Text; cmd.Connection = conn; /* 3. Create a reader to read back the identity information, then close the connection after reading the column id into a variable.*/ SqlDataReader reader = cmd.ExecuteReader(); reader.Read(); string id = reader[0].ToString(); conn.Close(); //Take the id value and place it into text inside the label. lbl_Identity.Text = "Dataset Created, Line ID: " + "<span>" + id + "</span>"; //Pass the Session Variable to the UpdateLogIn Page (Third Page). Session["userID"] = id; } } } Show User Log-In (C#) Page 10
  • 11. <%@ Page Title="Update Log-In" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="UpdateUserLogIn.aspx.cs" Inherits="PCPartsSuperStore.userManagement.UpdateUserLogIn" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="cpd_Main" runat="server"> <form id="formUULI" class="form" method="post" action="SecondPage.aspx" runat="server" defaultfocus="txbUpD_FName"> <!-- Display objects for input/output --> <asp:Label ID="lbl_Directions" Cssclass="LabelStyleUULI" runat="server" >Please put in a new "User Name" and "Email":</asp:Label><br /> <fieldset ID="fieldsetUULI"> <legend id="legendUULI" class="legendUULI">Update Log-In Information</legend> <!-- flexbox both the textbox and labels together side by side --> <div class="flexTBoxesWrapper"> <div class="flexText"> <asp:Label ID="lbl1_FName" Cssclass="LabelStyleUULI" runat="server" >First Name:</asp:Label><br /> <asp:Label ID="lbl1_LName" Cssclass="LabelStyleUULI" runat="server" >Last Name:</asp:Label><br /> <asp:Label ID="lbl1_UserName" Cssclass="LabelStyleUULI" runat="server" >User Name:</asp:Label><br /> <asp:Label ID="lbl1_Password" Cssclass="LabelStyleUULI" runat="server" >Password:</asp:Label><br /> <asp:Label ID="lbl1_Address" Cssclass="LabelStyleUULI" runat="server" >Address:</asp:Label><br /> <asp:Label ID="lbl1_Email" Cssclass="LabelStyleUULI" runat="server" >Email:</asp:Label><br /> <asp:Label ID="lbl1_PhoneNumber" Cssclass="LabelStyleUULI" runat="server" >Phone Number:</asp:Label> </div> <!-- Allow user input into the textboxes --> <div class="flexTextBoxes"> <div id="FName"><asp:TextBox ID="txbUpD_FName" Cssclass="BoxStyleUULI" placeholder="First Name" runat ="server" required ="required" ></asp:TextBox><br /></div> <div id="LName"><asp:TextBox ID="txbUpD_LName" Cssclass="BoxStyleUULI" placeholder="Last Name" runat ="server" required ="required" ></asp:TextBox><br /></div> <div id="UName"><asp:TextBox ID="txbUpD_UserName" Cssclass="BoxStyleUULI" placeholder="User Name" runat ="server" required ="required" ></asp:TextBox><br /></div> <div id="Pword"><asp:TextBox ID="txbUpD_Password" Cssclass="BoxStyleUULI" placeholder="Password" runat ="server" required ="true" ></asp:TextBox><br /></div> <div id="Address"><asp:TextBox ID="txbUpD_Address" Cssclass="BoxStyleUULI" placeholder="Address" runat ="server" required ="required" ></asp:TextBox><br /></div> <div id="Email"><asp:TextBox ID="txbUpD_Email" Csstype="email" Cssclass="BoxStyleUULI" placeholder="Email" runat ="server" required ="required" ></asp:TextBox><br /></div> <div id="PNumber"><asp:TextBox ID="txbUpD_PhoneNumber" Cssclass="BoxStyleUULI" placeholder="Phone Number" runat ="server" required ="required" ></asp:TextBox></div> </div> </div> <!-- User submits the input to the next page --> <asp:Button ID="submitButton" Cssclass="submitButton" runat="server" Text ="Submit" OnClientClick="form.target ='_blank';" PostBackUrl="~/userManagement/UserUpdatedShowInfo.aspx" /> </fieldset> </form> </asp:Content> Update Log-In ASPX (HTML) Page 11
  • 12. using System; using System.Configuration; using System.Data.SqlClient; namespace PCPartsSuperStore.userManagement { public partial class UpdateUserLogIn : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { /*1. Get the Session User ID.*/ string id = Session["userID"].ToString(); /*2. Open a connection using the connection string in the Web.config file under AppSettings.*/ string connStr = ConfigurationManager.AppSettings["connectionString"]; SqlConnection conn = new SqlConnection(connStr); conn.Open(); /* 3. Create a command that Selects all the data from the id row SQL Database using the where clause in showing what row to select by using what is stored in the id variable.*/ string query = "SELECT * FROM [dbo].[person] WHERE id = " + id; SqlCommand cmd = new SqlCommand(query); cmd.CommandType = System.Data.CommandType.Text; cmd.Connection = conn; /* 4 Create a reader to read the line in the SQL database into the text boxes*/ SqlDataReader reader = cmd.ExecuteReader(); reader.Read(); /* 5. Show the info in the textboxes that need updating.*/ string fName = reader["firstName"].ToString(); string lName = reader["lastName"].ToString(); string uName = reader["userName"].ToString(); string pWord = reader["password"].ToString(); string address = reader["address"].ToString(); string email = reader["email"].ToString(); string phone = reader["phone"].ToString(); // 6. Close the connection. conn.Close(); // 7. Show the variable information inside the text boxes. txbUpD_FName.Text = fName; txbUpD_LName.Text = lName; txbUpD_UserName.Text = uName; txbUpD_Password.Text = pWord; txbUpD_Address.Text = address; txbUpD_Email.Text = email; txbUpD_PhoneNumber.Text = phone; } } } } Update Log-In (C#) Page 12
  • 13. <%@ Page Title="Updated Log-In Info" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="UserUpdatedShowInfo.aspx.cs" Inherits="PCPartsSuperStore.userManagement.UserUpdatedShowInfo" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="cpd_Main" runat="server"> <form id="formUUSI" class="form" runat="server"> <fieldset id="fieldset1UUSI" class="fieldset1UUSI"> <legend id="legend1UUSI" class="legendUUSI">Show Updated Log-In Information</legend> <!-- Labels to display the hard coded text using flexbox side by side again --> <div class="flexLabelsWrapper"> <div class="flexTextLabels"> <asp:Label ID="lbl2_FName" CSSclass="TextLabelsUUSI" runat="server" >First Name:</asp:Label><br /> <asp:Label ID="lbl2_LName" CSSclass="TextLabelsUUSI" runat="server" >Last Name:</asp:Label><br /> <asp:Label ID="lbl2_UserName" CSSclass="TextLabelsUUSI" runat="server" >User Name:</asp:Label><br /> <asp:Label ID="lbl2_Password" CSSclass="TextLabelsUUSI" runat="server" >Password:</asp:Label><br /> <asp:Label ID="lbl2_Address" CSSclass="TextLabelsUUSI" runat="server" >Address:</asp:Label><br /> <asp:Label ID="lbl2_Email" CSSclass="TextLabelsUUSI" runat="server" >Email:</asp:Label><br /> <asp:Label ID="lbl2_PhoneNumber" CSSclass="TextLabelsUUSI" runat="server" >Phone Number:</asp:Label> </div> <!-- Use label ID to display the information being passed, Display in the label --> <div class="flexPassedText"> <asp:Label ID="lbl_fName" Cssclass="ResultTextStyleUUSI" runat="server" ></asp:Label><br /> <asp:Label ID="lbl_LName" Cssclass="ResultTextStyleUUSI" runat="server" ></asp:Label><br /> <asp:Label ID="lbl_UserName" Cssclass="ResultTextStyleUUSI" runat="server" ></asp:Label><br /> <asp:Label ID="lbl_Password" Cssclass="ResultTextStyleUUSI" runat="server" ></asp:Label><br /> <asp:Label ID="lbl_Address" Cssclass="ResultTextStyleUUSI" runat="server" ></asp:Label><br /> <asp:Label ID="lbl_Email" Cssclass="ResultTextStyleUUSI" runat="server" ></asp:Label><br /> <asp:Label ID="lbl_PhoneNumber" Cssclass="ResultTextStyleUUSI" runat="server" ></asp:Label><br /> </div> </div> </fieldset> <fieldset id="fieldset2UUSI" class="fieldset2UUSI"> <legend id="legend2UUSI" class="legendUUSI">Capture Row ID</legend> <asp:Label ID="lbl_Identity" Cssclass="ResultTextStyleUUSI" runat="server" ></asp:Label><br /> </fieldset> </form> </asp:Content> Updated Log-In Info ASPX (HTML) Page 13
  • 14. using System; using System.Configuration; using System.Data.SqlClient; namespace PCPartsSuperStore.userManagement { public partial class UserUpdatedShowInfo : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //Create the Variable for the Session. string id = Session["userID"].ToString(); //Pass the information from the text box to the variable. string strfName = Request.Form["ctl00$cpd_Main$txbUpD_FName"]; string strlName = Request.Form["ctl00$cpd_Main$txbUpD_LName"]; string struName = Request.Form["ctl00$cpd_Main$txbUpD_UserName"]; string strpWord = Request.Form["ctl00$cpd_Main$txbUpD_Password"]; string strAddress = Request.Form["ctl00$cpd_Main$txbUpD_Address"]; string strEmail = Request.Form["ctl00$cpd_Main$txbUpD_Email"]; string strPhone = Request.Form["ctl00$cpd_Main$txbUpD_PhoneNumber"]; //Define the label object to display what is in the variable. lbl_fName.Text = strfName; lbl_LName.Text = strlName; lbl_UserName.Text = struName; lbl_Password.Text = strpWord; lbl_Address.Text = strAddress; lbl_Email.Text = strEmail; lbl_PhoneNumber.Text = strPhone; /*1. Open a connection using the connection string in the Web.config file under AppSettings.*/ string connStr = ConfigurationManager.AppSettings["connectionString"]; SqlConnection conn = new SqlConnection(connStr); conn.Open(); /* 2. Create a command that updates the data into the SQL Database using variables with values that shows as text in the labels.*/ string query = "UPDATE [dbo].[person] SET" + "[firstName]= '" + strfName + "'," + "[lastName]= '" + strlName + "'," + "[userName]= '" + struName + "'," + "[password]= '" + strpWord + "'," + "[address]= '" + strAddress + "'," + "[email]= '" + strEmail + "'," + "[phone]= '" + strPhone + "' WHERE id =" + id; SqlCommand cmd = new SqlCommand(query); cmd.CommandType = System.Data.CommandType.Text; cmd.Connection = conn; /* 3. Create a reader to read back the identity information, then close the connection after reading the column id into a variable.*/ SqlDataReader reader = cmd.ExecuteReader(); reader.Read(); conn.Close(); //Take the id value and place it into text inside the label. lbl_Identity.Text = "Dataset Updated, Line ID: " + "<spanUUSI>" + id + "</spanUUSI>"; } } } Updated Log-In Info (C#) Page 14
  • 15. <%@ Page Title="Create Products" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="newProduct.aspx.cs" Inherits="PCPartsSuperStore.productManagement.newProduct" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"></asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="cpd_Main" runat="server"> <asp:HyperLink ID="UpdateUserInfo" Cssclass="UpdateUserInfoNP" runat="server" Target="_blank" NavigateUrl="~/userManagement/UpdateUserLogIn.aspx" >Update Log-In</asp:HyperLink> <form id="formNP" class="form" method="post" runat="server" defaultfocus="txb_prodName" > <!-- Display objects for input/output --> <fieldset id="fieldset1NP" class="fieldset1NP"> <legend id="legendNP" class="legendNP">Create New Product</legend> <!-- flexbox both the textbox and labels together side by side --> <div class="flexTBoxesWrapper"> <div class="flexText"> <asp:Label ID="lbl1_prodName" Cssclass="LabelStyleNP" runat="server" >Product Name:</asp:Label><br /> <asp:Label ID="lbl1_prodDesc" Cssclass="LabelStyleNP" runat="server" >Product Description:</asp:Label><br /> <asp:Label ID="lbl1_prodPrice" Cssclass="LabelStyleNP" runat="server" >Product Price:</asp:Label><br /> <asp:Label ID="lbl1_prodAmount" Cssclass="LabelStyleNP" runat="server" >Product Amount:</asp:Label> </div> <!-- Allow user input into the textboxes and validate as needed. --> <div class="flexTextBoxes"> <div id="pName"><asp:TextBox ID="txb_prodName" Cssclass="BoxStyleNP" placeholder="Product Name" runat ="server" required ="required" ></asp:TextBox><br /></div> <div id="pDesc"><asp:TextBox ID="txb_prodDesc" Cssclass="BoxStyleNP" placeholder="Product Description" runat ="server" required ="required" ></asp:TextBox><br /></div> <div id="pPrice"><asp:TextBox ID="txb_prodPrice" Cssclass="BoxStyleNP" placeholder="Product Price" runat ="server" required ="required" ></asp:TextBox> <asp:RegularExpressionValidator runat="server" ControlToValidate="txb_prodPrice" ErrorMessage="*Not a valid price!" ValidationExpression="[+]?([.]d+|d+([.]d+)?)$" ></asp:RegularExpressionValidator> <br /> </div> <div id="pAmount"> <asp:TextBox ID="txb_prodAmount" Cssclass="BoxStyleNP" placeholder="Product Amount" runat ="server" required ="true" ></asp:TextBox> <asp:RegularExpressionValidator runat="server" ControlToValidate="txb_prodAmount" ErrorMessage="*Only positive numbers!" ValidationExpression="^[1-9]d*$" ></asp:RegularExpressionValidator> </div> </div> </div><br /> <asp:Label ID="lbl_Identity" Cssclass="ResultTextStyleNP" runat="server" ></asp:Label><br /> <!-- User submits the input to the next page --> <asp:Button ID="submitButton" Cssclass="submitButton" runat="server" Text ="Submit" OnClick="submitButton_Click" PostBackUrl="~/productManagement/newProduct.aspx"/> </fieldset> </form> </asp:Content> Create Products ASPX (HTML) Page 15
  • 16. using System; using System.Configuration; using System.Data.SqlClient; namespace PCPartsSuperStore.productManagement { public partial class newProduct : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //Check if the user is logged in. if (Session["userID"] == null) { Response.Redirect("~/index.aspx"); } } protected void submitButton_Click(object sender, System.EventArgs e) { //Get the values from the user's product input boxes. string prodName = txb_prodName.Text; string prodDesc = txb_prodDesc.Text; string prodPrice = txb_prodPrice.Text; string prodAmount = txb_prodAmount.Text; /*1. Open a connection using the connection string in the Web.config file under AppSettings.*/ string connStr = ConfigurationManager.AppSettings["connectionString"]; SqlConnection conn = new SqlConnection(connStr); conn.Open(); //Create a query. /* 2. Create a command that inserts the data into the SQL Database using variables with values that shows as text in the labels.*/ string query = ("INSERT INTO [dbo].[products]([productName],[description],[price]" + ",[currentAmount]) VALUES (" + " '" + prodName + "'," + " '" + prodDesc + "'," + " '" + prodPrice + "'," + " '" + prodAmount + "') SELECT SCOPE_IDENTITY(); "); SqlCommand cmd = new SqlCommand(query); cmd.CommandType = System.Data.CommandType.Text; cmd.Connection = conn; /* 3. Create a reader to read back the identity information, then close the connection after reading the column id into a variable.*/ SqlDataReader reader = cmd.ExecuteReader(); reader.Read(); string pid = reader[0].ToString(); conn.Close(); //Take the id value and place it into text inside the label. lbl_Identity.Text = "Product: " + prodName + " created, Line ID: " + "<span>" + pid + "</span>"; //Clear the text boxes for the next input. txb_prodName.Text = ""; txb_prodDesc.Text = ""; txb_prodPrice.Text = ""; txb_prodAmount.Text = ""; } } } Create Products (C#) Page 16
  • 17. <%@ Page Title="Available Products" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="showAllProducts.aspx.cs" Inherits="PCPartsSuperStore.shopping.showAllProducts" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="cpd_Main" runat="server"> <asp:HyperLink ID="UpdateUserInfo" Cssclass="UpdateUserInfoAP" runat="server" Target="_blank" NavigateUrl="~/userManagement/UpdateUserLogIn.aspx" >Update Log-In</asp:HyperLink> <form id="formSAP" class="formSAP" method="post" runat="server" defaultfocus="prodName" > <!-- Display objects for input/output --> <fieldset id="fieldsetSAP" class="fieldsetSAP"> <legend id="legendSAP" class="legendSAP">Add Products to Shopping Cart</legend> <!-- Show the table content --> <div class="div_products" runat="server"> <asp:Label ID="div_products" Cssclass="ResultTextStyleSAP" runat="server" ></asp:Label><br /> </div> <asp:Table runat="server" ID="tbl_Products"> <asp:TableRow> <asp:TableCell CssClass="headCells">Product</asp:TableCell> <asp:TableCell CssClass="headCellDesc">Description</asp:TableCell> <asp:TableCell CssClass="headCells">Price</asp:TableCell> <asp:TableCell CssClass="headCellBuyIt">Buy it</asp:TableCell> </asp:TableRow> </asp:Table> </fieldset> </form> </asp:Content> using System; using System.Configuration; using System.Data.SqlClient; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; namespace PCPartsSuperStore.shopping { public partial class showAllProducts : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //Check if the user is logged in. if (Session["userID"] == null) { Response.Redirect("~/index.aspx"); } UpdateUserInfo.Visible = true; /*1. Open a connection using the connection string in the Web.config file under AppSettings.*/ string connStr = ConfigurationManager.AppSettings["connectionString"]; SqlConnection conn = new SqlConnection(connStr); conn.Open(); Show All Products ASPX (HTML) Page 17
  • 18. /* 2. Create a query that selects all the data from the SQL Database.*/ string query = ("SELECT * FROM [dbo].[products] WHERE currentAmount > 0"); SqlCommand cmd = new SqlCommand(query); cmd.CommandType = System.Data.CommandType.Text; cmd.Connection = conn; //Read from the Database all the data. SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { string prodID = reader["pid"].ToString(); string prodName = reader["productName"].ToString(); string prodDesc = reader["description"].ToString(); string prodPrice = reader["price"].ToString(); //Create a table row. TableRow tRow = new TableRow(); //Create a cell for the product name. TableCell tcProdName = new TableCell(); tcProdName.Attributes.Add("class", "cells"); tcProdName.Text = prodName; tRow.Cells.Add(tcProdName); //Create a cell for Description. TableCell tcProdDesc = new TableCell(); tcProdDesc.Attributes.Add("class", "cells"); tcProdDesc.Text = prodDesc; tRow.Cells.Add(tcProdDesc); //Create a cell for Price. TableCell tcProdPrice = new TableCell(); tcProdPrice.Attributes.Add("class", "cells"); tcProdPrice.Text = "$" + prodPrice; tRow.Cells.Add(tcProdPrice); //Create a link. HtmlAnchor link = new HtmlAnchor(); link.Attributes.Add("class", "cells"); link.HRef = "~/shopping/oneClickBuy.aspx?id=" + prodID; link.InnerText = "OneClick Buy"; //Create a cell for Links. TableCell tcBuy = new TableCell(); tcBuy.Attributes.Add("class", "cells"); tcBuy.Controls.Add(link); tRow.Cells.Add(tcBuy); //Add the Row to the Table. tbl_Products.Rows.Add(tRow); } //Close the connection. conn.Close(); } } } Show All Products (C#) Page 18
  • 19. <%@ Page Title="One Click Buy" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="oneClickBuy.aspx.cs" Inherits="PCPartsSuperStore.shopping.oneClickBuy" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"></asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="cpd_Main" runat="server"> <asp:HyperLink ID="UpdateUserInfoOCB" Cssclass="UpdateUserInfoOCB" runat="server" Target="_blank" NavigateUrl="~/userManagement/UpdateUserLogIn.aspx" >Update Log-In</asp:HyperLink> <form id="formOCB" class="form" method="post" runat="server" defaultfocus="prodName" > <!-- Display objects for input/output --> <fieldset class="fieldsetOCB"> <legend id="legendOCB">Thank You for Purchasing</legend> <!-- Show the Thank You Message in the div. --> <div id="div_purchase" runat="server"> </div> </fieldset> <asp:Button ID="submitButton" Cssclass="submitButton" runat="server" Text ="Email Receipt" OnClientClick="form.target ='_blank';" PostBackUrl="~/WebEmail/WebMail.aspx" /> </form> </asp:Content> using System; using System.Configuration; using System.Data.SqlClient; namespace PCPartsSuperStore.shopping { public partial class oneClickBuy : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //Check if the user is logged in. if (Session["userID"] == null) { Response.Redirect("~/index.aspx"); } //Pass the Session userID to id when querying for the user. string id = Session["userID"].ToString(); //Allow the user to update their info. UpdateUserInfoOCB.Visible = true; //Get the product from the query string. string productID = Request.QueryString["id"].ToString(); /*1. Open a connection using the connection string in the Web.config file under AppSettings.*/ string connStr = ConfigurationManager.AppSettings["connectionString"]; SqlConnection conn = new SqlConnection(connStr); conn.Open(); One Click Buy ASPX (HTML) One Click Buy (C#) Page 19
  • 20. /*2. Get the product information using a query string.*/ string query = ("SELECT * FROM [dbo].[products] WHERE pid =" + productID); SqlCommand cmd = new SqlCommand(query); cmd.CommandType = System.Data.CommandType.Text; cmd.Connection = conn; /*3. Read from the Database the Product Name and Product Price data that you selected in the query with the pid that was filtered after opening the new defined reader. Then close the reader to re-use it again.*/ SqlDataReader reader = cmd.ExecuteReader(); reader.Read(); string prodName = reader["productName"].ToString(); string prodPrice = reader["price"].ToString(); reader.Close(); /*4. Create a query with the user's First Name and Address based on the user already logged on. Then execute and read the reader once again from the database. After that close the reader. Note: Do Not Close the Connection (Connection still open).*/ cmd.CommandText = "SELECT * FROM person WHERE id =" +id; reader = cmd.ExecuteReader(); reader.Read(); string custName = reader["firstName"].ToString(); string custAddress = reader["address"].ToString(); string custEmail = reader["email"].ToString(); reader.Close(); /*5. Decrease the product from the selected pid (Product ID). Then Close the Connection and display the thank you message.*/ cmd.CommandText = "UPDATE products SET currentAmount = (currentAmount-1)" + " where pid =" + productID; cmd.ExecuteNonQuery(); conn.Close(); //create a sesssion with info for emailing the customer. Session["custName"] = custName; Session["prodName"] = prodName; Session["prodPrice"] = prodPrice; Session["custAddress"] = custAddress; //Send the customer's email info to the WebMail page. Session["email"] = custEmail; //Say thank you message and let the customer know about your interest in their purchase. div_purchase.InnerHtml = "Hi <spanOCB><b>" + custName + "</b></spanOCB>," + "<br/>Thank's for buying a <spanOCB><b>" + prodName + "</b></spanOCB>. Your " + "credit card will be charged <spanOCB><b>$" + prodPrice + "</b></spanOCB> and your" + " purchase will be shipped to <spanOCB><b>" + custAddress + "</b></spanOCB>." + " Thanks for shopping with us. Come back soon. We like your money."; } } } One Click Buy (C# Continued) Page 20
  • 21. <%@ Page Title="Email Customer" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="WebMail.aspx.cs" Inherits="PCPartsSuperStore.WebEmail.WebMail1" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="cpd_Main" runat="server"> <form id="formWebMail" class="formWebMail" method="post" runat="server" defaultfocus="prodName" > <fieldset class="WebMailHeader"> <legend class="legendWM">Please check your email:</legend> <!-- Wrap the labels together --> <div class="flexLabelsWrapper"> <div id="lbl_Email"> <asp:Label ID="lbl_WMText" CSSclass="lbl_WMText" runat="server" >Email Address:</asp:Label> </div> <div id="EmailAddress" class="EmailAddress" runat="server"> <asp:Label ID="lbl_WMAddress" CSSclass="WMAddress" runat="server" ></asp:Label> </div> </div> </fieldset> <!-- Display objects for input/output --> <fieldset class="fieldsetWebMail"> <legend id="legendWM" class="legendWM">Your reciept has been sent.</legend> <!-- Show the Thank You Message in the div. --> <div id="div_purchase" runat="server"> </div> </fieldset> </form> </asp:Content> using System; using System.Net; using System.Net.Mail; namespace PCPartsSuperStore.WebEmail { public partial class WebMail1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //Check if the user is logged in. if (Session["userID"] == null) { Response.Redirect("~/index.aspx"); } /*1. Get the Session variables to display what is in the email.*/ string custName = (string)Session["custName"]; string prodName = (string)Session["prodName"]; string prodPrice = (string)Session["prodPrice"]; string custAddress = (string)Session["custAddress"]; Email Customer ASPX (HTML) Email Customer (C#) Page 21
  • 22. /***************************************************************/ /***** Automatically gets the "to" email from the database *****/ /***************************************************************/ //Note: Database email must be a true email address in sending. /*2. Get the Session variable for the customer email and display it in the label. Then use the text in the label to send to the customer.*/ string custEmail = (string)Session["email"]; lbl_WMAddress.Text = custEmail.ToString(); /*3. Define the header of the email being sent.*/ string subject = "Thank you for shopping! (Test Email)"; /*4. Use what is in the label as an email address of the user's email as a string and then define the body (message). */ string to = lbl_WMAddress.Text; /***************************************************************/ /***************************************************************/ //Display what will be in the body of the email. string body = "Hi <b>" + custName + "</ b >, <br/>Thank's for "+ "buying a <spanOCB><b>" + prodName + "</b></spanOCB>. Your credit card will be "+ "charged <spanOCB><b>$" + prodPrice + "</b></spanOCB> and your purchase will be shipped"+ " to <spanOCB><b>" + custAddress + "</b></spanOCB>."+ " Thanks for shopping with us. Come back soon. We like your money."; /*5. Create a MailMessage object.*/ MailMessage mail = new MailMessage(); /***************************************************************/ /************************* Sender's Email **********************/ /***************************************************************/ /*6. Define what email address with password your sending from. (Your own gmail credentials).*/ string senderEmail = "sender@gmail.com"; string senderPasswd = "sendersgmailpassword"; // a valid password for the email above*/ /***************************************************************/ /***************************************************************/ /*7. Define the objects of the email and link them to the variables as objects.*/ mail.From = new MailAddress(senderEmail); mail.To.Add(to.ToString()); mail.Subject = subject; mail.Body = body; /*8. Allows HTML in the body.*/ mail.IsBodyHtml = true; //Note: Code to add attachements, but not needed in this case(reference). //mail.Attachments.Add(new Attachment("C:someFile.jpg")); /*9. SMTP Client for gmail only. Other emails will have different SMTP Client port numbers.*/ SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587); //Port 587 Email Customer (C# Continued) Page 22
  • 23. /*10. Set the credentials and secure socket link.*/ smtp.Credentials = new NetworkCredential(senderEmail, senderPasswd); smtp.EnableSsl = true; /*11. Sends the email.*/ smtp.Send(mail); /*12. Display another message with the variables.*/ div_purchase.InnerHtml = "Hi <spanOCB><b>" + custName + "</b></spanOCB>," + "<br/>Thank's for buying a <spanOCB><b>" + prodName + "</b></spanOCB>. Your " + "credit card will be charged <spanOCB><b>$" + prodPrice + "</b></spanOCB> and your" + " purchase will be shipped to <spanOCB><b>" + custAddress + "</b></spanOCB>." + " Please check your email:<spanOCB><b> " + custEmail + " </spanOCB></b>for the receipt!"; } } } /****************************WebEMail**************************/ .WMAddress { margin-left: 5px; } .fieldsetWebMail { border-radius: 5px; width: 585px; height: auto; color: black; font-size: 21px; } .legendWM { font-size: 24px; color: darkgreen; font-weight: bold; } .formWebMail { background-color: #FAF0E6; font-family: Calibri, San-Serif, Helvetica; width: 625px; height: auto; border: 3px solid rgba(255,255,255,.8); border-style: outset; border-radius: 25px; margin: 25px auto; padding: 25px; } /****************************newProduct*************************/ #lbl1_prodDesc { position: relative; margin-right: 5px; } .UpdateUserInfoNP { position: absolute; font-size: 24px; margin-left: -155px; margin-top: 380px; color: darkblue; } .UpdateUserInfoNP:visited { color:mediumorchid; } .BoxStyleNP { height: 21px; width: 225px; margin-top: 4px; margin-left: 5px; color: red; border-color: rgba(0,0,139,.9); } .BoxStyleNP:hover { box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.05) inset, 0px 0px 8px rgba(82, 168, 236, 0.6); } #fieldset1NP { border-radius: 5px; width: 715px; height: 230px; font-weight: bold; color: #4682B4; font-size: 21px; } .flexTBoxesWrapper { position: relative; display: inline-flex; } .LabelStyleNP { position: relative; font-size: 25px; color: #4682B4; } #formNP { background-color: #FAF0E6; font-family: Calibri, San-Serif, Helvetica; width: 755px; height: 258px; border: 3px solid rgba(255,255,255,.8); border-style: outset; border-radius: 25px; margin: 25px auto; padding: 25px; } MasterStyle (CSS Style Sheet) Page 23
  • 24. .legendNP { color: red; font-size: 25px; } span { color: darkblue; font-size: 25px; } .submitButton { position: relative; height: 28px; width: 125px; margin-top: 18px; margin-bottom: 8px; background: rgba(0,125,0,.9); margin-right: 20px; color: rgba(255,255,255,1); border-color: rgba(158,202,237,1); border-radius: 8px; box-shadow: 0 0 10px rgba(158,202,237,1); outline: none; cursor: pointer; } /**************************OneClickBuy*************************/ .UpdateUserInfoOCB { position: absolute; font-size: 24px; margin-left: -155px; margin-top: 380px; color: darkblue; } .UpdateUserInfoOCB:visited { color:mediumorchid; } .fieldsetOCB { border-radius: 5px; width: 585px; height: auto; color: black; font-size: 21px; } #legendOCB { font-size: 24px; color: darkgreen; font-weight: bold; } #formOCB { background-color: #FAF0E6; font-family: Calibri, San-Serif, Helvetica; width: 625px; height: auto; border: 3px solid rgba(255,255,255,.8); border-style: outset; border-radius: 25px; margin: 25px auto; padding: 25px; } spanOCB { font-size: 24px; color: cornflowerblue; font-weight: bold; } /*****************************showAllProducts*******************/ .UpdateUserInfoAP { position: absolute; font-size: 24px; margin-left: -155px; margin-top: 380px; color: darkblue; } .UpdateUserInfoAP:visited { color: mediumorchid; } #fieldsetSAP { border-radius: 5px; width: 785px; height: auto; font-weight: bold; color: #4682B4; font-size: 21px; } #formSAP { background-color: #FAF0E6; font-family: Calibri, San-Serif, Helvetica; width: 825px; height: auto; border: 3px solid rgba(255,255,255,.8); border-style: outset; border-radius: 25px; margin: 25px auto; padding: 25px; } .headCells { border: 1px solid white; background-color: darkolivegreen; color: darkseagreen; text-align: center; width: 150px; } .headCellDesc { border: 1px solid white; background-color: darkolivegreen; color: darkseagreen; text-align: center; width: 295px; } .headCellBuyIt { border: 1px solid white; background-color: darkolivegreen; color: darkseagreen; text-align: center; width: 165px; } .cells { border: 1px solid black; background-color: darkseagreen; padding: 10px; } .legendSAP { color: darkgreen; font-size: 25px; } Page 24
  • 25. /********************************ShowUserLogInInfo*************************/ .fieldset2SULII { border-radius: 5px; color: #4682B4; font-weight: bold; font-size: 21px; margin-left: 8px; width: 495px; } spanSULII { color: red; font-weight: bold; font-size: 21px; } .ResultTextStyleSULII { position: relative; color: red; } #lbl_Identity { color: #4682B4; } .fieldset1SULII { border-radius: 5px; width: 595px; height: 225px; font-weight: bold; color: #4682B4; font-size: 21px; margin-left: 8px; } #formSULII { background-color: #FAF0E6; font-family: Calibri, San-Serif, Helvetica; width: 645px; height: 365px; border: 3px solid rgba(255,255,255,.8); border-style: outset; border-radius: 25px; margin: 25px auto; padding: 50px;} .flexLabelsWrapper { position: relative; display: inline-flex; } .TextLabelsSULII { color: #4682B4; font-weight: bold; margin-right: 5px; } #lbl_PhoneNumber { margin-right: 5px;} .legendSULII { color: red; font-size: 25px; } .body { background-color: white; background-image: url('../img/X10DAX.png'); background-repeat: repeat; font-family: Calibri, San-Serif, Helvetica, Arial; } /******************************UserUpdatedShowInfo************************/ #fieldset2UUSI { border-radius: 5px; color: #4682B4; font-weight: bold; font-size: 21px; margin-left: 8px; width: 495px; } spanUUSI { color: red; font-weight: bold; font-size: 25px; } .ResultTextStyleUUSI { position: relative; color: red; font-size: 25px; margin-left: 25px; } #lbl_Identity { color: #4682B4; } #fieldset1UUSI { border-radius: 5px; width: 595px; height: 225px; font-weight: bold; color: #4682B4; font-size: 21px; margin-left: 8px; } #formUUSI { background-color: #FAF0E6; font-family: Calibri, San-Serif, Helvetica; width: 645px; height: 345px; border: 3px solid rgba(255,255,255,.8); border-style: outset; border-radius: 25px; margin: 25px auto; padding: 50px; } .flexLabelsWrapper { position: relative; display: inline-flex; } .TextLabelsUUSI { color: #4682B4; font-weight: bold; margin-right: 5px; } .legendUUSI { color: red; font-size: 25px; } Page 25
  • 26. body { background-color: white; background-repeat: repeat; font-family: Calibri, San-Serif, Helvetica, Arial; } /***************************UpdateUserLogIn**********************/ #lbl1_PhoneNumber { position: relative; margin-right: 5px; } .BoxStyleUULI { height: 21px; width: 265px; margin-top: 4px; color: red; border-color: rgba(0,0,139,.9); } .BoxStyleUULI:hover { box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.05) inset, 0px 0px 8px rgba(82, 168, 236, 0.6); } #fieldsetUULI { border-radius: 5px; width: 450px; height: 285px; font-weight: bold; color: #4682B4; font-size: 21px; margin-left: 8px; } .flexTBoxesWrapper { position: relative; display: inline-flex; } .LabelStyleUULI { position: relative; font-size: 25px; color: #4682B4; } #formUULI { background-color: #FAF0E6; font-family: Calibri, San-Serif, Helvetica; width: 500px; height: 345px; border: 3px solid rgba(255,255,255,.8); border-style: outset; border-radius: 25px; margin: 25px auto; padding: 50px;} #legendUULI { color: red; font-size: 25px; } /**************************MakeUserLogIn************************/ #lbl1_PhoneNumber { position: relative; margin-right: 5px; } .BoxStyleMULI { height: 21px; width: 265px; margin-top: 4px; color: red; border-color: rgba(0,0,139,.9); margin-left: 5px; } .BoxStyleMULI:hover { box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.05) inset, 0px 0px 8px rgba(82, 168, 236, 0.6); } .fieldsetMULI { border-radius: 5px; width: 450px; height: 285px; font-weight: bold; color: #4682B4; font-size: 21px; margin-left: 8px; } .flexTBoxesWrapper { position: relative; display: inline-flex; } .LabelStyleMULI { position: relative; font-size: 25px; color: #4682B4; } #formMULI { background-color: #FAF0E6; font-family: Calibri, San-Serif, Helvetica; width: 500px; height: 320px; border: 3px solid rgba(255,255,255,.8); border-style: outset; border-radius: 25px; margin: 25px auto; padding: 50px;} .LegendMULI { color: red; font-size: 25px; } /*************************Index*************************/ .BoxStyleLogIn { height: 21px; width: 125px; margin-top: 4px; color: red; border-color: rgba(0,0,139,.9); } #formLogIn { position: absolute; margin-top: 270px; } Page 26
  • 27. .BoxStyleLogIn:hover { box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.05) inset, 0px 0px 8px rgba(82, 168, 236, 0.6); } .SignInPos { position: relative; background-color: white; font-family: Calibri, San-Serif, Helvetica; padding-top: 8px; width: 135px; height: 115px; border-radius: 25px; padding-left: 5px; margin-left: 13px; border: solid; } .WelcomeUser { position: absolute; margin-left: 25px; font-size: 24px; color: darkblue; } spanIndex { color: cornflowerblue; } #formLogIn { position: absolute; } #txb_SignInUName { margin-bottom: 3px;} #txb_SignInPWord { margin-bottom: 5px; } .submitButtonLogIn { position: relative; height: 28px; width: 125px; margin-top: 18px; margin-bottom: 8px; background: rgba(0,125,0,.9); margin-right: 20px; color: rgba(255,255,255,1); border-color: rgba(158,202,237,1); border-radius: 8px; box-shadow: 0 0 10px rgba(158,202,237,1); outline: none; cursor: pointer; } /**********************BaseStyle**********************/ #header { border: solid; color: black; border-radius: 25px; height: 225px; background-image: url('../img/Header.png'); background-clip: border-box; } .LabelHeaderText { position: relative; color: white; font-size: 50px; font-weight: bold; } .SubHeaderTxt { position: relative; color: white; font-size: 36px; font-weight: bold; } .HeaderText { margin-top: 45px; text-shadow: 2px 2px #ff0000; } #newProducts { position: absolute; font-size: 24px; margin-left: 25px; margin-top: 45px; color: darkblue; font-size: 24px; cursor: pointer; } #newProducts:visited { color: mediumorchid; } #Products { position: absolute; font-size: 24px; margin-left: 25px; margin-top: 55px; color: darkblue; font-size: 24px; cursor: pointer; } #Products:visited { color: mediumorchid; } #Sale { position: absolute; font-size: 24px; margin-left: 25px; margin-top: 65px; color: darkblue; font-size: 24px; cursor: pointer;} #Featured { position: absolute; font-size: 24px; margin-left: 25px; margin-top: 75px; color: darkblue; font-size: 24px; cursor: pointer; } #Navigation { position: relative; float: left; border: solid; border-color: black; width: 175px; min-height: 605px; border-radius: 25px; background-color: darkgreen; } Page 27
  • 28. .SignUp { position: absolute; font-size: 24px; margin-left: -155px; margin-top: 405px; color: darkblue; } .SignUp:visited { color:mediumorchid; } .UpdateUserInfo { position: absolute; font-size: 24px; margin-left: -155px; margin-top: 405px; color: darkblue; } #footer { text-align: left; clear: both; padding-left: 65px; padding-bottom: 10px; height: 45px; color: white; border: solid; border-color: black; background-color: darkgreen; border-color: black; border-radius: 25px; background-clip: border-box; } .rights { float: right; padding-right: 65px; color: white; } a { color: darkblue; } .footerText { position: relative; } Page 28