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

加入VIP,免费下载
 

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

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

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(ASPNET应用开发综合实验报告.docx)为本站会员(b****8)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

ASPNET应用开发综合实验报告.docx

1、ASPNET应用开发综合实验报告网上订购系统实验报告姓名:蔡双江 学号:1108203422班级:软件114 指导老师:张金姬 一、 实验目的1、 学习在ASP.NET+SQL Server平台设计动态网站的方法2、 掌握设计网站涉及到的各种技术:模板设计、样式设计、站点地图导航设计、主页面设计与编程、功能页面设计与编程3、 掌握ASP.NET应用程序访问数据库的技术4、 掌握ASP.NET提供的各种控件应用技巧及主要事件处理程序的编程二、 实验内容和要求1、 设计网站模板、样式、菜单导航2、 购物网站所管理的信息数据库3、 设计网站主页4、 按站点地图设计各功能页面并编写相应的事件处理程序三

2、、 实验步骤1、 新建项目并构建购物网站母版页备注:打开Visual Studio 2005,新建ASP.Net网站并设置保存路径,新建母版页以下为设计好母版页的框架备注:创建网站模板时,需要注意排版的高度宽度尺寸,我设置的网站宽度为850px,高度为649px;其中最上的Logo栏高度为181px,菜单栏高度为30px;导航栏高度占380px,宽度为170px;编辑区域高度和导航栏高度保持一致为380px,宽度为680px;最底端处高度为58px。2、 数据库设计:(一共7个信息表)员工信息表客户信息表订单信息表订单详情表产品信息表产品类别表供应商信息表3、 建立站点地图Web.sitema

3、p文件 4、 设计层叠样式右击-添加样式规则选择元素、类名或者元素ID右击生成样式,对字体、背景、文本等等进行编辑,代码自动生成。BODYbackground-color: #ddedd0;.tr border-right: black thin solid; border-top: black thin solid; border-left: black thin solid; border-bottom: black thin solid;A:hover font-weight: bold; color: purple; font-family: 华文中宋; text-decoration

4、: underline overline; font-size: 18px;.bbackground-color: #ddedd0;#td1background-image:url(img/logo.jpg);#td2background-image:url(img/left.jpg);#b1background-color:transparent;#b3background-color: transparent;#div2 width:476px; height:316px; background-image:url(img/mb.jpg); display:none; font-famil

5、y:黑体; font-size:large;5、 数据库连接SqlConnection conn = new SqlConnection(); conn.ConnectionString = Data Source=.;Initial Catalog=shopping;Integrated Security=True; SqlCommand cmd = new SqlCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = sql; cmd.Connection = conn;6、 设计员工或客户注

6、册备注:采用上传控件FileUpload,并将上传路径显示在Label内。上传员工照片代码: string zp = Label1.Text; string xqah = ; for (int i = 0; i 3; i+) if (this.CheckBoxList1.Itemsi.Selected) xqah = xqah + + CheckBoxList1.Itemsi.Text; string csrq = TextBox8.Text; string sql =insert into dbo.Member(MemberID,memName,Title,Address,City,Phon

7、e,pwd,xingbie,csny,xqah,memphoto)values(+ygh+,+xm+,+zw+,+xxdz+,+cs+,+lxfs+,+mm+,+xb+,+csrq+,+xqah+,+zp+); SqlConnection conn=new SqlConnection(); conn.ConnectionString = Data Source=.;Initial Catalog=shopping;Integrated Security=True; SqlCommand cmd=new SqlCommand(); cmd.CommandType=System.Data.Comm

