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

matchCityAndState() public method

public matchCityAndState ( string city, string stateAbbr ) : TaggedTextArray
city string
stateAbbr string
return gov.va.medora.mdws.dto.TaggedTextArray
        public TaggedTextArray matchCityAndState(string city, string stateAbbr)
        {
            TaggedTextArray result = new TaggedTextArray();
            if (city == "")
            {
                result.fault = new FaultTO("Missing city");
            }
            else if (stateAbbr == "")
            {
                result.fault = new FaultTO("Missing stateAbbr");
            }
            if (result.fault != null)
            {
                return result;
            }

            try
            {
                SitesApi api = new SitesApi();
                string[] s = api.matchCityAndState(city, stateAbbr, mySession.MdwsConfiguration.SqlConnectionString);
                result.results = new TaggedText[s.Length];
                for (int i = 0; i < s.Length; i++)
                {
                    string[] parts = StringUtils.split(s[i],StringUtils.CARET);
                    result.results[i] = new TaggedText(parts[0], parts[1]);
                }
                result.count = result.results.Length;
            }
            catch (Exception e)
            {
                result.fault = new FaultTO(e.Message);
            }
            return result;
        }