Пример #1
0
        protected void CountryDropDownList_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                HRSCustomersBLL customerBLLObject = new HRSCustomersBLL();
                var             states            = customerBLLObject.GetState(Convert.ToInt32(CountryDropDownList.SelectedItem.Value));
                StateDropDownList.DataSource     = states;
                StateDropDownList.DataTextField  = "Value";
                StateDropDownList.DataValueField = "Key";
                StateDropDownList.DataBind();
                StateDropDownList.Focus();

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$(function () {");
                sb.Append(" $('#Register').modal('show');});");
                sb.Append("</script>");
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ModelScript", sb.ToString(), false);
                StateDropDownList.Focus();
            }
            catch (Exception ex)
            {
                Utility.ExceptionUtility.ExceptionLog(ex);
                throw;
            }
        }
    protected void CountryDropDownList_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList countryDropDownList = (DropDownList)sender;

        try
        {
            ServiceAccess serviceLoader = ServiceAccess.GetInstance();

            StateDropDownList.Items.Clear();
            int countryId = Convert.ToInt32(countryDropDownList.SelectedValue);

            if (countryId == 0)
            {
                StateDropDownList.Items.Add(new ListItem("&lt;Select a State&gt;", "0"));
            }
            else
            {
                CommonService.CommonService     commonService = serviceLoader.GetCommon();
                IList <CommonService.StateInfo> states        = commonService.GetStates(countryId);

                StateDropDownList.DataSource     = states;
                StateDropDownList.DataValueField = "StateId";
                StateDropDownList.DataTextField  = "Name";
                StateDropDownList.DataBind();
            }
        }
        catch (Exception ex)
        {
            log.Error("UNKNOWN ERROR:", ex);
        }
    }
Пример #3
0
        private void InitializeForCountyAdmin()
        {
            DialogCredentialMessage.InnerHtml = "Your sign-in credentials allow only " +
                                                Counties.GetFullName(_SecureAdminPage.StateCode,
                                                                     _SecureAdminPage.CountyCode) + " local districts to be selected.";

            StateName.InnerHtml = States.GetName(_SecureAdminPage.StateCode);
            StateDropDownList.AddCssClasses("hidden");
            StateRadioButton.AddCssClasses("invisible");
            CountyName.InnerHtml = Counties.GetName(_SecureAdminPage.StateCode,
                                                    _SecureAdminPage.CountyCode);
            CountyDropDownList.AddCssClasses("hidden");
            LocalName.AddCssClasses("hidden");

            switch (_SecureAdminPage.AdminPageLevel)
            {
            case AdminPageLevel.County:
                CountyRadioButton.Checked = true;
                PopulateLocalDropDown(true);
                break;

            case AdminPageLevel.Local:
                LocalRadioButton.Checked = true;
                PopulateLocalDropDown();
                break;
            }
        }
Пример #4
0
        private void PopulateStateDropDown(bool includeSelectMessage = false)
        {
            if (includeSelectMessage)
            {
                StateCache.Populate(StateDropDownList, "<select a state>", Empty);
            }
            else
            {
                StateCache.Populate(StateDropDownList, _SecureAdminPage.StateCode);
            }

            var nonStateCodesAllowed = _SecureAdminPage.NonStateCodesAllowed;

            if (nonStateCodesAllowed == null)
            {
                return;
            }
            if (!SecurePage.IsSuperUser)
            {
                var nonStateCodesRequireSuperUser = _SecureAdminPage.NonStateCodesRequireSuperUser;
                if (nonStateCodesRequireSuperUser != null)
                {
                    nonStateCodesAllowed =
                        nonStateCodesAllowed.Where(
                            s => !nonStateCodesRequireSuperUser.Contains(s));
                }
            }
            foreach (var nonState in nonStateCodesAllowed)
            {
                StateDropDownList.AddItem(GetNonStateCodeName(nonState), nonState,
                                          nonState == _SecureAdminPage.StateCode);
            }
        }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int.TryParse(Request.QueryString["id"], out CarrierID);
            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["GHMConnectionString"].ConnectionString))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand("spGetCarrierAddress", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@id", CarrierID);
                SqlDataReader rdr = cmd.ExecuteReader();
                rdr.Read();
                rdr.Close();
                conn.Close();
            }
            string getstates = "SELECT * from State";

            using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["GHMConnectionString"].ConnectionString))
            {
                SqlCommand cmd = new SqlCommand(getstates, conn);
                conn.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                StateDropDownList.DataSource     = rdr;
                StateDropDownList.DataTextField  = "Name";
                StateDropDownList.DataValueField = "Id";
                StateDropDownList.DataBind();
                rdr.Close();
                conn.Close();
            }
        }
