示例#1
0
        /// <summary>
        /// Destroys the program enrollment.
        /// </summary>
        /// <param name="programEnrollment">The program enrollment.</param>
        public void DestroyProgramEnrollment(ProgramEnrollment programEnrollment)
        {
            Check.IsNotNull(programEnrollment, "ProgramEnrollment is requried.");

            // TODO: no rules for now, will add in the future once there are clear requriements.
            // A program cannot be deleted if a visit or activity is associated with that program and that patient.
            _programEnrollmentRepository.MakeTransient(programEnrollment);
        }
        /// <summary>
        /// Creates the program enrollment.
        /// </summary>
        /// <param name="programOffering">The program offering.</param>
        /// <param name="clinicalCase">The clinical case.</param>
        /// <param name="enrollmentDate">The enrollment date.</param>
        /// <param name="enrollingStaff">The enrolling staff.</param>
        /// <returns>
        /// A ProgramEnrollment.
        /// </returns>
        public ProgramEnrollment CreateProgramEnrollment(ProgramOffering programOffering, ClinicalCase clinicalCase, DateTime enrollmentDate, Staff enrollingStaff)
        {
            Check.IsNotNull(programOffering, "Program Offering is required.");
            Check.IsNotNull(clinicalCase, "Clinical Case is required.");
            Check.IsNotNull(enrollmentDate, "Enrollment Date is required.");
            Check.IsNotNull(enrollingStaff, "Enrolling Staff is required.");

            var newProgramEnrollment = new ProgramEnrollment ( programOffering, clinicalCase, enrollmentDate, enrollingStaff );
            ProgramEnrollment createdProgramEnrollment = null;

            DomainRuleEngine.CreateRuleEngine ( newProgramEnrollment, "CreateProgramEnrollmentRuleSet" )
                .WithContext ( enrollmentDate )
                .WithContext ( enrollingStaff )
                .Execute ( () =>
                    {
                        _programEnrollmentRepository.MakePersistent(newProgramEnrollment);
                        createdProgramEnrollment = newProgramEnrollment;
                    });

            return createdProgramEnrollment;
        }
示例#3
0
        /// <summary>
        /// Creates the program enrollment.
        /// </summary>
        /// <param name="programOffering">The program offering.</param>
        /// <param name="clinicalCase">The clinical case.</param>
        /// <param name="enrollmentDate">The enrollment date.</param>
        /// <param name="enrollingStaff">The enrolling staff.</param>
        /// <returns>
        /// A ProgramEnrollment.
        /// </returns>
        public ProgramEnrollment CreateProgramEnrollment(ProgramOffering programOffering, ClinicalCase clinicalCase, DateTime enrollmentDate, Staff enrollingStaff)
        {
            Check.IsNotNull(programOffering, "Program Offering is required.");
            Check.IsNotNull(clinicalCase, "Clinical Case is required.");
            Check.IsNotNull(enrollmentDate, "Enrollment Date is required.");
            Check.IsNotNull(enrollingStaff, "Enrolling Staff is required.");

            var newProgramEnrollment = new ProgramEnrollment(programOffering, clinicalCase, enrollmentDate, enrollingStaff);
            ProgramEnrollment createdProgramEnrollment = null;

            DomainRuleEngine.CreateRuleEngine(newProgramEnrollment, "CreateProgramEnrollmentRuleSet")
            .WithContext(enrollmentDate)
            .WithContext(enrollingStaff)
            .Execute(() =>
            {
                _programEnrollmentRepository.MakePersistent(newProgramEnrollment);
                createdProgramEnrollment = newProgramEnrollment;
            });

            return(createdProgramEnrollment);
        }
        /// <summary>
        /// Destroys the program enrollment.
        /// </summary>
        /// <param name="programEnrollment">The program enrollment.</param>
        public void DestroyProgramEnrollment(ProgramEnrollment programEnrollment)
        {
            Check.IsNotNull(programEnrollment, "ProgramEnrollment is requried.");

            // TODO: no rules for now, will add in the future once there are clear requriements.
            // A program cannot be deleted if a visit or activity is associated with that program and that patient.
            _programEnrollmentRepository.MakeTransient(programEnrollment);
        }