ProductsList.aspx.cs
资源名称:yjal.rar [点击查看]
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:2k
源码类别:
Email客户端
开发平台:
Visual C++
- 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;
- using ShopCart;
- public partial class ProductsList : PageBase
- {
- UserInfoClass ucObj = new UserInfoClass();
- String login;
- protected void Page_Load(object sender, EventArgs e)
- {
- if (Session["Login"] != null)
- {
- login = Session["Login"].ToString();
- }
- else {
- Response.Redirect("Default.aspx");
- }
- }
- //绑定市场价格
- public string GetMKPStr(string P_Str_MarketPrice)
- {
- return ucObj.VarStr(P_Str_MarketPrice, 2);
- }
- //绑定会员价格
- public string GetMBPStr(string P_Str_MemberPrice)
- {
- return ucObj.VarStr(P_Str_MemberPrice, 2);
- }
- //当购买商品时,获取商品信息
- public SaveSubGoodsClass GetSubGoodsInformation(DataListCommandEventArgs e, DataList DLName)
- {
- //获取购物车中的信息
- SaveSubGoodsClass Goods = new SaveSubGoodsClass();
- Goods.GoodsID = int.Parse(DLName.DataKeys[e.Item.ItemIndex].ToString());
- string GoodsStyle = e.CommandArgument.ToString();
- int index = GoodsStyle.IndexOf("|");
- if (index < -1 || index + 1 >= GoodsStyle.Length)
- return Goods;
- Goods.GoodsWeight = float.Parse(GoodsStyle.Substring(0, index));
- Goods.MemberPrice = float.Parse(GoodsStyle.Substring(index + 1));
- return (Goods);
- }
- public void AddShopCart(DataListCommandEventArgs e, DataList DLName)
- {
- if (login == null)
- {
- Response.Write("<script>alert('对不起,你没有登陆,不能购买物品');</script>");
- }
- else
- {
- SaveSubGoodsClass Goods = null;
- Goods = GetSubGoodsInformation(e, DLName);
- ucObj.AddShopCart(Goods.GoodsID, Goods.MemberPrice, System.Convert.ToInt32(login), Goods.GoodsWeight);
- Response.Redirect("Cart.aspx");
- }
- }
- protected void DLrefinement_ItemCommand1(object source, DataListCommandEventArgs e)
- {
- AddShopCart(e, DLrefinement);
- }
- }