Пример #1
0
        public Adv24au Apply(Product product)
        {
            //var adv = product.Advs.First(a => a.Product.Id == product.Id && a.Marketplace.Id == this.Id);

            var adv = product.Advs.FirstOrDefault(a => a.Marketplace.Id == this.Id);

            bool save = false;
            if (adv == null)
            {
                var category = GetCategory(product);
                adv = new Adv24au(product, category, this);

                product.Advs.Add(adv);

                save = true;
            }

            if (!adv.Active)
            {
                adv.Active = true;
                save = true;
            }

            if (save)
            {
                Context.Save();
            }

            return adv;
        }
Пример #2
0
        public void ApplyStyles(Product product, BegemotProduct bproduct, Style specialStyle, Style saleStyle, Style marketStyle, Marketplace market, Adv24au adv)
        {
            //bool isNoStyles = specialStyle == null && saleStyle == null && marketStyle == null;

            var activeSale = product.GetActiveSale();

            Style defultStyle = Style.GetDefault();

            valueDict = new Dictionary<string, string>();
            AddToDict(product, bproduct, specialStyle, activeSale);

            AppleResult ar = null;
            ar = Apply(defultStyle, StyleType.SpecialDescrition);
            ar = Apply(specialStyle, StyleType.SpecialDescrition);
            ar = Apply(saleStyle, StyleType.Sale);
            ar = Apply(marketStyle, StyleType.MarketPlace);

            ar.ClearTags();
            //ar.ClearPolicyWords(market);

            var title = ar.GetResultTitle();
            var description = ar.GetResultDescription();

            if (adv == null)
            {
                product.Title = title;
                product.Description = description;
            }
            else
            {
                title = market.PrepareTitle(title);
                description = market.PrepareDescription(description);

                adv.Title = title;
                adv.Description = description;
            }
        }
Пример #3
0
        public void ApplyStyles(Product product, BegemotProduct bproduct, Adv24au adv = null)
        {
            Marketplace market = adv.Marketplace;

            var specialStyle = product.GetSpecialStyle();
            var saleStyle = product.GetSaleStyle();
            var marketStyle = market == null ? null : market.GetActiveStyle();

            ApplyStyles(product, bproduct, specialStyle, saleStyle, marketStyle, market, adv);
        }
Пример #4
0
 public AdvExportInfo(Adv24au adv)
 {
     Adv = adv;
 }