示例#1
0
        /// <summary>
        ///     Revises the email.
        /// </summary>
        /// <param name="email">The email.</param>
        public virtual void ReviseEmail(Email email)
        {
            var patientChangedEvent = new PatientChangedEvent(Key, Version, p => p.Email, email);

            new RuleEngineExecutor <Patient>(this)
            .ForCallingMethodRuleSet()
            .WithContext(patientChangedEvent)
            .Execute(() => RaiseEvent(patientChangedEvent));
        }
示例#2
0
        /// <summary>
        ///     Handles the specified message.
        /// </summary>
        /// <param name="message">The message.</param>
        public void Handle(PatientChangedEvent message)
        {
            if (message.Property == PropertyUtil.ExtractPropertyName <Patient, Gender>(p => p.Gender))
            {
                using (var connection = _connectionFactory.CreateConnection())
                {
                    connection.Execute(
                        "UPDATE PatientModule.Patient SET GenderCode = @GenderCode WHERE PatientKey=@PatientKey",
                        new { GenderCode = (message.Value as Lookup).CodedConcept.Code, PatientKey = message.Key });
                }
            }

            if (message.Property == PropertyUtil.ExtractPropertyName <Patient, PersonName>(p => p.Name))
            {
                using (var connection = _connectionFactory.CreateConnection())
                {
                    var name = (message.Value as PersonName);
                    connection.Execute(
                        "UPDATE PatientModule.Patient SET FirstName = @FirstName, LastName = @LastName WHERE PatientKey=@PatientKey",
                        new { name.FirstName, name.LastName, PatientKey = message.Key });
                }
            }
        }
示例#3
0
 public void Apply(PatientChangedEvent e)
 {
     // Intentionally left blank - internal model doesn't care
 }