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;
}