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) { 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); }