ImageVerifierCode 换一换
格式:DOC , 页数:24 ,大小:356.54KB ,
资源ID:12004371      下载积分:10 金币
快捷注册下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

开通VIP
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.zixin.com.cn/docdown/12004371.html】到电脑端继续下载(重复下载【60天内】不扣币)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

开通VIP折扣优惠下载文档

            查看会员权益                  [ 下载后找不到文档?]

填表反馈(24小时):  下载求助     关注领币    退款申请

开具发票请登录PC端进行申请

   平台协调中心        【在线客服】        免费申请共赢上传

权利声明

1、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
2、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,个别因单元格分列造成显示页码不一将协商解决,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
3、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
4、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前可先查看【教您几个在下载文档中可以更好的避免被坑】。
5、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
6、文档遇到问题,请及时联系平台进行协调解决,联系【微信客服】、【QQ客服】,若有其他问题请点击或扫码反馈【服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【版权申诉】”,意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:0574-28810668;投诉电话:18658249818。

注意事项

本文(MyPetShop实验报告书.doc)为本站上传会员【仙人****88】主动上传,咨信网仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知咨信网(发送邮件至1219186828@qq.com、拔打电话4009-655-100或【 微信客服】、【 QQ客服】),核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载【60天内】不扣币。 服务填表

MyPetShop实验报告书.doc

1、 《Web程序设计》 MyPetShop程序实验报告书 班 级: 计算机科学与技术A1201 学生姓名: 学生学号: 学生组别: 第七组 指导老师: 朱广福 2014年06月23日 目录 MyPetShop系统概述 2 实验内容 2 实验规划 2 网站设计中心思想和大体构架 2 系统的整体架构 4 实

2、验过程以及代码 4 母板页 4 数据库 6 登录模板 8 购物车 9 订单结算 14 地图功能 19 心得 21 MyPetShop系统概述 随着因特网的不断普及和信息高速公路的逐步延伸,人类社会现今已昂首步入信息社会时代,而商品交易模式在不断地发生着变化。在社会化大生产以及社会分工日趋专业化的今天,网上购物无形的占据着主要的地位。网上购物系统一般由商品管理,购物车管理,系统管理和会员管理等要素组成,是一个网上交易过程。其主要任务是交易各方以电子交易方式而不是通过当面交换或直接面谈方式进行的任何方式的商业交易。显然,这与“网上购物”的概念和内容

3、既有联系,又有明显的区别。它们涉及的信息范围,服务功能以及社会意义等都不相同。网上购物系统搜集和管理的是特定的信息,其范围较窄,功能和目标比较明确,具体,主要是为特定的领域和机构的决策和管理服务;而信息管理则要对各类信息及其相关要素进行全方位管理,而对全社会开展信息服务,以便有效地满足社会的信息需求。今天,我们可以确信网上购物毋庸置疑是未来的发展方向。然而网上购物系统却还没有一个严格的定义。Intel公司认为:网上购物=电子市场+电子交易+电子服务;IBM认为:网上购物=web;HP公司则说:“网上购物是通过电子化的手段来完成商业贸易活动的一种方式。”如此等等。 实验内容 组内成员一起完成

4、购物网站的设计与开发 实验规划 1、 网站设计中心思想和大体构架 1.前台商品浏览模块 按照电子商务网站的一般规划和人们使用电子商务网站的习惯,前台商品浏览模块主要实现按照各种条件显示、查看商品的前台显示功能。 2.用户注册登录模块 用户注册和登录模块与通常的会员系统类似,用户注册以后就可以成为系统的会员。用户只有在成功登录系统后,才可以实现商品的购买。注册用户还具有修改密码和找回密码的功能。 3.购物车模块 购物车是每个电子商务站点的基本元素。不允许匿名用户访问购物车。购物车中包含了用户决定购买的所以商品信息,包括商品编号、商品名称、商品价格、购买

