예제 #1
0
        /// <summary>
        /// Processes the single aggregate.
        /// </summary>
        /// <param name="socialHistoryDto">The social history dto.</param>
        /// <param name="socialHistory">The social history.</param>
        /// <returns>A <see cref="System.Boolean"/></returns>
        protected override bool ProcessSingleAggregate(SocialHistoryDto socialHistoryDto, SocialHistory socialHistory)
        {
            // register for various 'created' events
            DomainEvent.Register <Phq9CreatedEvent> (e => _isPhq9Created     = true);
            DomainEvent.Register <AuditCCreatedEvent> (e => _isAuditCCreated = true);
            DomainEvent.Register <Dast10CreatedEvent> (e => _isDast10Created = true);

            var socialHistoryPhq2 = new SocialHistoryPhq2(
                socialHistoryDto.Phq2LittleInterestInDoingThingsAnswerNumber,
                socialHistoryDto.Phq2FeelingDownAnswerNumber,
                socialHistoryDto.Phq2Score);

            socialHistory.ReviseSocialHistoryPhq2(socialHistoryPhq2);

            var socialHistoryAuditC = new SocialHistoryAuditC(
                socialHistoryDto.AuditCDrinkBeerWineOrOtherAlcoholicBeveragesIndicator);

            socialHistory.ReviseSocialHistoryAuditC(socialHistoryAuditC);

            var socialHistoryDast10 = new SocialHistoryDast10(
                socialHistoryDto.Dast10TimesPastYearUsedIllegalDrugOrPrescriptionMedicationForNonMedicalReasonsNumber);

            socialHistory.ReviseSocialHistoryDast10(socialHistoryDast10);

            var smokingStatus        = _mappingHelper.MapLookupField <SmokingStatus> (socialHistoryDto.SmokingStatus);
            var socialHistorySmoking = new SocialHistorySmoking(
                smokingStatus,
                socialHistoryDto.SmokingStatusAreYouWillingToQuitIndicator,
                socialHistoryDto.SmokingStatusAreYouWillingToQuitDate);

            socialHistory.ReviseSocialHistorySmoking(socialHistorySmoking);

            return(true);
        }
예제 #2
0
        public void CreateSocialHistory_GivenValidArguments_SocialHistoryIsEditable()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                SetupServiceLocatorFixture(serviceLocatorFixture);
                var entity = _factory.CreateSocialHistory(_visit.Object);

                var smokingStatus =
                    _lookupValueRepository.Object.GetLookupByWellKnownName <SmokingStatus>(It.IsAny <string>());
                var socialHistorySmoking = new SocialHistorySmoking(smokingStatus);
                entity.ReviseSocialHistorySmoking(socialHistorySmoking);
            }
        }
예제 #3
0
        public void CreateSocialHistory_GivenValidArguments_SocialHistoryIsEditable()
        {
            using (var serviceLocatorFixture = new ServiceLocatorFixture())
            {
                // Setup
                SetupServiceLocatorFixture(serviceLocatorFixture);
                var entity = _factory.CreateSocialHistory(_visit.Object);

                var smokingStatus =
                    _lookupValueRepository.Object.GetLookupByWellKnownName<SmokingStatus>(It.IsAny<string>());
                var socialHistorySmoking = new SocialHistorySmoking(smokingStatus);
                entity.ReviseSocialHistorySmoking(socialHistorySmoking);
            }
        }
예제 #4
0
        /// <summary>
        /// Revises the social history smoking.
        /// </summary>
        /// <param name="socialHistorySmoking">The social history smoking.</param>
        public virtual void ReviseSocialHistorySmoking( SocialHistorySmoking socialHistorySmoking )
        {
            Check.IsNotNull ( socialHistorySmoking, "socialHistorySmoking is required." );

            _socialHistorySmoking = socialHistorySmoking;

            DomainEvent.Raise ( new SocialHistorySmokingChangedEvent { SocialHistory = this } );
        }