protected void lbtnDoCreate_Click(object sender, EventArgs e) { AddressModel addr = ucAddress.GetSelectedAddressInfo(this.CurrentUser.UserId); if (addr == null) { this.ClientAlert("收货人地址信息不完整,请重新填写"); return; } if (String.IsNullOrEmpty(CurrentShopCart.OrderId) && !CurrentShopCart.Exists()) { CurrentShopCart.Address = addr; CurrentShopCart.ShipMethodId = int.Parse(rbtlShipMethod.SelectedValue); if (CurrentShopCart.PreSaveValidate()) { CurrentShopCart.Save(); Context.Items.Add("SavedOrderId", CurrentShopCart.OrderId); CurrentShopCart.RecentSavedOrderId = CurrentShopCart.OrderId; CurrentShopCart.OrderId = String.Empty; CurrentShopCart.OrderProducts.Clear(); CurrentShopCart.SaveCartToCookie(); CurrentShopCart.GoNext(); } } }
protected void gvList_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "delete") { string opkey = (string)e.CommandArgument; OrderProduct op = CurrentShopCart.OrderProducts.Find(c => c.Key == opkey); op.SetQuantiy(0); CurrentShopCart.SaveCartToCookie(); } BindCartData(); }
protected void lbtnDoCreate_Click(object sender, EventArgs e) { AddressModel addr = ucAddress.GetSelectedAddressInfo(this.CurrentUser.UserId); if (addr == null) { this.ClientAlert("收货人地址信息不完整,请重新填写"); return; } if (String.IsNullOrEmpty(CurrentShopCart.OrderId) || !CurrentShopCart.Exists()) { CurrentShopCart.Address = addr; CurrentShopCart.UserNotes = txtUserNotes.Text.Trim(); CurrentShopCart.PayMethodId = int.Parse(this.rbtlPayMethod.SelectedValue); CurrentShopCart.ShipMethodId = int.Parse(this.rbtlShipMethod.SelectedValue); if (CurrentShopCart is CommShopCart) { CurrentShopCart.ShipFee = ((CommShopCart)CurrentShopCart).CaculateShipFee(CurrentShopCart.ShipMethodId, CurrentShopCart.Address.RegionId); } else if (CurrentShopCart is SuitShopCart) { CurrentShopCart.ShipFee = ((SuitShopCart)CurrentShopCart).CaculateShipFee(CurrentShopCart.ShipMethodId, CurrentShopCart.Address.RegionId); } string isNeedInvoce = ReqParas["invoice"].Trim(); if (isNeedInvoce == "1") { CurrentShopCart.Invoice = ReqParas["invoiceTitle"].Trim(); } else { CurrentShopCart.Invoice = String.Empty; } if (CurrentShopCart.PreSaveValidate()) { CurrentShopCart.Save(); NotifyHelper.SendMessage(CurrentUser.UserId, "您刚刚提交了一个新订单", "您刚刚提交了一个新订单"); NotifyHelper.SendMail(CurrentUser.UserEmail, "您刚刚提交了一个新订单", "您刚刚提交了一个新订单"); Context.Items.Add("SavedOrderId", CurrentShopCart.OrderId); CurrentShopCart.RecentSavedOrderId = CurrentShopCart.OrderId; CurrentShopCart.OrderId = String.Empty; CurrentShopCart.OrderProducts.Clear(); CurrentShopCart.SaveCartToCookie(); CurrentShopCart.GoNext(); } } }
protected void Page_Load(object sender, EventArgs e) { //CurrentShopCart = CartFactory.Instance().GetCart("suit") as ShopCart; if (CurrentShopCart == null) { panNoData.Visible = true; Response.AddHeader("REFRESH", "3;URL='http://dingding.uncc.cn/'"); } if (!IsPostBack) { //可以在页面加载时设置页面的缓存为“SetNoStore()”,即无缓存 Response.Cache.SetNoStore(); CurrentShopCart.Reset(); if (!IsPostBack) { BindCartData(); BindSalesData(); } } }
// 通用商品购物车:可以修改数量:pids=pid-qua,pid-qua&opt=类型 private void ProcessCommProduct() { OrderType opType = GetOpType(); string[] pids = ReqParas["pid"].Split(','); foreach (string pidstr in pids) { string[] pd = pidstr.Split('-'); int pid = int.Parse(pd[0]); int quantity = 1; if (pd.Length == 2) { quantity = int.Parse(pd[1]); } OrderProduct op = CurrentShopCart.AddToCart(opType, pid, quantity, ReqParas); if (op != null) { //CurrentShopCart.ContinueShopUrl = op.ProductUrl; CurrentShopCart.ContinueShopUrl = WebConfigurationManager.AppSettings["foreFlatRootUrl"]; } } }
protected void Page_Load(object sender, EventArgs e) { //可以在页面加载时设置页面的缓存为“SetNoStore()”,即无缓存 Response.Cache.SetNoStore(); // 购买时传入的参数: // 需要区分的购物车商品类型: // 通用商品购物车:可以修改数量:pids=pid-qua,pid-qua&opt=类型 // 积分兑换购物车:没有金额,仅有积分:pids=pid-qua,pid-qua&opt=类型 // 推荐套装购物车:套装商品不可以修改,只有一个套装价格,没有单品价格,但所含商品需要展示:suitid=suitid&opt=类型 // 经典套装购物车:选中的套装商品不可以修改,价格根据商品价格计算:pids=pid-qua,pid-qua&opt=类型 SetCurrentShopCart(); if (CurrentShopCart != null) { if (!String.IsNullOrEmpty(ReqParas["pid"]) && Regex.IsMatch(ReqParas["pid"], @"(\d+(\-\d+)?,)*(\d+(\-\d+)?)")) { ProcessCommProduct(); } else if (!String.IsNullOrEmpty(ReqParas["suitId"]) && Regex.IsMatch(ReqParas["suitId"], @"\d+")) { ProcessSuitCommProduct(); } } if (CurrentShopCart.ProductNum > 0) { CurrentShopCart.SaveCartToCookie(); CurrentShopCart.GoFirst(); } else { //string script = "<script type='text/javascript'>alert('此商品暂时无法购买');window.go(-1);</script>"; //ClientScript.RegisterStartupScript(this.GetType(), "clientAlert", script); Response.Write("此商品暂时无法购买"); Response.AddHeader("REFRESH", "3;URL='http://dingding.uncc.cn/'"); } }
protected void Page_Load(object sender, EventArgs e) { //可以在页面加载时设置页面的缓存为“SetNoStore()”,即无缓存 Response.Cache.SetNoStore(); if (CurrentShopCart == null || CurrentShopCart.OrderProducts.Count == 0) { Response.Write("购物车已清空,页面将<a href='http://dingding.uncc.cn/'>跳转</a>至商城首页!"); Response.AddHeader("REFRESH", "3;URL='http://dingding.uncc.cn/'"); Response.End(); } if (!IsPostBack) { if (!CurrentShopCart.ValidStep()) { CurrentShopCart.GoFirst(); } else { ucAddress.ShowAddressList(CurrentUser.UserId); } } }
protected void lbtnGoPay_Click(object sender, EventArgs e) { CurrentShopCart.SaveCartToCookie(); CurrentShopCart.GoNext(); }
private void ProcessSuitCommProduct() { OrderType opType = GetOpType(); int suitId = int.Parse(ReqParas["suitId"]); OrderProduct op = CurrentShopCart.AddToCart(opType, suitId, 1, ReqParas); }