Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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,
            });
        }
Exemplo n.º 3
0
        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;
        }