Esempio n. 1
0
 /// <summary>Add/update a preference range on Buyer b.</summary>
 public void UpsertPreference(Buyer b, MetaProduct metaProduct, MetaAttribute ma, string formattedLowerBound, string formattedUpperBound)
 {
     Preference pref = null;
     if (b.HasPreferenceFor(ma.Id))
     {
         pref = b.GetPreference(ma.Id);
         if (IsEmptyRange(formattedLowerBound, formattedUpperBound))
         {
             saver.MarkForDeletion(pref);
             return;
         }
     }
     else
     {
         if (IsEmptyRange(formattedLowerBound, formattedUpperBound)) return;
         pref = _buyerRepo.CreatePreference(b, ma);
     }
     pref.SetRange(new ValueRange(formattedLowerBound, formattedUpperBound, ma.DataTypeEnum, FormattedOrRaw.FORMATTED));
 }
Esempio n. 2
0
 /// <summary>Add/update a preference set on Buyer b.</summary>
 /// <param name="b"></param><param name="metaProduct"></param><param name="ma"></param><param name="rawValues"></param>
 public void UpsertPreference(Buyer b, MetaProduct metaProduct, MetaAttribute ma, string rawValues)
 {
     Preference pref = null;
     if (b.HasPreferenceFor(ma.Id))
     {
         pref = b.GetPreference(ma.Id);
         if (String.IsNullOrEmpty(rawValues))
         {
             saver.MarkForDeletion(pref);
             return;
         }
     }
     else
     {
         if (String.IsNullOrEmpty(rawValues)) return;
         pref = _buyerRepo.CreatePreference(b, ma);
     }
     pref.SetSet(new ValueSet(rawValues, ma.DataTypeEnum));
 }