5、数量以及用户应付总价等。用户在查看商品详细信息时,如果决定购买即可将商品加入购物车,然后可以继续浏览其它产品。 4.订单结算模块 用户完成购物后即可进入结算中心,系统对用户的产品及数量进行价格计算,最后生成用户应付款金额。然后用户向系统下达订单并提供送货地址和付款方式等信息。 5.后台管理功能模块 后台管理功能模块是根据系统数据维护要求而设计的后台管理平台,只有拥有管理员角色的用户才可进入后台功能模块实现系统的维护与管理。 2、 系统的整体架构 系统功能模块设计、用户控件设计、系统数据库总体设计 web.config配置文件的设计 实验过程以及代码 首先我们应

6、该先建立一个ASP的网站 然后我们添加该模板页 然后对模板页面进行编辑代码和布局增加控件 public partial class MasterPage : System.Web.UI.MasterPage { protected void Page_Load(object sender, EventArgs e) { Initialize(); } protected void Initialize() { if (Roles.GetAllRoles().Length =

7、 0) { Roles.CreateRole("Member"); Roles.CreateRole("Admin"); } } protected void lnkbtnReset_Click(object sender, EventArgs e) { WebPartManager webPartManager = new WebPartManager(); webPartManager = WebPartManager.Get

8、CurrentWebPartManager(Page); webPartManager.Personalization.ResetPersonalizationState(); } protected void imgbtnSearch_Click(object sender, ImageClickEventArgs e) { string strQuery = ""; if (txtSearch.Text.Trim() == "") { strQ

9、uery = ""; } else { strQuery = "?SearchText=" + txtSearch.Text.Trim(); } Response.Redirect("~/Search.aspx" + strQuery, true); } } 母版页的布局代码 实现的效果 然后增添数据库,商品的数据可和用户的数据库 商品种类的数据库 数据库表中的相互关系 将注册的用户添加到数据

10、库里面 注册新的用户界面 public partial class Login : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { Login1.Focus(); } } 登录控件代码 购物车的功能部分代码 允许匿名用户访问购物车,购物车中包含了用户决定购买的所有商品信息,包括商品编号、商品名称、商品价格、购买数量以及用户应付总价等,用户在查看商品详细信息时,如果决定购买即可将商品加入购物车,然后可

