收藏 分享(赏)

网上商城详细设计说明书.doc

上传人:hwpkd79526 文档编号:6717680 上传时间:2019-04-21 格式:DOC 页数:17 大小:415.59KB
下载 相关 举报
网上商城详细设计说明书.doc_第1页
第1页 / 共17页
网上商城详细设计说明书.doc_第2页
第2页 / 共17页
网上商城详细设计说明书.doc_第3页
第3页 / 共17页
网上商城详细设计说明书.doc_第4页
第4页 / 共17页
网上商城详细设计说明书.doc_第5页
第5页 / 共17页
点击查看更多>>
资源描述

1、网上商城设计详细说明书姓名: lclboss班级:微机 1024学号:1000005442网上商城设计详细说明书 11.引言 .31.1 编写目的 31.2 前期工作 .31.3 编写背景 32.技术概述 .42.1 目标 .42.2 硬件支持 .42.3 软件支持 43.功能需求 .43.1 功能块划分 44.具体设计 .54.1 首页设计 .54.2 商品详细信息页面设计 .84.3 实现商品搜索功能 104.4 商城后台管理登录设计 .114.5 商城后台商城管理页面设计 .114.6 建立删除商品信息页面 155.总结 .161.引言1.1 编写目的通过学习 ASP.NET,以及结合教

2、师给的源代码,进一步修改,从而实现网上商城系统1.2 前期工作在编写该需求前,首先是对各大网上销售网站进行了调查,其中包括:网页排版、顾客消费流程、以及管理员的操作,这三大块进行了调查。并总结出了有自己特色的设计思路。1.3 编写背景随着 Internet 国际互联网的发展,越来越多的企业开始建造自己的网站。基于 Internet的信息服务,商务服务已经成为现代企业一项不可缺少的内容。很多企业都已不满足于建立一个简单的仅仅能够发布信息的静态网站。现代企业需要的是一个功能强大的,能提供完善的电子商务服务的动态商务网站。本网上商城系统就是根据电子商务和互联网的发展,针对网上顾客所开发的网络购物系统

3、,本商城系统主要有:1)用户浏览、注册、登录与购买商品;2)商品的入库资料登记;3)商城访问者的在线留言、查看留言,管理员的在线管理留言等;4)商城最新的新闻显示,历史新闻的分页显示,新闻详细情况的显示,后台管理员添加、删除、修改新闻等。本数据采用 access 作为数据库,亦可以使用 SQL 作为数据库,项目的重点是商品的添加、删除、显示与修改,需要克服的难点是商品图片的上传和删除。2.技术概述2.1 目标我们使用 C#以及数据库技术构建网站,争取将本网站做成一个界面友好、用户购物方便、管理员管理方便的购物系统。2.2 硬件支持Cpu: 弄个四核最好 比如老一代 core Q84002.3

4、软件支持操作系统:Windows xp/vista/seven 均可,C#开发环境。3.功能需求3.1 功能块划分1)用户浏览、注册、登录与购买商品;2)商品的入库资料登记;3)商城访问者的在线留言、查看留言,管理员的在线管理留言等;4)商城最新的新闻显示,历史新闻的分页显示,新闻详细情况的显示,后台管理员添加、删除、修改新闻等。网上购物系统在线购物添加留言显示留言管理留言购物车管理商品管理分类展示生成订单商城留言4.具体设计4.1 首页设计新建 web 窗体 default.aspx,其代码为:.style23width: 116px;height: 94px;.style24width:

5、600px;height: 132px;.style25width: 104px;.style26width: 598px;.style27width: 106px;热点促销更多“ target=“_blank“最新产品“ “ class=“style23“ style=“border-style: none“ / / /接着,切换到程序文件.cs 编辑栏里,写入代码:using System;using System.Collections.Generic;using System.Web;using System.Web.UI;using System.Web.UI.WebControls

6、;public partial class _Default : System.Web.UI.Pageprotected void Page_Load(object sender, EventArgs e)string strSQL = “select top 7 * from news order by id desc“;Repeater1.DataSource =DbManager.ExecuteQuery(strSQL);Repeater1.DataBind();4.2 商品详细信息页面设计新建 show.aspx,配置好各项值以后,载入代码:.style3width: 100%;.st

7、yle4text-align: center;width: 253px;售价:购买数量:1接着建立.cs 程序文件,编辑写入以下代码:using System;using System.Collections.Generic;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Data;public partial class show : System.Web.UI.Pageprotected void Page_Load(object sender, EventArgs e)st

8、ring sql = “select * from product where bh=“ + Request.QueryString“id“;DataTable dt= DbManager.ExecuteQuery(sql);Image1.ImageUrl =“images/“+dt.Rows0“pic“.ToString();txtTitle.Text = dt.Rows0“productName“.ToString();txtContents.Text = dt.Rows0“contents“.ToString();txtPrice.Text = dt.Rows0“price“.ToStr

