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>
    /// This method is to pull the data from filter and populate the ListView. The reason for Page_PreRender is to guarantee that all page controls are loaded and ready for rendering to avoid error with the list view paging.
    /// </summary>
    /// <param name="sender">Contains a reference to the control/object that raised the event.</param>
    /// <param name="e">Contains the event data.</param>
    protected void Page_PreRender(object sender, EventArgs e)
    {
        SubmittedSurveyController  sysmgr = new SubmittedSurveyController();
        List <SubmittedSurveyPOCO> submittedSurveyData = sysmgr.GetSubmittedSurveyList(filter.siteID, filter.startingDate, filter.endDate, filter.mealID, filter.unitID); // get the list of submitted surveys with the filter data

        SubmittedSurveyListView.DataSource = submittedSurveyData;                                                                                                         // set the ListView with the filterd submitted survey list data
        SubmittedSurveyListView.DataBind();                                                                                                                               // rebind the ListView
    }
Beispiel #3
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;";
    }
    /// <summary>
    /// This method is used to resolve an individual submitted survey that has a unresolved contact request attached to it.
    /// </summary>
    /// <param name="sender">Contains a reference to the control/object that raised the event.</param>
    /// <param name="e">Contains the event data.</param>
    protected void ResolveButton_Click(object sender, EventArgs e)
    {
        string ssn = Request.QueryString["sid"]; // get the survey ID from the URL query string

        MessageUserControl.TryRun(() =>
        {
            int surveyID = Convert.ToInt32(ssn);
            SubmittedSurveyController ssc = new SubmittedSurveyController();
            ssc.ContactSurvey(surveyID);                                  // send the survey ID to the ContactSurvey method on the SubmittedSurveyController
            ContactResolve.Visible = false;                               // remove the resolve button after it's been clicked
            Response.Redirect(Request.RawUrl);                            // reload the page to see the new contact information populated
        }, "Success", "The survey's contact request has been resolved."); // display a success message if the submitted survey was resolved correctly
    }
Beispiel #5
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 #6
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;";
                }
            }
        }
    }
