Esempio n. 1
0
 private static string FormatStreet(AddressDetail a)
 {
     StringBuilder sb = new StringBuilder();
     if (!String.IsNullOrEmpty(a.Unit))
     {
         sb.Append(a.Unit);
         sb.Append("-");
     }
     sb.Append(a.Street);
     return sb.ToString();
 }
Esempio n. 2
0
        /// <summary>
        /// Formats the address according to the specified format string.
        /// </summary>
        /// <remarks>
        /// Valid format specifiers are as follows:
        ///     %S - street address, including number and unit/apartment number
        ///     %V - city
        ///     %P - Province
        ///     %Z - Postal/Zip Code
        ///     %C - country
        /// </remarks>
        /// <param name="pn"></param>
        /// <param name="format"></param>
        /// <returns></returns>
        public static string Format(AddressDetail a, string format)
        {
            string result = format;
            result = result.Replace("%S", a.Street == null ? "" : FormatStreet(a));
            result = result.Replace("%V", a.City == null ? "" : a.City);
            result = result.Replace("%P", a.Province == null ? "" : a.Province);
            result = result.Replace("%Z", a.PostalCode == null ? "" : a.PostalCode);
            result = result.Replace("%C", a.Country == null ? "" : a.Country);

            return result.Trim();
        }
Esempio n. 3
0
        public object Clone()
        {
            AddressDetail clone = new AddressDetail();
            clone.City = this.City;
            clone.Country = this.Country;
            clone.PostalCode = this.PostalCode;
            clone.Province = this.Province;
            clone.Street = this.Street;
            clone.Type = (EnumValueInfo)this.Type.Clone();
            clone.Unit = this.Unit;
            clone.ValidRangeFrom = this.ValidRangeFrom;
            clone.ValidRangeUntil = this.ValidRangeUntil;

            return clone;
        }
Esempio n. 4
0
        public object Clone()
        {
            AddressDetail clone = new AddressDetail();

            clone.City            = this.City;
            clone.Country         = this.Country;
            clone.PostalCode      = this.PostalCode;
            clone.Province        = this.Province;
            clone.Street          = this.Street;
            clone.Type            = (EnumValueInfo)this.Type.Clone();
            clone.Unit            = this.Unit;
            clone.ValidRangeFrom  = this.ValidRangeFrom;
            clone.ValidRangeUntil = this.ValidRangeUntil;

            return(clone);
        }
Esempio n. 5
0
        public Address CreateAddress(AddressDetail addressDetail)
        {
            if (addressDetail == null)
                return null;

            Address newAddress = new Address();

            newAddress.Street = addressDetail.Street;
            newAddress.Unit = addressDetail.Unit;
            newAddress.City = addressDetail.City;
            newAddress.Province = addressDetail.Province;
            newAddress.PostalCode = addressDetail.PostalCode;
            newAddress.Country = addressDetail.Country;
            newAddress.Type = EnumUtils.GetEnumValue<AddressType>(addressDetail.Type);
            newAddress.ValidRange.From = addressDetail.ValidRangeFrom;
            newAddress.ValidRange.Until = addressDetail.ValidRangeUntil;

            return newAddress;
        }
Esempio n. 6
0
        public AddressDetail CreateAddressDetail(Address address, IPersistenceContext context)
        {
            if (address == null)
                return null;

            AddressDetail addressDetail = new AddressDetail();

            addressDetail.Street = address.Street;
            addressDetail.Unit = address.Unit;
            addressDetail.City = address.City;
            addressDetail.Province = address.Province;
            addressDetail.PostalCode = address.PostalCode;
            addressDetail.Country = address.Country;

            addressDetail.Type = EnumUtils.GetEnumValueInfo(address.Type, context);

            addressDetail.ValidRangeFrom = address.ValidRange.From;
            addressDetail.ValidRangeUntil = address.ValidRange.Until;

            return addressDetail;
        }
		public ExternalPractitionerContactPointDetail(
			EntityRef contactPointRef, string name, string description, bool isDefaultContactPoint,
			EnumValueInfo preferredResultCommunicationMode, EnumValueInfo informationAuthority,
			List<TelephoneDetail> phoneDetails, List<AddressDetail> addressDetails, List<EmailAddressDetail> emailAddressDetails,
			TelephoneDetail currentPhone, TelephoneDetail currentFax, AddressDetail currentAddress, EmailAddressDetail currentEmailAddress,
			ExternalPractitionerContactPointSummary mergeDestination, bool isMerged, bool deactivated)
		{
			this.ContactPointRef = contactPointRef;
			this.Name = name;
			this.Description = description;
			this.IsDefaultContactPoint = isDefaultContactPoint;
			this.PreferredResultCommunicationMode = preferredResultCommunicationMode;
			this.InformationAuthority = informationAuthority;
			this.TelephoneNumbers = phoneDetails;
			this.Addresses = addressDetails;
			this.EmailAddresses = emailAddressDetails;
			this.CurrentPhoneNumber = currentPhone;
			this.CurrentFaxNumber = currentFax;
			this.CurrentAddress = currentAddress;
			this.CurrentEmailAddress = currentEmailAddress;
			this.MergeDestination = mergeDestination;
			this.IsMerged = isMerged;
			this.Deactivated = deactivated;
		}
 public ExternalPractitionerContactPointDetail(
     EntityRef contactPointRef, string name, string description, bool isDefaultContactPoint,
     EnumValueInfo preferredResultCommunicationMode, EnumValueInfo informationAuthority,
     List <TelephoneDetail> phoneDetails, List <AddressDetail> addressDetails, List <EmailAddressDetail> emailAddressDetails,
     TelephoneDetail currentPhone, TelephoneDetail currentFax, AddressDetail currentAddress, EmailAddressDetail currentEmailAddress,
     ExternalPractitionerContactPointSummary mergeDestination, bool isMerged, bool deactivated)
 {
     this.ContactPointRef                  = contactPointRef;
     this.Name                             = name;
     this.Description                      = description;
     this.IsDefaultContactPoint            = isDefaultContactPoint;
     this.PreferredResultCommunicationMode = preferredResultCommunicationMode;
     this.InformationAuthority             = informationAuthority;
     this.TelephoneNumbers                 = phoneDetails;
     this.Addresses                        = addressDetails;
     this.EmailAddresses                   = emailAddressDetails;
     this.CurrentPhoneNumber               = currentPhone;
     this.CurrentFaxNumber                 = currentFax;
     this.CurrentAddress                   = currentAddress;
     this.CurrentEmailAddress              = currentEmailAddress;
     this.MergeDestination                 = mergeDestination;
     this.IsMerged                         = isMerged;
     this.Deactivated                      = deactivated;
 }
Esempio n. 9
0
 /// <summary>
 /// Formats the address according to the default format as specified in <see cref="FormatSettings"/>
 /// </summary>
 /// <param name="hc"></param>
 /// <returns></returns>
 public static string Format(AddressDetail addr)
 {
     return Format(addr, FormatSettings.Default.AddressDefaultFormat);
 }