Example #1
0
        /// <summary>
        /// Getting all dropdown info from database, like city, state, country.
        /// </summary>
        private void GetDropDownInfo()
        {
            var countryRepository = IoC.Resolve <ICountryRepository>();
            var countries         = countryRepository.GetAll();

            ddlCountry.DataSource     = countries;
            ddlCountry.DataTextField  = DDL_TEXT_NAME;
            ddlCountry.DataValueField = DDL_VALUE_ID;
            ddlCountry.DataBind();

            _ddlRace.Items.Clear();
            var races = Race.Other.GetNameValuePairs();

            _ddlRace.DataSource     = races;
            _ddlRace.DataTextField  = "SecondValue";
            _ddlRace.DataValueField = "FirstValue";
            _ddlRace.DataBind();

            var marketingSourceService = IoC.Resolve <IMarketingSourceService>();
            var marketingSources       = marketingSourceService.FetchMarketingSourceByZip(ZipCode);

            MarketingSourceDropDown.DataSource = marketingSources;
            MarketingSourceDropDown.DataBind();
            MarketingSourceDropDown.Items.Insert(0, new ListItem("", ""));
        }
        private void BindDropDownControls()
        {
            var countryRepository = IoC.Resolve <ICountryRepository>();
            var countries         = countryRepository.GetAll();

            ddlCountry.DataSource     = countries;
            ddlCountry.DataTextField  = "Name";
            ddlCountry.DataValueField = "Id";
            ddlCountry.DataBind();
            ddlCountry.Items[0].Selected = true;
            //ddlCountry.Items.Insert(0, new ListItem("Select Country", "0"));

            var races = Race.None.GetNameValuePairs();

            ddlrace.Items.Clear();
            ddlrace.DataSource     = races;
            ddlrace.DataTextField  = "SecondValue";
            ddlrace.DataValueField = "FirstValue";
            ddlrace.DataBind();

            MarketingSourceDropDown.Items.Clear();
            var marketingSourceService = IoC.Resolve <IMarketingSourceService>();
            var marketingSources       = marketingSourceService.FetchMarketingSourceByZip(ZipCode);

            MarketingSourceDropDown.DataSource = marketingSources;
            MarketingSourceDropDown.DataBind();
            MarketingSourceDropDown.Items.Insert(0, new ListItem("", ""));

            BestTimeToCallDropdown.Items.Clear();
            var bestTimeToCallTypes = BestTimeToCall.Morning.GetNameValuePairs();

            BestTimeToCallDropdown.DataSource     = bestTimeToCallTypes;
            BestTimeToCallDropdown.DataTextField  = "SecondValue";
            BestTimeToCallDropdown.DataValueField = "FirstValue";
            BestTimeToCallDropdown.DataBind();
            BestTimeToCallDropdown.Items.Insert(0, (new ListItem("--Select--", "0")));

            PreferredLanguageDropDown.Items.Clear();
            var languageRepository = IoC.Resolve <ILanguageRepository>();
            var languages          = languageRepository.GetAll().OrderBy(x => x.Name);

            PreferredLanguageDropDown.DataSource     = languages;
            PreferredLanguageDropDown.DataTextField  = "Name";
            PreferredLanguageDropDown.DataValueField = "Id";
            PreferredLanguageDropDown.DataBind();
            PreferredLanguageDropDown.Items.Insert(0, (new ListItem("--Select--", "0")));
            PreferredLanguageDropDown.Items[0].Selected = true;

            ddlPreferredContactType.Items.Clear();
            var lookupReporsitory     = IoC.Resolve <ILookupRepository>();
            var preferredContactTypes = lookupReporsitory.GetByLookupId((long)PreferredContactType.Email);

            ddlPreferredContactType.DataSource     = preferredContactTypes.OrderBy(x => x.DisplayName);
            ddlPreferredContactType.DataTextField  = "DisplayName";
            ddlPreferredContactType.DataValueField = "Id";
            ddlPreferredContactType.DataBind();

            ddlPreferredContactType.Items.Insert(0, new ListItem("--Select--", "0"));

            ddlPatientConsentPrimary.Items.Clear();
            var consentDropDown = DropDownHelper.GetPatientPhoneConsent();

            ddlPatientConsentPrimary.DataSource     = consentDropDown;
            ddlPatientConsentPrimary.DataTextField  = "Text";
            ddlPatientConsentPrimary.DataValueField = "Value";
            ddlPatientConsentPrimary.DataBind();

            ddlPatientConsentOffice.Items.Clear();
            ddlPatientConsentOffice.DataSource     = consentDropDown;
            ddlPatientConsentOffice.DataTextField  = "Text";
            ddlPatientConsentOffice.DataValueField = "Value";
            ddlPatientConsentOffice.DataBind();

            ddlPatientConsentCell.Items.Clear();
            ddlPatientConsentCell.DataSource     = consentDropDown;
            ddlPatientConsentCell.DataTextField  = "Text";
            ddlPatientConsentCell.DataValueField = "Value";
            ddlPatientConsentCell.DataBind();
        }