public override OrderProduct AddToCart(OrderType opType, int productId, int quantity, NameValueCollection paras) { int typecode; if (int.TryParse(paras["typecode"], out typecode)) { typecode = 0; } OrderProduct op = OrderProducts.Find(c => c.ProductID == productId && c.TypeCode == typecode); if (op == null) { op = OrderProductFactory.Instance().CreateOrderProduct(productId, quantity, opType, paras); op.Key = this.Key + "_op" + this.GetSerial(); op.Container = this; this.ContinueShopUrl = op.ProductUrl; if (op != null) { OrderProducts.Add(op); } } else { op.SetQuantiy(op.Quantity + quantity); } return(op); }
public override OrderProduct AddToCart(OrderType opType, int productId, int quantity, NameValueCollection paras) { SuitId = productId; int typecode; if (int.TryParse(paras["typecode"], out typecode)) { typecode = 0; } NoName.NetShop.Solution.BLL.SuiteBll sbll = new SuiteBll(); SolutionProductBll spbll = new SolutionProductBll(); SuiteModel smodel = sbll.GetModel(SuitId); List <SolutionProductModel> list = spbll.GetModelList(SuitId); this.OrderProducts.Clear(); foreach (SolutionProductModel model in list) { OrderProduct op = OrderProductFactory.Instance().CreateOrderProduct(model.ProductId, model.Quantity, opType, paras); op.Key = this.Key + "_op" + this.GetSerial(); op.Container = this; if (op != null) { OrderProducts.Add(op); } } this.DerateFee = this.ProductSum - smodel.Price; _score = smodel.Score; return(null); }
public override OrderProduct AddToCart(OrderType opType, int productId, int quantity, NameValueCollection paras) { int typecode; if (!int.TryParse(paras["typecode"], out typecode)) { typecode = 0; } ShopIdentity user = HttpContext.Current.User.Identity as ShopIdentity; MemberInfo member = MemberInfo.GetBaseInfo(user.UserId); OrderProduct op = OrderProducts.Find(c => c.ProductID == productId && c.TypeCode == typecode); if (op == null) { op = OrderProductFactory.Instance().CreateOrderProduct(productId, quantity, opType, paras); op.Key = this.Key + "_op" + this.GetSerial(); op.Container = this; this.ContinueShopUrl = op.ProductUrl; if (op != null) { if (this.TotalScore + op.TotalScore <= member.CurScore) { OrderProducts.Add(op); } else { op = null; } } } else { int oldQuantity = op.Quantity; op.SetQuantiy(op.Quantity + quantity); if (this.TotalScore > member.CurScore) { op.SetQuantiy(oldQuantity); } } return(op); }
public override OrderProduct AddToCart(OrderType opType, int productId, int quantity, string[] paras) { NameValueCollection nv = OrderProductFactory.Instance().GetParasFromCookieValue(opType, paras); return(this.AddToCart(opType, productId, quantity, nv)); }