Example #1
0
        /// <summary>
        /// Adds an administrative centre
        /// </summary>
        /// <returns></returns>
        public AdministrativeCentreType AddAdministrativeCentre()
        {
            var centre = new AdministrativeCentreType(this);

            this.AdministrativeCentres = new List <AdministrativeCentreType>();
            this.AdministrativeCentres.Add(centre);

            if (this.TaxIdentification != null)
            {
                if (this.TaxIdentification.ResidenceTypeCode == ResidenceTypeCodeType.ResidentInSpain)
                {
                    AddressType address = new AddressType();

                    address.CountryCode = CountryType.ESP;

                    centre.Item = address;
                }
                else
                {
                    centre.Item = new OverseasAddressType();
                }
            }

            return(this.AdministrativeCentres.Last());
        }
        /// <summary>
        /// Adds an administrative centre.
        /// </summary>
        /// <returns>The new administrative centre</returns>
        public AdministrativeCentreType AddAdministrativeCentre()
        {
            var centre = new AdministrativeCentreType(this);

            if (this.AdministrativeCentres == null)
            {
                this.AdministrativeCentres = new List<AdministrativeCentreType>();
            }
            
            this.AdministrativeCentres.Add(centre);

            if (this.TaxIdentification != null)
            {
                if (this.TaxIdentification.ResidenceTypeCode == ResidenceTypeCodeType.ResidentInSpain)
                {
                    centre.Item = new AddressType { CountryCode = CountryType.ESP };
                }
                else
                {
                    centre.Item = new OverseasAddressType();
                }
            }

            return centre;
        }