private void OnConsigneeZipChanged(object sender, EventArgs e) { //Event handler for change in consignee zip text this.Cursor = Cursors.WaitCursor; try { //Validate zip entry if (this.txtConsigneeZip.Text.Trim().Length == 5) { //Validate this is a servicable location string zip = this.txtConsigneeZip.Text; ServiceLocation location = FreightGateway.ReadServiceLocation(zip); if (location == null) { this.txtConsigneeZip.Text = ""; this.txtConsigneeZip.Focus(); MessageBox.Show(zip + " is currently not supported for delivery.", App.Product, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { this.lblZone.Text = location.ZoneCode.Trim(); } showQuote(null); } } catch (Exception ex) { App.ReportError(ex, false, LogLevel.Warning); } finally { OnValidateForm(null, EventArgs.Empty); this.Cursor = Cursors.Default; } }
private void OnZipChanged(object sender, EventArgs e) { //Validate consignee zip as deliverable (new consignees only) try { string zipCode = this.txtZip5.Text; if (this.mConsignee.Number == 0 && zipCode.Trim().Length == 5) { ServiceLocation location = FreightGateway.ReadServiceLocation(zipCode); if (location == null) { this.txtCity.Text = this.txtState.Text = this.txtZip5.Text = ""; this.txtZip5.Focus(); MessageBox.Show(zipCode + " is currently not supported for delivery.", App.Product, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { this.txtCity.Text = location.City.Trim(); this.txtState.Text = location.State.Trim(); this.txtName.Focus(); } } } catch (Exception ex) { App.ReportError(ex, true, LogLevel.Information); } finally { OnAddressChanged(null, EventArgs.Empty); } }