网上商城详细设计说明书.docx
《网上商城详细设计说明书.docx》由会员分享,可在线阅读,更多相关《网上商城详细设计说明书.docx(19页珍藏版)》请在冰豆网上搜索。
![网上商城详细设计说明书.docx](https://file1.bdocx.com/fileroot1/2023-1/9/a0fcc73f-0b6a-45e4-911c-bba569090be5/a0fcc73f-0b6a-45e4-911c-bba569090be51.gif)
网上商城详细设计说明书
网上商城设计详细说明书
姓名:
lclboss
班级:
微机1024
学号:
1000005442
网上商城设计详细说明书1
1.引言3
1.1编写目的3
1.2前期工作3
1.3编写背景3
2.技术概述4
2.1目标4
2.2硬件支持4
2.3软件支持4
3.功能需求4
3.1功能块划分4
4.具体设计5
4.1首页设计5
4.2商品详细信息页面设计8
4.3实现商品搜索功能10
4.4商城后台管理登录设计11
4.5商城后台商城管理页面设计11
4.6建立删除商品信息页面15
5.总结16
1.引言
1.1编写目的
通过学习ASP.NET,以及结合教师给的源代码,进一步修改,从而实现网上商城系统
1.2前期工作
在编写该需求前,首先是对各大网上销售网站进行了调查,其中包括:
网页排版、顾客消费流程、以及管理员的操作,这三大块进行了调查。
并总结出了有自己特色的设计思路。
1.3编写背景
随着Internet国际互联网的发展,越来越多的企业开始建造自己的网站。
基于Internet的信息服务,商务服务已经成为现代企业一项不可缺少的内容。
很多企业都已不满足于建立一个简单的仅仅能够发布信息的静态网站。
现代企业需要的是一个功能强大的,能提供完善的电子商务服务的动态商务网站。
本网上商城系统就是根据电子商务和互联网的发展,针对网上顾客所开发的网络购物系统,本商城系统主要有:
1)用户浏览、注册、登录与购买商品;
2)商品的入库资料登记;
3)商城访问者的在线留言、查看留言,管理员的在线管理留言等;
4)商城最新的新闻显示,历史新闻的分页显示,新闻详细情况的显示,后台管理员添加、删除、修改新闻等。
本数据采用access作为数据库,亦可以使用SQL作为数据库,项目的重点是商品的添加、删除、显示与修改,需要克服的难点是商品图片的上传和删除。
2.技术概述
2.1目标
我们使用C#以及数据库技术构建网站,争取将本网站做成一个界面友好、用户购物方便、管理员管理方便的购物系统。
2.2硬件支持
Cpu:
弄个四核最好比如老一代coreQ8400
2.3软件支持
操作系统:
Windowsxp/vista/seven均可,C#开发环境。
3.功能需求
3.1功能块划分
1)用户浏览、注册、登录与购买商品;
2)商品的入库资料登记;
3)商城访问者的在线留言、查看留言,管理员的在线管理留言等;
4)商城最新的新闻显示,历史新闻的分页显示,新闻详细情况的显示,后台管理员添加、删除、修改新闻等。
4.具体设计
4.1首页设计
新建web窗体default.aspx,其代码为:
<%@PageTitle=""Language="C#"MasterPageFile="~/shop.master"AutoEventWireup="true"
CodeFile="Default.aspx.cs"Inherits="_Default"%>
ContentID="Content1"ContentPlaceHolderID="head"runat="Server">
.style23
{
width:
116px;
height:
94px;
}
.style24
{
width:
600px;
height:
132px;
}
.style25
{
width:
104px;
}
.style26
{
width:
598px;
}
.style27
{
width:
106px;
}
Content>
ContentID="Content2"ContentPlaceHolderID="ContentPlaceHolder1"runat="Server">
9pt"class="style24">
11pt;color:
#FFFFFF;background-color:
#FF0000;
border-width:
0px">
热点促销
9pt;border-width:
0px;background-image:
url('images/line.GIF');
width:
178px;">
更多>>>
|
RepeaterID="Repeater1"runat="server">
id=<%#Eval("id")%>"target="_blank">
<%#Eval("title")%>
<%#Eval("AddTime","{0:
d}")%>
Repeater>
|
11pt;color:
#FFFFFF;background-color:
#FF0000;
border-width:
0px">
最新产品
url('images/line.GIF')">
|
DataListID="DataList1"runat="server"DataKeyField="bh"DataSourceID="AccessDataSource1"
RepeatColumns="3"RepeatDirection="Horizontal">
id=<%#Eval("bh")%>">"class="style23"style="border-style:
none"/>
LabelID="titleLabel"runat="server"Text='<%#Eval("productName")%>'/>
LabelID="priceLabel"runat="server"Text='<%#Eval("price")%>'/>
DataList>
AccessDataSourceID="AccessDataSource1"runat="server"DataFile="~/App_Data/shop.mdb"
SelectCommand="SELECTtop9[bh],[pic],[price],[productName]FROM[product]orderbybhdesc">
AccessDataSource>
Content>
接着,切换到程序文件.cs编辑栏里,写入代码:
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Web;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
publicpartialclass_Default:
System.Web.UI.Page
{
protectedvoidPage_Load(objectsender,EventArgse)
{
stringstrSQL="selecttop7*fromnewsorderbyiddesc";
Repeater1.DataSource=DbManager.ExecuteQuery(strSQL);
Repeater1.DataBind();
}
}
4.2商品详细信息页面设计
新建show.aspx,配置好各项值以后,载入代码:
<%@PageTitle=""Language="C#"MasterPageFile="~/shop.master"AutoEventWireup="true"
CodeFile="show.aspx.cs"Inherits="show"%>
ContentID="Content1"ContentPlaceHolderID="head"runat="Server">
.style3
{
width:
100%;
}
.style4
{
text-align:
center;
width:
253px;
}
Content>
ContentID="Content2"ContentPlaceHolderID="ContentPlaceHolder1"runat="Server">
ImageID="Image1"runat="server"/>
LabelID="txtTitle"runat="server"Text="Label">
Label>
LabelID="txtContents"runat="server"Text="Label">
Label>
售价:
LabelID="txtPrice"runat="server"Text="Label">
Label>
|
购买数量:
TextBoxID="num"runat="server"Width="37px">1
TextBox>
ImageButtonID="ImageButton1"runat="server"
ImageUrl="~/images/gouWuChe3.jpg"Height="74px"ImageAlign="Middle"
onclick="ImageButton1_Click"Width="72px"/>
Content>
接着建立.cs程序文件,编辑写入以下代码:
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Web;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Data;
publicpartialclassshow:
System.Web.UI.Page
{
protectedvoidPage_Load(objectsender,EventArgse)
{
stringsql="select*fromproductwherebh="+Request.QueryString["id"];
DataTabledt=DbManager.ExecuteQuery(sql);
Image1.ImageUrl="images/"+dt.Rows[0]["pic"].ToString();
txtTitle.Text=dt.Rows[0]["productName"].ToString();
txtContents.Text=dt.Rows[0]["contents"].ToString();
txtPrice.Text=dt.Rows[0]["price"].ToString();
}
protectedvoidImageButton1_Click(objectsender,ImageClickEventArgse)
{
Response.Redirect("buy.aspx?
id="+Request.QueryString["id"]+"&num="+Convert.ToInt32(num.Text));
}
}
4.3实现商品搜索功能
新建search.aspx,配置相关参数,载入以下代码:
<%@PageLanguage="C#"MasterPageFile="~/shop.master"AutoEventWireup="true"CodeFile="search.aspx.cs"Inherits="search"Title="UntitledPage"%>
ContentID="Content1"ContentPlaceHolderID="ContentPlaceHolder1"Runat="Server">
查询结果
RepeaterID="Repeater1"runat="server">
<%#Eval("bh")%> | id=<%#Eval("bh")%>"target="_blank"><%#Eval("productName")%> |
Repeater>
Content>
然后编辑.cs文件
usingSystem;
usingSystem.Data;
usingSystem.Configuration;
usingSystem.Collections;
usingSystem.Web;
usingSystem.Web.Security;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls;
publicpartialclasssearch:
System.Web.UI.Page
{
protectedvoidPage_Load(objectsender,EventArgse)
{
stringstrSQL="select*fromproductwhereproductNamelike'%"+Server.UrlDecode(Request.QueryString["txtSearchName"])+"%'";
DataTabledt=DbManager.ExecuteQuery(strSQL);
Repeater1.DataSource=dt;
Repeater1.DataBind();
}
}
4.4商城后台管理登录设计
新建一个login.aspx,添加所需要的元件,在.cs程序文件中编写ImageButton的事件代码:
usingSystem;
publicpartialclasslogin:
System.Web.UI.Page
{
protectedvoidPage_Load(objectsender,EventArgse)
{
Session["pass"]=0;
}
protectedvoidButton1_Click(objectsender,EventArgse)
{
if(TextBox3.Text!
=Request.Cookies["CheckCode"].Value.ToString())
Response.Write("");
else
{
stringstrSQL="select*fromuserswhereuserName='"+TextBox1.Text+"'andpwd='"+TextBox2.Text+"'";
if(DbManager.ExecuteQuery(strSQL).Rows.Count>0)
{
Session["pass"]=1;
Response.Redirect("manageProduct.aspx");
}
else
Response.Write("");
}
}
}
4.5商城后台商城管理页面设计
新建.aspx文件,添加好所需控件元件以后,载入源代码:
<%@ControlLanguage="C#"AutoEventWireup="true"CodeFile="fenyePro.ascx.cs"Inherits="fenyepro"%>
DataListID="DataList1"runat="server"RepeatColumns="3"RepeatDirection="Horizontal">
id=<%#Eval("bh")%>">
"class="style23"style="border-style:
none"height="80"width="111"/>
LabelID="titleLabel"runat="server"Text='<%#Eval("productName")%>'/>
单价:
LabelID="priceLabel"runat="server"Text='<%#Eval("price")%>'/>元
id=<%#Eval("bh")%>"target="_blank">修改
id=<%#Eval("bh")%>"target="_blank">删除
DataList>
PanelID="Panel1"runat="server">
LabelID="lblTotal"runat="server"Text="">
Label>
HyperLinkID="hlFirst"runat="server">首页
HyperLink>
HyperLinkID="hlPre"runat="server">上一页
HyperLink>
HyperLinkID="hlNext"runat="server">下一页
HyperLink>
HyperLinkID="hlLast"runat="server">末页
HyperLink>
第TextBoxID="txtGoPage"runat="server"Width="40px">
TextBox>
页ButtonID="Button1"runat="server"OnClick="Button1_Click"Text="转到"/>
Panel>
然后编辑.cs程序文件,其代码为:
usingSystem;
publicpartialclassfenyepro:
System.Web.UI.UserControl
{
protectedvoidPage_Load(objectsender,EventArgse)
{
intiPageSize=9;//每页几条
stringstrTableName="product";//要显示的数据表
stringstrKey="bh";//说明数据表的关键字段
stringstrOrder="desc";//按关键字段升序asc,降序desc排列
stringstrFields="*";//要显示的字段,用"*"表示或用英文逗号分隔开如"产品名称,单价,单位数量"
intiCurPage;
intiMaxPage=1;
stringsql="";
stringsqlstr="selectcount(*)from"+strTableName;
if(Request.QueryString["page"]!
="")
iCurPage=Convert.ToInt32(Request.QueryString["page"]);
else
iCurPage=1;
intintTotalRec=Convert.ToInt32(DbManager.ExecuteScalar(sqlstr));//求总记录数
if(intTotal