Пример #6
0
        private void InitializeForStateAdmin()
        {
            DialogCredentialMessage.InnerHtml = "Your sign-in credentials allow any " +
                                                States.GetName(_SecureAdminPage.StateCode) +
                                                " jurisdiction to be selected.";

            StateName.InnerHtml = States.GetName(_SecureAdminPage.StateCode);
            StateDropDownList.AddCssClasses("hidden");
            CountyName.AddCssClasses("hidden");

            switch (_SecureAdminPage.AdminPageLevel)
            {
            case AdminPageLevel.State:
                StateRadioButton.Checked  = true;
                LocalRadioButton.Disabled = true;
                PopulateCountyDropDown(true);
                LocalDropDownList.AddCssClasses("hidden");
                break;

            case AdminPageLevel.County:
                CountyRadioButton.Checked = true;
                PopulateCountyDropDown();
                PopulateLocalDropDown(true);
                LocalName.AddCssClasses("hidden");
                break;

            case AdminPageLevel.Local:
                LocalRadioButton.Checked = true;
                PopulateCountyDropDown();
                PopulateLocalDropDown();
                LocalName.AddCssClasses("hidden");
                break;
            }
        }
Пример #7
0
        protected void AddressDropDownList_SelectedIndexChanged(object sender, EventArgs e)
        {
            int i = Int32.Parse(AddressDropDownList.SelectedValue.ToString());

            if (i == 0)
            {
                DescriptionTextBox.Text           = "";
                Address1TextBox.Text              = "";
                Address2TextBox.Text              = "";
                Address3TextBox.Text              = "";
                CityTextBox.Text                  = "";
                ZipTextBox.Text                   = "";
                CountryDropDownList.SelectedValue = "1";
                StateDropDownList.SelectedValue   = "1";
            }
            else
            {
                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["GHMConnectionString"].ConnectionString))
                {
                    SqlCommand cmd = new SqlCommand("spGetAddressDetails", conn);

                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.AddWithValue("@id", i);

                    conn.Open();
                    SqlDataReader rdr = cmd.ExecuteReader();

                    rdr.Read();
                    DescriptionTextBox.Text           = rdr["AddressDescription"].ToString();
                    Address1TextBox.Text              = rdr["AddressLine1"].ToString();
                    Address2TextBox.Text              = rdr["AddressLine2"].ToString();
                    Address3TextBox.Text              = rdr["AddressLine3"].ToString();
                    CityTextBox.Text                  = rdr["City"].ToString();
                    ZipTextBox.Text                   = rdr["Zip"].ToString();
                    CountryDropDownList.SelectedValue = rdr["CountryID"].ToString();
                    if (CountryDropDownList.SelectedValue == "2")
                    {
                        StateLabel.Text = "Province:";
                        string getprovinces = "SELECT * from Province";
                        using (SqlConnection conn2 = new SqlConnection(ConfigurationManager.ConnectionStrings["GHMConnectionString"].ConnectionString))
                        {
                            SqlCommand cmd2 = new SqlCommand(getprovinces, conn2);
                            conn2.Open();
                            SqlDataReader rdr2 = cmd2.ExecuteReader();
                            StateDropDownList.DataSource     = rdr2;
                            StateDropDownList.DataTextField  = "Name";
                            StateDropDownList.DataValueField = "Id";
                            StateDropDownList.DataBind();
                            rdr2.Close();
                            conn2.Close();
                        }
                    }
                    StateDropDownList.SelectedValue = rdr["StateID"].ToString();

                    rdr.Close();
                    conn.Close();
                }
            }
        }
Пример #8
0
        protected void CancelButton_Click(object sender, EventArgs e)
        {
            /*BranchNameDropDownList.SelectedValue = "";
            *  BranchHeadDropDownList.SelectedValue = "";
            *  MaleRadioButton.Checked = false;
            *  FemaleRadioButton.Checked = false;
            *  OtherRadioButton.Checked = false;
            *  StateDropDownList.SelectedValue = "";
            *  CityDropDownList.SelectedValue = "";
            *  BranchAddressTextBox.Text = "";
            *  DateofBranchRegistrationTextBox.Text = "";
            *  BranchCodeDropDownList.SelectedValue = "";*/


            BranchNameDropDownList.ClearSelection();
            BranchHeadDropDownList.ClearSelection();
            MaleRadioButton.Checked   = false;
            FemaleRadioButton.Checked = false;
            OtherRadioButton.Checked  = false;
            StateDropDownList.ClearSelection();
            CityDropDownList.ClearSelection();
            BranchAddressTextBox.Text            = " ";
            DateofBranchRegistrationTextBox.Text = "";
            BranchCodeDropDownList.ClearSelection();
        }
Пример #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     StateDropDownList.ListDataSource = () =>
     {
         DataTable statesTable = DatabaseHelper.Retrieve(GetStatesQuery);
         StateDropDownList.SetTextAndValueFields("Abbreviation", "Id");
         return(statesTable);
     };
 }
Пример #10
0
        protected void ResetButton_Click(object sender, EventArgs e)
        {
            NameTextBox.Text = " ";
            CellTextBox.Text = " ";

            StateDropDownList.ClearSelection();
            AgeUpdown.Text       = " ";
            MaleButton.Checked   = false;
            FemaleButton.Checked = false;
            MailTextBox.Text     = " ";
        }
Пример #11
0
 protected void CountryDropDownList_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         HRSCustomersBLL customerBLLObject = new HRSCustomersBLL();
         var             states            = customerBLLObject.GetState(Convert.ToInt32(CountryDropDownList.SelectedItem.Value));
         StateDropDownList.DataSource     = states;
         StateDropDownList.DataTextField  = "Value";
         StateDropDownList.DataValueField = "Key";
         StateDropDownList.DataBind();
         StateDropDownList.Focus();
     }
     catch (Exception ex)
     {
         Utility.ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }
Пример #12
0
 protected void CountryDropDownList_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (CountryDropDownList.SelectedValue == "1")
     {
         StateLabel.Text = "State:";
         string getstates = "SELECT * from State";
         using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["GHMConnectionString"].ConnectionString))
         {
             SqlCommand cmd = new SqlCommand(getstates, conn);
             conn.Open();
             SqlDataReader rdr = cmd.ExecuteReader();
             StateDropDownList.DataSource     = rdr;
             StateDropDownList.DataTextField  = "Name";
             StateDropDownList.DataValueField = "Id";
             StateDropDownList.DataBind();
             rdr.Close();
             conn.Close();
         }
         return;
     }
     if (CountryDropDownList.SelectedValue == "2")
     {
         StateLabel.Text = "Province:";
         string getprovinces = "SELECT * from Province";
         using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["GHMConnectionString"].ConnectionString))
         {
             SqlCommand cmd = new SqlCommand(getprovinces, conn);
             conn.Open();
             SqlDataReader rdr = cmd.ExecuteReader();
             StateDropDownList.DataSource     = rdr;
             StateDropDownList.DataTextField  = "Name";
             StateDropDownList.DataValueField = "Id";
             StateDropDownList.DataBind();
             rdr.Close();
             conn.Close();
         }
         return;
     }
 }
