Beispiel #1
0
    /// <summary>
    /// This method is used when the Administrator changes the selected index on the dropdown list
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void HospitalDDL_SelectedIndexChanged(object sender, EventArgs e)
    {
        // Update the contact request count
        SubmittedSurveyController ssc = new SubmittedSurveyController();
        string value        = HospitalDDL.SelectedValue;
        int    siteID       = Convert.ToInt32(value);
        int    contactCount = ssc.GetContactRequestTotal(siteID);

        // Change styling to grab the Administrator's attention if the contact count is greater than zero (0)
        if (contactCount > 0)
        {
            ViewButton.Visible                        = true;
            PendingRequestNumberLabel.Text            = "&nbsp;" + contactCount.ToString() + " &nbsp;";
            PendingRequestNumberLabel.Font.Bold       = true;
            PendingRequestNumberLabel.ForeColor       = System.Drawing.ColorTranslator.FromHtml("#223f88");
            PendingContactSection.Attributes["style"] = " background-color: #a6ebf7";
        }
        // Hide the View button and clear the highlight styling
        else
        {
            PendingContactSection.Attributes["style"] = null;
            PendingRequestNumberLabel.Text            = "&nbsp; 0 &nbsp;";
            ViewButton.Visible = false;
        }

        // Update the survey word of the day on the new selected site
        SurveyWordController surveyWordManager = new SurveyWordController();

        WOTDLabel.Text = surveyWordManager.GetSurveyWord(siteID);
    }
Beispiel #2
0
    /// <summary>
    /// updates the page when a new site is selected
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void SiteDDL_SelectedIndexChanged(object sender, EventArgs e)
    {
        SubmittedSurveyController ssc = new SubmittedSurveyController();
        string value = SiteDDL.SelectedValue;

        //PendingRequestNumberLabel.Text = value;
        int siteID       = Convert.ToInt32(value);
        int contactCount = ssc.GetContactRequestTotal(siteID);

        ContactCountLabel.Text = "&nbsp;" + contactCount.ToString() + " &nbsp;";
    }
Beispiel #3
0
    /// <summary>
    /// When the page loads first the page checks if the user is logged in, and is redirected to the login page if not.
    /// Then the method checks if the user has has proper authentication (Master Administrator role) to access this page.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["securityID"] == null) // Redirect Administrator to login if not logged in
        {
            Response.Redirect("~/Admin/Login.aspx");
        }
        else
        {
            if ((int)Session["securityID"] != 2)    // If not a Master Administrator
            {
                GenereteWordButton.Visible = false; // Hide the button to generate a survey word
            }
            if (!IsPostBack)
            {
                SubmittedSurveyController ssc = new SubmittedSurveyController();
                HospitalDDL.DataBind();
                string value = HospitalDDL.SelectedValue;
                if (value != null)
                {
                    // Assign variables to be used
                    int siteID       = Convert.ToInt32(value);
                    int contactCount = ssc.GetContactRequestTotal(siteID);

                    // Get the survey word of the day for the selected site
                    SurveyWordController surveyWordManager = new SurveyWordController();
                    WOTDLabel.Text = surveyWordManager.GetSurveyWord(siteID);

                    // Change styling to grab the Administrator's attention if the contact count is greater than zero (0)
                    if (contactCount > 0)
                    {
                        PendingRequestNumberLabel.Text            = "&nbsp;" + contactCount.ToString() + " &nbsp;";
                        PendingRequestNumberLabel.Font.Bold       = true;
                        PendingRequestNumberLabel.ForeColor       = System.Drawing.ColorTranslator.FromHtml("#223f88");
                        PendingContactSection.Attributes["style"] = " background-color: #a6ebf7";
                    }
                    // Hide the View button and clear the highlight styling
                    else
                    {
                        PendingRequestNumberLabel.Text = "&nbsp; 0 &nbsp;";
                        ViewButton.Visible             = false;
                    }
                }
            }
        }
        // Display a welcome message with the Administrator's username
        WelcomeMessage.Text = "Welcome, " + Session["username"].ToString();
    }
Beispiel #4
0
    /// <summary>
    /// when the page loads, the page checks the user's session's credentials to ensure that they are allowed to access the page.
    /// If the user does, if it is the first time loading the page, the site id is pulled and checked.
    /// It then uses the site id with the method GetContactRequestTotal() to determine the number of  requests for the site,
    /// and sets the ContactCountLabel's text to this number.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        //message.Text = HttpContext.Current.Request.RawUrl.StartsWith("/Pages/AdministratorPages").ToString();


        if (Session["securityID"] == null) // Redirect user to login if not logged in
        {
            Response.Redirect("~/Admin/Login.aspx");
        }
        else if ((int)Session["securityID"] != 1 && (int)Session["securityID"] != 2) // Return HTTP Code 403
        {
            Context.Response.StatusCode = 403;
        }
        else
        {
            if (!Page.IsPostBack)
            {
                //Updated April 8. Bad ID handling.
                //retrieve the site id passed from the main screen
                SubmittedSurveyController ssc = new SubmittedSurveyController();
                SiteDDL.DataBind();
                string broughtSite = Request.QueryString["sid"];

                //add check to ensure the passed siteid is a vaild site id

                //set the selection to the given site id
                SiteDDL.SelectedValue = broughtSite;

                string value = SiteDDL.SelectedValue;
                bool   good;
                int    siteID;
                good = Int32.TryParse(value, out siteID);
                //update label to display the desired value
                if (value != null && good)
                {
                    //PendingRequestNumberLabel.Text = value;

                    int contactCount = ssc.GetContactRequestTotal(siteID);
                    ContactCountLabel.Text = "&nbsp;" + contactCount.ToString() + " &nbsp;";
                }
            }
        }
    }