예제 #1
0
        private void btnVerifyAddress_Click(object sender, EventArgs e)
        {
            ClearResultFields();
            var restoreCursor = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;

            if (String.IsNullOrEmpty(txtStreet.Text) || String.IsNullOrEmpty(txtCityStateZip.Text))
            {
                MessageBox.Show("Street and CityStateZip input required.",
                                "Invalid input data", MessageBoxButtons.OK);
                return;
            }

            if (updateServiceCredentials)
            {
                SetServiceCredentials(txtUserName.Text, txtPassword.Text);
            }

            EZGeoSaaS.AddressLocation addressLocation = null;
            EZGeoSaaS.InputAddress    inputAddress    = GetInputAddress();

            try
            {
                addressLocation = ezgeoServiceClient.GeocodeAddress(inputAddress);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Service Request Failed", MessageBoxButtons.OK);
                ClearFaultedState();
            }

            if (addressLocation != null)
            {
                DisplayGeocodeResult(addressLocation);
            }
            else
            {
                txtScore.Text          = "0.0";
                txtGeocodedStreet.Text = "Address not found";
            }

            Cursor.Current = restoreCursor;
        }
예제 #2
0
        private EZGeoSaaS.InputAddress GetInputAddress()
        {
            var inputAddress = new EZGeoSaaS.InputAddress();

            inputAddress.StreetAddress = this.txtStreet.Text;
            inputAddress.CityStateZip  = this.txtCityStateZip.Text;
            inputAddress.CassCertify   = chkCassCertify.Checked;
            inputAddress.MinimumScore  = 0.7;
            inputAddress.Offset        = 3.0;
            if (chkSpecialTaxDistrict.Checked)
            {
                inputAddress.Options = 24;
            }
            else
            {
                inputAddress.Options = 8;
            }

            return(inputAddress);
        }