Example #1
0
        public virtual bool RemoveOverlappablePromotion(int promotionId)
        {
            var promotion = OverlappablePromotions.FirstOrDefault(p => p.Id == promotionId);

            if (promotion != null)
            {
                OverlappablePromotions.Remove(promotion);
                return(true);
            }

            return(false);
        }
Example #2
0
        public virtual bool CanBeOverlappedUsedWith(Promotion other)
        {
            if (Priority < other.Priority)
            {
                return(other.CanBeOverlappedUsedWith(this));
            }

            if (OverlappingUsage == PromotionOverlappingUsage.NotAllowed)
            {
                return(false);
            }
            else if (OverlappingUsage == PromotionOverlappingUsage.AllowedWithAnyPromotion)
            {
                return(true);
            }
            else if (OverlappingUsage == PromotionOverlappingUsage.AllowedWithSpecifiedPromotions)
            {
                return(OverlappablePromotions.Any(x => x.Id == other.Id));
            }
            else
            {
                throw new NotSupportedException(OverlappingUsage + " is not supported.");
            }
        }