Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CareSiteAccessController csaController = new CareSiteAccessController();
        CareSiteController       csController  = new CareSiteController();

        //string codeWord = Request.QueryString["accessCode"];

        //try
        //{
        //    var careSiteId = csaController.GetCareSiteID(codeWord);
        //    string careSiteName = csController.GetCareSiteName(careSiteId);

        //    SiteNameLabel.Text = careSiteName;
        //}
        //catch (Exception ex)
        //{
        //    Server.Transfer("index.aspx?errorMSG=That code is not active, please check your meal or tray ticket", true);
        //}

        //TODO: Populate the Units DDL from the database
    }
Ejemplo n.º 2
0
    /*
     * CREATED:      H. L'Heureux         MAR 16 2018
     * MODIFIED:     H. Conant            MAR 29 2018
     *  - Added !IsPostBack check
     *  - Removed get respondent types
     * MODIFIED:     H. L'Heureux            APR 12 2018
     *  - Added error handling
     *
     * Page_Load()
     * This method contains information to show the initial set up of the take survey page to the user. It will show the Care Site Name with a valid access code word for the day, or it will redirect the user back to the landing page (index.aspx) with an error message to inform the user to check their meal/chit ticket.
     *
     * PARAMETERS:
     * object sender - object on the page that is being targeted
     * EventArgs e - event that has triggered the method
     *
     * RETURNS:
     * void
     *
     * ODEV METHOD CALLS:
     * CareSiteController.GetCareSiteID()
     * CareSiteController.GetCareSitename()
     * UnitController.GetActiveCareSiteUnits()
     */
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Cache.SetNoStore();
        Response.Cache.AppendCacheExtension("no-cache");
        Response.Expires = 0;

        if (!IsPostBack) // added this to stop information from disapearing if there was an error
        {
            FirstNameLbl.Visible   = false;
            FirstName.Visible      = false;
            RoomNumber.Visible     = false;
            RoomNumberLbl.Visible  = false;
            BedNumber.Visible      = false;
            BedNumberLbl.Visible   = false;
            PhoneNumberLbl.Visible = false;
            PhoneNumber.Visible    = false;
        }
        CareSiteAccessController csaController = new CareSiteAccessController();
        CareSiteController       csController  = new CareSiteController();

        string codeword     = Request.QueryString["accesscode"];
        string caresitename = "";

        try
        {
            //get the care site ID from the database for the codeword given by the user
            var caresiteid = csaController.GetCareSiteID(codeword);
            //get the care site name for the care site ID
            caresitename = csController.GetCareSiteName(caresiteid);

            // check if new caresite
            if (SiteNameLabel.Text != caresitename)
            {
                //display the caresite name in the label for the user to see
                SiteNameLabel.Text = caresitename;

                UnitListDDL.Items.Clear();
                UnitListDDL.Items.Insert(0, new ListItem("Please select your unit", "-1"));

                //populate the unit list for the user to choose their unit
                List <UnitDTO> tempUnitList = unitCont.GetActiveCareSiteUnits(caresiteid);
                UnitListDDL.DataSource = tempUnitList;
                UnitListDDL.DataBind();
            }
        }
        catch (Exception ex)
        {
            //redirect to the index page with an appropriate error message
            if (codeword == "")
            {
                Response.Redirect("index.aspx?errormsg=You must enter the access code on your meal or tray ticket");
            }
            else if (caresitename == "" || string.IsNullOrWhiteSpace(caresitename))
            {
                Response.Redirect("index.aspx?errormsg=That code is not active, please check your meal or tray ticket. If problem persists this care site may be no longer supplying survey service.");
            }
            else
            {
                ErrorMSG.Text = "Login not available. If error persists, please contact covenant health. Error Message: " + ex.Message;
            }
        }
    }