Patient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace PatientEntities | |
{ | |
public partial class Patient | |
{ | |
#region Primitive Properties | |
public virtual long PatientId | |
{ | |
get; | |
set; | |
} | |
public virtual string Mrn | |
{ | |
get; | |
set; | |
} | |
public virtual string ClientPatientIdentity | |
{ | |
get; | |
set; | |
} | |
public virtual string FinNumber | |
{ | |
get; | |
set; | |
} | |
public virtual long GenderId | |
{ | |
get; | |
set; | |
} | |
public virtual string PreferredName | |
{ | |
get; | |
set; | |
} | |
public virtual string Race | |
{ | |
get; | |
set; | |
} | |
public virtual Nullable<long> AddressId | |
{ | |
get { return _addressId; } | |
set | |
{ | |
try | |
{ | |
_settingFK = true; | |
if (_addressId != value) | |
{ | |
if (Address != null && Address.AddressId != value) | |
{ | |
Address = null; | |
} | |
_addressId = value; | |
} | |
} | |
finally | |
{ | |
_settingFK = false; | |
} | |
} | |
} | |
private Nullable<long> _addressId; | |
public virtual string CountryCode | |
{ | |
get; | |
set; | |
} | |
public virtual string HomePhone | |
{ | |
get; | |
set; | |
} | |
public virtual string BusinessPhone | |
{ | |
get; | |
set; | |
} | |
public virtual string Language | |
{ | |
get; | |
set; | |
} | |
public virtual string MaritalStatus | |
{ | |
get; | |
set; | |
} | |
public virtual string Religion | |
{ | |
get; | |
set; | |
} | |
public virtual long InformationSourceId | |
{ | |
get; | |
set; | |
} | |
public virtual string LastName | |
{ | |
get; | |
set; | |
} | |
public virtual string FirstName | |
{ | |
get; | |
set; | |
} | |
public virtual string MiddleName | |
{ | |
get; | |
set; | |
} | |
public virtual string NamePrefix | |
{ | |
get; | |
set; | |
} | |
public virtual string NameSuffix | |
{ | |
get; | |
set; | |
} | |
public virtual string NameTypeCode | |
{ | |
get; | |
set; | |
} | |
#endregion | |
#region Navigation Properties | |
public virtual Address Address | |
{ | |
get { return _address; } | |
set | |
{ | |
if (!ReferenceEquals(_address, value)) | |
{ | |
var previousValue = _address; | |
_address = value; | |
FixupAddress(previousValue); | |
} | |
} | |
} | |
private Address _address; | |
#endregion | |
#region Association Fixup | |
private bool _settingFK = false; | |
private void FixupAddress(Address previousValue) | |
{ | |
if (previousValue != null && previousValue.Patients.Contains(this)) | |
{ | |
previousValue.Patients.Remove(this); | |
} | |
if (Address != null) | |
{ | |
if (!Address.Patients.Contains(this)) | |
{ | |
Address.Patients.Add(this); | |
} | |
if (AddressId != Address.AddressId) | |
{ | |
AddressId = Address.AddressId; | |
} | |
} | |
else if (!_settingFK) | |
{ | |
AddressId = null; | |
} | |
} | |
#endregion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment