Ejemplo n.º 1
0
        public void Countries_SelectedIndexChanged(object sender, EventArgs e)
        {
            BLClient client = null;
            List <LocationNameValue> states     = null;
            List <LocationNameValue> townCities = null;

            try
            {
                client = new BLClient();

                states = Helper.AddToFrontOfDropDown <LocationNameValue>(client.GetChildGeoTTNodes(int.Parse(((DropDownList)sender).SelectedValue)), new LocationNameValue("Please select one ¬", -1, true));

                if (HasChildren(states))
                {
                    townCities = Helper.AddToFrontOfDropDown <LocationNameValue>(new List <LocationNameValue>(), new LocationNameValue("Please select one ¬", -1, false));
                }
                else
                {
                    townCities = states;
                    states     = null;
                }
            }
            finally
            {
                if (client != null)
                {
                    client.Dispose();
                }
            }

            if (states != null)
            {
                StatePanel.Visible      = true;
                ddlState.DataSource     = states;
                ddlState.DataTextField  = "Name";
                ddlState.DataValueField = "Value";
                ddlState.DataBind();
            }
            else
            {
                StatePanel.Visible = false;
            }

            ddlTownCities.DataSource     = townCities;
            ddlTownCities.DataTextField  = "Name";
            ddlTownCities.DataValueField = "Value";
            ddlTownCities.DataBind();
        }
Ejemplo n.º 2
0
        public void States_SelectedIndexChanged(object sender, EventArgs e)
        {
            BLClient client = null;
            List <LocationNameValue> townCities = null;

            try
            {
                client = new BLClient();

                townCities = Helper.AddToFrontOfDropDown <LocationNameValue>(client.GetChildGeoTTNodes(int.Parse(((DropDownList)sender).SelectedValue)), new LocationNameValue("Please select one ¬", -1, true));
            }
            finally
            {
                if (client != null)
                {
                    client.Dispose();
                }
            }

            ddlTownCities.DataSource     = townCities;
            ddlTownCities.DataTextField  = "Name";
            ddlTownCities.DataValueField = "Value";
            ddlTownCities.DataBind();
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["User"] == null)
            {
                Response.Redirect("Home.aspx");
            }

            BLClient client = null;
            List <LocationNameValue>           countries              = null;
            List <LocationNameValue>           states                 = null;
            List <LocationNameValue>           townCities             = null;
            List <KeyValuePair <int, string> > occupationSectors      = null;
            List <KeyValuePair <int, string> > employmentLevels       = null;
            List <KeyValuePair <int, string> > annualHouseholdIncomes = null;

            UserDetails userDetails = null;

            if (!IsPostBack)
            {
                try
                {
                    client = new BLClient();

                    userDetails = client.GetUserDetails(((User)Session["User"]).UserID);

                    // geographical dropdowns
                    countries = Helper.AddToFrontOfDropDown <LocationNameValue>(client.GetCountries(), new LocationNameValue("Please select one ¬", -1, true));
                    states    = Helper.AddToFrontOfDropDown <LocationNameValue>(client.GetChildGeoTTNodes(userDetails.CountryID), new LocationNameValue("Please select one ¬", -1, true));

                    if (HasChildren(states))
                    {
                        townCities = Helper.AddToFrontOfDropDown <LocationNameValue>(client.GetChildGeoTTNodes(userDetails.StateID), new LocationNameValue("Please select one ¬", -1, false));
                    }
                    else
                    {
                        townCities = states;
                        states     = null;
                    }

                    // Socio-economic status dropdowns
                    occupationSectors      = Helper.AddToFrontOfDropDown <KeyValuePair <int, string> >(client.GetSocioEconomicStatuses("O"), new KeyValuePair <int, string>(-1, "Please Select One ¬"));
                    employmentLevels       = Helper.AddToFrontOfDropDown <KeyValuePair <int, string> >(client.GetSocioEconomicStatuses("L"), new KeyValuePair <int, string>(-1, "Please Select One ¬"));
                    annualHouseholdIncomes = Helper.AddToFrontOfDropDown <KeyValuePair <int, string> >(client.GetSocioEconomicStatuses("I"), new KeyValuePair <int, string>(-1, "Please Select One ¬"));
                }
                finally
                {
                    if (client != null)
                    {
                        client.Dispose();
                    }
                }

                ddlCountry.DataSource     = countries;
                ddlCountry.DataTextField  = "Name";
                ddlCountry.DataValueField = "Value";
                ddlCountry.DataBind();

                if (states != null)
                {
                    StatePanel.Visible      = true;
                    ddlState.DataSource     = states;
                    ddlState.DataTextField  = "Name";
                    ddlState.DataValueField = "Value";
                    ddlState.DataBind();
                }
                else
                {
                    StatePanel.Visible = false;
                }

                ddlTownCities.DataSource     = townCities;
                ddlTownCities.DataTextField  = "Name";
                ddlTownCities.DataValueField = "Value";
                ddlTownCities.DataBind();

                ddlSector.DataSource     = occupationSectors;
                ddlSector.DataTextField  = "Value";
                ddlSector.DataValueField = "Key";
                ddlSector.DataBind();

                ddlLevel.DataSource     = employmentLevels;
                ddlLevel.DataTextField  = "Value";
                ddlLevel.DataValueField = "Key";
                ddlLevel.DataBind();

                ddlIncome.DataSource     = annualHouseholdIncomes;
                ddlIncome.DataTextField  = "Value";
                ddlIncome.DataValueField = "Key";
                ddlIncome.DataBind();

                PopulateDOBDropDowns();

                // populate user settings
                txtEmail.Text               = userDetails.EmailAddress;
                txtFirstName.Text           = userDetails.FirstName;
                txtLastName.Text            = userDetails.LastName;
                rbGenderMale.Checked        = userDetails.Gender == "male";
                rbGenderFemale.Checked      = userDetails.Gender == "female";
                dobDay.SelectedValue        = userDetails.Dob.Day.ToString();
                dobMonth.SelectedValue      = userDetails.Dob.Month.ToString();
                dobYear.SelectedValue       = userDetails.Dob.Year.ToString();
                ddlCountry.SelectedValue    = userDetails.CountryID.ToString();
                ddlState.SelectedValue      = userDetails.StateID.ToString();
                ddlTownCities.SelectedValue = userDetails.TownCityID.ToString();
                ddlSector.SelectedValue     = userDetails.OccupationSectorID.ToString();
                ddlLevel.SelectedValue      = userDetails.EmploymentLevelID.ToString();
                ddlIncome.SelectedValue     = userDetails.AnnualHouseholdIncomeID.ToString();
            }
        }