gov.va.medora.mdws.SitesLib.getZipcodeForCity C# (CSharp) Method

getZipcodeForCity() public method

public getZipcodeForCity ( string city, string stateAbbr ) : TextTO
city string
stateAbbr string
return gov.va.medora.mdws.dto.TextTO
        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;
        }