protected override void DoDuplicate()
        {
            var repository = Repository as IMarketingRepository;

            var item = InnerItem.DeepClone(EntityFactory as IKnownSerializationTypes);

            item.PromotionId = item.GenerateNewKey();
            item.Name        = item.Name + "_1";
            item.Status      = PromotionStatusConverter.ValueInActive;
            item.Rewards.Clear();
            item.Coupon   = null;
            item.CouponId = null;

            if (InnerItem.Coupon != null)
            {
                var coupon = InnerItem.Coupon.DeepClone(EntityFactory as IKnownSerializationTypes);
                coupon.CouponId = coupon.GenerateNewKey();
                item.CouponId   = coupon.CouponId;
                repository.Add(coupon);
            }

            InnerItem.Rewards.ToList().ForEach(x =>
            {
                var newReward = x.DeepClone(EntityFactory as IKnownSerializationTypes);
                newReward.PromotionRewardId = newReward.GenerateNewKey();
                item.Rewards.Add(newReward);
            });

            repository.Add(item);
        }
Example #2
0
        protected override void DoDuplicate()
        {
            var item = InnerItem.DeepClone(EntityFactory as IKnownSerializationTypes);

            item.ImportJobId = item.GenerateNewKey();
            item.PropertiesMap.ToList().ForEach(mapItem =>
            {
                mapItem.ImportJobId   = item.ImportJobId;
                mapItem.MappingItemId = mapItem.GenerateNewKey();
                mapItem.ImportJob     = null;
            });

            item.Name = item.Name + "_1";
            Repository.Add(item);
        }