Пример #1
0
        private void RefreshKeywords(SmartWordSetupModel model, Promotion promo)
        {
            IEnumerable<PromotionKeywordAssociation> qry =
                _dbcontext.PromotionKeywordAssociations.Where(key => key.PromotionFK == promo.PromotionPK).ToList();
            var kpos = new List<KeywordProbabilityObject>();
            KeywordProbabilityObject kpo;

            foreach (PromotionKeywordAssociation pka in qry)
            {
                kpo = new KeywordProbabilityObject
                          {
                              keyword = pka.Keyword.Keyword1,
                              semplestProbability =
                                  pka.SemplestProbability == null ? 0 : pka.SemplestProbability.Value,
                              isTargetMSN = pka.IsTargetMSN,
                              isTargetGoogle = pka.IsTargetGoogle,
                              isDeleted = pka.IsDeleted,
                              id = pka.KeywordFK
                          };
                kpos.Add(kpo);
            }
            SaveKeywords(promo.PromotionPK, kpos, model.NegativeKeywords,
                         model.ProductGroup.ProductGroupName, model.ProductGroup.ProductPromotionName);
        }
Пример #2
0
 public void SaveNegativeKeywords(Promotion promo, CampaignSetupModel model, SemplestModel.Semplest dbcontext)
 {
     IEnumerable<PromotionKeywordAssociation> qry = dbcontext.PromotionKeywordAssociations.Where(key => key.PromotionFK == promo.PromotionPK).ToList();
     var kpos = new List<KeywordProbabilityObject>();
     KeywordProbabilityObject kpo;
     foreach (PromotionKeywordAssociation pka in qry)
     {
         kpo = new KeywordProbabilityObject
         {
             keyword = pka.Keyword.Keyword1,
             semplestProbability = pka.SemplestProbability == null ? 0 : pka.SemplestProbability.Value,
             isTargetMSN = pka.IsTargetMSN,
             isTargetGoogle = pka.IsTargetGoogle
         };
         kpos.Add(kpo);
     }
     if (model.AdModelProp.NegativeKeywords != null)
         foreach (string negativeKeyword in model.AdModelProp.NegativeKeywords)
         {
             if (!qry.Any(key => key.Keyword.Keyword1 == negativeKeyword))
             {
                 kpo = new KeywordProbabilityObject { keyword = negativeKeyword };
                 kpos.Add(kpo);
             }
         }
     SaveKeywords(promo.PromotionPK, kpos, model.AdModelProp.NegativeKeywords, model.ProductGroup.ProductGroupName, model.ProductGroup.ProductPromotionName);
 }