网上商城详细设计说明书Word下载.docx
- 文档编号:19804362
- 上传时间:2023-01-10
- 格式:DOCX
- 页数:19
- 大小:306.95KB
网上商城详细设计说明书Word下载.docx
《网上商城详细设计说明书Word下载.docx》由会员分享,可在线阅读,更多相关《网上商城详细设计说明书Word下载.docx(19页珍藏版)》请在冰豆网上搜索。
3)商城访问者的在线留言、查看留言,管理员的在线管理留言等;
4)商城最新的新闻显示,历史新闻的分页显示,新闻详细情况的显示,后台管理员添加、删除、修改新闻等。
本数据采用access作为数据库,亦可以使用SQL作为数据库,项目的重点是商品的添加、删除、显示与修改,需要克服的难点是商品图片的上传和删除。
2.技术概述
2.1目标
我们使用C#以及数据库技术构建网站,争取将本网站做成一个界面友好、用户购物方便、管理员管理方便的购物系统。
2.2硬件支持
Cpu:
弄个四核最好比如老一代coreQ8400
2.3软件支持
操作系统:
Windowsxp/vista/seven均可,C#开发环境。
3.功能需求
3.1功能块划分
4.具体设计
4.1首页设计
新建web窗体default.aspx,其代码为:
<
%@PageTitle="
"
Language="
C#"
MasterPageFile="
~/shop.master"
AutoEventWireup="
true"
CodeFile="
Default.aspx.cs"
Inherits="
_Default"
%>
asp:
ContentID="
Content1"
ContentPlaceHolderID="
head"
runat="
Server"
>
<
styletype="
text/css"
.style23
{
width:
116px;
height:
94px;
}
.style24
600px;
132px;
.style25
104px;
.style26
598px;
.style27
106px;
/style>
/asp:
Content>
Content2"
ContentPlaceHolder1"
tablestyle="
font-size:
9pt"
class="
style24"
tr>
tdvalign="
top"
align="
left"
table>
tdclass="
style25"
style="
11pt;
color:
#FFFFFF;
background-color:
#FF0000;
border-width:
0px"
热点促销
/td>
tdstyle="
9pt;
0px;
background-image:
url('
images/line.GIF'
);
178px;
b>
ahref="
news\more.aspx"
更多&
gt;
&
/a>
/b>
/tr>
/table>
RepeaterID="
Repeater1"
server"
ItemTemplate>
news\show.aspx?
id=<
%#Eval("
id"
)%>
target="
_blank"
title"
)%>
AddTime"
"
{0:
d}"
br/>
/ItemTemplate>
Repeater>
imgalt="
电话"
src="
images/TEL.gif"
/>
tableclass="
style26"
style27"
最新产品
background-image:
)"
&
nbsp;
DataListID="
DataList1"
DataKeyField="
bh"
DataSourceID="
AccessDataSource1"
RepeatColumns="
3"
RepeatDirection="
Horizontal"
>
show.aspx?
%#Eval("
altimgsrc="
images/<
pic"
style23"
border-style:
none"
span>
LabelID="
titleLabel"
Text='
productName"
'
priceLabel"
price"
/span>
DataList>
AccessDataSourceID="
DataFile="
~/App_Data/shop.mdb"
SelectCommand="
SELECTtop9[bh],[pic],[price],[productName]FROM[product]orderbybhdesc"
AccessDataSource>
接着,切换到程序文件.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,配置好各项值以后,载入代码:
show.aspx.cs"
show"
.style3
100%;
.style4
text-align:
center;
253px;
style3"
style4"
ImageID="
Image1"
txtTitle"
Text="
Label"
Label>
tdalign="
txtContents"
售价:
txtPrice"
购买数量:
TextBoxID="
num"
Width="
37px"
1<
TextBox>
ImageButtonID="
ImageButton1"
ImageUrl="
~/images/gouWuChe3.jpg"
Height="
74px"
ImageAlign="
Middle"
onclick="
ImageButton1_Click"
72px"
/>
接着建立.cs程序文件,编辑写入以下代码:
usingSystem.Data;
publicpartialclassshow:
stringsql="
select*fromproductwherebh="
+Request.QueryString["
];
DataTabledt=DbManager.ExecuteQuery(sql);
Image1.ImageUrl="
images/"
+dt.Rows[0]["
].ToString();
txtTitle.Text=dt.Rows[0]["
txtContents.Text=dt.Rows[0]["
contents"
txtPrice.Text=dt.Rows[0]["
protectedvoidImageButton1_Click(objectsender,ImageClickEventArgse)
Response.Redirect("
buy.aspx?
id="
]+"
num="
+Convert.ToInt32(num.Text));
4.3实现商品搜索功能
新建search.aspx,配置相关参数,载入以下代码:
%@PageLanguage="
search.aspx.cs"
search"
Title="
UntitledPage"
Runat="
strong>
查询结果
hrwidth="
75%"
/strong>
HeaderTemplate>
/HeaderTemplate>
td>
FooterTemplate>
/FooterTemplate>
然后编辑.cs文件
usingSystem.Configuration;
usingSystem.Collections;
usingSystem.Web.Security;
usingSystem.Web.UI.WebControls.WebParts;
usingSystem.Web.UI.HtmlControls;
publicpartialclasssearch:
select*fromproductwhereproductNamelike'
%"
+Server.UrlDecode(Request.QueryString["
txtSearchName"
])+"
%'
DataTabledt=DbManager.ExecuteQuery(strSQL);
Repeater1.DataSource=dt;
4.4商城后台管理登录设计
新建一个login.aspx,添加所需要的元件,在.cs程序文件中编写ImageButton的事件代码:
publicpartialclasslogin:
Session["
pass"
]=0;
protectedvoidButton1_Click(objectsender,EventArgse)
if(TextBox3.Text!
=Request.Cookies["
CheckCode"
].Value.ToString())
Response.Write("
script>
alert('
验证码错误!
)<
/script>
else
select*fromuserswhereuserName='
+TextBox1.Text+"
andpwd='
+TextBox2.Text+"
if(DbManager.ExecuteQuery(strSQL).Rows.Count>
0)
]=1;
manageProduct.aspx"
用户名或密码错误!
4.5商城后台商城管理页面设计
新建.aspx文件,添加好所需控件元件以后,载入源代码:
%@ControlLanguage="
fenyePro.ascx.cs"
fenyepro"
div>
showpro.aspx?
imgsrc="
height="
80"
width="
111"
单价:
元<
updatepro.aspx?
修改<
delpro.aspx?
删除<
PanelID="
Panel1"
lblTotal"
HyperLinkID="
hlFirst"
首页<
HyperLink>
hlPre"
上一页<
hlNext"
下一页<
hlLast"
末页<
第<
txtGoPage"
40px"
页<
ButtonID="
Button1"
OnClick="
Button1_Click"
转到"
Panel>
/div>
然后编辑.cs程序文件,其代码为:
publicpartialclassfenyepro:
System.Web.UI.UserControl
intiPageSize=9;
//每页几条
stringstrTableName="
product"
//要显示的数据表
stringstrKey="
//说明数据表的关键字段
stringstrOrder="
desc"
//按关键字段升序asc,降序desc排列
stringstrFields="
*"
//要显示的字段,用"
表示或用英文逗号分隔开如"
产品名称,单价,单位数量"
intiCurPage;
intiMaxPage=1;
stringsqlstr="
selectcount(*)from"
+strTableName;
if(Request.QueryString["
page"
]!
="
)
iCurPage=Convert.ToInt32(Request.QueryString["
]);
iCurPage=1;
intintTotalRec=Convert.ToInt32(DbManager.ExecuteScalar(sqlstr));
//求总记录数
if(intTotal
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 网上商城 详细 设计 说明书