Esempio n. 1
0
        /// <summary>
        /// If the visit does not have a Dast10, then it returns a newly created Dast10,
        /// else, it returns an existing one from the visit.
        /// </summary>
        /// <param name="visit">A visit.</param>
        /// <returns>A Dast10.</returns>
        public Dast10 CreateDast10(Visit visit)
        {
            Check.IsNotNull(visit, "visit is required.");

            Dast10 dast10;
            var    existingNidaDrugQuestionnaire = _dast10Repository.GetDast10ByVisitKey(visit.Key);

            if (existingNidaDrugQuestionnaire != null)
            {
                dast10 = existingNidaDrugQuestionnaire;
            }
            else
            {
                var activityType = _lookupValueRepository.GetLookupByWellKnownName <ActivityType> (WellKnownNames.VisitModule.ActivityType.Dast10);
                dast10 = new Dast10(visit, activityType);

                _dast10Repository.MakePersistent(dast10);

                DomainEvent.Raise(new Dast10CreatedEvent {
                    Dast10 = dast10
                });
            }

            return(dast10);
        }
Esempio n. 2
0
        /// <summary>
        /// If the visit does not have a Dast10, then it returns a newly created Dast10,
        /// else, it returns an existing one from the visit.
        /// </summary>
        /// <param name="visit">A visit.</param>
        /// <returns>A Dast10.</returns>
        public Dast10 CreateDast10( Visit visit )
        {
            Check.IsNotNull(visit, "visit is required.");

            Dast10 dast10;
            var existingNidaDrugQuestionnaire = _dast10Repository.GetDast10ByVisitKey ( visit.Key );

            if (existingNidaDrugQuestionnaire != null)
            {
                dast10 = existingNidaDrugQuestionnaire;
            }
            else
            {
                var activityType = _lookupValueRepository.GetLookupByWellKnownName<ActivityType> ( WellKnownNames.VisitModule.ActivityType.Dast10 );
                dast10 = new Dast10 ( visit, activityType );

                _dast10Repository.MakePersistent ( dast10 );

                DomainEvent.Raise ( new Dast10CreatedEvent { Dast10 = dast10 } );
            }

            return dast10;
        }
Esempio n. 3
0
 /// <summary>
 /// Destroys the Dast10.
 /// </summary>
 /// <param name="dast10">The dast10.</param>
 public void DestroyDast10( Dast10 dast10 )
 {
     _dast10Repository.MakeTransient ( dast10 );
 }
Esempio n. 4
0
 /// <summary>
 /// Destroys the Dast10.
 /// </summary>
 /// <param name="dast10">The dast10.</param>
 public void DestroyDast10(Dast10 dast10)
 {
     _dast10Repository.MakeTransient(dast10);
 }