11、以继续浏览其他产品。 public partial class ShopCart : System.Web.UI.Page { DataConn dataconn = new DataConn(); protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["ProductId"] != null) {

12、 int productId = int.Parse(Request.QueryString["ProductId"]); AddProduct(productId); } lblHint.Text = "温馨提示:更改购买数量后,请单击'重新计算'按钮进行更新!"; Bind(); } } protected void AddProduct(int productId) { int isExit =

13、0; for (int j = 0; j < Profile.Cart.ProName.Count; j++) { if (productId == (int)Profile.Cart.ProId[j]) { int qty = (int)Profile.Cart.Qty[j]; qty++; Profile.Cart.Qty[j] = qty; Pr

14、ofile.Save(); isExit = 1; } } if (isExit == 0) { var products = from r in dataconn.Product where r.ProductId == productId select r; foreach (var produ

15、ct in products) { Profile.Cart.ListPrice.Add(product.ListPrice); Profile.Cart.Qty.Add(1); Profile.Cart.ProId.Add(product.ProductId); Profile.Cart.ProName.Add(product.Name); } Profile.Save();

16、 } } protected void Bind() { Profile.Cart.TotalPrice = TotalPrice().ToString(); lblTotalPrice.Text = Profile.Cart.TotalPrice; DataTable dt = new DataTable(); dt.Columns.Add("ProId"); dt.Columns.Add("ProName"); dt.Columns.

17、Add("ListPrice"); dt.Columns.Add("Qty"); for (int i = 0; i < Profile.Cart.ProName.Count; i++) { DataRow row = dt.NewRow(); row[0] = Profile.Cart.ProId[i]; row[1] = Profile.Cart.ProName[i]; row[2] = Profile.Cart.ListPrice[

18、i]; row[3] = Profile.Cart.Qty[i]; dt.Rows.Add(row); } gvCart.DataSource = dt; gvCart.DataBind(); if (gvCart.Rows.Count != 0) { pnlCart.Visible = true; lblCart.Text = ""; } else

19、 { pnlCart.Visible = false; lblCart.Text = "购物车内无商品,请先购物!"; } } protected decimal TotalPrice() { decimal sum = 0; for (int j = 0; j < Profile.Cart.ProName.Count; j++) { int qty = (int)Profile.Cart.Qty[j];

20、 decimal listPrice = (decimal)Profile.Cart.ListPrice[j]; sum += qty * listPrice; } return sum; } protected void btnDelete_Click(object sender, EventArgs e) { int productId = 0; GridView gvCart = new GridView();

21、 gvCart = (GridView)Page.Master.FindControl("ContentPlaceHolder2").FindControl("gvCart"); if (gvCart != null) { for (int i = 0; i < gvCart.Rows.Count; i++) { CheckBox chkProduct = new CheckBox(); chkProduct = (CheckBox)gvC

22、art.Rows[i].FindControl("chkProduct"); if (chkProduct != null) { if (chkProduct.Checked) { productId = int.Parse(gvCart.Rows[i].Cells[1].Text); DeleteProduct(productId);

23、 } } } } Bind(); } protected void DeleteProduct(int productId) { int j = 0; for (int i = 0; i < Profile.Cart.ProName.Count; i++) { if (productId == (int)Profile.Cart.

24、ProId[i]) { j = i; break; } } Profile.Cart.ListPrice.RemoveAt(j); Profile.Cart.ProId.RemoveAt(j); Profile.Cart.ProName.RemoveAt(j); Profile.Cart.Qty.RemoveAt(j); Profile.Save();

25、 } protected void btnClear_Click(object sender, EventArgs e) { Profile.Cart.Qty.Clear(); Profile.Cart.ProName.Clear(); Profile.Cart.ProId.Clear(); Profile.Cart.ListPrice.Clear(); Profile.Save(); Response.Redirect("Default.

26、aspx", true); } protected void btnComputeAgain_Click(object sender, EventArgs e) { lblError.Text = ""; GridView gvCart = new GridView(); gvCart = (GridView)Page.Master.FindControl("ContentPlaceHolder2").FindControl("gvCart"); if (gvCart != null)

27、 { for (int i = 0; i < gvCart.Rows.Count; i++) { TextBox txtQty = new TextBox(); txtQty = (TextBox)gvCart.Rows[i].FindControl("txtQty"); if (txtQty != null) { var product = (fr

28、om p in dataconn.Product where p.ProductId == int.Parse(gvCart.Rows[i].Cells[1].Text) select p).First(); if (int.Parse(txtQty.Text) > product.Qty) { lblError.

29、Text += "Error:库存不足,商品名为 " + gvCart.Rows[i].Cells[2].Text + " 的库存数量为 " + product.Qty.ToString() + "
"; } else { ChangeQty(int.Parse(gvCart.Rows[i].Cells[1].Text), int.Parse(txtQty.Text));

30、 } } } } Bind(); } protected void ChangeQty(int productId, int qty) { for (int i = 0; i < Profile.Cart.ProName.Count; i++) { if (productId == (int)Profile.Cart.ProId[i]) {

31、 Profile.Cart.Qty[i] = qty; Profile.Save(); } } } protected void btnSettle_Click(object sender, EventArgs e) { if (User.Identity.IsAuthenticated) { Response.Redirect("SubmitCart.aspx", true); }

32、 else { Response.Redirect("Login.aspx"); } } } 执行控件功能 有增添商品 删除商品 清空购物车 重新计算等功能 public partial class SubmitCart : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!User.Identity.IsAuthenticated)

33、 { Response.Redirect("~/Login.aspx", true); } pnlConsignee.Visible = true; lblMsg.Text = ""; } protected void btnSubmit_Click(object sender, EventArgs e) { DataConn dataconn = new DataConn(); Order order = new Order();

34、 order.UserName = User.Identity.Name; order.OrderDate = DateTime.Now; order.Addr1 = txtAddr1.Text.Trim(); order.Addr2 = txtAddr2.Text.Trim(); order.City = txtCity.Text.Trim(); order.State = txtState.Text.Trim(); order.Zip = txtZip.Text.Trim

35、); order.Phone = txtPhone.Text.Trim(); order.Status = "未审核"; dataconn.Order.InsertOnSubmit(order); dataconn.SubmitChanges(); int orderId = order.OrderId; for (int i = 0; i < Profile.Cart.ProName.Count; i++) { OrderItem

36、 orderItem = new OrderItem(); orderItem.OrderId = orderId; orderItem.ProName = (string)Profile.Cart.ProName[i]; orderItem.ListPrice = (decimal)Profile.Cart.ListPrice[i]; orderItem.Qty = (int)Profile.Cart.Qty[i]; orderItem.TotalPrice =

37、int)Profile.Cart.Qty[i] * (decimal)Profile.Cart.ListPrice[i]; var product = (from c in dataconn.Product where c.ProductId == (int)Profile.Cart.ProId[i] select c).First(); product.Qty -= orderItem.Qty;

