Exemplo n.º 1
0
        /// <summary>
        /// Destroys the program offering.
        /// </summary>
        /// <param name="programOffering">The program offering.</param>
        public void DestroyProgramOffering( ProgramOffering programOffering )
        {
            Check.IsNotNull ( programOffering, "Program is required" );

            DomainRuleEngine.CreateRuleEngine ( programOffering, () => DestroyProgramOffering )
                .Execute(() => _programOfferingRepository.MakeTransient(programOffering));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Destroys the program offering.
        /// </summary>
        /// <param name="programOffering">The program offering.</param>
        public void DestroyProgramOffering(ProgramOffering programOffering)
        {
            Check.IsNotNull(programOffering, "Program is required");

            DomainRuleEngine.CreateRuleEngine(programOffering, () => DestroyProgramOffering)
            .Execute(() => _programOfferingRepository.MakeTransient(programOffering));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates the program offering.
        /// </summary>
        /// <param name="program">The program.</param>
        /// <param name="location">The location.</param>
        /// <param name="startDate">The start date.</param>
        /// <returns>
        /// A ProgramOffering.
        /// </returns>
        public ProgramOffering CreateProgramOffering(Program program, Location location, DateTime startDate)
        {
            var programOffering = new ProgramOffering(program, location, startDate);

            _programOfferingRepository.MakePersistent(programOffering);
            return(programOffering);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProgramEnrollment"/> class.
        /// </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>
        protected internal ProgramEnrollment(ProgramOffering programOffering, ClinicalCase clinicalCase, DateTime enrollmentDate, Staff enrollingStaff)
            : this()
        {
            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.");

            _programOffering = programOffering;
            _clinicalCase = clinicalCase;
            _enrollmentDate = enrollmentDate;
            _enrollingStaff = enrollingStaff;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProgramEnrollment"/> class.
        /// </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>
        protected internal ProgramEnrollment(ProgramOffering programOffering, ClinicalCase clinicalCase, DateTime enrollmentDate, Staff enrollingStaff)
            : this()
        {
            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.");

            _programOffering = programOffering;
            _clinicalCase    = clinicalCase;
            _enrollmentDate  = enrollmentDate;
            _enrollingStaff  = enrollingStaff;
        }
Exemplo n.º 6
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;
        }
Exemplo n.º 7
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);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Creates the program offering.
 /// </summary>
 /// <param name="program">The program.</param>
 /// <param name="location">The location.</param>
 /// <param name="startDate">The start date.</param>
 /// <returns>
 /// A ProgramOffering.
 /// </returns>
 public ProgramOffering CreateProgramOffering( Program program, Location location, DateTime startDate )
 {
     var programOffering = new ProgramOffering ( program, location, startDate );
     _programOfferingRepository.MakePersistent ( programOffering );
     return programOffering;
 }