Пример #1
0
        public ServiceResult CancelRegistration(int existingRegistrationId)
        {
            var              result          = new ServiceResult();
            IEmailService    emailService    = new EmailService();
            IDiscountService discountService = new DiscountService(this._repository, false);

            Registration cancelReg = _repository.Registrations.Find(x => x.RegistrationId == existingRegistrationId);

            cancelReg.RegistrationStatus = RegistrationStatus.Cancelled;
            cancelReg.DateUpdated        = DateTime.Now;

            var newTransferCode = new RedemptionCode
            {
                GeneratingRegistrationId = existingRegistrationId,
                Code = discountService.GenerateDiscountCode(),
                RedemptionCodeType = RedemptionCodeType.StraightValue,
                Value        = GetRegistrationPathValue(existingRegistrationId),
                DiscountType = DiscountType.Dollars
            };

            result = discountService.CreateRedemptionCode(newTransferCode);

            if (!_sharedRepository)
            {
                _repository.SaveChanges();
                emailService.SendCancellationEmail(newTransferCode.DiscountItemId);
            }


            return(result);
        }
Пример #2
0
        public ServiceResult TransferRegistration(int existingRegistrationId, string name, string email)
        {
            ServiceResult result = null;

            IEmailService emailService    = new EmailService();
            var           discountService = new DiscountService(this._repository, false);

            Registration transferReg = _repository.Registrations.Find(x => x.RegistrationId == existingRegistrationId);

            transferReg.RegistrationStatus = RegistrationStatus.Held;
            transferReg.DateUpdated        = DateTime.Now;

            var newTransferCode = new RedemptionCode
            {
                GeneratingRegistrationId = existingRegistrationId,
                Code = discountService.GenerateDiscountCode(),
                RedemptionCodeType = RedemptionCodeType.Transfer,
                Value        = GetRegistrationPathValue(existingRegistrationId),
                DiscountType = DiscountType.Dollars
            };

            result = discountService.CreateRedemptionCode(newTransferCode);

            if (!_sharedRepository)
            {
                _repository.SaveChanges();
                emailService.SendTransferEmail(newTransferCode.DiscountItemId, name, email);
            }

            return(result);
        }
Пример #3
0
        public ServiceResult CancelRegistration(int existingRegistrationId)
        {
            var result = new ServiceResult();
            IEmailService emailService = new EmailService();
            IDiscountService discountService = new DiscountService(this._repository, false);

            Registration cancelReg = _repository.Registrations.Find(x => x.RegistrationId == existingRegistrationId);
            cancelReg.RegistrationStatus = RegistrationStatus.Cancelled;
            cancelReg.DateUpdated = DateTime.Now;

            var newTransferCode = new RedemptionCode
            {
                GeneratingRegistrationId = existingRegistrationId,
                Code = discountService.GenerateDiscountCode(),
                RedemptionCodeType = RedemptionCodeType.StraightValue,
                Value = GetRegistrationPathValue(existingRegistrationId),
                DiscountType = DiscountType.Dollars
            };

            result = discountService.CreateRedemptionCode(newTransferCode);

            if (!_sharedRepository)
            {
                _repository.SaveChanges();
                emailService.SendCancellationEmail(newTransferCode.DiscountItemId);
            }

            return result;
        }
Пример #4
0
        public ServiceResult TransferRegistration(int existingRegistrationId, string name, string email)
        {
            ServiceResult result = null;

            IEmailService emailService = new EmailService();
            var discountService = new DiscountService(this._repository, false);

            Registration transferReg = _repository.Registrations.Find(x => x.RegistrationId == existingRegistrationId);
            transferReg.RegistrationStatus = RegistrationStatus.Held;
            transferReg.DateUpdated = DateTime.Now;

            var newTransferCode = new RedemptionCode
            {
                GeneratingRegistrationId = existingRegistrationId,
                Code = discountService.GenerateDiscountCode(),
                RedemptionCodeType = RedemptionCodeType.Transfer,
                Value = GetRegistrationPathValue(existingRegistrationId),
                DiscountType = DiscountType.Dollars
            };

            result = discountService.CreateRedemptionCode(newTransferCode);

            if (!_sharedRepository)
            {
                _repository.SaveChanges();
                emailService.SendTransferEmail(newTransferCode.DiscountItemId, name, email);
            }

            return result;
        }