38、 dataconn.OrderItem.InsertOnSubmit(orderItem); dataconn.SubmitChanges(); } Profile.Cart.Qty.Clear(); Profile.Cart.ProName.Clear(); Profile.Cart.ProId.Clear(); Profile.Cart.ListPrice.Clear(); Profile.Cart.TotalPrice = ""; p

39、nlConsignee.Visible = false; lblMsg.Text = "谢谢光临本店,祝您购物愉快!"; } } 对产品进行收货发货地址的填写 public partial class Search : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Bind(); } }

40、 protected void Bind() { if (Request.QueryString["SearchText"] != null) { string strSearchText = Request.QueryString["SearchText"].ToString(); DataConn dataconn = new DataConn(); var products = from p in dataconn.Product

41、 where SqlMethods.Like(p.Name, "%" + strSearchText.Trim() + "%") select p; gvProduct.DataSource = products; gvProduct.DataBind(); } else { lblError.Text = "无搜索结果!"; } } prote

42、cted void gvProduct_PageIndexChanging(Object sender, GridViewPageEventArgs e) { gvProduct.PageIndex = e.NewPageIndex; Bind(); } } 商品的浏览和是否加入购物车 用户浏览时候的界面 public partial class UserControl_NewProduct : System.Web.UI.UserControl { protected void Page_Load(

43、object sender, EventArgs e) { DataConn dataconn = new DataConn(); var products = (from c in dataconn.Product orderby c.ProductId descending select c).Take(7); gvProduct.DataSource = products; gvProduct.DataBin

44、d(); } } 商品显示的名称和价格 若已经登录则则跳转若没有登录则跳转至登录界面 public partial class Default2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { try { DataSet ds = WeatherClass.getSupportDataSet(); if (!

45、Page.IsPostBack) { DataTable dt = ds.Tables[0]; ddlProvince.DataSource = dt; ddlProvince.DataValueField = "ID"; ddlProvince.DataTextField = "Zone"; ddlProvince.DataBind();

46、 ddlCity.SelectedIndex = 1; CityDataBind("1"); GetWeatherByCode("54511"); } } catch (Exception) { lblTitle.Text = "网络连接异常"; } } protected void CityDataBind(str

47、ing zoneID) { DataView dv = new DataView(WeatherClass.getSupportDataSet().Tables[1]); dv.RowFilter = "[ZoneID] = " + zoneID; ddlCity.DataSource = dv; ddlCity.DataTextField = "Area"; ddlCity.DataValueField = "AreaCode"; ddlCity.DataBi

48、nd(); ddlCity.Items.Insert(0, new ListItem("选择城市", "0")); ddlCity.SelectedIndex = 0; } protected void GetWeatherByCode(string cityCode) { String[] wa = WeatherClass.GetCityWeather(cityCode.Trim()); lblNow.Text = wa[10]; lblToday.T

49、ext = wa[6] + "   " + wa[5] + "   " + wa[7]; lblTomorrow.Text = wa[13] + "   " + wa[12] + "   " + wa[14]; lblAfterTmr.Text = wa[18] + "   " + wa[17] + "   " + wa[19]; lblExponen

50、t.Text = wa[11].Replace("\n", "
"); lblCityIntro.Text = wa[22].Replace("\n", "
"); lblTime.Text = DateTime.Parse(wa[4]).ToString("yyyy年MM月dd日 dddd HH:mm"); lblCity.Text = wa[0] + " / " + wa[1]; imgWeathertrendsTdS.ImageUrl = "~/img/weather/" + wa[8];

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服