示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
文件: SitesLib.cs 项目: OSEHRA/mdws
        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;
        }
示例#6
0
文件: SitesLib.cs 项目: OSEHRA/mdws
 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;
 }
示例#7
0
文件: SitesLib.cs 项目: OSEHRA/mdws
        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;
        }
示例#8
0
文件: SitesLib.cs 项目: OSEHRA/mdws
        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;
        }