Example #1
0
    /// <summary>
    /// event
    /// US:838
    /// load the options list box based on the radio option selected
    /// </summary>
    /// <param name="bClearSearch"></param>
    /// <returns></returns>
    public CStatus LoadOptionsListBox(bool bClearSearch)
    {
        CStatus status = new CStatus();

        if (!String.IsNullOrEmpty(rblOptions.SelectedValue))
        {
            //hide clinic appt controls to start with
            ShowClinicApptControls(false);

            if (bClearSearch)
            {
                txtSearchOptions.Text = string.Empty;
            }
            //clear current options
            lbOptions.Items.Clear();

            //set enabled to start with
            lbOptions.Enabled        = true;
            txtSearchOptions.Enabled = true;
            btnSearchOptions.Enabled = true;

            string strValue = rblOptions.SelectedValue;
            if (strValue == OPTION_NONE)
            {
                //0=none
                lbOptions.Items.Clear();
                lbOptions.Enabled        = false;
                txtSearchOptions.Enabled = false;
                btnSearchOptions.Enabled = false;
            }
            else if (strValue == OPTION_TEAMS)
            {
                //get the dataset from our db
                DataSet   dsTeams = null;
                CTeamData td      = new CTeamData(BaseMstr.BaseData);
                status = td.GetTeamDS(out dsTeams);

                CListBox lb = new CListBox();
                lb.RenderDataSet(
                    dsTeams,
                    lbOptions,
                    "All",
                    "TEAM_LABEL",
                    "TEAM_ID");
            }
            else if (strValue == OPTION_SPECIALTIES)
            {
                //get the dataset from our db
                DataSet        dsSpecialties = null;
                CSpecialtyData sd            = new CSpecialtyData(BaseMstr.BaseData);
                status = sd.GetSpecialtyDS(out dsSpecialties);

                CListBox lb = new CListBox();
                lb.RenderDataSet(
                    dsSpecialties,
                    lbOptions,
                    "All",
                    "SPECIALTY_LABEL",
                    "SPECIALTY_ID");
            }
            else if (strValue == OPTION_CLINICS)
            {
                //show clinic appt controls
                ShowClinicApptControls(true);

                //get the dataset from our db
                DataSet     dsClinics = null;
                CClinicData cd        = new CClinicData(BaseMstr.BaseData);
                status = cd.GetClinicDS(out dsClinics);

                CListBox lb = new CListBox();
                lb.RenderDataSet(
                    dsClinics,
                    lbOptions,
                    "All",
                    "CLINIC_LABEL",
                    "CLINIC_ID");
            }
            else if (strValue == OPTION_WARDS)
            {
                //get the dataset from our db
                DataSet   dsWards = null;
                CWardData wd      = new CWardData(BaseMstr.BaseData);
                status = wd.GetWardDS(out dsWards);

                CListBox lb = new CListBox();
                lb.RenderDataSet(
                    dsWards,
                    lbOptions,
                    "All",
                    "WARD_LABEL",
                    "WARD_ID");
            }

            string strScript = string.Format("document.getElementById('{0}_{1}').focus();", rblOptions.ClientID, rblOptions.SelectedIndex);

            if (ScriptManager.GetCurrent(Page) != null && ScriptManager.GetCurrent(Page).IsInAsyncPostBack)
            {
                ScriptManager.RegisterStartupScript(rblOptions, typeof(RadioButtonList), rblOptions.ClientID, strScript, true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(typeof(RadioButtonList), rblOptions.ClientID, strScript, true);
            }
        }

        return(status);
    }