欢迎来到天天文库
浏览记录
ID:11315424
大小:61.09 KB
页数:3页
时间:2018-07-11
《匿名用户书的详细检索页面》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、从BookListControl.aspx页面完成跳转到本页面BookDetail.aspx页面页面样式:全部采用table表格完成当用户看一次则点击数增加一,完成修改点击率然后再完成页面正常数据呈现,数据源由aspx.cs文件给出。参考代码publicpartialclassBookDetail:System.Web.UI.Page{protectedvoidPage_Load(objectsender,EventArgse){if(!IsPostBack){if(Request.QueryString["bid"]!=null){initPage(Convert.ToInt32(Requ
2、est.QueryString["bid"]));ViewState["BookId"]=Request.QueryString["bid"].ToString();}}}privatevoidinitPage(intbid){Bookbook=BookManager.GetBookById(bid);book.Clicks++;BookManager.ModifyBook(book);this.lblAuthor.Text=book.Author;this.lblBookName.Text=book.Title;this.lblPublisher.Text=book.Publisher.N
3、ame;this.lblBooksName.Text=book.Category.Name;this.lblISBN.Text=book.ISBN;this.lblPublishDate.Text=book.PublishDate.ToShortDateString();this.lblFonts.Text=book.WordsCount.ToString();this.lblPrice.Text=book.UnitPrice.ToString()+"元";this.lblContent.Text=book.ContentDescription;this.lblAuthorIntroduce
4、.Text=book.AurhorDescription;this.lblRecomment.Text=book.EditorComment;this.lblCatagory.Text=book.TOC;this.imgBook.ImageUrl=StringHandler.CoverUrl(book.ISBN);}//////购买/////////protectedvoidimgb_Buy_Click(objectsender,ImageClickEv
5、entArgse){if(Session["CurrentUser"]!=null){if(Session["Cart"]==null){this.BuildCart();}else{DataTablecart=Session["Cart"]asDataTable;if(this.ExistBook(cart)){this.BuildSession(cart);}}Response.Redirect("Cart.aspx");}else{Response.Redirect(@"MembershipUserLogin.aspx");}}//////已有图书///6、ary>//////publicboolExistBook(DataTablecart){foreach(DataRowdrincart.Rows){if(dr["BookName"].ToString().Equals(this.lblBookName.Text.Trim())){dr["Number"]=Convert.ToInt32(dr["Number"])+1;Session["Cart"]=cart;Response.Redirect("Cart.aspx");}}returntrue;}/7、/////新建购物车表///publicvoidBuildCart(){DataTablecart=newDataTable();cart.Columns.Add("BookId");cart.Columns.Add("BookName");cart.Columns.Add("Number");cart.Columns.Add("UnitPrice");cart.Colu
6、ary>//////publicboolExistBook(DataTablecart){foreach(DataRowdrincart.Rows){if(dr["BookName"].ToString().Equals(this.lblBookName.Text.Trim())){dr["Number"]=Convert.ToInt32(dr["Number"])+1;Session["Cart"]=cart;Response.Redirect("Cart.aspx");}}returntrue;}/
7、/////新建购物车表///publicvoidBuildCart(){DataTablecart=newDataTable();cart.Columns.Add("BookId");cart.Columns.Add("BookName");cart.Columns.Add("Number");cart.Columns.Add("UnitPrice");cart.Colu
此文档下载收益归作者所有