private static void LoadZipCodes(object state) { if (state == null) { try { Stream zipcodes = new MemoryStream(File.ReadAllBytes(System.Web.Hosting.HostingEnvironment.MapPath("~/BVModules/Shipping/ZipCodes.csv"))); EventLog.LogEvent("Postal Code Support", "Starting to load ZIP codes...", EventLogSeverity.Information); int count = PostalCode.LoadCVS(Country.FindByISOCode("US").Bvin, zipcodes, "ZipCodes.csv", 1, 0, 3, 2, 5); EventLog.LogEvent("Postal Code Support", string.Format("Finished loading {0} ZIP codes.", count), EventLogSeverity.Information); } catch (Exception ex) { EventLog.LogEvent("Postal Code Support", ex.Message, EventLogSeverity.Error); } } else { object[] args = (object[])state; String countryBvin = (string)args[0]; Stream stream = (Stream)args[1]; String filename = (String)args[2]; Int32 codeIndex = (Int32)args[3]; Int32 latitudeIndex = (Int32)args[4]; Int32 longitudeIndex = (Int32)args[5]; Int32 cityIndex = (Int32)args[6]; Int32 regionIndex = (Int32)args[7]; try { EventLog.LogEvent("Postal Code Support", "Starting to load postal codes...", EventLogSeverity.Information); int count = PostalCode.LoadCVS(countryBvin, stream, filename, codeIndex, latitudeIndex, longitudeIndex, cityIndex, regionIndex); EventLog.LogEvent("Postal Code Support", string.Format("Finished loading {0} postal codes from {1}.", count, filename), EventLogSeverity.Information); } catch (Exception ex) { EventLog.LogEvent("Postal Code Support", ex.Message, EventLogSeverity.Error); } } }