Example #1
0
        /// <summary>
        /// Removes the patient race.
        /// </summary>
        /// <param name="patientRace">The patient race.</param>
        public virtual void RemovePatientRace(PatientRace patientRace)
        {
            Check.IsNotNull(patientRace, "patient race is required.");

            if (PrimaryPatientRace == patientRace)
            {
                PrimaryPatientRace = null;
            }

            _races.Delete(patientRace);
            NotifyItemRemoved(() => Races, patientRace);
        }
Example #2
0
        /// <summary>
        /// Adds the patient race.
        /// </summary>
        /// <param name="patientRace">The patient race.</param>
        public virtual void AddPatientRace(PatientRace patientRace)
        {
            Check.IsNotNull(patientRace, "patient race is required.");

            DomainRuleEngine.CreateRuleEngine <Patient, PatientRace> (this, () => AddPatientRace)
            .WithContext(patientRace)
            .Execute(
                () =>
            {
                patientRace.Patient = this;
                _races.Add(patientRace);
                NotifyItemAdded(() => Races, patientRace);
            });
        }
Example #3
0
        /// <summary>
        /// Sets the primary race.
        /// </summary>
        /// <param name="race">The race.</param>
        public virtual void SetPrimaryRace(Race race)
        {
            Check.IsNotNull(race, "race is required.");

            PatientRace patientRace = null;

            if (race != null)
            {
                patientRace = _races.FirstOrDefault(p => p.Race.Key == race.Key);
            }

            DomainRuleEngine.CreateRuleEngine <Patient, Race> (this, () => SetPrimaryRace)
            .WithContext(patientRace)
            .Execute(() => PrimaryPatientRace = patientRace);
        }