예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AssessmentInstance" /> class.
        /// </summary>
        /// <param name="assessmentDefinition">The assessment definition.</param>
        /// <param name="patientKey">The patient key.</param>
        /// <param name="assessmentName">Name of the assessment.</param>
        /// <param name="canSelfAdminister">If set to <c>true</c> [can self administer].</param>
        internal AssessmentInstance(AssessmentDefinition assessmentDefinition, Guid patientKey, string assessmentName, bool canSelfAdminister = false)
        {
            Key = CombGuid.NewCombGuid();
            var  itemDefinitions = assessmentDefinition.GetAllItemDefinitionsOfType(ItemType.Question).ToList();
            var  total           = itemDefinitions.Count(item => item.GetIsRequired());
            Guid?staffKey        = null;

            if (UserContext.Current.StaffKey != null)
            {
                staffKey = UserContext.Current.StaffKey.Value;
            }
            RaiseEvent(
                new AssessmentCreatedEvent(
                    Key,
                    Version,
                    patientKey,
                    staffKey,
                    assessmentDefinition.Key,
                    assessmentName,
                    total,
                    DateTime.Now,
                    canSelfAdminister));
        }
예제 #2
0
 /// <summary>
 /// Creates the specified assessment definition key.
 /// </summary>
 /// <param name="assessmentDefinition">The assessment definition.</param>
 /// <param name="patientKey">The patient key.</param>
 /// <param name="assessmentName">Name of the assessment.</param>
 /// <param name="canSelfAdminister">If set to <c>true</c> [can self administer].</param>
 /// <returns>
 /// A <see cref="AssessmentInstance" />.
 /// </returns>
 public AssessmentInstance Create(AssessmentDefinition assessmentDefinition, Guid patientKey, string assessmentName, bool canSelfAdminister = false)
 {
     return(new AssessmentInstance(assessmentDefinition, patientKey, assessmentName, canSelfAdminister));
 }