public NoteboxItem(Note note, Order order, Patient patient, Staff author, string diagnosticServiceName, bool isAcknowledged, InformationAuthorityEnum informationAuthority) { this.Note = note; this.Order = order; this.Patient = patient; this.Author = author; this.DiagnosticServiceName = diagnosticServiceName; this.NotePostingAcknowledged = isAcknowledged; this.OrderingFacilityInformationAuthority = informationAuthority; }
private InformationAuthorityEnum GetAuthority(string id, string name) { InformationAuthorityEnum authority = CollectionUtils.SelectFirst(_authorities, delegate(InformationAuthorityEnum a) { return(a.Code == id); }); if (authority == null) { // create a new value InformationAuthorityEnum lastValue = CollectionUtils.LastElement(_authorities); authority = (InformationAuthorityEnum)_enumBroker.AddValue(typeof(InformationAuthorityEnum), id, id, name, lastValue == null ? 1 : lastValue.DisplayOrder + 1, false); _authorities.Add(authority); } return(authority); }
public Facility(string code, string name, string description, InformationAuthorityEnum informationAuthority) :this(code, name, description, informationAuthority, new HashedSet<Department>()) { }
public Facility(string code, string name, string description, InformationAuthorityEnum informationAuthority) : this(code, name, description, informationAuthority, new HashedSet <Department>()) { }
private static Facility LoadOrCreateFacility(string code, string name, string description, InformationAuthorityEnum ia, IPersistenceContext context) { Facility pt; try { // see if already exists in db var where = new FacilitySearchCriteria(); where.Code.EqualTo(code); pt = context.GetBroker <IFacilityBroker>().FindOne(where); } catch (EntityNotFoundException) { // create it pt = new Facility(code, name, description, ia); context.Lock(pt, DirtyState.New); } return(pt); }
/// <summary> /// Creates a new contact point that is the result of merging the two specified contact points. /// </summary> /// <remarks> /// Any phone numbers, addresses and email addresses in the supplied arguments will supercede those /// from the source contact points. /// </remarks> public static ExternalPractitionerContactPoint MergeContactPoints( ExternalPractitionerContactPoint right, ExternalPractitionerContactPoint left, string name, string description, ResultCommunicationMode preferredCommunicationMode, InformationAuthorityEnum informationAuthority, IList <TelephoneNumber> phoneNumbers, IList <Address> addresses, IList <EmailAddress> emailAddresses ) { // sanity checks if (Equals(right, left)) { throw new WorkflowException("Cannot merge a contact point with itself."); } if (!Equals(right.Practitioner, left.Practitioner)) { throw new WorkflowException("Only contact points belonging to the same practitioner can be merged."); } if (right.Deactivated || left.Deactivated) { throw new WorkflowException("Cannot merge a contact point that is de-activated."); } if (right.IsMerged || left.IsMerged) { throw new WorkflowException("Cannot merge a contact point that has already been merged."); } var practitioner = right.Practitioner; // same practitioner for both // create new contact point, using specified name and description // the new contact point is default if either of the source contact points were the default // start with empty value collections var result = new ExternalPractitionerContactPoint( practitioner, name, description, preferredCommunicationMode, informationAuthority, right.IsDefaultContactPoint || left.IsDefaultContactPoint, phoneNumbers ?? new List <TelephoneNumber>(), addresses ?? new List <Address>(), emailAddresses ?? new List <EmailAddress>(), null); practitioner.ContactPoints.Add(result); // merge value collections from source contact points, and update source contact points appropriately foreach (var contactPoint in new[] { right, left }) { // merge all value collections into the result MergeValueCollection(result.TelephoneNumbers, contactPoint.TelephoneNumbers, (x, y) => x.IsSameNumber(y)); MergeValueCollection(result.Addresses, contactPoint.Addresses, (x, y) => x.IsSameAddress(y)); MergeValueCollection(result.EmailAddresses, contactPoint.EmailAddresses, (x, y) => x.IsSameEmailAddress(y)); // mark as merged contactPoint.SetMergedInto(result); } // mark the practitioner as being edited practitioner.MarkEdited(); return(result); }