protected void Page_Load(object sender, EventArgs e) { shopCarBLL = (IShopCarBLL)SpringContext.Context.CreateInstance("ShopCarBLL"); string cmd = Request.QueryString["cmd"]; switch (cmd) { case "list": GetList(); break; case "add": Add(); break; case "edit": Edit(); break; case "del": Del(); break; case "order": Order(); break; default: break; } }
protected void Page_Load(object sender, EventArgs e) { _shopCarBLL = (IShopCarBLL)SpringContext.Context.CreateSecurityProxyInstance("ShopCarBLL"); if (!IsPostBack) { BindRepeater(); } }
protected void rpt_ItemCommand(object source, RepeaterCommandEventArgs e) { int productId = int.Parse(e.CommandArgument.ToString()); IProductBLL productBLL = (IProductBLL)SpringContext.Context.CreateSecurityProxyInstance("ProductBLL"); switch (e.CommandName.ToLower()) { case "delete": productBLL.Delete(productId); Response.Redirect("ProductList.aspx", true); break; case "putcar":; Product product = productBLL.Select(productId); OrderProduct orderProduct = new OrderProduct(); orderProduct.Num = 1; orderProduct.ProductID = productId; orderProduct.ProductName = product.ProductName; IUserBLL userBLL = (IUserBLL)SpringContext.Context.CreateSecurityProxyInstance("UserBLL"); ICustomBLL customBLL = (ICustomBLL)SpringContext.Context.CreateSecurityProxyInstance("CustomBLL"); if (customBLL.Select(userBLL.UserID).IsMember) { orderProduct.Price = product.MemberPrice; } else { orderProduct.Price = product.NormalPrice; } IShopCarBLL shopCarBLL = (IShopCarBLL)SpringContext.Context.CreateSecurityProxyInstance("ShopCarBLL"); shopCarBLL.Add(orderProduct); Response.Redirect("ShopCar.aspx", true); break; default: break; } }