8、andType.Text; cmd.CommandText=sql; cmd.Connection =conn; try conn.Open(); int num = cmd.ExecuteNonQuery() ; if (num = 1) Response.Write(操作:插入成功!); catch(Exception ex) Response.Write(ex.Message.ToString(); finally /关闭对象 if(conn!=null) conn.Close(); protected void Button2_Click(object sender, EventArg

9、s e) string flname = FileUpload1.FileName; Label1.Text =+ upload + flname.Substring(flname.LastIndexOf()+1); string fm = flname.Substring(flname.LastIndexOf()+1); FileUpload1.PostedFile.SaveAs(HttpRuntime.AppDomainAppPath+upload+fm); 7、 分类查询设计以及详细信息显示备注:使用下拉框控件DropDrownList并勾选AutoPostBack选项,实现无刷新显示所

10、查询的类别商品信息。8、 登陆页面设计以及密码修改9、 购物车设计备注:在C盘下路径:WINDOWSMicrosoft.NETFramworkv2.0.50727下找到_regsql.exe文件,并直接双击它即可对Profile的配置实现多用户(支持匿名用户)购物系统。Web.config文件代码“Asp.Net 配置”选项。 设置和注释的完整列表在 ments 中,该文件通常位于 WindowsMicrosoft.NetFrameworkv2.xConfig 中-configuration xmlns= !- 通过 节可以配置 ASP.NET 使用的 安全身份验证模式, 以标识传入的用户。

11、- !- - !- 如果在执行请求的过程中出现未处理的错误, 则通过 节可以配置相应的处理步骤。具体说来, 开发人员通过该节可以配置 要显示的 html 错误页 以代替错误堆栈跟踪。 - 备注:采用DetailView表显示所选商品的详细信息,并且LinkButton控件点击事件引入CartItem.cs和ShoppingCart.cs来对所购商品进行加入购物车处理CartItem.csusing System;using System.Collections.Generic;using System.Web; Serializablepublic class Cartitem private

12、 int prouductid; private string prouductname; private decimal bookprice; private int quality = 1; public int ProductId get return prouductid; public string prouductName get return prouductname; public decimal price get return bookprice; public int Quantity get return quality; set quality = value; pu

13、blic decimal subtotalprice get return bookprice * quality; public Cartitem(int Prouductid, string Prouductname, decimal pricE) prouductid = Prouductid; prouductname = Prouductname; bookprice = pricE; ShoppingCart.csusing System;using System.Collections.Generic;using System.Web;using System.Collectio

14、ns; Serializablepublic class ShoppingCart private Hashtable mycart = new Hashtable(); public ICollection CartItems get return mycart.Values; public decimal TotalPrice get decimal sum = 0; foreach (Cartitem item in mycart.Values) sum += item.price * item.Quantity; return sum; / 定义向购物车中添加 public void

15、AddBook(int productid, string productname, decimal price) Cartitem item = (Cartitem)mycartproductid; if (item = null) mycart.Add(productid, new Cartitem(productid, productname, price); else item.Quantity+; mycartproductid = item; public void RemoveBook(int productid) Cartitem item = (Cartitem)mycart

16、productid; if (item != null) mycart.Remove(productid); public void SetQuantity(int productid, int quanlity) Cartitem item = (Cartitem)mycartproductid; if (item != null & quanlity 0) item.Quantity = quanlity; mycartproductid = item; 备注:根据是否为匿名用户对购物车的商品是否被购入作出判断,如果用户尚未登录就给予尚未登录的警告框,登录之后则跳转到购买成功页面。购物车实

17、现代码using System;using System.Collections.Generic;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;public partial class buyproduct3 : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) BindShoppingCart(); protected void GridView1_SelectedIndexChanged(object se

18、nder, EventArgs e) int id = (int)GridView1.SelectedDataKey.Value; Profile.ShoppingCart.RemoveBook(id); GridView1.SelectedIndex = -1; BindShoppingCart(); protected void BindShoppingCart() if (Profile.ShoppingCart != null) GridView1.DataSource = Profile.ShoppingCart.CartItems; GridView1.DataBind(); if

19、 (GridView1.FooterRow != null) Label1.Text = 总价: + Profile.ShoppingCart.TotalPrice.ToString(c); Sessiontotalprice = Profile.ShoppingCart.TotalPrice.ToString(c); protected void Txtproductquality_TextChanged1(object sender, EventArgs e) bool isSuccess = false; TextBox txtquality = new TextBox(); txtquality = (TextBox)GridView1.Rows0.Cells5.FindControl(txtproductquality); GridViewRow row = txtquality.Parent.Parent as GridViewRow; if (!string.IsNullOrEmpty(txtquality.Text)

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1