public static List <CartInfo> ReadList(int userId) { if (userId > 0) { var cartList = dal.ReadList(userId); foreach (CartInfo cart in cartList) { if (ProductBLL.Read(cart.ProductId).Id <= 0) //如果商品已删除则删除购物车里的 { Delete(Array.ConvertAll <string, int>(cart.Id.ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k)), userId); } } return(dal.ReadList(userId)); } else { var cartList = CartHelper.ReadCart(); foreach (CartInfo cart in cartList) { if (ProductBLL.Read(cart.ProductId).Id <= 0) { Delete(Array.ConvertAll <string, int>(cart.Id.ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k)), userId); } } return(CartHelper.ReadCart()); } }
public static decimal GetCurrentPriceWithStandard(int id, int grade, string standardValue) { var proStandRecord = ProductTypeStandardRecordBLL.Read(id, standardValue); if (!string.IsNullOrEmpty(standardValue.Trim())) { return(Math.Round(proStandRecord.SalePrice * UserGradeBLL.Read(grade).Discount / 100, 2)); } else { return(Math.Round(ProductBLL.Read(id).SalePrice *UserGradeBLL.Read(grade).Discount / 100, 2)); } }