您目前尚未登陆,请选择【登陆】或【注册
首页->电子商务->明日网上商城购物系统源码>>User/ClassGoods.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:明日网上商城购物系统源码
当前文件:文件类型 MingriNetShop/User/ClassGoods.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Configuration; 4using System.Collections; 5using System.Web; 6using System.Web.Security; 7using System.Web.UI; 8using System.Web.UI.WebControls; 9using System.Web.UI.WebControls.WebParts; 10using System.Web.UI.HtmlControls; 11 12public partial class User_ClassGoods : System.Web.UI.Page 13{ 14 MangerClass mcObj = new MangerClass(); 15 UserInfoClass ucObj = new UserInfoClass(); 16 protected void Page_Load(object sender, EventArgs e) 17 { 18 if (!IsPostBack) 19 { 20 dlClassBind(); 21 lbClassName.Text = GetClass(Convert.ToInt32(this.Request.QueryString["ClassID"].ToString())); 22 } 23 } 24 public string GetClass(int P_Int_ClassID) 25 { 26 string P_Str_ClassName = mcObj.GetClass(P_Int_ClassID); 27 return P_Str_ClassName; 28 } 29 //绑定市场价格 30 public string GetVarMKP(string P_Str_MarketPrice) 31 { 32 return ucObj.VarStr(P_Str_MarketPrice, 2); 33 } 34 //绑定会员价格 35 public string GetVarMBP(string P_Str_MemberPrice) 36 { 37 return ucObj.VarStr(P_Str_MemberPrice, 2); 38 } 39 40 /// <summary> 41 /// 显示指定类别的商品信息 42 /// </summary> 43 public void dlClassBind() 44 { 45 46 ucObj.DCGIBind(Convert.ToInt32(this.Request.QueryString["ClassID"].ToString()), "Class", DLClass); 47 } 48 //当购买商品时,获取商品信息 49 public SaveSubGoodsClass GetSubGoodsInformation(DataListCommandEventArgs e, DataList DLName) 50 { 51 //获取购物车中的信息 52 SaveSubGoodsClass Goods = new SaveSubGoodsClass(); 53 Goods.GoodsID = int.Parse(DLName.DataKeys[e.Item.ItemIndex].ToString()); 54 string GoodsStyle = e.CommandArgument.ToString(); 55 int index = GoodsStyle.IndexOf("|"); 56 if (index < -1 || index + 1 >= GoodsStyle.Length) 57 return Goods; 58 Goods.GoodsWeight = float.Parse(GoodsStyle.Substring(0, index)); 59 Goods.MemberPrice = float.Parse(GoodsStyle.Substring(index + 1)); 60 return (Goods); 61 62 } 63 public void AddShopCart(DataListCommandEventArgs e, DataList DLName) 64 { 65 if (Session["UID"] != null) 66 { 67 SaveSubGoodsClass Goods = null; 68 Goods = GetSubGoodsInformation(e, DLName); 69 if (Goods == null) 70 { 71 //显示错误信息 72 Response.Write("<script>alert('没有可用的数据');</script>"); 73 return; 74 } 75 else 76 { 77 ucObj.AddShopCart(Goods.GoodsID, Goods.MemberPrice, Convert.ToInt32(Session["UID"].ToString()), Goods.GoodsWeight); 78 Response.Write("<script>alert('恭喜您,添加成功!')</script>"); 79 80 } 81 } 82 else 83 { 84 Response.Write("<script>alert('请先登录,谢谢合作!');</script>"); 85 86 } 87 88 } 89 protected void DLClass_ItemCommand(object source, DataListCommandEventArgs e) 90 { 91 if (e.CommandName == "detailSee") 92 { 93 Session["address"] = ""; 94 Session["address"] = "ClassGoods.aspx?ClassID=" + Convert.ToInt32(this.Request.QueryString["ClassID"].ToString()); 95 Response.Redirect("~/User/GoodsDetail.aspx?GoodsID=" + Convert.ToInt32(DLClass.DataKeys[e.Item.ItemIndex].ToString())); 96 } 97 else if (e.CommandName == "buyGoods") 98 { 99 AddShopCart(e, DLClass); 100 } 101 } 102} 103
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:明日网上商城购物系统源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号