コード例 #1
0
        /// <summary>
        /// Returns the geographic region (i.e., northeast, southwest, etc.)
        /// corresponding to the specified postal code.
        /// </summary>
        public GeographicRegion RegionFromZipCode(string zipCode)
        {
            DataRow row = this[zipCode];

            if (row == null)
            {
                return(GeographicRegion.Undefined);
            }

            string state = row["state"] as string;

            return(GeoData.RegionFromState(state));
        }
コード例 #2
0
        /// <summary>
        /// Creates a new instance with the specified parameters.
        /// </summary>
        public Sale(
            DateTime date,
            HoodieStyle style, decimal price,
            string zipCode, string city, string state)
        {
            GeographicRegion region = GeoData.RegionFromState(state);

            if (region == GeographicRegion.Undefined)
            {
                throw new ArgumentException(string.Format("Unrecognized state '{0}'.", state));
            }

            this.Date    = date;
            this.Style   = style;
            this.Price   = price;
            this.ZipCode = zipCode;
            this.State   = state;
            this.City    = city == null ? string.Empty : city;
            this.Region  = region;
        }