/// <summary> /// Disenrolls the specified disenrollment date. /// </summary> /// <param name="disenrollmentDate">The disenrollment date.</param> /// <param name="disenrollReason">The disenroll reason.</param> /// <param name="disenrollOtherReasonNote">The disenroll other reason note.</param> public virtual void Disenroll(DateTime?disenrollmentDate, DisenrollReason disenrollReason, string disenrollOtherReasonNote = null) { Check.IsNotNull(disenrollmentDate, "Disenrollment Date is required."); Check.IsNotNull(disenrollReason, "Disenroll Reason is required."); if (disenrollReason.WellKnownName == WellKnownNames.ProgramModule.DisenrollReason.Other) { Check.IsNotNull(disenrollOtherReasonNote, "Disenroll Other Reason Note is required."); } DomainRuleEngine.CreateRuleEngine(this, "DisenrollRuleSet") .WithContext(disenrollmentDate) .WithContext(disenrollReason) .WithContext(disenrollOtherReasonNote) .Execute(() => { DisenrollmentDate = disenrollmentDate; DisenrollReason = disenrollReason; DisenrollOtherReasonNote = disenrollReason.WellKnownName == WellKnownNames.ProgramModule.DisenrollReason.Other ? disenrollOtherReasonNote : null; }); }
/// <summary> /// Disenrolls the specified disenrollment date. /// </summary> /// <param name="disenrollmentDate">The disenrollment date.</param> /// <param name="disenrollReason">The disenroll reason.</param> /// <param name="disenrollOtherReasonNote">The disenroll other reason note.</param> public virtual void Disenroll(DateTime? disenrollmentDate, DisenrollReason disenrollReason, string disenrollOtherReasonNote = null) { Check.IsNotNull(disenrollmentDate, "Disenrollment Date is required."); Check.IsNotNull(disenrollReason, "Disenroll Reason is required."); if (disenrollReason.WellKnownName == WellKnownNames.ProgramModule.DisenrollReason.Other) { Check.IsNotNull ( disenrollOtherReasonNote, "Disenroll Other Reason Note is required." ); } DomainRuleEngine.CreateRuleEngine ( this, "DisenrollRuleSet" ) .WithContext ( disenrollmentDate ) .WithContext ( disenrollReason ) .WithContext ( disenrollOtherReasonNote ) .Execute(() => { DisenrollmentDate = disenrollmentDate; DisenrollReason = disenrollReason; DisenrollOtherReasonNote = disenrollReason.WellKnownName == WellKnownNames.ProgramModule.DisenrollReason.Other ? disenrollOtherReasonNote : null; }); }