More Related Content Similar to My project working well, but there no relationship between the t.docx (20) More from rosemarybdodson23141 (20) My project working well, but there no relationship between the t.docx1. My project working well, but there no relationship between the
tables of database because each table working alone
I want make relationship between them even that order to
change some
names of the tables and I want this relationship to work in the
project well
For example:
-From this table
-To this
Online Car Sales/EWAPP/AdminAddNewItem.aspx
<%@ Page Language="C#"
MasterPageFile="~/AdminMasterPage.master"
MaintainScrollPositionOnPostback="true"
AutoEventWireup="true"
CodeFile="AdminAddNewItem.aspx.cs" Inherits="AdminPage"
Title="OurShopping - Online Shopping Store" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head"
Runat="Server">
<style type="text/css">
.style9
4. Product's Description:
</p>
<p>
<asp:TextBox ID="txtProductDescription"
runat="server" Height="156px"
TextMode="MultiLine"
Width="375px"></asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator3" runat="server"
ControlToValidate="txtProductDescription"
ErrorMessage="Description is
Requierd">*</asp:RequiredFieldValidator>
<br __designer:mapid="da" />
<br __designer:mapid="db" />
Make:
<asp:DropDownList ID="dropCatInsert" runat="server"
DataSourceID="SqlDataSource2"
DataTextField="Category"
DataValueField="Category">
8. <asp:ListItem Value="Mini MPV">Mini MPV</asp:ListItem>
<asp:ListItem Value="Coupe">Coupe</asp:ListItem>
<asp:ListItem Value="Convertible">Convertible</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td width="300">Exterior Color</td>
<td>
<asp:DropDownList ID="ddlExteriorColor" runat="server">
<asp:ListItem Value="Red">Red</asp:ListItem>
<asp:ListItem Value="Blue">Blue</asp:ListItem>
<asp:ListItem Value="White">White</asp:ListItem>
<asp:ListItem Value="Black">Black</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
9. <tr>
<td width="300">Interior Color</td>
<td>
<asp:DropDownList ID="ddlInteriorColor" runat="server">
<asp:ListItem Value="Red">Red</asp:ListItem>
<asp:ListItem Value="Blue">Blue</asp:ListItem>
<asp:ListItem Value="White">White</asp:ListItem>
<asp:ListItem Value="Black">Black</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td width="300">Engine</td>
<td>
<asp:DropDownList ID="ddlEngine" runat="server">
<asp:ListItem Value="6 Cylinder">6 Cylinder</asp:ListItem>
10. <asp:ListItem Value="4 Cylinder">4 Cylinder</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td width="300">Drive Type</td>
<td>
<asp:DropDownList ID="ddlDriveType" runat="server">
<asp:ListItem Value="All Wheel Drive">All Wheel
Drive</asp:ListItem>
<asp:ListItem Value="Two Drive">Two Drive</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td width="300">Fuel</td>
11. <td>
<asp:DropDownList ID="ddlFuel" runat="server">
<asp:ListItem Value="Petrol">Petrol</asp:ListItem>
<asp:ListItem Value="Diesel">Diesel</asp:ListItem>
<asp:ListItem Value="Unleaded">Unleaded</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td width="300">Doors</td>
<td>
<asp:DropDownList ID="ddlDoors" runat="server">
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
</asp:DropDownList>
</td>
13. </p>
<p>
</p>
<hr />
<p>
<br __designer:mapid="167" />
Upload Product Full Size Image:
</p>
<p>
<asp:FileUpload ID="FileUpload1" runat="server"
ondatabinding="btnsaveProduct_Click" />
<asp:RequiredFieldValidator
ID="RequiredFieldValidator5" runat="server"
ControlToValidate="FileUpload1"
ErrorMessage="you must enter product
full size image">*</asp:RequiredFieldValidator>
<asp:Label ID="lblFullSizeImage"
runat="server" style="color: #FFFFFF"></asp:Label>
</p>
<p>
14. Upload Product Thumbnail Size Image:</p>
<p>
<asp:FileUpload ID="FileUpload2"
runat="server"
ondatabinding="btnsaveProduct_Click" />
<asp:RequiredFieldValidator
ID="RequiredFieldValidator6" runat="server"
ControlToValidate="FileUpload2"
ErrorMessage="you must enter product
thubnail size image">*</asp:RequiredFieldValidator>
<asp:Label ID="lblThumbSizeImage"
runat="server"
style="font-weight: 700; color:
#FFFFFF"></asp:Label>
</p>
<p>
</p>
<hr />
<p>
<br __designer:mapid="de" />
</p>
15. <asp:ValidationSummary
ID="ValidationSummary1" runat="server" />
<p>
<br __designer:mapid="df" />
<br __designer:mapid="e1" />
<br __designer:mapid="e2" />
<asp:Label ID="lblAddingNewItem" runat="server"
ForeColor="#FF3300"></asp:Label>
<br __designer:mapid="e4" />
<br __designer:mapid="e5" />
<asp:Button ID="btnsaveProduct" runat="server"
Text="Add The Item"
onclick="btnsaveProduct_Click" />
<asp:Button ID="btnInsert" runat="server" Text="insert
another Item"
onclick="btnInsert_Click" />
<br __designer:mapid="e8" />
<br __designer:mapid="e9" />
<br __designer:mapid="ea" />
<br __designer:mapid="eb" />
16. <asp:SqlDataSource ID="SqlDataSource1"
runat="server"
ConnectionString="<%$
ConnectionStrings:ConnectionString %>"
DeleteCommand="DELETE FROM [ProductTable]
WHERE [ProductID] = @ProductID"
InsertCommand="INSERT INTO [ProductTable]
([ProductName], [ProductDescription],
[ProductShortDescription], [Price], [Category], [ProductImage],
[ProductImageThumb]) VALUES (@ProductName,
@ProductDescription, @ProductShortDescription, @Price,
@Category, @ProductImage, @ProductImageThumb)"
SelectCommand="SELECT * FROM [ProductTable]"
UpdateCommand="UPDATE
[ProductTable] SET [ProductName] = @ProductName,
[ProductDescription] = @ProductDescription,
[ProductShortDescription] = @ProductShortDescription, [Price]
= @Price, [Category] = @Category, [ProductImage] =
@ProductImage, [ProductImageThumb] =
@ProductImageThumb WHERE [ProductID] = @ProductID">
18. <asp:ControlParameter
ControlID="txtProductName" Name="ProductName"
PropertyName="Text" Type="String" />
<asp:ControlParameter
ControlID="txtProductDescription"
Name="ProductDescription"
PropertyName="Text" Type="String" />
<asp:ControlParameter
ControlID="txtProductDescription"
Name="ProductShortDescription"
PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="txtPrice"
Name="Price" PropertyName="Text"
Type="Double" />
<asp:ControlParameter ControlID="dropCatInsert"
Name="Category"
PropertyName="SelectedValue" Type="String"
/>
<asp:ControlParameter
ControlID="lblFullSizeImage" Name="ProductImage"
PropertyName="Text" Type="String" />
<asp:ControlParameter
ControlID="lblThumbSizeImage" Name="ProductImageThumb"
20. using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
public partial class AdminPage : System.Web.UI.Page
{
21. SqlConnection con;
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
string strcon =
System.Configuration.ConfigurationManager.ConnectionStrings
["ConnectionString"].ConnectionString;
con = new SqlConnection(strcon);
btnInsert.Visible = false;
// btnsaveProduct.Visible = false;
}
protected void
RadioButtonList1_SelectedIndexChanged(object sender,
EventArgs e)
{
22. // MultiView1.ActiveViewIndex =
RadioButtonList1.SelectedIndex;
}
protected void btnsaveProduct_Click(object sender,
EventArgs e)
{
if (FileUpload1.HasFile)
{
FileUpload1.SaveAs(HttpContext.Current.Request.PhysicalAppl
icationPath + "//Uploadedpix//" + FileUpload1.FileName);
lblFullSizeImage.Text = FileUpload1.FileName;
}
if (FileUpload2.HasFile)
{
FileUpload2.SaveAs(HttpContext.Current.Request.PhysicalAppl
icationPath + "//Thumbnails//" + FileUpload2.FileName);
}
24. con.Open();
cmd = new SqlCommand("Insert into
CarSpecs(CarId,Price,Mileage,BodyStyle,ExteriorColor,Interior
Color,Engine,DriveType,FuelType,Doors) Values ("
+ MaxProductId + ","
+ Convert.ToDouble(txtInitialPrice.Text) + ","
+ Convert.ToInt32(txtAverageMPG.Text) + ",'"
+ ddlBodyType.Text + "','"
+ ddlExteriorColor.Text + "','"
+ ddlInteriorColor.Text + "','"
+ ddlEngine.Text + "','"
+ ddlDriveType.Text + "','"
+ ddlFuel.Text + "',"
+ Convert.ToInt32(ddlDoors.Text) + ")", con);
cmd.ExecuteNonQuery();
con.Close();
25. this.lblAddingNewItem.Text = "Item Has Been Added
into the Database";
btnsaveProduct.Visible = false;
btnInsert.Visible = true;
txtPrice.Enabled = false;
txtShortDescription.Enabled = false;
txtProductDescription.Enabled = false;
txtProductName.Enabled = false;
dropCatInsert.Enabled = false;
}
protected void btnInsert_Click(object sender, EventArgs e)
{
txtPrice.Text = "";
txtProductDescription.Text = "";
txtProductName.Text = "";
txtPrice.Enabled = true;
txtProductDescription.Enabled = true;
txtProductName.Enabled = true;
26. btnsaveProduct.Visible = true;
dropCatInsert.Enabled = true;
}
protected void LinkButton1_Click(object sender, EventArgs
e)
{
// txtsearchUser.Visible = true;
//btn1.Visible = true;
//txtUserIDSearch.Visible = false;
// btn2.Visible = false;
// LinkButton1.Visible = false;
}
protected void LinkButton2_Click(object sender, EventArgs
e)
{
//txtUserIDSearch.Visible = true;
// btn2.Visible = true;
27. // txtsearchUser.Visible = false;
//btn1.Visible = false;
// LinkButton2.Visible = false;
}
protected void
DropSearchItems_SelectedIndexChanged(object sender,
EventArgs e)
{
}
//protected void btnuploadImages_Click(object sender,
EventArgs e)
//{
// if (FileUpload1.HasFile)
// {
// FileUpload1.SaveAs("F:/Documents and
Settings/shift/Desktop/EWAPP/Uploadedpix/" +
FileUpload1.FileName);
28. // }
// if (FileUpload2.HasFile)
// {
// FileUpload2.SaveAs("F:/Documents and
Settings/shift/Desktop/EWAPP/Thumbnails/" +
FileUpload2.FileName);
// }
// txtFimage.Text = FileUpload1.FileName;
// txtTimage.Text = FileUpload2.FileName;
// Label1.Visible = false;
// // btnsaveProduct.Visible = true;
//}
}
Online Car Sales/EWAPP/AdminCategoryMaintenance.aspx
<%@ Page Title="" Language="C#"
MasterPageFile="~/AdminMasterPage.master"
AutoEventWireup="true"
CodeFile="AdminCategoryMaintenance.aspx.cs"
Inherits="AdminCategoryMaintenance" %>
29. <asp:Content ID="Content1" ContentPlaceHolderID="head"
Runat="Server">
</asp:Content>
<asp:Content ID="Content2"
ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<asp:RadioButtonList ID="RadioButtonList1" runat="server"
AutoPostBack="True"
onselectedindexchanged="RadioButtonList1_SelectedIndexChan
ged">
<asp:ListItem Value="0">Add New
Category</asp:ListItem>
<asp:ListItem Value="1">View / modify
Categories</asp:ListItem>
</asp:RadioButtonList>
<asp:MultiView ID="MultiView1" runat="server">
<asp:View ID="View1" runat="server">
31. <td>
Category Description:
</td>
<td>
<asp:TextBox ID="txtCategoryDesc"
TextMode=MultiLine runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
<td class="style18">
<asp:SqlDataSource ID="SqlDataSource2"
runat="server"
ConnectionString="<%$
ConnectionStrings:ConnectionString %>"
DeleteCommand="DELETE FROM
[ProductCategory] WHERE [CategoryID] = @CategoryID"
InsertCommand="INSERT INTO
[ProductCategory] ([Category]) VALUES (@NewCategory)"
SelectCommand="SELECT * FROM
[ProductCategory] WHERE [CategoryID] = @CategoryID"
32. UpdateCommand="UPDATE
[ProductCategory] SET [Category] = @NewCategory WHERE
[CategoryID] = @CategoryID">
<DeleteParameters>
<asp:Parameter Name="CategoryID"
Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Category"
Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:ControlParameter
ControlID="txtCategoryName" Name="NewCategory"
PropertyName="Text" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</td>
</td>
</tr>
33. <tr>
<td colspan="2" align="center">
<asp:Button ID="btnInsert" runat="server"
Text="Insert"
onclick="btnInsert_Click" />
</td>
</tr>
</table>
</asp:View>
<asp:View ID="View2" runat="server">
<br /><br />
<asp:GridView ID="GridView2" runat="server"
AutoGenerateColumns="False"
BackColor="White" BorderColor="#999999"
BorderStyle="None" BorderWidth="1px"
CellPadding="3" DataKeyNames="CategoryID"
DataSourceID="SqlDataSource10"
34. GridLines="Vertical">
<FooterStyle BackColor="#CCCCCC"
ForeColor="Black" />
<RowStyle BackColor="#EEEEEE"
ForeColor="Black" />
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="CategoryID"
HeaderText="Category ID" InsertVisible="False"
ReadOnly="True"
SortExpression="CategoryID" />
<asp:BoundField DataField="Category"
HeaderText="Category"
SortExpression="Category" />
</Columns>
<PagerStyle BackColor="#999999"
ForeColor="Black" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#008A8C" Font-
Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#000084" Font-
Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#DCDCDC" />
37. <asp:Label ID="IDLabel0" runat="server"
Text='<%# Eval("CategoryID") %>' />
</td>
</tr>
<tr>
<td class="style20">
Category:</td>
<td>
<asp:TextBox ID="CategoryLabel0"
runat="server" Text='<%# Bind("Category") %>' />
</td>
</tr>
</table>
<asp:LinkButton ID="UpdateButton0"
runat="server" CausesValidation="True"
CommandName="Update" Text="Update" />
<asp:LinkButton
ID="UpdateCancelButton0" runat="server"
CausesValidation="False"
CommandName="Cancel" Text="Cancel" />
<br />
39. <td class="style20">
Category ID:</td>
<td>
<asp:Label ID="IDLabel1" runat="server"
Text='<%# Eval("CategoryID") %>' />
</td>
</tr>
<tr>
<td class="style20">
Category:</td>
<td>
<asp:Label ID="CategoryLabel1"
runat="server" Text='<%# Bind("Category") %>' />
</td>
</tr>
</table>
<asp:LinkButton ID="EditButton0" runat="server"
CausesValidation="False"
CommandName="Edit" Text="Edit" />
40. <asp:LinkButton ID="DeleteButton0"
runat="server" CausesValidation="False"
CommandName="Delete" Text="Delete" />
</ItemTemplate>
</asp:FormView>
<br />
<asp:SqlDataSource ID="SqlDataSource11"
runat="server"
ConnectionString="<%$
ConnectionStrings:ConnectionString %>"
DeleteCommand="DELETE FROM
[ProductCategory] WHERE [CategoryID] = @CategoryID"
InsertCommand="INSERT INTO [ProductCategory]
([Category]) VALUES (@Category)"
SelectCommand="SELECT * FROM
[ProductCategory] WHERE [CategoryID] = @CategoryID"
UpdateCommand="UPDATE [ProductCategory] SET
[Category] = @Category WHERE [CategoryID] =
@CategoryID">
<SelectParameters>
<asp:ControlParameter ControlID="GridView2"
42. </asp:Content>
Online Car Sales/EWAPP/AdminCategoryMaintenance.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
public partial class AdminCategoryMaintenance :
System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
43. }
protected void
RadioButtonList1_SelectedIndexChanged(object sender,
EventArgs e)
{
MultiView1.ActiveViewIndex =
RadioButtonList1.SelectedIndex;
}
protected void btnInsert_Click(object sender, EventArgs e)
{
SqlDataSource sds = new SqlDataSource();
sds.ConnectionString =
ConfigurationManager.ConnectionStrings["ConnectionString"].
ToString();
sds.SelectParameters.Add("NewCategory",
TypeCode.String, this.txtCategoryName.Text);
sds.SelectCommand = "SELECT * FROM
[ProductCategory] WHERE [Category] = @NewCategory";
45. }
protected void FormView2_ItemUpdated(object sender,
FormViewUpdatedEventArgs e)
{
this.GridView2.DataBind();
}
protected void FormView2_ItemDeleted(object sender,
FormViewDeletedEventArgs e)
{
this.GridView2.DataBind();
}
}
Online Car Sales/EWAPP/AdminMaintainItems.aspx
<%@ Page Language="C#"
MasterPageFile="~/AdminMasterPage.master"
MaintainScrollPositionOnPostback="true"
AutoEventWireup="true"
CodeFile="AdminMaintainItems.aspx.cs"
Inherits="AdminMaintainItems" Title="OurShopping - Online
Shopping Store" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head"
48. <asp:CommandField ButtonType="Button"
ShowSelectButton="True" />
<asp:BoundField DataField="ProductID"
HeaderText="ProductID"
InsertVisible="False" ReadOnly="True"
SortExpression="ProductID" />
<asp:BoundField DataField="ProductName"
HeaderText="ProductName"
SortExpression="ProductName" />
<asp:BoundField
DataField="ProductShortDescription"
HeaderText="ProductShortDescription"
SortExpression="ProductShortDescription" />
<asp:BoundField DataField="Price"
HeaderText="Price" SortExpression="Price" />
<asp:BoundField DataField="Category"
HeaderText="Category"
SortExpression="Category" />
<asp:BoundField DataField="ProductImage"
HeaderText="ProductImage"
SortExpression="ProductImage" />
</Columns>
49. <PagerStyle BackColor="#2461BF" ForeColor="White"
HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-
Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True"
ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$
ConnectionStrings:ConnectionString %>"
DeleteCommand="DELETE FROM [ProductTable]
WHERE [ProductID] = @ProductID"
InsertCommand="INSERT INTO [ProductTable]
([ProductName], [ProductDescription],
[ProductShortDescription], [Price], [Category], [ProductImage])
VALUES (@ProductName, @ProductDescription,
@ProductShortDescription, @Price, @Category,
@ProductImage)"
SelectCommand="SELECT * FROM [ProductTable]
WHERE ([Category] = @Category)"
UpdateCommand="UPDATE [ProductTable] SET
[ProductName] = @ProductName, [ProductDescription] =
@ProductDescription, [ProductShortDescription] =
50. @ProductShortDescription, [Price] = @Price, [Category] =
@Category, [ProductImage] = @ProductImage WHERE
[ProductID] = @ProductID">
<SelectParameters>
<asp:ControlParameter ControlID="DropSearchCat"
Name="Category"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="ProductID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="ProductName" Type="String"
/>
<asp:Parameter Name="ProductDescription"
Type="String" />
<asp:Parameter Name="ProductShortDescription"
Type="String" />
<asp:Parameter Name="Price" Type="Double" />
<asp:Parameter Name="Category" Type="String" />
<asp:Parameter Name="ProductImage"
Type="String" />
51. <asp:Parameter Name="ProductID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="ProductName" Type="String"
/>
<asp:Parameter Name="ProductDescription"
Type="String" />
<asp:Parameter Name="ProductShortDescription"
Type="String" />
<asp:Parameter Name="Price" Type="Double" />
<asp:Parameter Name="Category" Type="String" />
<asp:Parameter Name="ProductImage"
Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</p>
<p>
<asp:FormView ID="FormView2" runat="server"
DataKeyNames="ProductID"
DataSourceID="SqlDataSource3"
55. Price:</td>
<td>
<asp:TextBox ID="PriceTextBox"
runat="server" Text='<%# Bind("Price") %>' />
<asp:RequiredFieldValidator
ID="RequiredFieldValidator4" runat="server"
ControlToValidate="PriceTextBox"
ErrorMessage="image is
requierd">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
Category:</td>
<td>
<asp:DropDownList ID="DropDownList1"
runat="server"
DataSourceID="SqlDataSource1"
DataTextField="Category"
DataValueField="Category"
SelectedValue='<%# Bind("Category") %>'>
58. CommandName="Update" Text="Update" />
<asp:LinkButton ID="UpdateCancelButton"
runat="server"
CausesValidation="False"
CommandName="Cancel" Text="Cancel" />
<br />
<asp:ValidationSummary ID="ValidationSummary1"
runat="server" />
</EditItemTemplate>
<InsertItemTemplate>
ProductName:
<asp:TextBox ID="ProductNameTextBox"
runat="server"
Text='<%# Bind("ProductName") %>' />
<br />
ProductDescription:
<asp:TextBox ID="ProductDescriptionTextBox"
runat="server"
Text='<%# Bind("ProductDescription") %>' />
<br />
ProductShortDescription:
60. runat="server"
Text='<%# Bind("ProductImageThumb") %>' />
<br />
<asp:LinkButton ID="InsertButton" runat="server"
CausesValidation="True"
CommandName="Insert" Text="Insert" />
<asp:LinkButton ID="InsertCancelButton"
runat="server"
CausesValidation="False"
CommandName="Cancel" Text="Cancel" />
</InsertItemTemplate>
<ItemTemplate>
<table class="style9">
<tr>
<td>
ProductID:</td>
<td>
<asp:Label ID="ProductIDLabel"
runat="server" Text='<%# Eval("ProductID") %>' />
</td>
64. <td>
<asp:Label ID="ProductImageThumbLabel"
runat="server"
Text='<%# Bind("ProductImageThumb")
%>' />
</td>
</tr>
</table>
<asp:LinkButton ID="EditButton" runat="server"
CausesValidation="False"
CommandName="Edit" Text="Edit" />
<asp:LinkButton ID="DeleteButton"
runat="server" CausesValidation="False"
CommandName="Delete" Text="Delete" />
<asp:LinkButton ID="NewButton"
runat="server" CausesValidation="False"
CommandName="New" Text="New" />
</ItemTemplate>
</asp:FormView>
</p>
<p>
65. <asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$
ConnectionStrings:ConnectionString %>"
DeleteCommand="DELETE FROM [ProductTable]
WHERE [ProductID] = @ProductID"
InsertCommand="INSERT INTO [ProductTable]
([ProductName], [ProductDescription],
[ProductShortDescription], [Price], [Category], [ProductImage],
[ProductImageThumb]) VALUES (@ProductName,
@ProductDescription, @ProductShortDescription, @Price,
@Category, @ProductImage, @ProductImageThumb)"
SelectCommand="SELECT * FROM [ProductTable]
Where ProductID = @ProductID"
UpdateCommand="UPDATE [ProductTable] SET
[ProductName] = @ProductName, [ProductDescription] =
@ProductDescription, [ProductShortDescription] =
@ProductShortDescription, [Price] = @Price, [Category] =
@Category, [ProductImage] = @ProductImage,
[ProductImageThumb] = @ProductImageThumb WHERE
[ProductID] = @ProductID">
<SelectParameters>
<asp:ControlParameter ControlID="GridView1"
Name="ProductID"
PropertyName="SelectedValue" />
</SelectParameters>
66. <DeleteParameters>
<asp:Parameter Name="ProductID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="ProductName" Type="String"
/>
<asp:Parameter Name="ProductDescription"
Type="String" />
<asp:Parameter Name="ProductShortDescription"
Type="String" />
<asp:Parameter Name="Price" Type="Double" />
<asp:Parameter Name="Category" Type="String" />
<asp:Parameter Name="ProductImage"
Type="String" />
<asp:Parameter Name="ProductImageThumb"
Type="String" />
<asp:Parameter Name="ProductID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="ProductName" Type="String"
/>
67. <asp:Parameter Name="ProductDescription"
Type="String" />
<asp:Parameter Name="ProductShortDescription"
Type="String" />
<asp:Parameter Name="Price" Type="Double" />
<asp:Parameter Name="Category" Type="String" />
<asp:Parameter Name="ProductImage"
Type="String" />
<asp:Parameter Name="ProductImageThumb"
Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<br />
</p>
</asp:Content>
Online Car Sales/EWAPP/AdminMaintainItems.aspx.cs
using System;
using System.Collections;
using System.Configuration;
68. using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class AdminMaintainItems : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void DropSearchCat_SelectedIndexChanged(object
sender, EventArgs e)
69. {
}
protected void FormView2_ItemUpdated(object sender,
FormViewUpdatedEventArgs e)
{
this.GridView1.DataBind();
}
}
Online Car
Sales/EWAPP/AdminMasterPage.masterHomeCategoriesUsersS
alesAdd Car(s)Manage Car(s)User Reviews
Name:
Name:
71. using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
public partial class MasterPage : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["UserType"] == null ||
!Session["UserType"].Equals("admin"))
Response.Redirect("Default.aspx");
}
72. protected void LinkButton1_Click(object sender, EventArgs
e)
{
Session.Abandon();
Response.Redirect("MainPage.aspx");
}
protected void LinkButton2_Click(object sender, EventArgs
e)
{
Response.Redirect("login.aspx");
}
}
Online Car Sales/EWAPP/AdminSalesMaintenance.aspx
<%@ Page EnableEventValidation="false" Language="C#"
MasterPageFile="~/AdminMasterPage.master"
MaintainScrollPositionOnPostback="true"
AutoEventWireup="true"
CodeFile="AdminSalesMaintenance.aspx.cs"
Inherits="AdminSalesMaintenance" Title="OurShopping -
73. Online Shopping Store"%>
<asp:Content ID="Content1" ContentPlaceHolderID="head"
Runat="Server">
<style type="text/css">
.style9
{
width: 100%;
}
</style>
</asp:Content>
<asp:Content ID="Content2"
ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<p>
<asp:RadioButtonList ID="RadioButtonList1"
runat="server" AutoPostBack="True"
onselectedindexchanged="RadioButtonList1_SelectedIndexChan
ged">
<asp:ListItem Value="0">Show All Open
Orders</asp:ListItem>
74. <asp:ListItem Value="1">Show All Closed
Orders</asp:ListItem>
<asp:ListItem Value="2">Search For
Order</asp:ListItem>
</asp:RadioButtonList>
</p>
<p>
<asp:MultiView ID="MultiView1" runat="server">
<asp:View ID="View1" runat="server">
<hr />
<br />
All open Orders:<br />
<asp:GridView ID="GridView3" runat="server"
AutoGenerateColumns="False"
BackColor="White" BorderColor="#999999"
BorderStyle="None" BorderWidth="1px"
CellPadding="3" DataKeyNames="ShoppingID"
DataSourceID="SqlDataSource1"
GridLines="Vertical"
onrowupdated="GridView3_RowUpdated">
<FooterStyle BackColor="#CCCCCC"
75. ForeColor="Black" />
<RowStyle BackColor="#EEEEEE"
ForeColor="Black" />
<Columns>
<asp:CommandField ButtonType="Button"
ShowSelectButton="True" />
<asp:BoundField DataField="ShoppingID"
HeaderText="ShoppingID"
InsertVisible="False" ReadOnly="True"
SortExpression="ShoppingID" />
<asp:BoundField DataField="ProductIDNo"
HeaderText="ProductIDNo"
SortExpression="ProductIDNo" />
<asp:BoundField DataField="UserID"
HeaderText="UserID"
SortExpression="UserID" />
<asp:BoundField DataField="SalesStatus"
HeaderText="SalesStatus"
SortExpression="SalesStatus" />
<asp:BoundField DataField="qty"
HeaderText="qty" SortExpression="qty" />
</Columns>
76. <PagerStyle BackColor="#999999"
ForeColor="Black" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#008A8C" Font-
Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#000084" Font-
Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#DCDCDC" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1"
runat="server"
ConnectionString="<%$
ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM
[ShoppingCart] WHERE (([SalesStatus] = @SalesStatus) OR
([SalesStatus] = @SalesStatus2)) AND
ShoppingCart.ShoppingID in (Select ShoppingID from
FinalizedOrders)">
<SelectParameters>
<asp:Parameter DefaultValue="Open"
Name="SalesStatus" Type="String" />
<asp:Parameter DefaultValue="Pending"
Name="SalesStatus2" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
77. <br />
<asp:SqlDataSource ID="SqlDataSource4"
runat="server"
ConnectionString="<%$
ConnectionStrings:ConnectionString %>"
DeleteCommand="DELETE FROM
[ShoppingCart] WHERE [ShoppingID] = @ShoppingID"
InsertCommand="INSERT INTO [ShoppingCart]
([ProductIDNo], [UserID], [SalesStatus], [qty]) VALUES
(@ProductIDNo, @UserID, @SalesStatus, @qty)"
SelectCommand="SELECT
ShoppingCart.ShoppingID, ShoppingCart.ProductIDNo,
ShoppingCart.UserID, ShoppingCart.SalesStatus,
ShoppingCart.qty, ProductTable.Price,
ProductTable.ProductName, UserTable.Email,
UserTable.Address, UserTable.Name FROM ShoppingCart
INNER JOIN UserTable ON ShoppingCart.UserID =
UserTable.Username INNER JOIN ProductTable ON
ShoppingCart.ProductIDNo = ProductTable.ProductID WHERE
(ShoppingCart.ShoppingID = @ShoppingID)"
UpdateCommand="UPDATE [ShoppingCart] SET
[ProductIDNo] = @ProductIDNo, [UserID] = @UserID,
[SalesStatus] = @SalesStatus, [qty] = @qty WHERE
[ShoppingID] = @ShoppingID">
<SelectParameters>
<asp:ControlParameter ControlID="GridView3"
Name="ShoppingID"
79. />
<asp:Parameter Name="SalesStatus"
Type="String" />
<asp:Parameter Name="qty" Type="Int32" />
</InsertParameters>
</asp:SqlDataSource>
<br />
<asp:FormView ID="FormView2" runat="server"
BackColor="White"
BorderColor="#CCCCCC" BorderStyle="None"
BorderWidth="1px" CellPadding="3"
DataKeyNames="ShoppingID"
DataSourceID="SqlDataSource4" GridLines="Both"
onitemupdated="FormView2_ItemUpdated"
Width="205px">
<FooterStyle BackColor="White"
ForeColor="#000066" />
<RowStyle ForeColor="#000066" />
<EditItemTemplate>
<table class="style9"
style="border-bottom-style: solid; border-
bottom-color: #000080;">
85. <asp:LinkButton ID="DeleteButton"
runat="server" CausesValidation="False"
CommandName="Delete" Text="Delete" />
<br />
<asp:LinkButton ID="UpdateButton"
runat="server" CausesValidation="True"
CommandName="Update" Text="Update" />
<asp:LinkButton
ID="UpdateCancelButton" runat="server"
CausesValidation="False"
CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
<InsertItemTemplate>
ProductIDNo:
<asp:TextBox ID="ProductIDNoTextBox"
runat="server"
Text='<%# Bind("ProductIDNo") %>' />
<br />
UserID:
<asp:TextBox ID="UserIDTextBox"
runat="server" Text='<%# Bind("UserID") %>' />
86. <br />
SalesStatus:
<asp:TextBox ID="SalesStatusTextBox"
runat="server"
Text='<%# Bind("SalesStatus") %>' />
<br />
qty:
<asp:TextBox ID="qtyTextBox" runat="server"
Text='<%# Bind("qty") %>' />
<br />
Price:
<asp:TextBox ID="PriceTextBox"
runat="server" Text='<%# Bind("Price") %>' />
<br />
ProductName:
<asp:TextBox ID="ProductNameTextBox"
runat="server"
Text='<%# Bind("ProductName") %>' />
<br />
Email:
87. <asp:TextBox ID="EmailTextBox"
runat="server" Text='<%# Bind("Email") %>' />
<br />
Address:
<asp:TextBox ID="AddressTextBox"
runat="server" Text='<%# Bind("Address") %>' />
<br />
Name:
<asp:TextBox ID="NameTextBox"
runat="server" Text='<%# Bind("Name") %>' />
<br />
<asp:LinkButton ID="InsertButton"
runat="server" CausesValidation="True"
CommandName="Insert" Text="Insert" />
<asp:LinkButton
ID="InsertCancelButton" runat="server"
CausesValidation="False"
CommandName="Cancel" Text="Cancel" />
</InsertItemTemplate>
<ItemTemplate>
<table class="style9" style="border-bottom-
style: solid; border-color: #000080">
93. ForeColor="#000066" HorizontalAlign="Left" />
<HeaderStyle BackColor="#006699" Font-
Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#669999" Font-
Bold="True" ForeColor="White" />
</asp:FormView>
<br />
</asp:View>
<br />
<br />
<asp:View ID="View2" runat="server">
<hr />
All Closed Orders:<br />
<br />
<asp:GridView ID="GridView2" runat="server"
AutoGenerateColumns="False"
DataKeyNames="ShoppingID"
DataSourceID="SqlDataSource2" BackColor="White"
BorderColor="#999999" BorderStyle="None"
BorderWidth="1px" CellPadding="3"
GridLines="Vertical">
94. <FooterStyle BackColor="#CCCCCC"
ForeColor="Black" />
<RowStyle BackColor="#EEEEEE"
ForeColor="Black" />
<Columns>
<asp:CommandField ShowSelectButton="True"
/>
<asp:BoundField DataField="ShoppingID"
HeaderText="ShoppingID"
InsertVisible="False" ReadOnly="True"
SortExpression="ShoppingID" />
<asp:BoundField DataField="ProductIDNo"
HeaderText="ProductIDNo"
SortExpression="ProductIDNo" />
<asp:BoundField DataField="UserID"
HeaderText="UserID"
SortExpression="UserID" />
<asp:BoundField DataField="SalesStatus"
HeaderText="SalesStatus"
SortExpression="SalesStatus" />
<asp:BoundField DataField="qty"
HeaderText="qty"
95. SortExpression="qty" />
</Columns>
<PagerStyle BackColor="#999999"
ForeColor="Black" HorizontalAlign="Center" />
<EmptyDataTemplate>
<span class="style10"><b>No Closed
orders</b></span>
</EmptyDataTemplate>
<SelectedRowStyle BackColor="#008A8C" Font-
Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#000084" Font-
Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#DCDCDC" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource2"
runat="server"
ConnectionString="<%$
ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM
[ShoppingCart] WHERE ([SalesStatus] = @SalesStatus)">
<SelectParameters>
96. <asp:Parameter DefaultValue="Completed"
Name="SalesStatus" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<br />
<asp:FormView ID="FormView3" runat="server"
BackColor="White"
BorderColor="#CCCCCC" BorderStyle="None"
BorderWidth="1px" CellPadding="3"
DataKeyNames="ShoppingID"
DataSourceID="SqlDataSource5" GridLines="Both"
onitemupdated="FormView2_ItemUpdated"
Width="205px">
<FooterStyle BackColor="White"
ForeColor="#000066" />
<RowStyle ForeColor="#000066" />
<EditItemTemplate>
<table class="style9"
style="border-bottom-style: solid; border-
bottom-color: #000080;">
101. <td>
Address:</td>
<td>
<asp:Label ID="AddressLabel1"
runat="server" Text='<%# Bind("Address") %>' />
</td>
</tr>
<tr>
<td>
Name:</td>
<td>
<asp:Label ID="NameLabel1"
runat="server" Text='<%# Bind("Name") %>' />
</td>
</tr>
</table>
<asp:LinkButton ID="UpdateCancelButton"
runat="server" CausesValidation="False"
CommandName="Cancel" Text="Cancel" />
<asp:LinkButton ID="UpdateButton0"
102. runat="server" CausesValidation="True"
CommandName="Update" Text="Update" />
</EditItemTemplate>
<InsertItemTemplate>
ProductIDNo:
<asp:TextBox ID="ProductIDNoTextBox"
runat="server"
Text='<%# Bind("ProductIDNo") %>' />
<br />
UserID:
<asp:TextBox ID="UserIDTextBox"
runat="server" Text='<%# Bind("UserID") %>' />
<br />
SalesStatus:
<asp:TextBox ID="SalesStatusTextBox"
runat="server"
Text='<%# Bind("SalesStatus") %>' />
<br />
qty:
103. <asp:TextBox ID="qtyTextBox" runat="server"
Text='<%# Bind("qty") %>' />
<br />
Price:
<asp:TextBox ID="PriceTextBox"
runat="server" Text='<%# Bind("Price") %>' />
<br />
ProductName:
<asp:TextBox ID="ProductNameTextBox"
runat="server"
Text='<%# Bind("ProductName") %>' />
<br />
Email:
<asp:TextBox ID="EmailTextBox"
runat="server" Text='<%# Bind("Email") %>' />
<br />
Address:
<asp:TextBox ID="AddressTextBox"
runat="server" Text='<%# Bind("Address") %>' />
<br />
104. Name:
<asp:TextBox ID="NameTextBox"
runat="server" Text='<%# Bind("Name") %>' />
<br />
<asp:LinkButton ID="InsertButton"
runat="server" CausesValidation="True"
CommandName="Insert" Text="Insert" />
<asp:LinkButton
ID="InsertCancelButton" runat="server"
CausesValidation="False"
CommandName="Cancel" Text="Cancel" />
</InsertItemTemplate>
<ItemTemplate>
<table class="style9" style="border-bottom-
style: solid; border-color: #000080">
<tr>
<td>
ShoppingID:</td>
<td>
<asp:Label ID="ShoppingIDLabel1"
runat="server"
109. <asp:Label ID="NameLabel2"
runat="server" Text='<%# Bind("Name") %>' />
</td>
</tr>
</table>
<asp:LinkButton ID="EditButton0"
runat="server" CausesValidation="False"
CommandName="Edit" Text="Edit" />
<asp:LinkButton ID="DeleteButton1"
runat="server" CausesValidation="False"
CommandName="Delete" Text="Delete" />
</ItemTemplate>
<PagerStyle BackColor="White"
ForeColor="#000066" HorizontalAlign="Left" />
<HeaderStyle BackColor="#006699" Font-
Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#669999" Font-
Bold="True" ForeColor="White" />
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource5"
runat="server"
110. ConnectionString="<%$
ConnectionStrings:ConnectionString %>"
DeleteCommand="DELETE FROM
[ShoppingCart] WHERE [ShoppingID] = @ShoppingID"
InsertCommand="INSERT INTO [ShoppingCart]
([ProductIDNo], [UserID], [SalesStatus], [qty]) VALUES
(@ProductIDNo, @UserID, @SalesStatus, @qty)"
SelectCommand="SELECT
ShoppingCart.ShoppingID, ShoppingCart.ProductIDNo,
ShoppingCart.UserID, ShoppingCart.SalesStatus,
ShoppingCart.qty, ProductTable.Price,
ProductTable.ProductName, UserTable.Email,
UserTable.Address, UserTable.Name FROM ShoppingCart
INNER JOIN UserTable ON ShoppingCart.UserID =
UserTable.Username INNER JOIN ProductTable ON
ShoppingCart.ProductIDNo = ProductTable.ProductID where
ShoppingID = @ShoppingID"
UpdateCommand="UPDATE [ShoppingCart] SET
[ProductIDNo] = @ProductIDNo, [UserID] = @UserID,
[SalesStatus] = @SalesStatus, [qty] = @qty WHERE
[ShoppingID] = @ShoppingID">
<SelectParameters>
<asp:ControlParameter ControlID="GridView2"
Name="ShoppingID"
PropertyName="SelectedValue" />
</SelectParameters>
112. <asp:Parameter Name="qty" Type="Int32" />
</InsertParameters>
</asp:SqlDataSource>
</asp:View>
<br />
<asp:View ID="View3" runat="server">
<hr />
Enter Order Number:
<asp:TextBox ID="txtSearchSerial"
runat="server"></asp:TextBox>
<br />
<br />
<asp:FormView ID="FormView4" runat="server"
BackColor="White"
BorderColor="#CCCCCC" BorderStyle="None"
BorderWidth="1px" CellPadding="3"
DataKeyNames="ShoppingID"
DataSourceID="SqlDataSource3" GridLines="Both"
onitemupdated="FormView2_ItemUpdated"
Width="205px">
<FooterStyle BackColor="White"
113. ForeColor="#000066" />
<RowStyle ForeColor="#000066" />
<EditItemTemplate>
<table class="style9"
style="border-bottom-style: solid; border-
bottom-color: #000080;">
<tr>
<td>
ShoppingID:</td>
<td>
<asp:Label ID="ShoppingIDLabel2"
runat="server"
Text='<%# Eval("ShoppingID") %>'
/>
</td>
</tr>
<tr>
<td>
ProductIDNo:</td>
<td>
117. <td>
<asp:Label ID="EmailLabel3"
runat="server" Text='<%# Bind("Email") %>' />
</td>
</tr>
<tr>
<td>
Address:</td>
<td>
<asp:Label ID="AddressLabel3"
runat="server" Text='<%# Bind("Address") %>' />
</td>
</tr>
<tr>
<td>
Name:</td>
<td>
<asp:Label ID="NameLabel3"
runat="server" Text='<%# Bind("Name") %>' />
</td>
119. <br />
SalesStatus:
<asp:TextBox ID="SalesStatusTextBox0"
runat="server"
Text='<%# Bind("SalesStatus") %>' />
<br />
qty:
<asp:TextBox ID="qtyTextBox0"
runat="server" Text='<%# Bind("qty") %>' />
<br />
Price:
<asp:TextBox ID="PriceTextBox0"
runat="server" Text='<%# Bind("Price") %>' />
<br />
ProductName:
<asp:TextBox ID="ProductNameTextBox0"
runat="server"
Text='<%# Bind("ProductName") %>' />
<br />
Email:
120. <asp:TextBox ID="EmailTextBox0"
runat="server" Text='<%# Bind("Email") %>' />
<br />
Address:
<asp:TextBox ID="AddressTextBox0"
runat="server"
Text='<%# Bind("Address") %>' />
<br />
Name:
<asp:TextBox ID="NameTextBox0"
runat="server" Text='<%# Bind("Name") %>' />
<br />
<asp:LinkButton ID="InsertButton0"
runat="server" CausesValidation="True"
CommandName="Insert" Text="Insert" />
<asp:LinkButton
ID="InsertCancelButton0" runat="server"
CausesValidation="False"
CommandName="Cancel" Text="Cancel" />
</InsertItemTemplate>
<ItemTemplate>
121. <table class="style9" style="border-bottom-
style: solid; border-color: #000080">
<tr>
<td>
ShoppingID:</td>
<td>
<asp:Label ID="ShoppingIDLabel3"
runat="server"
Text='<%# Eval("ShoppingID") %>'
/>
</td>
</tr>
<tr>
<td>
ProductIDNo:</td>
<td>
<asp:Label ID="ProductIDNoLabel4"
runat="server"
Text='<%# Bind("ProductIDNo")
%>' />
</td>
125. runat="server" Text='<%# Bind("Address") %>' />
</td>
</tr>
<tr>
<td>
Name:</td>
<td>
<asp:Label ID="NameLabel4"
runat="server" Text='<%# Bind("Name") %>' />
</td>
</tr>
</table>
<asp:LinkButton ID="EditButton1"
runat="server" CausesValidation="False"
CommandName="Edit" Text="Edit" />
<asp:LinkButton ID="DeleteButton2"
runat="server" CausesValidation="False"
CommandName="Delete" Text="Delete" />
</ItemTemplate>
126. <PagerStyle BackColor="White"
ForeColor="#000066" HorizontalAlign="Left" />
<HeaderStyle BackColor="#006699" Font-
Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#669999" Font-
Bold="True" ForeColor="White" />
</asp:FormView>
<br />
<br />
<asp:SqlDataSource ID="SqlDataSource3"
runat="server"
ConnectionString="<%$
ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT
ShoppingCart.ShoppingID, ShoppingCart.ProductIDNo,
ShoppingCart.UserID, ShoppingCart.SalesStatus,
ShoppingCart.qty, ProductTable.Price,
ProductTable.ProductName, UserTable.Email,
UserTable.Address, UserTable.Name FROM ShoppingCart
INNER JOIN UserTable ON ShoppingCart.UserID =
UserTable.Username INNER JOIN ProductTable ON
ShoppingCart.ProductIDNo = ProductTable.ProductID WHERE
([ShoppingID] = @ShoppingID)"
127. UpdateCommand="UPDATE [ShoppingCart] SET
[ProductIDNo] = @ProductIDNo, [UserID] = @UserID,
[SalesStatus] = @SalesStatus, [qty] = @qty WHERE
[ShoppingID] = @ShoppingID">
<SelectParameters>
<asp:ControlParameter
ControlID="txtSearchSerial" Name="ShoppingID"
PropertyName="Text" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</asp:View>
<br />
<br />
</asp:MultiView>
</p>
<p>
</p>
</asp:Content>
128. Online Car Sales/EWAPP/AdminSalesMaintenance.aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using System.Net.Mail;
public partial class AdminSalesMaintenance :
System.Web.UI.Page
{
129. protected void Page_Load(object sender, EventArgs e)
{
}
protected void
RadioButtonList1_SelectedIndexChanged(object sender,
EventArgs e)
{
MultiView1.ActiveViewIndex =
RadioButtonList1.SelectedIndex;
}
protected void FormView2_ItemUpdated(object sender,
FormViewUpdatedEventArgs e)
{
this.GridView3.DataBind();
String ToEMail =
(FormView2.Row.FindControl("EmailLabel0") as Label).Text;
130. using (StringWriter sw = new StringWriter())
{
using (HtmlTextWriter hw = new HtmlTextWriter(sw))
{
FormView2.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
MailMessage mm = new
MailMessage("[email protected]", ToEMail);
mm.Subject = "Your Order Status has been
modified";
mm.Body = "Order Status: " + sw.ToString() +
"<br><br> You will be Notified Once Your Order is processed";
mm.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
System.Net.NetworkCredential NetworkCred = new
System.Net.NetworkCredential();
NetworkCred.UserName = "[email protected]";
131. NetworkCred.Password = "aminroop";
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 587;
smtp.Send(mm);
}
}
}
public override void VerifyRenderingInServerForm(Control
control)
{
/* Verifies that the control is rendered */
}
protected void FormView3_ItemUpdated(object sender,
FormViewUpdatedEventArgs e)
{
132. this.GridView2.DataBind();
}
protected void GridView3_RowUpdated(object sender,
GridViewUpdatedEventArgs e)
{
}
}
Online Car Sales/EWAPP/AdminUserMaintenance.aspx
<%@ Page Language="C#"
MasterPageFile="~/AdminMasterPage.master"
MaintainScrollPositionOnPostback="true"
AutoEventWireup="true"
CodeFile="AdminUserMaintenance.aspx.cs"
Inherits="AdminUserMaintenance" Title="OurShopping -
Online Shopping Store" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head"
Runat="Server">
<style type="text/css">
135. style="border-color: #000080; background-
color: #AABFEA; border-bottom-style: solid;">
Add New Administrator Account</td>
</tr>
<tr>
<td class="style18">
Name</td>
<td>
<asp:TextBox ID="txtName" runat="server"
Width="139px"></asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txtName"
ErrorMessage="Name Is
requierd">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style18">
Passport Number</td>
140. ControlToValidate="txtEmail2"
ErrorMessage="accepted format is [email protected]"
ValidationExpression="w+([-
+.']w+)*@w+([-.]w+)*.w+([-
.]w+)*">*</asp:RegularExpressionValidator>
<asp:CompareValidator
ID="CompareValidator2" runat="server"
ControlToCompare="txtEmail1"
ControlToValidate="txtEmail2"
ErrorMessage="The Email address does not
matched">*</asp:CompareValidator>
</td>
</tr>
<tr>
<td class="style18">
Address:</td>
<td>
<asp:TextBox ID="txtAddress" runat="server"
TextMode="MultiLine" Width="141px"></asp:TextBox>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator8" runat="server"
ControlToValidate="txtAddress"
141. ErrorMessage="accepted format is
[email protected]">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style18">
Choose the user Role</td>
<td>
<asp:ListBox ID="ListBox1" runat="server"
AutoPostBack="True">
<asp:ListItem>admin</asp:ListItem>
<asp:ListItem>user</asp:ListItem>
</asp:ListBox>
</td>
</tr>
<tr>
<td class="style18">
</td>
<td>
142. <asp:Label ID="Label1" runat="server"
ForeColor="#000066"></asp:Label>
<asp:ValidationSummary
ID="ValidationSummary1" runat="server" />
</td>
</tr>
<tr>
<td class="style18">
<asp:SqlDataSource ID="SqlDataSource2"
runat="server"
ConnectionString="<%$
ConnectionStrings:ConnectionString %>"
DeleteCommand="DELETE FROM
[UserTable] WHERE [ID] = @ID"
InsertCommand="INSERT INTO [UserTable]
([Username], [Password], [Email], [Address], [Name],
[IDnumber], [UserType]) VALUES (@Username, @Password,
@Email, @Address, @Name, @IDnumber, @UserType)"
SelectCommand="SELECT * FROM
[UserTable]"
UpdateCommand="UPDATE [UserTable]
SET [Username] = @Username, [Password] = @Password,
[Email] = @Email, [Address] = @Address, [Name] = @Name,
[IDnumber] = @IDnumber, [UserType] = @UserType WHERE
143. [ID] = @ID">
<DeleteParameters>
<asp:Parameter Name="ID" Type="Int32"
/>
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Username"
Type="String" />
<asp:Parameter Name="Password"
Type="String" />
<asp:Parameter Name="Email"
Type="String" />
<asp:Parameter Name="Address"
Type="String" />
<asp:Parameter Name="Name"
Type="String" />
<asp:Parameter Name="IDnumber"
Type="String" />
<asp:Parameter Name="UserType"
Type="String" />
<asp:Parameter Name="ID" Type="Int32"
/>
</UpdateParameters>
144. <InsertParameters>
<asp:ControlParameter
ControlID="txtUserName" Name="Username"
PropertyName="Text" Type="String" />
<asp:ControlParameter
ControlID="txtPassword1" Name="Password"
PropertyName="Text" Type="String" />
<asp:ControlParameter
ControlID="txtEmail1" Name="Email" PropertyName="Text"
Type="String" />
<asp:ControlParameter
ControlID="txtAddress" Name="Address"
PropertyName="Text"
Type="String" />
<asp:ControlParameter
ControlID="txtName" Name="Name" PropertyName="Text"
Type="String" />
<asp:ControlParameter
ControlID="txtpassportNumber" Name="IDnumber"
PropertyName="Text" Type="String" />
<asp:ControlParameter
ControlID="ListBox1" Name="UserType"
146. GridLines="Vertical" BackColor="White"
BorderColor="#999999" BorderStyle="None"
BorderWidth="1px">
<FooterStyle BackColor="#CCCCCC"
ForeColor="Black" />
<RowStyle BackColor="#EEEEEE"
ForeColor="Black" />
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="ID"
HeaderText="ID" InsertVisible="False"
ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="Username"
HeaderText="Username"
SortExpression="Username" />
<asp:BoundField DataField="Password"
HeaderText="Password"
SortExpression="Password" />
<asp:BoundField DataField="Email"
HeaderText="Email" SortExpression="Email" />
<asp:BoundField DataField="Address"
HeaderText="Address"
147. SortExpression="Address" />
<asp:BoundField DataField="Name"
HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="IDnumber"
HeaderText="IDnumber"
SortExpression="IDnumber" />
</Columns>
<PagerStyle BackColor="#999999"
ForeColor="Black" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#008A8C" Font-
Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#000084" Font-
Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#DCDCDC" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource3"
runat="server"
ConnectionString="<%$
ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [UserTable]
WHERE ([UserType] = @UserType) AND ([Username] =