public int GetZoneForAreaCode(string number) { try { LoadAreaCodeData(); if (_areaCodes != null && _areaCodes.Any()) { string areaCode = NumberHelper.TryGetAreaCode(number); if (!String.IsNullOrWhiteSpace(areaCode)) { var record = _areaCodes.Where(x => x.AreaCode == int.Parse(areaCode)).FirstOrDefault(); if (record != null && !String.IsNullOrWhiteSpace(record.State)) { switch (record.State.ToUpper()) { case "ALABAMA": return(4); case "ALASKA": return(1); case "AMERICAN SAMOA": return(1); case "ARIZONA": return(2); case "ARKANSAS": return(4); case "CALIFORNIA": return(1); case "COLORADO": return(2); case "CONNECTICUT": return(5); case "DELAWARE": return(5); case "DISTRICT OF COLUMBIA": return(6); case "FEDERATED STATES OF MICRONESIA": return(1); case "FLORIDA": return(4); case "GEORGIA": return(4); case "GUAM": return(1); case "HAWAII": return(1); case "IDAHO": return(1); case "ILLINOIS": return(3); case "INDIANA": return(6); case "IOWA": return(3); case "KANSAS": return(3); case "KENTUCKY": return(4); case "LOUISIANA": return(4); case "MAINE": return(5); case "MARSHALL ISLANDS": return(1); case "MARYLAND": return(5); case "MASSACHUSETTS": return(5); case "MICHIGAN": return(6); case "MINNESOTA": return(3); case "MISSISSIPPI": return(4); case "MISSOURI": return(3); case "MONTANA": return(2); case "NEBRASKA": return(3); case "NEVADA": return(1); case "NEW HAMPSHIRE": return(5); case "NEW JERSEY": return(5); case "NEW MEXICO": return(2); case "NEW YORK": return(5); case "NORTH CAROLINA": return(6); case "NORTH DAKOTA": return(3); case "NORTHERN MARIANA ISLANDS": return(1); case "OHIO": return(6); case "OKLAHOMA": return(4); case "OREGON": return(1); case "PALAU": return(1); case "PENNSYLVANIA": return(5); case "PUERTO RICO": return(1); case "RHODE ISLAND": return(5); case "SOUTH CAROLINA": return(6); case "SOUTH DAKOTA": return(3); case "TENNESSEE": return(4); case "TEXAS": return(4); case "UTAH": return(2); case "VERMONT": return(5); case "VIRGIN ISLANDS": return(1); case "VIRGINIA": return(6); case "WASHINGTON": return(1); case "WEST VIRGINIA": return(6); case "WISCONSIN": return(3); case "WYOMING": return(2); } } } } } catch (Exception ex) { } var rnd = new Random(DateTime.Now.Millisecond); int zone = rnd.Next(_minZone, _maxZone); return(zone); }