//private void cbDiffBilling_CheckedChanged(object sender, EventArgs e) //{ // if (cbDiffBilling.Checked) // { // grbBilling.Enabled = true; // txtStreetAddress.Text =""; // txtCity.Text =""; // txtZipcode.Text =""; // cbState.Enabled = true; // } // else // { // txtStreetAddress.Text = GlobalVar.CurrentDealer.StreetAddress; // txtCity.Text = GlobalVar.CurrentDealer.City; // txtZipcode.Text = GlobalVar.CurrentDealer.ZipCode; // int zipcode = 0; // Int32.TryParse(GlobalVar.CurrentDealer.ZipCode, out zipcode); // ZipCodeCity findResult = ZipCodeHelper.LookUpZipCode(zipcode); // if (!String.IsNullOrEmpty(findResult.City)) // { // txtCity.Text = findResult.City; // cbState.SelectedIndex = _allStatesList.ToList().FindIndex(x => x.State == findResult.State); // } // grbBilling.Enabled = false; // } //} private void CreditCardAuthorizeForm_Load(object sender, EventArgs e) { cbExpireMonths.DataSource = QuickBookHelper.GetExpirationMonths(); cbExpireYear.DataSource = QuickBookHelper.GetExpirationYears(); cbPackages.DataSource = QuickBookHelper.GetAllPackages(); _allStatesList = ZipCodeHelper.GetAllStates(); cbState.DataSource = _allStatesList; txtNameOnCard.Text = GlobalVar.CurrentAccount.FirstName + " " + GlobalVar.CurrentAccount.LastName; txtStreetAddress.Text = GlobalVar.CurrentDealer.StreetAddress; txtCity.Text = GlobalVar.CurrentDealer.City; txtZipcode.Text = GlobalVar.CurrentDealer.ZipCode; int zipcode = 0; Int32.TryParse(GlobalVar.CurrentDealer.ZipCode, out zipcode); ZipCodeCity findResult = ZipCodeHelper.LookUpZipCode(zipcode); if (!String.IsNullOrEmpty(findResult.City)) { txtCity.Text = findResult.City; cbState.SelectedIndex = _allStatesList.ToList().FindIndex(x => x.State == findResult.State); } }
private void txtZipcode_Leave_1(object sender, EventArgs e) { if (!String.IsNullOrEmpty(txtZipcode.Text)) { int zipcode = 0; Int32.TryParse(txtZipcode.Text, out zipcode); ZipCodeCity findResult = ZipCodeHelper.LookUpZipCode(zipcode); if (!String.IsNullOrEmpty(findResult.City)) { txtCity.Text = findResult.City; cbState.SelectedIndex = _allStatesList.ToList().FindIndex(x => x.State == findResult.State); cbState.Enabled = false; } } }