Exemple #1
0
        protected void EntityAddressState_OnSelectedIndexChanged(Object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs eventArgs)
        {
            if (MercuryApplication == null)
            {
                return;
            }

            if (EntityAddressState.SelectedItem == null)
            {
                return;
            }

            if (EntityAddressState.SelectedValue == String.Empty)
            {
                InitializeState();
            }

            else
            {
                EntityAddressCity.Items.Clear();

                foreach (Mercury.Server.Application.CityStateZipCodeView currentCity in MercuryApplication.CityReferenceByState(EntityAddressState.SelectedValue, true))
                {
                    EntityAddressCity.Items.Add(new Telerik.Web.UI.RadComboBoxItem(currentCity.City, currentCity.City));
                } /* END FOREACH */

                EntityAddressCounty.Items.Clear();

                foreach (String currentCounty in MercuryApplication.CountyReferenceByState(EntityAddressState.SelectedValue))
                {
                    EntityAddressCounty.Items.Add(new Telerik.Web.UI.RadComboBoxItem(currentCounty, currentCounty));
                } /* END FOREACH */
            }

            return;
        }
Exemple #2
0
        protected virtual void EntityAddressZipCode_OnTextChanged(Object sender, EventArgs e)
        {
            if (MercuryApplication == null)
            {
                return;
            }

            if (EntityAddressZipCode.Text == null)
            {
                return;
            }

            if (EntityAddressZipCode.Text == String.Empty)
            {
                return;
            }

            if (EntityAddressZipCode.Text.Length < 5)
            {
                return;
            }

            String fiveDigitZipCode = EntityAddressZipCode.Text.Substring(0, 5);

            String stateFromZipCode = MercuryApplication.StateReferenceByZipCode(fiveDigitZipCode);

            if (!EntityAddressState.Items.Contains(new Telerik.Web.UI.RadComboBoxItem(stateFromZipCode, stateFromZipCode)))
            {
                InitializeState();
            }

            EntityAddressState.SelectedValue = stateFromZipCode;

            String countyFromZipCode = MercuryApplication.CountyReferenceByZipCode(fiveDigitZipCode);

            if (!EntityAddressCounty.Items.Contains(new Telerik.Web.UI.RadComboBoxItem(countyFromZipCode, countyFromZipCode)))
            {
                EntityAddressCounty.Items.Add(new Telerik.Web.UI.RadComboBoxItem(countyFromZipCode, countyFromZipCode));

                EntityAddressCounty.SelectedValue = countyFromZipCode;;
            }

            String cityFromZipCode = MercuryApplication.CityReferenceByZipCode(fiveDigitZipCode);

            if (!EntityAddressCity.Items.Contains(new Telerik.Web.UI.RadComboBoxItem(cityFromZipCode, cityFromZipCode)))
            {
                EntityAddressCity.Items.Clear();

                foreach (Mercury.Server.Application.CityStateZipCodeView currentCity  in MercuryApplication.CityReferenceByState(EntityAddressState.SelectedValue, true))
                {
                    EntityAddressCity.Items.Add(new Telerik.Web.UI.RadComboBoxItem(currentCity.City, currentCity.City));
                } /* END FOREACH */
            }

            EntityAddressCity.SelectedValue = cityFromZipCode;

            return;
        }