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

上传人:jian****018 文档编号:9307210 上传时间:2020-04-04 格式:DOC 页数:18 大小:345.50KB
返回 下载 相关 举报
网上商城详细设计说明书.doc_第1页
第1页 / 共18页
网上商城详细设计说明书.doc_第2页
第2页 / 共18页
网上商城详细设计说明书.doc_第3页
第3页 / 共18页
点击查看更多>>
资源描述
网上商城设计详细说明书姓名: 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,以及结合教师给的源代码,进一步修改,从而实现网上商城系统1.2 前期工作在编写该需求前,首先是对各大网上销售网站进行了调查,其中包括:网页排版、顾客消费流程、以及管理员的操作,这三大块进行了调查。并总结出了有自己特色的设计思路。1.3编写背景随着Internet国际互联网的发展,越来越多的企业开始建造自己的网站。基于Internet的信息服务,商务服务已经成为现代企业一项不可缺少的内容。很多企业都已不满足于建立一个简单的仅仅能够发布信息的静态网站。现代企业需要的是一个功能强大的,能提供完善的电子商务服务的动态商务网站。本网上商城系统就是根据电子商务和互联网的发展,针对网上顾客所开发的网络购物系统,本商城系统主要有:1)用户浏览、注册、登录与购买商品;2)商品的入库资料登记;3)商城访问者的在线留言、查看留言,管理员的在线管理留言等;4)商城最新的新闻显示,历史新闻的分页显示,新闻详细情况的显示,后台管理员添加、删除、修改新闻等。本数据采用access作为数据库,亦可以使用SQL作为数据库,项目的重点是商品的添加、删除、显示与修改,需要克服的难点是商品图片的上传和删除。2.技术概述2.1 目标我们使用C#以及数据库技术构建网站,争取将本网站做成一个界面友好、用户购物方便、管理员管理方便的购物系统。2.2 硬件支持Cpu: 弄个四核最好 比如老一代core Q84002.3 软件支持 操作系统:Windows xp/vista/seven均可,C#开发环境。3.功能需求3.1 功能块划分1)用户浏览、注册、登录与购买商品;2)商品的入库资料登记;3)商城访问者的在线留言、查看留言,管理员的在线管理留言等;4)商城最新的新闻显示,历史新闻的分页显示,新闻详细情况的显示,后台管理员添加、删除、修改新闻等。网上购物系统在线购物添加留言显示留言管理留言购物车管理商品管理分类展示生成订单商城留言4.具体设计4.1首页设计新建web窗体default.aspx,其代码为: .style23 width: 116px; height: 94px; .style24 width: 600px; height: 132px; .style25 width: 104px; .style26 width: 598px; .style27 width: 106px; 热点促销 更多>>> a href=newsshow.aspx?id= target=_blank 最新产品   a href=show.aspx?id= altimg src=images/ class=style23 style=border-style: none /  asp:Label ID=titleLabel runat=server Text= /  asp:Label ID=priceLabel runat=server Text= / 接着,切换到程序文件.cs编辑栏里,写入代码:using System;using System.Collections.Generic;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;public partial class _Default : System.Web.UI.Page protected 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,配置好各项值以后,载入代码: .style3 width: 100%; .style4 text-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.Page protected void Page_Load(object sender, EventArgs e) string sql = select * from product where bh= + Request.QueryStringid; DataTable dt= DbManager.ExecuteQuery(sql); Image1.ImageUrl =images/+dt.Rows0pic.ToString(); txtTitle.Text = dt.Rows0productName.ToString(); txtContents.Text = dt.Rows0contents.ToString(); txtPrice.Text = dt.Rows0price.ToString(); protected void ImageButton1_Click(object sender, ImageClickEventArgs e) Response.Redirect(buy.aspx?id= + Request.QueryStringid + &num= + Convert.ToInt32(num.Text); 4.3 实现商品搜索功能新建search.aspx,配置相关参数,载入以下代码: 查询结果 a href=show.aspx?id= target=_blank 然后编辑.cs文件using System;using System.Data;using System.Configuration;using System.Collections;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;public partial class search : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) string strSQL = select * from product where productName like % + Server.UrlDecode(Request.QueryStringtxtSearchName) + %; DataTable dt = DbManager.ExecuteQuery(strSQL); Repeater1.DataSource = dt; Repeater1.DataBind(); 4.4商城后台管理登录设计新建一个login.aspx,添加所需要的元件,在.cs程序文件中编写ImageButton的事件代码:using System;public partial class login : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) Sessionpass = 0; protected void Button1_Click(object sender, EventArgs e) if (TextBox3.Text != Request.CookiesCheckCode.Value.ToString() Response.Write(alert(验证码错误!); else string strSQL = select * from users where userName= + TextBox1.Text + and pwd= + TextBox2.Text + ; if (DbManager.ExecuteQuery(strSQL).Rows.Count 0) Sessionpass = 1; Response.Redirect(manageProduct.aspx); else Response.Write(alert(用户名或密码错误!); 4.5商城后台商城管理页面设计新建.aspx文件,添加好所需控件元件以后,载入源代码: a href=showpro.aspx?id= img src=images/ class=style23 style=border-style: none height=80 width=111 / asp:Label ID=titleLabel runat=server Text= / 单价:asp:Label ID=priceLabel runat=server Text= / 元 a href=updatepro.aspx?id= target=_blank修改 a href=delpro.aspx?id= target=_blank删除 首页 上一页 下一页 末页 第 页 然后编辑.cs程序文件,其代码为:using System;public partial class fenyepro : System.Web.UI.UserControl protected void Page_Load(object sender, EventArgs e) int iPageSize = 9; /每页几条 string strTableName = product; /要显示的数据表 string strKey = bh; /说明数据表的关键字段 string strOrder = desc; /按关键字段升序asc,降序desc排列 string strFields = *; /要显示的字段,用*表示或用英文逗号分隔开如产品名称,单价,单位数量 int iCurPage; int iMaxPage = 1; string sql = ; string sqlstr = select count(*) from + strTableName; if (Request.QueryStringpage != ) iCurPage = Convert.ToInt32(Request.QueryStringpage); else iCurPage = 1; int intTotalRec = Convert.ToInt32(DbManager.ExecuteScalar(sqlstr);/求总记录数 if (intTotalRec % iPageSize = 0) iMaxPage = intTotalRec / iPageSize;/求总页数 else iMaxPage = intTotalRec / iPageSize + 1; if (iMaxPage = 0) iMaxPage = 1; if (iCurPage iMaxPage) iCurPage = iMaxPage; if (intTotalRec != 0) if (iCurPage = 1) sql = select top + iPageSize + + strFields + from + strTableName + order by + strKey + + strOrder; else sql = select top + iPageSize + + strFields + from + strTableName + where + strKey + not in(select top + (iCurPage - 1) * iPageSize + + strKey + from + strTableName + order by + strKey + + strOrder + ) order by + strKey + + strOrder; DataList1.DataSource = DbManager.ExecuteQuery(sql);/显示控件名称要根据实际使用控件名修改 DataList1.DataBind(); lblTotal.Text = 共有 + intTotalRec.ToString() + 条记录 当前是第 + iCurPage.ToString() + / + iMaxPage.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= + iMaxPage; if (intTotalRec = iPageSize) Panel1.Visible = false; else Panel1.Visible = true; protected void Button1_Click(object sender, EventArgs e) int iCurPage = 1; if (txtGoPage.Text != ) iCurPage = Convert.ToInt32(txtGoPage.Text); Response.Redirect(Request.FilePath + ?page= + iCurPage); 然后建立商品显示窗体页,新建manageProduct.aspx,拖fenyePro.aspx到其中,添加一个“增加新商品”link,链接指向insertPro.aspx。接着,为manageProduct.aspx.cs添加程序代码:using System;using System.Collections.Generic;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;public partial class manageProduct : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) if (Convert.ToInt32(Sessionpass) != 1) Response.Write(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;using 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.Page protected void Page_Load(object sender, EventArgs e) if (Convert.ToInt32(Sessionpass) != 1) Response.Redirect(login.aspx); /按编号查找到要删除的图片文件名称 string strSQL1 = select pic from product where bh = + Request.QueryStringid; DataTable dt = DbManager.ExecuteQuery(strSQL1); string strurl = dt.Rows0pic.ToString(); File.Delete(Server.MapPath(images/ + strurl);/将图片从服务器上删除 string strSQL = delete * from product where bh= + Request.QueryStringid; if (DbManager.ExecuteNonQuery(strSQL) 0) Response.Write(alert(删除成功); Response.Write(location.assign(manageProduct.aspx); 5.总结至此,大部分系统已经做完,后面补全即可初步完成商城系统
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 模板表格


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!