示例#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));
        }
示例#2
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();
        }
示例#3
0
 public override string ToString()
 {
     return(AddressFormatter.Format(this));
 }
示例#4
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));
        }
示例#5
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));
 }