Пример #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string constring = ConfigurationManager.ConnectionStrings["RKCS"].ConnectionString;

            using (SqlConnection con = new SqlConnection(constring))
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("Select count(*) from Volunteers", con);
                count           = Convert.ToInt32(cmd.ExecuteScalar());
                CountLabel.Text = count.ToString();
                if (!IsPostBack)
                {
                    SqlDataAdapter    da    = new SqlDataAdapter("Select * from State", con);
                    SqlCommandBuilder build = new SqlCommandBuilder(da);
                    DataSet           ds    = new DataSet();
                    da.Fill(ds, "State");
                    StateDropDownList.DataSource     = ds;
                    StateDropDownList.DataTextField  = "StateName";
                    StateDropDownList.DataValueField = "StateId";
                    StateDropDownList.DataBind();
                }
            }
        }
Пример #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!User.IsInRole("Librarian"))
            {
                Response.Redirect(SitePages.GetUrl(LibraryPage.NotAuthorized));
            }
            if (!IsPostBack)
            {
                // Bind libraries list
                LibraryDropDownList.ListDataSource = () => {
                    DataTable librariesTable = DatabaseHelper.Retrieve(GetLibrariesQuery);
                    LibraryDropDownList.SetTextAndValueFields("Name", "Id");
                    return(librariesTable);
                };

                // Bind states list
                StateDropDownList.ListDataSource = () =>
                {
                    DataTable statesTable = DatabaseHelper.Retrieve(GetStatesQuery);
                    StateDropDownList.SetTextAndValueFields("Abbreviation", "Id");
                    return(statesTable);
                };
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //load option for Gender
                try
                {
                    using (SqlConnection connection = GetConnection())
                    {
                        SqlCommand    command = new SqlCommand("Select * from options where qid = 1", connection);
                        SqlDataReader reader  = command.ExecuteReader();
                        GenderDropdownList.DataSource     = reader;
                        GenderDropdownList.DataTextField  = "description";
                        GenderDropdownList.DataValueField = "oid";
                        GenderDropdownList.DataBind();
                        GenderDropdownList.Items.Insert(0, new ListItem("Please select", "Default value"));
                    }
                }
                catch (SqlException ex)
                {
                    Console.WriteLine("Error: " + ex);
                }

                //load option for State
                try
                {
                    using (SqlConnection connection = GetConnection())
                    {
                        SqlCommand    command = new SqlCommand("Select * from options where qid = 3", connection);
                        SqlDataReader reader  = command.ExecuteReader();

                        StateDropDownList.DataSource     = reader;
                        StateDropDownList.DataTextField  = "description";
                        StateDropDownList.DataValueField = "oid";
                        StateDropDownList.DataBind();
                        StateDropDownList.Items.Insert(0, new ListItem("Please select", "Default value"));
                    }
                }
                catch (SqlException ex)
                {
                    Console.WriteLine("Error: " + ex);
                }

                //load option for Bank
                try
                {
                    using (SqlConnection connection = GetConnection())
                    {
                        SqlCommand    command = new SqlCommand("Select * from options where qid = 7", connection);
                        SqlDataReader reader  = command.ExecuteReader();
                        BankDropdownList.DataSource     = reader;
                        BankDropdownList.DataTextField  = "description";
                        BankDropdownList.DataValueField = "oid";
                        BankDropdownList.DataBind();
                        BankDropdownList.Items.Insert(0, new ListItem("Please select", "Default value"));
                    }
                }
                catch (SqlException ex)
                {
                    Console.WriteLine("Error: " + ex);
                }

                //load option for Service
                try
                {
                    using (SqlConnection connection = GetConnection())
                    {
                        SqlCommand    command = new SqlCommand("Select * from options where qid = 13", connection);
                        SqlDataReader reader  = command.ExecuteReader();

                        ServiceDropdownList.DataSource     = reader;
                        ServiceDropdownList.DataTextField  = "description";
                        ServiceDropdownList.DataValueField = "oid";
                        ServiceDropdownList.DataBind();
                        ServiceDropdownList.Items.Insert(0, new ListItem("Please select", "Default value"));
                    }
                }
                catch (SqlException ex)
                {
                    Console.WriteLine("Error: " + ex);
                }
            }
        }