Beispiel #1
0
        public ClosestFacilityTO getNearestFacility(string city, string stateAbbr)
        {
            ClosestFacilityTO result = new ClosestFacilityTO();

            if (city == "")
            {
                result.fault = new FaultTO("Missing city");
            }
            else if (!State.isValidAbbr(stateAbbr))
            {
                result.fault = new FaultTO("Invalid stateAbbr");
            }
            if (result.fault != null)
            {
                return(result);
            }
            try
            {
                TextTO zipcode = getZipcodeForCity(city, stateAbbr);
                if (zipcode.fault != null)
                {
                    result.fault = zipcode.fault;
                    return(result);
                }
                result = getNearestFacility(zipcode.text);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }
Beispiel #2
0
        public ClosestFacilityTO getNearestFacility(string zipcode)
        {
            ClosestFacilityTO result = new ClosestFacilityTO();

            if (zipcode == "")
            {
                result.fault = new FaultTO("Missing zipcode");
            }
            if (result.fault != null)
            {
                return(result);
            }
            try
            {
                SitesApi        api = new SitesApi();
                ClosestFacility fac = api.getNearestFacility(zipcode, mySession.MdwsConfiguration.SqlConnectionString);
                result = new ClosestFacilityTO(fac);
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return(result);
        }