Beispiel #7
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        int    surveyVersionId   = Convert.ToInt32(Session["survey_version_id"]);
        int    unitId            = int.Parse(Session["Unit"].ToString());
        int    mealId            = int.Parse(Session["MealType"].ToString());
        int    participantTypeId = int.Parse(Session["ParticipantType"].ToString());
        int    ageRangeId;
        int    genderId;
        bool   customerProfileCheckBox = CustomerProfileCheckBox.Checked;
        bool   contactRequest          = ContactRequestsCheckBox.Checked;
        string contactRoomNumber       = "";
        string contactPhoneNumber      = "";
        string q1AResponse             = Session["Q1A"].ToString();
        string q1BResponse             = Session["Q1B"].ToString();
        string q1CResponse             = Session["Q1C"].ToString();
        string q1DResponse             = Session["Q1D"].ToString();
        string q1EResponse             = Session["Q1E"].ToString();
        string q2Response = Session["Q2"].ToString();
        string q3Response = Session["Q3"].ToString();
        string q4Response = Session["Q4"].ToString();

        //If Q5 is null or empty return as an empty string
        string q5Response = String.IsNullOrEmpty(Session["Q5"].ToString()) ? "" : Session["Q5"].ToString();

        if (!customerProfileCheckBox)
        {
            ageRangeId = 1; // This defaults to the "Prefer not to answer"
            genderId   = 1; // This defaults to the "Prefer not to answer"
        }
        else
        {
            ageRangeId = int.Parse(AgeDDL.SelectedItem.Value);    // TODO - use the stored Session value
            genderId   = int.Parse(GenderDDL.SelectedItem.Value); // TODO - use the stored Session value
        }

        //Regex validation for phone number
        Regex validNum = new Regex("^\\(?([0-9]{3})\\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$"); //check to see that the phone number is 10 digits.

        //Regex validation for room number
        Regex validRoomNum = new Regex("^([0-9a-zA-Z]){0,10}$"); //check to see that room number is no more than ten characters.

        //If checkbox is not checked display N/A and submit survey
        if (!contactRequest)
        {
            contactRoomNumber  = "N/A";
            contactPhoneNumber = "N/A";

            SubmittedSurveyController sysmgr = new SubmittedSurveyController();
            sysmgr.SubmitSurvey(surveyVersionId, unitId, mealId, participantTypeId, ageRangeId, genderId, contactRequest, contactRoomNumber, contactPhoneNumber, q1AResponse, q1BResponse, q1CResponse, q1DResponse, q1EResponse, q2Response, q3Response, q4Response, q5Response);

            Response.Redirect("~/Thankyou");
        }

        // else proceed with validations on contact fields.
        else
        {
            //initialize the variables in both fields
            contactPhoneNumber = PhoneTextBox.Text;
            contactRoomNumber  = RoomTextBox.Text;

            //if phone number text field is blank, set it to N/A
            if (PhoneTextBox.Text == "")
            {
                contactPhoneNumber = "N/A";
            }
            //else if the field is not valid display an error message and set contact phone number to blank
            else if (!validNum.IsMatch(PhoneTextBox.Text)) //check for only numbers and no letters
            {
                PhoneNumber.Visible = true;
                contactPhoneNumber  = "";
            }
            //else toggle the error message to false
            else
            {
                PhoneNumber.Visible = false;
            }

            //if room number text field is blank, set it to N/A
            if (RoomTextBox.Text == "")
            {
                contactRoomNumber = "N/A";
            }
            //else if the field is not valid display an error message and set contact room number to blank
            else if (!validRoomNum.IsMatch(RoomTextBox.Text))
            {
                RoomNumber.Visible = true;
                contactRoomNumber  = "";
            }
            //else toggle the error message to false
            else
            {
                RoomNumber.Visible = false;
            }

            //if both fields are valid submit the survey
            if (contactRoomNumber != "" && contactPhoneNumber != "")
            {
                PhoneNumber.Visible = false;
                RoomNumber.Visible  = false;

                SubmittedSurveyController sysmgr = new SubmittedSurveyController();
                sysmgr.SubmitSurvey(surveyVersionId, unitId, mealId, participantTypeId, ageRangeId, genderId, contactRequest, contactRoomNumber, contactPhoneNumber, q1AResponse, q1BResponse, q1CResponse, q1DResponse, q1EResponse, q2Response, q3Response, q4Response, q5Response);

                Response.Redirect("~/Thankyou");
            }
        }
    }
    /// <summary>
    /// When the page loads first the page checks if the admin has proper authentication to access this page, and is redirected to login if not.
    /// Following that, the query string for the surveyID (sid) is obtained to populate the page with the appropriate submitted survey details.
    /// </summary>
    /// <param name="sender">Contains a reference to the control/object that raised the event.</param>
    /// <param name="e">Contains the event data.</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["securityID"] == null) // Redirect admin to login if not logged in
        {
            Response.Redirect("~/Admin/Login.aspx");
        }
        else if (!IsPostBack)
        {
            string ssn         = Request.QueryString["sid"]; // retreive the surveyID through a query string request passed from the submitted survey list page
            int    subSurveyID = Convert.ToInt32(ssn);

            SubmittedSurveyController ssc = new SubmittedSurveyController();
            // if the query string is null, the survey id is not a number or is not a valid number (too big or references a non-existant submitted survey),
            // then the admin is taken back to the view survey filter page
            if (ssn == null || !ssc.ValidSurvey(subSurveyID))
            {
                Response.Redirect("ViewSurveyFilter.aspx");
            }
            else // else, the submitted survey details are shown on the page
            {
                if (ssc.RequestsContact(subSurveyID))  // the "Resolve" button will be shown if the admin wishes to be contacted and the issue has not been resolved yet
                {
                    ContactResolve.Visible = true;
                }
                else // else, the "Resolve" button will not be shown
                {
                    ContactResolve.Visible = false;
                }

                // this is to populated the survey details on the first part of the page
                SubmittedSurveyPOCO subSurveyDetailsList = ssc.GetSubmittedSurvey(subSurveyID);
                SiteNameLabel.Text           = subSurveyDetailsList.site.ToString();
                UnitNumberLabel.Text         = subSurveyDetailsList.unitNumber.ToString();
                MealNameLabel.Text           = subSurveyDetailsList.mealName.ToString();
                ParticipantTypeLabel.Text    = subSurveyDetailsList.participantType.ToString();
                AgeRangeLabel.Text           = subSurveyDetailsList.ageRange.ToString();
                GenderLabel.Text             = subSurveyDetailsList.gender.ToString();
                DateEnteredLabel.Text        = subSurveyDetailsList.dateEntered.ToString();
                ContactRequestLabel.Text     = (subSurveyDetailsList.contactRequest == false) ? "No" : "Yes";
                ContactStatusLabel.Text      = (subSurveyDetailsList.contacted == false) ? "Not resolved" : "Resolved";
                ContactRoomNumberLabel.Text  = subSurveyDetailsList.contactRoomNumber.ToString();
                ContactPhoneNumberLabel.Text = subSurveyDetailsList.contactPhoneNumber.ToString();

                if (ContactRequestLabel.Text == "No") // if the contact request was false on this survey, don't display the empty contact details
                {
                    ContactStatLabel.Visible        = false;
                    ContactStatusLabel.Visible      = false;
                    ContactRoomLabel.Visible        = false;
                    ContactRoomNumberLabel.Visible  = false;
                    ContactPhoneLabel.Visible       = false;
                    ContactPhoneNumberLabel.Visible = false;
                }

                // this is to populated the survey questions and answers on the second part of the page
                List <ParticipantResponsePOCO> subSuveyAnswerList = ssc.GetSubmittedSurveyAnswers(subSurveyID).ToList();
                Response1aLabel.Text = subSuveyAnswerList[0].response.ToString();
                Response1bLabel.Text = subSuveyAnswerList[1].response.ToString();
                Response1cLabel.Text = subSuveyAnswerList[2].response.ToString();
                Response1dLabel.Text = subSuveyAnswerList[3].response.ToString();
                Response1eLabel.Text = subSuveyAnswerList[4].response.ToString();
                Response2Label.Text  = subSuveyAnswerList[5].response.ToString();
                Response3Label.Text  = subSuveyAnswerList[6].response.ToString();
                Response4Label.Text  = subSuveyAnswerList[7].response.ToString();
                Response5Label.Text  = subSuveyAnswerList[8].response.ToString();
                Question1aLabel.Text = "a. " + subSuveyAnswerList[0].question.ToString() + ":";
                Question1bLabel.Text = "b. " + subSuveyAnswerList[1].question.ToString() + ":";
                Question1cLabel.Text = "c. " + subSuveyAnswerList[2].question.ToString() + ":";
                Question1dLabel.Text = "d. " + subSuveyAnswerList[3].question.ToString() + ":";
                Question1eLabel.Text = "e. " + subSuveyAnswerList[4].question.ToString() + ":";
                Question2Label.Text  = "2. " + subSuveyAnswerList[5].question.ToString();
                Question3Label.Text  = "3. " + subSuveyAnswerList[6].question.ToString();
                Question4Label.Text  = "4. " + subSuveyAnswerList[7].question.ToString();
                Question5Label.Text  = "5. " + subSuveyAnswerList[8].question.ToString();
            }
        }
    }