public object Clone()
        {
            TelephoneDetail clone = new TelephoneDetail();
            clone.AreaCode = this.AreaCode;
            clone.CountryCode = this.CountryCode;
            clone.Extension = this.Extension;
            clone.Number = this.Number;
            clone.Type = (EnumValueInfo)this.Type.Clone();
            clone.ValidRangeFrom = this.ValidRangeFrom;
            clone.ValidRangeUntil = this.ValidRangeUntil;

            return clone;
        }
Beispiel #2
0
        public object Clone()
        {
            TelephoneDetail clone = new TelephoneDetail();

            clone.AreaCode        = this.AreaCode;
            clone.CountryCode     = this.CountryCode;
            clone.Extension       = this.Extension;
            clone.Number          = this.Number;
            clone.Type            = (EnumValueInfo)this.Type.Clone();
            clone.ValidRangeFrom  = this.ValidRangeFrom;
            clone.ValidRangeUntil = this.ValidRangeUntil;

            return(clone);
        }
        /// <summary>
        /// Formats the address according to the specified format string.
        /// </summary>
        /// <remarks>
        /// Valid format specifiers are as follows:
        ///     %C - country code, preceded by +
        ///     %c - country code if different from default country code specified in <see cref="FormatSettings"/>
        ///     %A - area code
        ///     %N - phone number in form XXX-XXXX 
        ///     %X - extension, preceded by x
        /// </remarks>
        /// <param name="tn"></param>
        /// <param name="format"></param>
        /// <returns></returns>
        public static string Format(TelephoneDetail tn, string format)
        {
            string result = format;
            result = result.Replace("%C", tn.CountryCode == null ? "" : string.Format("+{0}", tn.CountryCode));

            result = result.Replace("%c",
                (tn.CountryCode == null || tn.CountryCode == FormatSettings.Default.TelephoneNumberSuppressCountryCode) ? ""
                : string.Format("+{0}", tn.CountryCode));

            result = result.Replace("%A", tn.AreaCode == null ? "" : tn.AreaCode);
            result = result.Replace("%N", StringMask.Apply(tn.Number, FormatSettings.Default.TelephoneNumberLocalMask) ?? "");
            result = result.Replace("%X", string.IsNullOrEmpty(tn.Extension) ? "" : string.Format("x{0}", tn.Extension));

            return result.Trim();
        }
        public TelephoneNumber CreateTelephoneNumber(TelephoneDetail telephoneDetail)
        {
            if (telephoneDetail == null)
                return null;

            TelephoneNumber telephoneNumber = new TelephoneNumber();

            telephoneNumber.CountryCode = telephoneDetail.CountryCode;
            telephoneNumber.AreaCode = telephoneDetail.AreaCode;
            telephoneNumber.Number = telephoneDetail.Number;
            telephoneNumber.Extension = telephoneDetail.Extension;
            telephoneNumber.ValidRange.From = telephoneDetail.ValidRangeFrom;
            telephoneNumber.ValidRange.Until = telephoneDetail.ValidRangeUntil;

            SimplifiedPhoneTypeAssembler simplePhoneTypeAssembler = new SimplifiedPhoneTypeAssembler();
            simplePhoneTypeAssembler.UpdatePhoneNumber(telephoneDetail.Type, telephoneNumber);

            return telephoneNumber;
        }
        public TelephoneDetail CreateTelephoneDetail(TelephoneNumber telephoneNumber, IPersistenceContext context)
        {
            if (telephoneNumber == null)
                return null;

            TelephoneDetail telephoneDetail = new TelephoneDetail();

            telephoneDetail.CountryCode = telephoneNumber.CountryCode;
            telephoneDetail.AreaCode = telephoneNumber.AreaCode;
            telephoneDetail.Number = telephoneNumber.Number;
            telephoneDetail.Extension = telephoneNumber.Extension;

            SimplifiedPhoneTypeAssembler simplePhoneTypeAssembler = new SimplifiedPhoneTypeAssembler();
            telephoneDetail.Type = simplePhoneTypeAssembler.GetSimplifiedPhoneType(telephoneNumber);

            telephoneDetail.ValidRangeFrom = telephoneNumber.ValidRange.From;
            telephoneDetail.ValidRangeUntil = telephoneNumber.ValidRange.Until;

            return telephoneDetail;
        }
		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;
 }
 /// <summary>
 /// Formats the telephone number according to the default format as specified in <see cref="FormatSettings"/>
 /// </summary>
 /// <param name="tn"></param>
 /// <returns></returns>
 public static string Format(TelephoneDetail tn)
 {
     return Format(tn, FormatSettings.Default.TelephoneNumberDefaultFormat);
 }