9、ing();protected void ImageButton1_Click(object sender, ImageClickEventArgs e)Response.Redirect(“buy.aspx?id=“ + Request.QueryString“id“ + “4.3 实现商品搜索功能新建 search.aspx,配置相关参数,载入以下代码:查询结果“ target=“_blank“ 然后编辑.cs 文件using System;using System.Data;using System.Configuration;using System.Collections;using

10、 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;public partial class search : System.Web.UI.Pageprotected void Page_Load(object sender, EventArgs e)string strSQL = “select * from produ

11、ct where productName like %“ + Server.UrlDecode(Request.QueryString“txtSearchName“) + “%“;DataTable dt = DbManager.ExecuteQuery(strSQL);Repeater1.DataSource = dt;Repeater1.DataBind();4.4 商城后台管理登录设计新建一个 login.aspx,添加所需要的元件,在.cs 程序文件中编写 ImageButton 的事件代码:using System;public partial class login : Syste

12、m.Web.UI.Pageprotected void Page_Load(object sender, EventArgs e)Session“pass“ = 0;protected void Button1_Click(object sender, EventArgs e)if (TextBox3.Text != Request.Cookies“CheckCode“.Value.ToString()Response.Write(“alert(验证码错误!)“);elsestring strSQL = “select * from users where userName=“ + TextB

13、ox1.Text + “ and pwd=“ + TextBox2.Text + “;if (DbManager.ExecuteQuery(strSQL).Rows.Count 0)Session“pass“ = 1;Response.Redirect(“manageProduct.aspx“);elseResponse.Write(“alert(用户名或密码错误!)“);4.5 商城后台商城管理页面设计新建.aspx 文件,添加好所需控件元件以后,载入源代码:“ class=“style23“ style=“border-style: none“ height=“80“ width=“111

14、“ / /单价: / 元 “ target=“_blank“修改“ target=“_blank“删除首页上一页下一页末页第页然后编辑.cs 程序文件,其代码为:using System;public partial class fenyepro : System.Web.UI.UserControlprotected void Page_Load(object sender, EventArgs e)int iPageSize = 9; /每页几条string strTableName = “product“; /要显示的数据表string strKey = “bh“; /说明数据表的关键字

15、段string strOrder = “desc“; /按关键字段升序 asc,降序 desc 排列string strFields = “*“; /要显示的字段,用 “*“表示或用英文逗号分隔开如“产品名称,单价,单位数量“int iCurPage;int iMaxPage = 1;string sql = “;string sqlstr = “select count(*) from “ + strTableName;if (Request.QueryString“page“ != “)iCurPage = Convert.ToInt32(Request.QueryString“page“

16、);elseiCurPage = 1;int intTotalRec = Convert.ToInt32(DbManager.ExecuteScalar(sqlstr);/求总记录数if (intTotalRec % iPageSize = 0)iMaxPage = intTotalRec / iPageSize;/求总页数elseiMaxPage = intTotalRec / iPageSize + 1;if (iMaxPage = 0) iMaxPage = 1; if (iCurPage iMaxPage) iCurPage = iMaxPage; if (intTotalRec !=

17、 0)if (iCurPage = 1)sql = “select top “ + iPageSize + “ “ + strFields + “ from “ + strTableName + “ order by “ + strKey + “ “ + strOrder;elsesql = “select top “ + iPageSize + “ “ + strFields + “ from “ + strTableName + “ where “ + strKey + “ not in(select top “ + (iCurPage - 1) * iPageSize + “ “ + s

18、trKey + “ from “ + strTableName + “ order by “ + strKey + “ “ + strOrder + “ ) order by “ + strKey + “ “ + strOrder;DataList1.DataSource = DbManager.ExecuteQuery(sql);/显示控件名称要根据实际使用控件名修改DataList1.DataBind();lblTotal.Text = “共有“ + intTotalRec.ToString() + “条记录 当前是第“ + iCurPage.ToString() + “/“ + iMax

19、Page.ToString() + “页 “;if (iCurPage != 1)hlFirst.NavigateUrl = Request.FilePath + “?page=1“;hlPre.NavigateUrl = Request.FilePath + “?page=“ + (iCurPage - 1);if (iCurPage != iMaxPage)hlNext.NavigateUrl = Request.FilePath + “?page=“ + (iCurPage + 1);hlLast.NavigateUrl = Request.FilePath + “?page=“ + i

20、MaxPage;if (intTotalRec alert(用户名或密码不对,请重新登录)“);Response.Write(“location.assign(login.aspx)“);Response.End();protected void Button1_Click(object sender, EventArgs e)Session.Clear();Response.Redirect(“default.aspx“);4.6 建立删除商品信息页面在 manageProduct.aspx 中建立一个删除链接。指向 delpro.aspx,并为程序文件添加代码:using System;u

21、sing System.Data;using System.Collections.Generic;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.IO;/删除图片文件时要用到这个命名空间public partial class delpro : System.Web.UI.Pageprotected void Page_Load(object sender, EventArgs e)if (Convert.ToInt32(Session“pass“) != 1) Respons

22、e.Redirect(“login.aspx“);/按编号查找到要删除的图片文件名称string strSQL1 = “select pic from product where bh =“ + Request.QueryString“id“;DataTable dt = DbManager.ExecuteQuery(strSQL1);string strurl = dt.Rows0“pic“.ToString();File.Delete(Server.MapPath(“images/“ + strurl);/将图片从服务器上删除string strSQL = “delete * from product where bh=“ + Request.QueryString“id“;if (DbManager.ExecuteNonQuery(strSQL) 0)Response.Write(“alert(删除成功)“);Response.Write(“location.assign(manageProduct.aspx)“);5.总结至此,大部分系统已经做完,后面补全即可初步完成商城系统

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 实用文档 > 说明文书

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报