Example #1
0
        /// <summary>
        /// Create an AD instance from simple address data
        /// </summary>
        /// <param name="use">The intended use of the address</param>
        /// <param name="addressLine1">The first address line of the address</param>
        /// <param name="addressLine2">The second address line of the address</param>
        /// <param name="city">The city the address should carry</param>
        /// <param name="state">The state the address should carry</param>
        /// <param name="country">The country the address should carry</param>
        /// <param name="zip">The zip code the address should carry</param>
        public static AD FromSimpleAddress(PostalAddressUse use, String addressLine1, String addressLine2, String city, String state, String country, String zip)
        {
            // Sanity check
            AD retVal = AD.CreateAD(use);

            if (!String.IsNullOrEmpty(addressLine1))
            {
                retVal.Part.Add(new ADXP(addressLine1, AddressPartType.AddressLine));
            }
            if (!String.IsNullOrEmpty(addressLine2))
            {
                retVal.Part.Add(new ADXP(addressLine2, AddressPartType.AddressLine));
            }
            if (!String.IsNullOrEmpty(city))
            {
                retVal.Part.Add(new ADXP(city, AddressPartType.City));
            }
            if (!String.IsNullOrEmpty(state))
            {
                retVal.Part.Add(new ADXP(state, AddressPartType.State));
            }
            if (!String.IsNullOrEmpty(country))
            {
                retVal.Part.Add(new ADXP(country, AddressPartType.Country));
            }
            if (!String.IsNullOrEmpty(zip))
            {
                retVal.Part.Add(new ADXP(zip, AddressPartType.PostalCode));
            }
            return(retVal);
        }
Example #2
0
 private static PRPA_MT101306NO01IdentifiedPersonAddress[] CreateIdentifiedPersonAddressParameter(
     IEnumerable <ADXP> addressItems, PostalAddressUse typeAddress)
 {
     return(new[]
     {
         new PRPA_MT101306NO01IdentifiedPersonAddress
         {
             value = new[] { new AD {
                                 Items = addressItems.ToArray(), use = new[] { typeAddress }
                             } }
         }
     });
 }
Example #3
0
        public static Extension CreateADUseExtension(AddressSet.AddressSetUse use)
        {
            if (use == AddressSet.AddressSetUse.Search)
            {
                return(CreateNullElementExtension(NullFlavor.Other));
            }

            PostalAddressUse v3Use    = (PostalAddressUse)Enum.Parse(typeof(PostalAddressUse), use.ToString());
            string           wireCode = MARC.Everest.Connectors.Util.ToWireFormat(v3Use);

            return(new Extension()
            {
                Url = GetExtensionNameUrl("addressUse"),
                Value = new Coding(typeof(PostalAddressUse).GetValueSetDefinition(), wireCode)
            });
        }
Example #4
0
        public virtual void TestUsesMultipleUses()
        {
            XmlNode node = CreateNode("<something use=\"H PHYS PST\"/>");
            AD      ad   = (AD) new AdElementParser().Parse(CreateContext("AD.BASIC", SpecificationVersion.V02R02), node, this.xmlResult);

            Assert.IsTrue(this.xmlResult.IsValid());
            PostalAddress postalAddress = ad.Value;

            Assert.AreEqual(3, postalAddress.Uses.Count, "one use");
            int index = 0;

            PostalAddressUse[] expectedUses = { Ca.Infoway.Messagebuilder.Domainvalue.Basic.X_BasicPostalAddressUse.HOME,
                                                Ca.Infoway.Messagebuilder.Domainvalue.Basic.X_BasicPostalAddressUse.PHYSICAL,
                                                Ca.Infoway.Messagebuilder.Domainvalue.Basic.X_BasicPostalAddressUse.POSTAL };
            foreach (PostalAddressUse actualUse in postalAddress.Uses)
            {
                PostalAddressUse expectedUse = expectedUses[index];
                Assert.AreEqual(expectedUse, actualUse, "contains " + expectedUse.CodeValue + " use");
                index++;
            }
        }
Example #5
0
 /// <summary>
 /// Helper method for creating AD instances
 /// </summary>
 /// <param name="use">The use of the returned address</param>
 /// <param name="parts">The parts that make up the address</param>
 public static AD CreateAD(PostalAddressUse use, params ADXP[] parts)
 {
     return(new AD(use, parts));
 }
Example #6
0
 /// <summary>
 /// Create a new address instance with the specified use
 /// </summary>
 /// <param name="use">The use that should constructed address should have</param>
 public AD(PostalAddressUse use) : this()
 {
     this.Use = new SET <CS <PostalAddressUse> >(use);
 }
Example #7
0
 /// <summary>
 /// Adds a postal address use.
 /// </summary>
 ///
 /// <param name="use">a postal address use</param>
 public void AddUse(PostalAddressUse use)
 {
     ILOG.J2CsMapping.Collections.Generics.Collections.Add(this.uses, use);
 }