protected void PostcodeLookup(string AmbiguityId, string SearchStatus) { try { ContactServiceClient contactService = new ContactServiceClient(); PostcodeLookupReturnValue returnValue = new PostcodeLookupReturnValue(); CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.StartRow = 0; PostcodeLookupSearchCriteria criteria = new PostcodeLookupSearchCriteria(); criteria.Address = new Address(); criteria.Address.OrganisationName = _txtOrganisation.Text; criteria.Address.PostBox = _txtPOBox.Text; criteria.Address.SubBuilding = _txtSubBuildingName.Text; criteria.Address.HouseName = _txtHouseName.Text; criteria.Address.StreetNumber = _txtHouseNumber.Text; criteria.Address.Line1 = _txtAddress1.Text; criteria.Address.Line2 = _txtAddress2.Text; criteria.Address.Line3 = _txtAddress3.Text; criteria.Address.DependantLocality = _txtDeptLoc.Text; criteria.Address.Town = _txtTown.Text; criteria.Address.County = _txtCounty.Text; criteria.Address.PostCode = _txtPostcode.Text; criteria.Address.Country = _txtCountry.Text; criteria.Address.DXNumber = _txtDXAddress1.Text; criteria.Address.DXTown = _txtDXAddress2.Text; criteria.AmbiguityId = AmbiguityId; criteria.SearchStatus = SearchStatus; returnValue = contactService.PostcodeLookupSearch(_logonId, criteria); if (returnValue != null) { //Add each address if (returnValue.PostcodeLookup != null) { _trServiceError.Style["display"] = "none"; _trServiceErrorSpace.Style["display"] = "none"; _listAddress.Style["display"] = ""; _listAddress.Items.Clear(); foreach (PostcodeLookupSearchItem cAddress in returnValue.PostcodeLookup) { this._listAddress.Items.Add(CreateListViewItem(cAddress)); } } else { string msg = string.Empty; if (string.IsNullOrEmpty(returnValue.Message)) { msg = "No matching or ambiguous addresses could be found for these details."; } else { msg = returnValue.Message; } _trServiceError.Style["display"] = ""; _trServiceErrorSpace.Style["display"] = ""; _listAddress.Style["display"] = "none"; _lblServiceError.Text = msg; } } else { _trServiceError.Style["display"] = ""; _trServiceErrorSpace.Style["display"] = ""; _listAddress.Style["display"] = "none"; _lblServiceError.Text = "No matching or ambiguous addresses could be found for these details."; } } catch (Exception ex) { //throw ex; _trServiceError.Style["display"] = ""; _trServiceErrorSpace.Style["display"] = ""; _listAddress.Style["display"] = "none"; _lblServiceError.Text = ex.Message; } _mpePostcodeLookup.Show(); }
protected void PostcodeLookup(string AmbiguityId, string SearchStatus) { try { ContactServiceClient contactService = new ContactServiceClient(); PostcodeLookupReturnValue returnValue = new PostcodeLookupReturnValue(); CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.StartRow = 0; PostcodeLookupSearchCriteria criteria = new PostcodeLookupSearchCriteria(); criteria.Address = new Address(); criteria.Address.OrganisationName = _txtOrganisation.Text; criteria.Address.PostBox = _txtPOBox.Text; criteria.Address.SubBuilding = _txtSubBuildingName.Text; criteria.Address.HouseName = _txtHouseName.Text; criteria.Address.StreetNumber = _txtHouseNumber.Text; criteria.Address.Line1 = _txtAddress1.Text; criteria.Address.Line2 = _txtAddress2.Text; criteria.Address.Line3 = _txtAddress3.Text; criteria.Address.DependantLocality = _txtDeptLoc.Text; criteria.Address.Town = _txtTown.Text; criteria.Address.County = _txtCounty.Text; criteria.Address.PostCode = _txtPostcode.Text; criteria.Address.Country = _txtCountry.Text; criteria.Address.DXNumber = _txtDXAddress1.Text; criteria.Address.DXTown = _txtDXAddress2.Text; criteria.AmbiguityId = AmbiguityId; criteria.SearchStatus = SearchStatus; returnValue = contactService.PostcodeLookupSearch(_logonId, criteria); if (returnValue != null) { //Add each address if (returnValue.PostcodeLookup != null) { _trServiceError.Style["display"] = "none"; _trServiceErrorSpace.Style["display"] = "none"; _listAddress.Style["display"] = ""; _listAddress.Items.Clear(); foreach (PostcodeLookupSearchItem cAddress in returnValue.PostcodeLookup) { this._listAddress.Items.Add(CreateListViewItem(cAddress)); } } else { string msg = string.Empty; if (string.IsNullOrEmpty(returnValue.Message)) msg = "No matching or ambiguous addresses could be found for these details."; else msg = returnValue.Message; _trServiceError.Style["display"] = ""; _trServiceErrorSpace.Style["display"] = ""; _listAddress.Style["display"] = "none"; _lblServiceError.Text = msg; } } else { _trServiceError.Style["display"] = ""; _trServiceErrorSpace.Style["display"] = ""; _listAddress.Style["display"] = "none"; _lblServiceError.Text = "No matching or ambiguous addresses could be found for these details."; } } catch (Exception ex) { //throw ex; _trServiceError.Style["display"] = ""; _trServiceErrorSpace.Style["display"] = ""; _listAddress.Style["display"] = "none"; _lblServiceError.Text = ex.Message; } _mpePostcodeLookup.Show(); }