示例#1
0
    /* protected void RetrieveUnitListButton_Click(object sender, EventArgs e)
     * {
     *   if (CareSiteDDL.SelectedValue == "0")
     *   {
     *       UserMessage.Text = "Please select a care site";
     *   }
     *   else
     *   {
     *       int tempCareSiteId;
     *       int.TryParse(CareSiteDDL.SelectedValue, out tempCareSiteId);
     *       List<UnitDTO> tempUnitList = unitController.GetCareSiteUnits(tempCareSiteId);
     *       UnitDDL.DataSource = tempUnitList;
     *       UnitDDL.DataBind();
     *       UnitDDL.Items.Insert(0, new ListItem("Select...", "0"));
     *       UnitDDL.SelectedValue = "0";
     *
     *       // clear unit selections so user doesn't get confused and edit a unit in another care site
     *       AddUnitNameTB.Text = "";
     *       UpdateUnitNameTB.Text = "";
     *       DeactivateUnitNameLabel.Text = "";
     *   }
     * }*/

    /*
     * CREATED:     C. Stanhope		MAR 2 2018
     * MODIFIED:    A. Valberg		MAR 3 2018
     *  - Added method body code
     * MODIFIED:    H. Conant		MAR 5 2018
     *  - Updated method signature
     *  - Updated method body code
     *
     * RetrieveUnitList_Select()
     * This method retrieves the units of a care site specified by the user.
     *
     * PARAMETERS:
     * object sender - object on the page that is being targeted
     * EventArgs e - event that has triggered the method
     *
     * RETURNS:
     * void - Nothing is returned
     *
     * METHOD CALLS:
     * .Clear()
     * .Insert()
     * .TryParse()
     * .GetCareSiteUnits()
     * .DataBind()
     */
    protected void RetrieveUnitList_Select(object sender, EventArgs e)
    {
        if (CareSiteDDL.SelectedValue == "0")
        {
            UserMessage.Text = "Please select a care site";
            UnitDDL.Items.Clear();
            UnitDDL.Items.Insert(0, new ListItem("Select...", "0"));
            AddUnitNameTB.Text           = "";
            UpdateUnitNameTB.Text        = "";
            DeactivateUnitNameLabel.Text = "";
            UnitHiddenField.Value        = ""; // can delete
            HiddenCareSiteID.Value       = ""; // can delete
        }
        else
        {
            int tempCareSiteId;
            int.TryParse(CareSiteDDL.SelectedValue, out tempCareSiteId);
            List <UnitDTO> tempUnitList = unitController.GetCareSiteUnits(tempCareSiteId);
            UnitDDL.DataSource = tempUnitList;
            UnitDDL.DataBind();
            UnitDDL.Items.Insert(0, new ListItem("Select...", "0"));
            UnitDDL.SelectedValue = "0";

            // clear unit selections so user doesn't get confused and edit a unit in another care site
            AddUnitNameTB.Text           = "";
            UpdateUnitNameTB.Text        = "";
            DeactivateUnitNameLabel.Text = "";
        }
    }
示例#2
0
    /*
     * CREATED:     A. Valberg		MAR 3 2018
     * MODIFIED:    H. Conant		MAR 5 2018
     *  - Updated method signature
     *  - Updated method body code
     *
     * RetrieveUnitList_Select()
     * This method retrieves the units of a care site specified by the user.
     *
     * PARAMETERS:
     * object sender - object on the page that is being targeted
     * EventArgs e - event that has triggered the method
     *
     * RETURNS:
     * void
     *
     * ODEV METHOD CALLS:
     * UnitController.GetActiveCareSiteUnits()
     * MessageUserControl.ShowInfoMessage()
     * MessageUserControl.ShowErrorMessage()
     */
    protected void RetrieveUnitList_Select(object sender, EventArgs e)
    {
        if (CareSiteDDL.SelectedValue == "0")
        {
            MessageUserControl.ShowInfoMessage("Please select a care site.");
            UnitDDL.Items.Clear();
            UnitDDL.Items.Insert(0, new ListItem("Select...", "0"));
            AddUnitNameTB.Text           = "";
            UpdateUnitNameTB.Text        = "";
            DeactivateUnitNameLabel.Text = "";

            AddUnitRow.Visible          = false;
            ModifyUnitRow.Visible       = false;
            UpdateDeactivateRow.Visible = false;
        }
        else
        {
            try
            {
                int tempCareSiteId;
                int.TryParse(CareSiteDDL.SelectedValue, out tempCareSiteId);
                List <UnitDTO> tempUnitList = unitController.GetActiveCareSiteUnits(tempCareSiteId);
                UnitDDL.DataSource = tempUnitList;
                UnitDDL.DataBind();
                UnitDDL.Items.Insert(0, new ListItem("Select...", "0"));
                UnitDDL.SelectedValue = "0";

                // clear unit selections so user doesn't get confused and edit a unit in another care site
                AddUnitNameTB.Text           = "";
                UpdateUnitNameTB.Text        = "";
                DeactivateUnitNameLabel.Text = "";
                UpdateDeactivateRow.Visible  = false;
                AddUnitRow.Visible           = true;
                ModifyUnitRow.Visible        = true;
            }
            catch (Exception ex)
            {
                MessageUserControl.ShowErrorMessage("Retrieving units failed. Please try again. If error persists, please contact your administrator.", ex);
            }
        }
    }