private void OnFormLoad(object sender, System.EventArgs e) { //Initialize controls - set default values this.Cursor = Cursors.WaitCursor; try { //Load early this.Visible = true; Application.DoEvents(); //Get selection lists this.mCountriesDS.Merge(EnterpriseFactory.GetCountries()); this.mStatesDS.Merge(EnterpriseFactory.GetStates()); //Set control services this.txtNumber.MaxLength = 8; this.txtNumber.Text = this.mCarriersDS.CarrierDetailTable[0].Number; this.txtNumber.Enabled = (this.mCarrierID == 0); this.txtName.MaxLength = 30; if (!this.mCarriersDS.CarrierDetailTable[0].IsCarrierNameNull()) { this.txtName.Text = this.mCarriersDS.CarrierDetailTable[0].CarrierName; } this.txtLine1.MaxLength = 40; this.txtLine1.Text = this.mCarriersDS.CarrierDetailTable[0].AddressLine1; this.txtLine2.MaxLength = 40; if (!this.mCarriersDS.CarrierDetailTable[0].IsAddressLine2Null()) { this.txtLine2.Text = this.mCarriersDS.CarrierDetailTable[0].AddressLine2; } this.txtCity.MaxLength = 40; //if(!this.mCarriersDS.CarrierDetailTable[0].IsCityNull()) this.txtCity.Text = this.mCarriersDS.CarrierDetailTable[0].City; if (!this.mCarriersDS.CarrierDetailTable[0].IsStateOrProvinceNull()) { this.cboStates.SelectedValue = this.mCarriersDS.CarrierDetailTable[0].StateOrProvince; } else if (this.cboStates.Items.Count > 0) { this.cboStates.SelectedIndex = 0; } this.cboStates.Enabled = (this.cboStates.Items.Count > 0); this.txtZip.MaxLength = 15; if (!this.mCarriersDS.CarrierDetailTable[0].IsPostalCodeNull()) { this.txtZip.Text = this.mCarriersDS.CarrierDetailTable[0].PostalCode; } if (this.mCarriersDS.CarrierDetailTable[0].CountryID > 0) { this.cboCountries.SelectedValue = this.mCarriersDS.CarrierDetailTable[0].CountryID; } else if (this.cboCountries.Items.Count > 0) { this.cboCountries.SelectedIndex = 0; } this.cboCountries.Enabled = (this.cboCountries.Items.Count > 0); this.txtContact.MaxLength = 30; if (!this.mCarriersDS.CarrierDetailTable[0].IsContactNameNull()) { this.txtContact.Text = this.mCarriersDS.CarrierDetailTable[0].ContactName; } this.mskPhone.InputMask = "###-###-####"; if (!this.mCarriersDS.CarrierDetailTable[0].IsPhoneNull()) { this.mskPhone.Value = this.mCarriersDS.CarrierDetailTable[0].Phone; } this.txtExt.MaxLength = 4; if (!this.mCarriersDS.CarrierDetailTable[0].IsExtensionNull()) { this.txtExt.Text = this.mCarriersDS.CarrierDetailTable[0].Extension; } this.mskFax.InputMask = "###-###-####"; if (!this.mCarriersDS.CarrierDetailTable[0].IsFaxNull()) { this.mskFax.Value = this.mCarriersDS.CarrierDetailTable[0].Fax; } this.txteMail.MaxLength = 50; if (!this.mCarriersDS.CarrierDetailTable[0].IsEmailNull()) { this.txteMail.Text = this.mCarriersDS.CarrierDetailTable[0].Email; } this.chkCtlDrivers.Checked = this.mCarriersDS.CarrierDetailTable[0].ControlDrivers; this.chkCtlTrailers.Checked = this.mCarriersDS.CarrierDetailTable[0].ControlTrailers; this.chkStatus.Checked = this.mCarriersDS.CarrierDetailTable[0].IsActive; } catch (Exception ex) { reportError(ex); } finally { this.btnOk.Enabled = false; this.Cursor = Cursors.Default; } }
private void OnFormLoad(object sender, System.EventArgs e) { //Initialize controls - set default values this.Cursor = Cursors.WaitCursor; try { //Show early this.Visible = true; Application.DoEvents(); //Get selection lists this.mTypesDS.Merge(EnterpriseFactory.GetAddressTypes()); this.mCountriesDS.Merge(EnterpriseFactory.GetCountries()); this.mStatesDS.Merge(EnterpriseFactory.GetStates()); //Load details if (this.mAddressDS.AddressViewTable[0].AddressType != "") { this.cboTypes.SelectedValue = this.mAddressDS.AddressViewTable[0].AddressType; } else if (this.cboTypes.Items.Count > 0) { this.cboTypes.SelectedIndex = 0; } this.cboTypes.Enabled = false; this.txtLine1.MaxLength = 40; this.txtLine1.Text = this.mAddressDS.AddressViewTable[0].AddressLine1; this.txtLine2.MaxLength = 40; this.txtLine2.Text = ""; if (!this.mAddressDS.AddressViewTable[0].IsAddressLine2Null()) { this.txtLine2.Text = this.mAddressDS.AddressViewTable[0].AddressLine2; } this.txtCity.MaxLength = 40; this.txtCity.Text = this.mAddressDS.AddressViewTable[0].City; if (!this.mAddressDS.AddressViewTable[0].IsStateOrProvinceNull()) { this.cboStates.SelectedValue = this.mAddressDS.AddressViewTable[0].StateOrProvince; } else if (this.cboStates.Items.Count > 0) { this.cboStates.SelectedIndex = 0; } this.cboStates.Enabled = (this.cboStates.Items.Count > 0); this.txtZip.MaxLength = 15; this.txtZip.Text = ""; if (!this.mAddressDS.AddressViewTable[0].IsPostalCodeNull()) { this.txtZip.Text = this.mAddressDS.AddressViewTable[0].PostalCode; } if (!this.mAddressDS.AddressViewTable[0].IsCountryIDNull()) { this.cboCountries.SelectedValue = this.mAddressDS.AddressViewTable[0].CountryID; } else if (this.cboCountries.Items.Count > 0) { this.cboCountries.SelectedIndex = 0; } this.cboCountries.Enabled = (this.cboCountries.Items.Count > 0); this.chkStatus.Checked = this.mAddressDS.AddressViewTable[0].IsActive; } catch (Exception ex) { reportError(ex); } finally { this.btnOk.Enabled = false; this.Cursor = Cursors.Default; } }