Ejemplo n.º 1
0
        private void SavePcp(long customerId, string primaryCarePhysicianName, long updatorOrgRoleUserId, long eventCustomerId)
        {
            var pcp = _primaryCarePhysicianRepository.Get(customerId);

            if (!string.IsNullOrEmpty(primaryCarePhysicianName))
            {
                if (pcp == null)
                {
                    pcp = new PrimaryCarePhysician
                    {
                        CustomerId           = customerId,
                        Name                 = new Name(primaryCarePhysicianName),
                        DataRecorderMetaData =
                            new DataRecorderMetaData(updatorOrgRoleUserId, DateTime.Now, null)
                    };
                }
                else
                {
                    pcp.Name = new Name(primaryCarePhysicianName);
                }

                _primaryCarePhysicianRepository.Save(pcp);
                SaveCustomerHealthAnswer("Yes", customerId, eventCustomerId);
            }
            else if (pcp != null)
            {
                _primaryCarePhysicianRepository.Delete(pcp);
                SaveCustomerHealthAnswer("No", customerId, eventCustomerId);
            }
        }