public static ProductInfo GetProduct(int intProductID) { ProductInfo dataById = Product.GetDataById(intProductID); if (dataById != null) { ProductModelInfo cacheModelById = ProductModel.GetCacheModelById(dataById.ModelID); dataById.CustomTable = Product.GetCustomContentInfo(intProductID, cacheModelById.TableName); dataById.PhotoAlbums = PhotoAlbum.GetPhotoAlbumByPID(intProductID); UserInfo user = User.GetLoginUser(); if (user != null) { dataById.MemberPriceSets = MemberPriceSet.GetList(dataById.MemberPriceSet, dataById.SellPrice); MemberPriceSetInfo memberPriceSetInfo = (from p in dataById.MemberPriceSets where p.UserLevelID.Equals(user.LevelID) select p).FirstOrDefault <MemberPriceSetInfo>(); if (memberPriceSetInfo != null) { dataById.MemberPrice = ((memberPriceSetInfo.Price > 0m) ? memberPriceSetInfo.Price : memberPriceSetInfo.DiscoutPrice); if (dataById.MemberPrice == 0m) { dataById.MemberPrice = dataById.SellPrice; } } } dataById.PriceRange = dataById.SellPrice.ToString("f2"); dataById.RealStock = dataById.Stock; if (dataById.ClassID > 0) { List <decimal> priceRange = GoodsSpecify.GetPriceRange(dataById); if (priceRange[0] == priceRange[1]) { dataById.PriceRange = priceRange[0].ToString("f2"); } else { dataById.PriceRange = priceRange[0].ToString("f2") + " - " + priceRange[1].ToString("f2"); } dataById.GuiGe = GoodsSpecify.GetListByProID(dataById.AutoID); if (dataById.GuiGe != null && dataById.GuiGe.Count > 0) { dataById.RealStock = dataById.GuiGe.Sum((GoodsSpecifyInfo p) => p.Stock); } } } return(dataById); }
private static GoodsSpecifyInfo Get(GoodsSpecifyInfo guige) { UserInfo user = User.GetLoginUser(); if (user != null) { guige.MemberPriceSets = MemberPriceSet.GetList(guige.MemberPriceSet, guige.SellPrice); MemberPriceSetInfo memberPriceSetInfo = (from p in guige.MemberPriceSets where p.UserLevelID.Equals(user.LevelID) select p).FirstOrDefault <MemberPriceSetInfo>(); if (memberPriceSetInfo != null) { guige.MemberPrice = ((memberPriceSetInfo.Price > 0m) ? memberPriceSetInfo.Price : memberPriceSetInfo.DiscoutPrice); if (guige.MemberPrice == 0m) { guige.MemberPrice = guige.SellPrice; } } } return(guige); }
public static List <MemberPriceSetInfo> GetDefault(decimal defPrice) { return(MemberPriceSet.GetList(null, defPrice)); }