public Product(EkProduct ekProduct) { Assure.ArgumentNotNull(ekProduct, nameof(ekProduct)); EkProduct = ekProduct; Key = ekProduct.Key; ThumbnailUrl = ekProduct.GetThumbnailUrl(); Photos = ekProduct.Photos; Name = ekProduct.Name?.GetValue(Languages.RussianCode); Price = ekProduct.Price; PriceString = Price.ToAmountStringWithSpaces(); PriceComment = ekProduct.Source == EkProductSourceEnum.AllegroPl ? "с учетом доставки\nдоставка 1-7 дней" : "доставка 1-3 дня"; SetStateString(ekProduct.State); ProductionYear = ekProduct.ProductionYear; PartNumber = ekProduct.PartNumber; IsNotAvailable = Price <= 0; // description _descriptionValue = ekProduct.Description; UpdateParametersByValue(); IsDescriptionRequestRequired = !IsNotAvailable && _descriptionValue == null && ekProduct.Source == EkProductSourceEnum.AllegroPl; }
public static EkTransactionProduct FromProduct(EkProduct product, MultiLanguageString description, int quantity) { Assure.ArgumentNotNull(product, nameof(product)); return(new EkTransactionProduct() { Key = product.Key, Source = product.Source, SourceId = product.SourceId, BrandName = product.BrandName, PartNumber = product.PartNumber, CategoryId = product.CategoryId, Name = product.Name, Description = description, ThumbnailUrl = product.GetThumbnailUrl(), BasePrice = product.BasePrice, BasePriceCurrencyCode = product.BasePriceCurrencyCode, DeliveryPrice = product.DeliveryPrice, Price = product.Price, PriceCurrencyCode = product.PriceCurrencyCode, PriceCalculationInfo = product.PriceCalculationInfo, State = product.State, Quantity = quantity, }); }
public Product(EkProduct ekProduct) { Assure.ArgumentNotNull(ekProduct, nameof(ekProduct)); EkProduct = ekProduct; Key = ekProduct.Key; ThumbnailUrl = ekProduct.GetThumbnailUrl(); Photos = ekProduct.Photos; Name = ekProduct.Name?.GetValue(Languages.RussianCode); Price = ekProduct.Price; PriceString = Price.ToAmountStringWithSpaces(); PriceComment = ekProduct.Source == EkProductSourceEnum.AllegroPl ? "с учетом доставки\nдоставка 1-7 дней" : "доставка 1-3 дня"; switch (ekProduct.State) { case EkProductStateEnum.New: StateString = "новое"; break; case EkProductStateEnum.Used: StateString = "б/у"; break; case EkProductStateEnum.Recovered: StateString = "восстановлено"; break; case EkProductStateEnum.Broken: StateString = "неисправно"; break; default: StateString = "?"; break; } ProductionYear = ekProduct.ProductionYear; PartNumber = ekProduct.PartNumber; IsNotAvailable = Price <= 0; // description _descriptionValue = ekProduct.Description; UpdateDescriptionByValue(); IsDescriptionRequestRequired = !IsNotAvailable && _descriptionValue == null && ekProduct.Source == EkProductSourceEnum.AllegroPl; }