private void OnZipChanged(object sender, EventArgs e) { //Validate consignee zip as deliverable (new shippers only) try { string zipCode = this.txtZip5.Text; if (this.mShipper.Number.Trim().Length == 0 && zipCode.Trim().Length == 5) { ServiceLocation location = FreightGateway.ReadPickupLocation(zipCode); if (location == null) { this.txtCity.Text = this.txtState.Text = this.txtZip5.Text = ""; this.txtZip5.Focus(); MessageBox.Show(zipCode + " is currently not supported for pickup.", 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); } }
private void OnShipperZipChanged(object sender, EventArgs e) { //Event handler for change in shipper zip text this.Cursor = Cursors.WaitCursor; try { //Validate zip entry if (this.txtShipperZip.Text.Trim().Length == 5) { //Validate this is a servicable location string zip = this.txtShipperZip.Text; ServiceLocation location = FreightGateway.ReadPickupLocation(zip); if (location == null) { this.txtShipperZip.Text = ""; this.txtShipperZip.Focus(); MessageBox.Show(zip + " is currently not supported for pickup.", App.Product, MessageBoxButtons.OK, MessageBoxIcon.Information); } showQuote(null); } } catch (Exception ex) { App.ReportError(ex, false, LogLevel.Warning); } finally { OnValidateForm(null, EventArgs.Empty); this.Cursor = Cursors.Default; } }