网上购物车系统课程设计任务书.doc_第1页
网上购物车系统课程设计任务书.doc_第2页
网上购物车系统课程设计任务书.doc_第3页
网上购物车系统课程设计任务书.doc_第4页
网上购物车系统课程设计任务书.doc_第5页
已阅读5页,还剩21页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

软件学院 课程设计报告书课程名称 .NET框架程序设计 设计题目 网上购物车系统 专业班级 软升本14-2 学 号 1420980208 姓 名 侯铎 指导教师 刘亮 2015 年 1 月目 录1 设计时间12 设计目的13设计任务14 设计内容14.1需求分析24.2总体设计24.3详细设计34.4测试与分析54.4.1测试54.4.2分析74.5 附录75 总结与展望23参考文献24成绩评定241 设计时间时 间:20周(2015年1月122011年1月18日);上机时间:周一上午,周二上午,周三上午,周四下午;2 设计目的本课程设计是学生学习完.net框架程序设计课程后,进行的一次全面的综合训练,通过课程设计,让学生掌握运用Visual Stdio.NET平台开发一个虚拟商品采购中的虚拟购货车和订单子系统,综合运用本课程前面讲述的各部分内容。3设计任务完成对网上购物车系统设计,并写出规范的设计文档。本系统是一个网上食品商店的小型网站,几个核心问题包括:主页面的设计;商品的分类显示;选购和调整购物车;集中结算;存储订单;查看订单。将此些功能完好的结合在一起。4 设计内容 课程设计以一个订单为中心的小型电子商务网站为基础,传统观念中的商店除必须有商品以外,还需要有店房、门面和货架等。而网上商店主要依靠网络技术来完成商品展示、订购以及支付等项工作,网上商店既没有店房、门面也没有货架,因此网上商店常被称之为“虚拟”商店。人们到超级商场去购买东西时,总得先将想买的商品从货架上取下来,放到购货车中,然后集中起来一起算账、付款。网上商店模拟这个购物过程,先让客户从不同的网页中选取商品,并将这些商品集中到“购货车”中一起算账,最后生成完整的订单。网上购货车不同于实际的购货车,它是一种虚拟结构,称为“虚拟购货车”。“虚拟购货车”和“订单”是商品采购中的核心部分,创建虚拟购货车和订单是一门综合技术,可以采用多种方式。所用的技术包括:利用用户控件和主控页进行界面设计;实现数据表多表之间的同步;完成对数据表的显示、修改和统计。除此以外,还要动态生成内存中的数据表以及使用Session对象保存数据并在网页之间进行传递等。SQL Server提供的Northwind样板库是一个虚拟的国外食品公司的数据库,我们将利用这个数据库(加以简化)来创建自己的购货车与订单。下面先对Northwind样板库做一个简单的介绍。Northwind样板库的数据表包括以下4部分。订单部分:包含订单表(Orders)、订单细目(Order Details)、订单发货(Shippers)。l 产品部分:包括类型表(Categories)、产品表(Products)、产品提供者(Suppliers)。l 雇员信息部分:包括有关雇员(Employees)的4张表。l 顾客信息:包括顾客表(Customers)等。l 本设计还需要在数据库中自行建立一个简化的订单表,订单表的结构将在下面讲述。 4.1需求分析理解系统的关键是搞清GridView、内存数据表与Session对象三者之间的关系。系统的执行过程是:进入“主界面”(主页面这里没有画),显示商品分类,以及欢迎界面;在分类数据表(Categories)中任选一种数据类型,同步打开“产品.aspx”网页,用GridView控件分类显示Products数据表中相应的商品;单击想要购买的商品,将该商品的数据取出来,放到下面的动态数据表中(数据表用虚线画的长方形表示),然后再将数据表放入“购货车”中,这里的购货车用SessionShoppingCart表示;打开“购货车.aspx”网页,控件GridView以SessionShoppingCart作为数据源显示数据,并在新网页中确定购买的数量,并输入“客户标志”;与此同时生成新的内存数据表,并将新数据表存入新的SessionShoppingCart2中;打开“结账.aspx”网页,以新Session对象作为数据源在GridView控件中显示数据,同时通过Sessionkhbj将客户标志传入到网页中;在“结账”网页中完成计算总价的工作,最后存入订单;在“查看订单.aspx”网页中以客户标志作为查询条件显示订单,以便只显示客户本人的订单部分。在上述各个阶段中,都允许客户对数据进行选择和修改。除开始阶段和最后阶段需要直接存取数据库以外,其他部分均采用内存动态数据表来组织数据,这样做可以提高系统的运行效率。客户标志是识别客户的惟一标志,平时存放在客户登录表中,包括有联系地址、联系方法等。具体项目由网络商店事先确定。 4.2总体设计总体设计分为概要设计和逻辑设计,大体思想如下图。概要设计:图4-1逻辑设计:图4-24.3详细设计这次设计的购物网站一共分为八部分,分别为用户控件,母版页,主页,购物车页,商品页,结账页,订单页,用户控件,数据库的设计。设计步骤:1. 用户控件添加;2. 主控页设计;3. 主页设计;图4-34. 商品网页设计;图4-45. 购物车网页设计;图4-56. 结账网页设计。图4-67. 订单页设计8. 数据库设计4.4测试与分析4.4.1测试主页运行结果:购物车运行结果:结账运行结果如下:4.4.2分析 通过本次网页的简单制作,购物网站大体完成。该系统能够实现网上购物的一些基本功能,即能够基本满足用户在前台对商品进行浏览,添加购物车,修改购物车,结账。但该系统除基本满足功能需求外,在性能方面还存在不足,有系统继续优化的空间。另外,部分功能在设计上仍存在不足之处。需要在进一步学习之后进行功能完善。4.5 附录用户控件源代码: 欢迎来到网络食品店     主页     购物车     结账     : 用户控件后台文件: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 WebUserControl : System.Web.UI.UserControl protected void Page_Load(object sender, EventArgs e) DateTime d = DateTime.Now; Label2.Text = d.ToLongDateString() + d.ToLongTimeString(); 主控页源代码: 无标题页     asp:SqlDataSource ID=SqlDataSource1 runat=server ConnectionString= SelectCommand=SELECT CategoryName, CategoryID FROM Categories   Copyright©2014软升本14-2 主页源代码: 欢   迎 选   购 商品页源代码: asp:SqlDataSource ID=SqlDataSource1 runat=server ConnectionString= SelectCommand=SELECT ProductID, ProductName, CategoryID, QuantityPerUnit, UnitPrice FROM Products WHERE (CategoryID = CategoryID)  商品页后台文件: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 Default2 : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) System.Data.DataTable Cart = new System.Data.DataTable(); if (e.CommandName = select) if (SessionShoppingCart = null) Cart.Columns.Add(商品编号, typeof(int); Cart.Columns.Add(商品名称, typeof(string); Cart.Columns.Add(单元含量, typeof(string); Cart.Columns.Add(单价, typeof(double); SessionShoppingCart = Cart; Cart = (System.Data.DataTable)SessionShoppingCart; int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = GridView1.Rowsindex; string bhText = row.Cells1.Text; string mcText = row.Cells2.Text; string dyText = row.Cells4.Text; string djText = row.Cells5.Text; int bh = int.Parse(bhText); double dj = double.Parse(djText); System.Data.DataRow rr = Cart.NewRow(); rr商品编号 = bh; rr商品名称 = mcText; rr单元含量 = dyText; rr单价 = dj; Cart.Rows.Add(rr); SessionShoppingCart = Cart; 购物车页源代码: 客户标志: asp:TextBox ID=TextBox2 runat=server Text= Width=57px 购物车页后台文件: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 Default2 : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) if (!IsPostBack) GridView1.DataSource = SessionShoppingCart; DataBind(); protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) System.Data.DataTable Cart = new System.Data.DataTable(); if (e.CommandName = buy) if (SessionShoppingCart2 = null) Cart.Columns.Add(商品编号, typeof(int); Cart.Columns.Add(商品名称, typeof(string); Cart.Columns.Add(单元含量, typeof(string); Cart.Columns.Add(单价, typeof(double); Cart.Columns.Add(订购数量, typeof(int); Cart.Columns.Add(折扣, typeof(double); Cart.Columns.Add(合计, typeof(double); SessionShoppingCart2 = Cart; Cart = (System.Data.DataTable)SessionShoppingCart2; if (TextBox1.Text = ) Validate(); else Sessionkhbz = TextBox1.Text; int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = GridView1.Rowsindex; TextBox tt = (System.Web.UI.WebControls.TextBox)row.Cells1.FindControl(TextBox2); string dg1 = tt.Text; int dg = int.Parse(dg1); if (dg = 1) dg = 1; string bhText = row.Cells2.Text; string mcText = row.Cells3.Text; string dyText = row.Cells4.Text; string djText = row.Cells5.Text; int bh = int.Parse(bhText); double dj = double.Parse(djText); System.Data.DataRow rr = Cart.NewRow(); rr商品编号 = bh; rr商品名称 = mcText; rr单元含量 = dyText; rr单价 = dj; rr订购数量 = dg; int zk = 1; rr折扣 = zk; double hj = dj * dg * zk; rr合计 = hj; Cart.Rows.Add(rr); SessionShoppingCart2 = Cart; 结账页源代码: 客户标志: : asp:SqlDataSource ID=SqlDataSource1 runat=server ConnectionString= SelectCommand=NewCartInsert SelectCommandType=StoredProcedure InsertCommand=NewCartInsert2 InsertCommandType=StoredProcedure 结账页后台文件: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 Default2 : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) if (!IsPostBack) TextBox1.Text = Sessionkhbz.ToString(); GridView1.DataSource = SessionShoppingCart2; GridView1.DataBind(); protected void Button1_Click(object sender, EventArgs e) double sum = 0.0; for (int ii = 0; ii GridView1.Rows.Count; ii+) CheckBox cc = (CheckBox)GridView1.Rowsii.Cells0.FindControl(CheckBox1); if (cc.Checked) sum = sum + (double.Parse(GridView1.Rowsii.Cells7.Text); TextBox2.Text = sum.ToString(); protected void Button2_Click(object s

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论