Exemple #1
0
        /// <summary>
        /// Convert a telecom address
        /// </summary>
        internal TelecommunicationsAddress ConvertTelecom(Telecom tel, List <IResultDetail> dtls)
        {
            var retVal = new TelecommunicationsAddress();

            if (tel.Use != null)
            {
                retVal.Use = MARC.Everest.Connectors.Util.ToWireFormat(HackishCodeMapping.Lookup(HackishCodeMapping.TELECOM_USE, tel.Use));
                // Extensions
                retVal.Use += ExtensionUtil.ParseTELUseExtension(tel.Extension, dtls);
            }
            if (String.IsNullOrEmpty(tel.Value))
            {
                dtls.Add(new MandatoryElementMissingResultDetail(ResultDetailType.Error, "Telecommunications address must carry a value", "telecom"));
            }
            else
            {
                retVal.Value = tel.Value;
                if (tel.System.Value == "phone" && !retVal.Value.StartsWith("tel:"))
                {
                    dtls.Add(new ValidationResultDetail(ResultDetailType.Error, "Telecommunications address must start with tel: when system is phone", null, null));
                }
                else if (tel.System.Value == "email" && !retVal.Value.StartsWith("mailto:"))
                {
                    dtls.Add(new ValidationResultDetail(ResultDetailType.Error, "Telecommunications address must start with mailto: when system is email", null, null));
                }
            }
            if (tel.Period != null)
            {
                dtls.Add(new UnsupportedFhirDatatypePropertyResultDetail(ResultDetailType.Warning, "Period", "Name"));
                tel.Period = null;
            }

            return(retVal);
        }