Ejemplo n.º 1
0
        /// <summary>
        /// Gets formatted Ship From address
        /// </summary>
        /// <param name="pattern">Format pattern to use for formatting</param>
        /// <param name="isHtml">If <b>true</b>, address is formatted in HTML format</param>
        /// <returns>Formatted Ship From address</returns>
        public string FormatFromAddress(string pattern, bool isHtml)
        {
            Warehouse warehouse = this.Warehouse;

            if (warehouse == null)
            {
                return(string.Empty);
            }
            return(AddressFormatter.Format(warehouse.Name, string.Empty, warehouse.Address1, warehouse.Address2, warehouse.City, warehouse.Province, warehouse.PostalCode, warehouse.CountryCode, warehouse.Phone, warehouse.Fax, warehouse.Email, isHtml));
        }
        /// <summary>
        /// Select address elements that need to be displayed per the given country
        /// Use properties from IAddressElementInputSelection to obtain element selection values
        /// </summary>
        /// <param name="country">Country in the form of CountryRegion code</param>
        public void SetElementSelection(string country)
        {
            var formatter = new AddressFormatter(ApplicationSettings.Database.LocalConnection, ApplicationSettings.Database.DATAAREAID);

            if (!string.IsNullOrEmpty(country))
            {
                elementSelection = formatter.ElementSelection(country);
            }

            RefreshControlVisibility();
        }
        /// <summary>
        /// Select address elements that need to be displayed per the given country
        /// Use properties from IAddressElementInputSelection to obtain element selection values
        /// </summary>
        /// <param name="country">Country for which the elements are to be selected</param>
        public void SetElementSelection(SupportedCountryRegion country)
        {
            var    formatter = new AddressFormatter(ApplicationSettings.Database.LocalConnection, ApplicationSettings.Database.DATAAREAID);
            string isoCode   = string.Empty;

            isoCode = Enum.GetName(typeof(SupportedCountryRegion), country);
            var countryRegion = formatter.GetCountryRegion(searchISOCode: isoCode);

            elementSelection = formatter.ElementSelection(countryRegion);
            RefreshControlVisibility();
        }
Ejemplo n.º 4
0
        public static void Main(string[] args)
        {
            const string PathToExampleData = @"D:\PAF\Fixed PAF";
            var          addressFormatter  = new AddressFormatter();
            var          mainfile          = new Mainfile(PathToExampleData);
            var          repository        = new MemoryRepository(FormatOptions.Postcode | FormatOptions.TitleCase);

            var sw = System.Diagnostics.Stopwatch.StartNew();

            mainfile.SaveAll(repository);
            sw.Stop();
            Console.WriteLine("Converted {0} addresses in {1}ms", repository.Addresses.Count, sw.ElapsedMilliseconds);

            Console.WriteLine(
                string.Join(
                    "\n",
                    addressFormatter.Format(repository.Addresses[1])));

            Console.ReadKey();
        }
Ejemplo n.º 5
0
 public void SetUp()
 {
     this.formatter = new AddressFormatter();
 }
Ejemplo n.º 6
0
 public AddressFormatterTest()
 {
     Formatter = new AddressFormatter();
 }
Ejemplo n.º 7
0
 public override string ToString()
 {
     return(AddressFormatter.Format(this));
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Gets formatted Ship To address
        /// </summary>
        /// <param name="pattern">Format pattern to use for formatting</param>
        /// <param name="isHtml">If <b>true</b>, address is formatted in HTML format</param>
        /// <returns>Formatted Ship To address</returns>
        public string FormatToAddress(string pattern, bool isHtml)
        {
            string name = (this.ShipToFirstName + " " + this.ShipToLastName).Trim();

            return(AddressFormatter.Format(name, this.ShipToCompany, this.ShipToAddress1, this.ShipToAddress2, this.ShipToCity, this.ShipToProvince, this.ShipToPostalCode, this.ShipToCountryCode, this.ShipToPhone, this.ShipToFax, this.ShipToEmail, isHtml));
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Gets the formatted address for the warehouse.
 /// </summary>
 /// <param name="isHtml">Indicates whether the returned address should be formatted for HTML.</param>
 /// <returns>The formatted address for the warehouse.</returns>
 /// <remarks>The returned address does not include the "name" of the warehouse.</remarks>
 public string FormatAddress(bool isHtml)
 {
     return(AddressFormatter.Format(string.Empty, string.Empty, this.Address1, this.Address2, this.City, this.Province, this.PostalCode, this.CountryCode, this.Phone, this.Fax, this.Email, isHtml));
 }