public TextTO getZipcodeForCity(string city, string stateAbbr) { TextTO result = new TextTO(); if (city == "") { result.fault = new FaultTO("Missing city"); } else if (stateAbbr == "") { result.fault = new FaultTO("Missing stateAbbr"); } if (result.fault != null) { return(result); } try { gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao dao = new gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao(mySession.MdwsConfiguration.SqlConnectionString); string zip = dao.getZipcode(city, stateAbbr); result = new TextTO(zip); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return(result); }
public StateArray getStates() { StateArray result = new StateArray(); try { gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao dao = new gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao(mySession.MdwsConfiguration.SqlConnectionString); State[] states = dao.getStates(); result = new StateArray(states); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return(result); }
public ZipcodeTO[] getCitiesInState(string stateAbbr) { gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao dao = new gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao(mySession.MdwsConfiguration.SqlConnectionString); ZipcodeTO[] result = new ZipcodeTO[1]; result[0] = new ZipcodeTO(); if (String.IsNullOrEmpty(stateAbbr)) { result[0].fault = new FaultTO("Missing state abbreviation"); } else if (stateAbbr.Length != 2) { result[0].fault = new FaultTO("Invalid state abbreviation", "Please supply a valid 2 letter abbreviation"); } if (result[0].fault != null) { return(result); } try { Zipcode[] zips = dao.getCitiesInState(stateAbbr); IndexedHashtable t = new IndexedHashtable(); for (int i = 0; i < zips.Length; i++) { if (!t.ContainsKey(zips[i].City)) { t.Add(zips[i].City, zips[i]); } } result = new ZipcodeTO[t.Count]; for (int i = 0; i < t.Count; i++) { result[i] = new ZipcodeTO((Zipcode)t.GetValue(i)); } } catch (Exception exc) { result[0].fault = new FaultTO(exc); } return(result); }
public GeographicLocationArray getGeographicLocations(string zipcode) { GeographicLocationArray result = new GeographicLocationArray(); if (zipcode.Length != 5 || !StringUtils.isNumeric(zipcode)) { result.fault = new FaultTO("Invalid zipcode: must be 5 numeric chars"); return(result); } try { gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao dao = new gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao(mySession.MdwsConfiguration.SqlConnectionString); GeographicLocation[] locations = dao.getGeographicLocations(zipcode); result = new GeographicLocationArray(locations); } catch (Exception e) { result.fault = new FaultTO(e); } return(result); }
public TextTO getZipcodeForCity(string city, string stateAbbr) { TextTO result = new TextTO(); if (city == "") { result.fault = new FaultTO("Missing city"); } else if (stateAbbr == "") { result.fault = new FaultTO("Missing stateAbbr"); } if (result.fault != null) { return result; } try { gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao dao = new gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao(mySession.MdwsConfiguration.SqlConnectionString); string zip = dao.getZipcode(city, stateAbbr); result = new TextTO(zip); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }
public StateArray getStates() { StateArray result = new StateArray(); try { gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao dao = new gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao(mySession.MdwsConfiguration.SqlConnectionString); State[] states = dao.getStates(); result = new StateArray(states); } catch (Exception e) { result.fault = new FaultTO(e.Message); } return result; }
public GeographicLocationArray getGeographicLocations(string zipcode) { GeographicLocationArray result = new GeographicLocationArray(); if (zipcode.Length != 5 || !StringUtils.isNumeric(zipcode)) { result.fault = new FaultTO("Invalid zipcode: must be 5 numeric chars"); return result; } try { gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao dao = new gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao(mySession.MdwsConfiguration.SqlConnectionString); GeographicLocation[] locations = dao.getGeographicLocations(zipcode); result = new GeographicLocationArray(locations); } catch (Exception e) { result.fault = new FaultTO(e); } return result; }
public ZipcodeTO[] getCitiesInState(string stateAbbr) { gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao dao = new gov.va.medora.mdo.dao.sql.zipcodeDB.ZipcodeDao(mySession.MdwsConfiguration.SqlConnectionString); ZipcodeTO[] result = new ZipcodeTO[1]; result[0] = new ZipcodeTO(); if (String.IsNullOrEmpty(stateAbbr)) { result[0].fault = new FaultTO("Missing state abbreviation"); } else if (stateAbbr.Length != 2) { result[0].fault = new FaultTO("Invalid state abbreviation", "Please supply a valid 2 letter abbreviation"); } if (result[0].fault != null) { return result; } try { Zipcode[] zips = dao.getCitiesInState(stateAbbr); IndexedHashtable t = new IndexedHashtable(); for (int i = 0; i < zips.Length; i++) { if (!t.ContainsKey(zips[i].City)) { t.Add(zips[i].City, zips[i]); } } result = new ZipcodeTO[t.Count]; for (int i = 0; i < t.Count; i++) { result[i] = new ZipcodeTO((Zipcode)t.GetValue(i)); } } catch (Exception exc) { result[0].fault = new FaultTO(exc); } return result; }