Example #1
0
    [WebMethod] // This attribute allows XML Web service created using ASP.NET to be the callable from remote Web Clients.
    public static string GetChartData(int chartId)
    {
        // Instantiate Report POCO, Chart POCO, Chart POCO List, Preferred Response Order List, Sorted Response Variable, and Report Controller variables
        FinalReportPOCO  report    = new FinalReportPOCO();
        List <ChartPOCO> responses = new List <ChartPOCO>();
        ChartPOCO        response  = null;
        // List of Preferred Response Order based on the Question Responses answers
        List <String> preferencesForOrderByFirstOption = new List <String> {
            "Very Good", "Good", "Fair", "Poor", "Don't Know/No Opinion", "No Response"
        };
        List <String> preferencesForOrderBySecondOption = new List <String> {
            "Portion sizes are too small", "Portion sizes are just right", "Portion sizes are too large", "No Response"
        };
        List <String> preferencesForOrderByThirdOption = new List <String> {
            "Always", "Usually", "Occasionally", "Never", "I do not have any specific dietary requirements", "No Response"
        };
        List <String> preferencesForOrderByFourthOption = new List <String> {
            "Very Good", "Good", "Fair", "Never", "Poor", "Very Poor"
        };
        IEnumerable <ChartPOCO> sortedResponses = null;
        ReportController        reportMgr       = new ReportController();
        // Get the Filter to be use as a parameter to get the data for report.
        FilterPOCO filter = (FilterPOCO)(HttpContext.Current.Session["filter"]);

        // Initialize report by calling GenerateOverAllReport method from Report Controller which return a FinalReportPOCO object.
        report = reportMgr.GenerateOverAllReport(filter.startingDate, filter.endDate, filter.siteID, filter.mealID);
        // Check if the the retrieve report has atleast 1 survey submitted.
        if (report.SubmittedSurveyList.Count > 0)
        {
            // Check to see if what ajax call is accessing the data and process the desired value to be retrieves.
            // Retrieves data for Chart1 for Question 1A.
            if (chartId == 1)
            {
                // Loop to the specific List from report POCO based on the chart.
                for (int counter = 0; counter < report.QuestionTwoValueCount.Count; counter++)
                {
                    //Instantiate new ChartPOCO
                    response = new ChartPOCO();
                    // Check and handle if the retrieve string is empty
                    if (report.QuestionTwoValueList[counter].Equals(""))
                    {
                        response.Text = "No Response";
                    }
                    else
                    {
                        response.Text = report.QuestionTwoValueList[counter];
                    }
                    // Set the Chart POCO attributes based on the current Object being looped in.
                    response.Value       = report.QuestionTwoValueCount[counter];
                    response.Title       = report.Question[0];
                    response.Color       = COLOR_VALUE[counter];
                    response.BorderColor = BORDER_COLOR_VALUE[counter];
                    // Add the ChartPOCO Object to the ChartPOCO List
                    responses.Add(response);
                    // Clear the ChartPOCO Object
                    response = null;
                }
                // Sort the responses based on the preferred option declared and assigned it to the sortedResponse variable of IEnumerable type.
                sortedResponses = responses.OrderBy(item => preferencesForOrderByFirstOption.IndexOf(item.Text));
            }
            // Check to see if what ajax call is accessing the data and process the desired value to be retrieves.
            // Retrieves data for Chart2 for Question 1B.
            else if (chartId == 2)
            {
                // Loop to the specific List from report POCO based on the chart.
                for (int counter = 0; counter < report.QuestionThreeValueCount.Count; counter++)
                {
                    //Instantiate new ChartPOCO
                    response = new ChartPOCO();
                    // Check and handle if the retrieve string is empty
                    if (report.QuestionThreeValueList[counter].Equals(""))
                    {
                        response.Text = "No Response";
                    }
                    else
                    {
                        response.Text = report.QuestionThreeValueList[counter];
                    }
                    // Set the Chart POCO attributes based on the current Object being looped in.
                    response.Value       = report.QuestionThreeValueCount[counter];
                    response.Title       = report.Question[1];
                    response.Color       = COLOR_VALUE[counter];
                    response.BorderColor = BORDER_COLOR_VALUE[counter];
                    // Add the ChartPOCO Object to the ChartPOCO List
                    responses.Add(response);
                    // Clear the ChartPOCO Object
                    response = null;
                }
                // Sort the responses based on the preferred option declared and assigned it to the sortedResponse variable of IEnumerable type.
                sortedResponses = responses.OrderBy(item => preferencesForOrderByFirstOption.IndexOf(item.Text));
            }
            // Check to see if what ajax call is accessing the data and process the desired value to be retrieves.
            // Retrieves data for Chart3 for Question 1C.
            else if (chartId == 3)
            {
                // Loop to the specific List from report POCO based on the chart.
                for (int counter = 0; counter < report.QuestionFourValueCount.Count; counter++)
                {
                    //Instantiate new ChartPOCO
                    response = new ChartPOCO();
                    // Check and handle if the retrieve string is empty
                    if (report.QuestionFourValueList[counter].Equals(""))
                    {
                        response.Text = "No Response";
                    }
                    else
                    {
                        response.Text = report.QuestionFourValueList[counter];
                    }
                    // Set the Chart POCO attributes based on the current Object being looped in.
                    response.Value       = report.QuestionFourValueCount[counter];
                    response.Title       = report.Question[2];
                    response.Color       = COLOR_VALUE[counter];
                    response.BorderColor = BORDER_COLOR_VALUE[counter];
                    // Add the ChartPOCO Object to the ChartPOCO List
                    responses.Add(response);
                    // Clear the ChartPOCO Object
                    response = null;
                }
                // Sort the responses based on the preferred option declared and assigned it to the sortedResponse variable of IEnumerable type.
                sortedResponses = responses.OrderBy(item => preferencesForOrderByFirstOption.IndexOf(item.Text));
            }
            // Check to see if what ajax call is accessing the data and process the desired value to be retrieves.
            // Retrieves data for Chart4 for Question 1D.
            else if (chartId == 4)
            {
                // Loop to the specific List from report POCO based on the chart.
                for (int counter = 0; counter < report.QuestionFiveValueCount.Count; counter++)
                {
                    //Instantiate new ChartPOCO
                    response = new ChartPOCO();
                    // Check and handle if the retrieve string is empty
                    if (report.QuestionFiveValueList[counter].Equals(""))
                    {
                        response.Text = "No Response";
                    }
                    else
                    {
                        response.Text = report.QuestionFiveValueList[counter];
                    }
                    // Set the Chart POCO attributes based on the current Object being looped in.
                    response.Value       = report.QuestionFiveValueCount[counter];
                    response.Title       = report.Question[3];
                    response.Color       = COLOR_VALUE[counter];
                    response.BorderColor = BORDER_COLOR_VALUE[counter];
                    // Add the ChartPOCO Object to the ChartPOCO List
                    responses.Add(response);
                    // Clear the ChartPOCO Object
                    response = null;
                }
                // Sort the responses based on the preferred option declared and assigned it to the sortedResponse variable of IEnumerable type.
                sortedResponses = responses.OrderBy(item => preferencesForOrderByFirstOption.IndexOf(item.Text));
            }
            // Check to see if what ajax call is accessing the data and process the desired value to be retrieves.
            // Retrieves data for Chart5 for Question 1E.
            else if (chartId == 5)
            {
                // Loop to the specific List from report POCO based on the chart.
                for (int counter = 0; counter < report.QuestionSixValueCount.Count; counter++)
                {
                    //Instantiate new ChartPOCO
                    response = new ChartPOCO();
                    // Check and handle if the retrieve string is empty
                    if (report.QuestionSixValueList[counter].Equals(""))
                    {
                        response.Text = "No Response";
                    }
                    else
                    {
                        response.Text = report.QuestionSixValueList[counter];
                    }
                    // Set the Chart POCO attributes based on the current Object being looped in.
                    response.Value       = report.QuestionSixValueCount[counter];
                    response.Title       = report.Question[4];
                    response.Color       = COLOR_VALUE[counter];
                    response.BorderColor = BORDER_COLOR_VALUE[counter];
                    // Add the ChartPOCO Object to the ChartPOCO List
                    responses.Add(response);
                    // Clear the ChartPOCO Object
                    response = null;
                }
                // Sort the responses based on the preferred option declared and assigned it to the sortedResponse variable of IEnumerable type.
                sortedResponses = responses.OrderBy(item => preferencesForOrderByFirstOption.IndexOf(item.Text));
            }
            // Check to see if what ajax call is accessing the data and process the desired value to be retrieves.
            // Retrieves data for Chart6 for Question 2.
            else if (chartId == 6)
            {
                // Loop to the specific List from report POCO based on the chart.
                for (int counter = 0; counter < report.QuestionEightValueCount.Count; counter++)
                {
                    //Instantiate new ChartPOCO
                    response = new ChartPOCO();
                    // Check and handle if the retrieve string is empty
                    if (report.QuestionEightValueList[counter].Equals(""))
                    {
                        response.Text = "No Response";
                    }
                    else
                    {
                        response.Text = report.QuestionEightValueList[counter];
                    }
                    // Set the Chart POCO attributes based on the current Object being looped in.
                    response.Value       = report.QuestionEightValueCount[counter];
                    response.Title       = report.Question[5];
                    response.Color       = COLOR_VALUE[counter];
                    response.BorderColor = BORDER_COLOR_VALUE[counter];
                    // Add the ChartPOCO Object to the ChartPOCO List
                    responses.Add(response);
                    // Clear the ChartPOCO Object
                    response = null;
                }
                // Sort the responses based on the preferred option declared and assigned it to the sortedResponse variable of IEnumerable type.
                sortedResponses = responses.OrderBy(item => preferencesForOrderBySecondOption.IndexOf(item.Text));
            }
            // Check to see if what ajax call is accessing the data and process the desired value to be retrieves.
            // Retrieves data for Chart7 for Question 3.
            else if (chartId == 7)
            {
                // Loop to the specific List from report POCO based on the chart.
                for (int counter = 0; counter < report.QuestionNineValueCount.Count; counter++)
                {
                    //Instantiate new ChartPOCO
                    response = new ChartPOCO();
                    // Check and handle if the retrieve string is empty
                    if (report.QuestionNineValueList[counter].Equals(""))
                    {
                        response.Text = "No Response";
                    }
                    else
                    {
                        response.Text = report.QuestionNineValueList[counter];
                    }
                    // Set the Chart POCO attributes based on the current Object being looped in.
                    response.Value       = report.QuestionNineValueCount[counter];
                    response.Title       = report.Question[6];
                    response.Color       = COLOR_VALUE[counter];
                    response.BorderColor = BORDER_COLOR_VALUE[counter];
                    // Add the ChartPOCO Object to the ChartPOCO List
                    responses.Add(response);
                    // Clear the ChartPOCO Object
                    response = null;
                }
                // Sort the responses based on the preferred option declared and assigned it to the sortedResponse variable of IEnumerable type.
                sortedResponses = responses.OrderBy(item => preferencesForOrderByThirdOption.IndexOf(item.Text));
            }
            // Check to see if what ajax call is accessing the data and process the desired value to be retrieves.
            // Retrieves data for Chart8 for Question 4.
            else if (chartId == 8)
            {
                // Loop to the specific List from report POCO based on the chart.
                for (int counter = 0; counter < report.QuestionTenValueCount.Count; counter++)
                {
                    //Instantiate new ChartPOCO
                    response = new ChartPOCO();
                    // Check and handle if the retrieve string is empty
                    if (report.QuestionTenValueList[counter].Equals(""))
                    {
                        response.Text = "No Response";
                    }
                    else
                    {
                        response.Text = report.QuestionTenValueList[counter];
                    }
                    // Set the Chart POCO attributes based on the current Object being looped in.
                    response.Value       = report.QuestionTenValueCount[counter];
                    response.Title       = report.Question[7];
                    response.Color       = COLOR_VALUE[counter];
                    response.BorderColor = BORDER_COLOR_VALUE[counter];
                    // Add the ChartPOCO Object to the ChartPOCO List
                    responses.Add(response);
                    // Clear the ChartPOCO Object
                    response = null;
                }
                // Sort the responses based on the preferred option declared and assigned it to the sortedResponse variable of IEnumerable type.
                sortedResponses = responses.OrderBy(item => preferencesForOrderByFourthOption.IndexOf(item.Text));
            }
        }
        // Convert sortedResponses variable of type IEnumerable to Serialze JSON Ojject using JsonConvert.SerializeObject method.
        // Return sortedResponses of type JSON Object
        return(JsonConvert.SerializeObject(sortedResponses));
    }
Example #2
0
 /// <summary>
 /// Default Web Page Method use to initialize pages and check if the user is logged in and if it passes the required filters for generating reports.
 /// </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)
 {
     // Set the visibility for Alert Message Label to hidden.
     Alert.Visible = false;
     // Check if the user is logged in. Redirect to Admin Login page if the user doesn't have a securityId
     if (Session["securityID"] == null)
     {
         Response.Redirect("~/Admin/Login.aspx");
     }
     else
     {
         // Initialize and set filter variable with the type of FilterPOCO and retrieve the Session state with an ID of "filter" that is passed from the ViewReportFilter page
         // to be use for the generating report.
         FilterPOCO filter = (FilterPOCO)(Session["filter"]);
         // Check if the filter has a value. Redirect the user to ViewReportFilter page if the the filter doesn't have any values.
         if (filter == null)
         {
             Response.Redirect("~/Admin/ViewReportFilter.aspx");
         }
         else
         {
             // Instantiate Report Controller, Meal Controller, Site Controller, Site Name, FinalReportPOCO and Meal variable.
             ReportController reportMgr = new ReportController();
             MealController   mealMgr   = new MealController();
             Meal             meal      = new Meal();
             FinalReportPOCO  report    = new FinalReportPOCO();
             SiteController   siteMgr   = new SiteController();
             string           siteName  = "";
             // Initialize report by calling GenerateOverAllReport method from Report Controller which return a FinalReportPOCO object.
             report = reportMgr.GenerateOverAllReport(filter.startingDate, filter.endDate, filter.siteID, filter.mealID);
             // Initialize Site Name variable by calling DisplaySiteName method from Site Controller which return a string.
             siteName = siteMgr.DisplaySiteName(filter.siteID);
             // Check if siteName is null, change the Site Name variable to "All sites".
             if (siteName == null)
             {
                 siteName = "All sites";
             }
             // Initialize Meal variable by calling GetMeal method from Meal Controller which return a Meal object.
             meal = mealMgr.GetMeal(filter.mealID);
             // Check if meal variable is null.
             if (meal == null)
             {
                 // If meal variable is null change the FilterDescription Label Text to the described markup.
                 FilterDescription.Text = "Report from " + siteName + " from " + filter.startingDate.ToString("MMMM-dd-yyyy") + " to " + filter.endDate.ToString("MMMM-dd-yyyy") +
                                          " with no meal filter.";
             }
             else
             {
                 // If meal variable is not null change the FilterDescription Label Text to the described markup.
                 FilterDescription.Text = "Report from " + siteName + " from " + filter.startingDate.ToString("MMMM-dd-yyyy") + " to " + filter.endDate.ToString("MMMM-dd-yyyy") +
                                          " with a meal filter of " + meal.meal_name + ".";
             }
             // Set the TotalNumberOfSubmittedSurvey Label Text to the described markup.
             TotalNumberOfSubmittedSurvey.Text = "Total number of submitted survey with the given criteria: " + report.SubmittedSurveyList.Count().ToString() + " surveys submitted.";
             // Check if the SubmittedSurveyList from report variable has atleast 1 survey.
             if (report.SubmittedSurveyList.Count < 1)
             {
                 // Hide TotalNumberOfSubmittedSurvey Label.
                 TotalNumberOfSubmittedSurvey.Visible = false;
                 // Display EmptyMessage Label.
                 EmptyMessage.Visible = true;
                 // Set EmptyMessage Label to "No Submitted Survey Found. Please check your filter".
                 EmptyMessage.Text = "No Submitted Survey Found. Please check your filter";
             }
         }
     }
 }
Example #3
0
        /// <summary>
        /// This method generate FinalReportPOCO use in chart
        /// </summary>
        /// <param name="startDate">Start date of report scope</param>
        /// <param name="endDate">End date of report scope</param>
        /// <param name="siteID">Site Id of the report scope</param>
        /// <param name="mealID">Meal Id of report scope</param>
        /// <returns></returns>
        public FinalReportPOCO GenerateOverAllReport(DateTime startDate, DateTime endDate, int siteID, int mealID)
        {
            // Start of Transaction
            using (var context = new FSOSSContext())
            {
                // Initialize variables
                List <ParticipantResponse> participantResponseList = new List <ParticipantResponse>();
                List <SubmittedSurvey>     submittedSurveyList     = new List <SubmittedSurvey>();
                // Check to see if the sideId being passes is zero, get all sites if the site id is set to zero
                // Check to see if the mealId being passes is zero, get all meal if the site id is set to zero
                if (siteID == 0 && mealID != 0)
                {
                    participantResponseList = (from x in context.ParticipantResponses
                                               where x.submittedsurvey.date_entered >= startDate &&
                                               x.submittedsurvey.date_entered <= endDate &&
                                               x.submittedsurvey.meal_id == mealID
                                               select x).ToList();
                    submittedSurveyList = (from x in context.SubmittedSurveys
                                           where x.date_entered >= startDate && x.date_entered <= endDate &&
                                           x.meal_id == mealID
                                           select x).ToList();
                }
                else if (siteID == 0 && mealID == 0)
                {
                    participantResponseList = (from x in context.ParticipantResponses
                                               where x.submittedsurvey.date_entered >= startDate &&
                                               x.submittedsurvey.date_entered <= endDate
                                               select x).ToList();
                    submittedSurveyList = (from x in context.SubmittedSurveys
                                           where x.date_entered >= startDate && x.date_entered <= endDate
                                           select x).ToList();
                }
                else if (mealID == 0 && siteID != 0)
                {
                    participantResponseList = (from x in context.ParticipantResponses
                                               where x.submittedsurvey.date_entered >= startDate &&
                                               x.submittedsurvey.date_entered <= endDate &&
                                               x.submittedsurvey.Unit.site_id == siteID
                                               select x).ToList();
                    submittedSurveyList = (from x in context.SubmittedSurveys
                                           where x.date_entered >= startDate && x.date_entered <= endDate &&
                                           x.Unit.site_id == siteID
                                           select x).ToList();
                }
                else
                {
                    participantResponseList = (from x in context.ParticipantResponses
                                               where x.submittedsurvey.date_entered >= startDate &&
                                               x.submittedsurvey.date_entered <= endDate &&
                                               x.submittedsurvey.Unit.site_id == siteID &&
                                               x.submittedsurvey.meal_id == mealID
                                               select x).ToList();
                    submittedSurveyList = (from x in context.SubmittedSurveys
                                           where x.date_entered >= startDate && x.date_entered <= endDate &&
                                           x.Unit.site_id == siteID &&
                                           x.meal_id == mealID
                                           select x).ToList();
                }
                // Get the list of question
                List <Question> questions = (from x in context.Questions
                                             select x).ToList();
                // Set a list of string to store questions
                List <string> Questions = new List <string>();
                // Loop through the loop and retrieve only questions with a response
                foreach (Question question in questions)
                {
                    if (question.questionselections.Count != 0)
                    {
                        Questions.Add(question.question_text);
                    }
                }


                // Initialize all variable required for saving the answer and count
                List <string> QuestionTwoValueList    = new List <string>();
                List <int>    QuestionTwoValueCount   = new List <int>();
                List <string> QuestionThreeValueList  = new List <string>();
                List <int>    QuestionThreeValueCount = new List <int>();
                List <string> QuestionFourValueList   = new List <string>();
                List <int>    QuestionFourValueCount  = new List <int>();
                List <string> QuestionFiveValueList   = new List <string>();
                List <int>    QuestionFiveValueCount  = new List <int>();
                List <string> QuestionSixValueList    = new List <string>();
                List <int>    QuestionSixValueCount   = new List <int>();
                List <string> QuestionEightValueList  = new List <string>();
                List <int>    QuestionEightValueCount = new List <int>();
                List <string> QuestionNineValueList   = new List <string>();
                List <int>    QuestionNineValueCount  = new List <int>();
                List <string> QuestionTenValueList    = new List <string>();
                List <int>    QuestionTenValueCount   = new List <int>();
                // initialize valueCounter use for counting the answers from the responses
                int valueCounter = 0;
                // initialize index use for getting the value from the list
                int index = 0;
                // Loop through all the responses from the participant response list
                foreach (ParticipantResponse responses in participantResponseList)
                {
                    // Check to see if the response being check is any of the question with answers
                    if (responses.question_id == 2)
                    {
                        // Check if the answer value contains any answer or the answer is not currently in the list.
                        // if there are no answer assign the answer and add a +1 on the list
                        if (QuestionTwoValueList.Count < 1 || !QuestionTwoValueList.Contains(responses.participant_answer))
                        {
                            QuestionTwoValueList.Add(responses.participant_answer);
                            valueCounter++;
                            QuestionTwoValueCount.Add(valueCounter);
                        }
                        // If there is an existing answer on the list
                        else
                        {
                            // Find the index of the existing value
                            index = QuestionTwoValueList.IndexOf(responses.participant_answer);
                            // Get the count associated with the existing value
                            valueCounter = QuestionTwoValueCount[index];
                            // Add a +1 to the value counter
                            valueCounter++;
                            // replace the old value from the list with the new value from the valueCounter
                            QuestionTwoValueCount[index] = valueCounter;
                        }
                        // set the value counter to zero
                        valueCounter = 0;
                    }
                    // Same steps with question_id 2
                    else if (responses.question_id == 3)
                    {
                        if (QuestionThreeValueList.Count < 1 || !QuestionThreeValueList.Contains(responses.participant_answer))
                        {
                            QuestionThreeValueList.Add(responses.participant_answer);
                            valueCounter++;
                            QuestionThreeValueCount.Add(valueCounter);
                        }
                        else
                        {
                            index        = QuestionThreeValueList.IndexOf(responses.participant_answer);
                            valueCounter = QuestionThreeValueCount[index];
                            valueCounter++;
                            QuestionThreeValueCount[index] = valueCounter;
                        }
                        valueCounter = 0;
                    }
                    // Same steps with question_id 2
                    else if (responses.question_id == 4)
                    {
                        if (QuestionFourValueList.Count < 1 || !QuestionFourValueList.Contains(responses.participant_answer))
                        {
                            QuestionFourValueList.Add(responses.participant_answer);
                            valueCounter++;
                            QuestionFourValueCount.Add(valueCounter);
                        }
                        else
                        {
                            index        = QuestionFourValueList.IndexOf(responses.participant_answer);
                            valueCounter = QuestionFourValueCount[index];
                            valueCounter++;
                            QuestionFourValueCount[index] = valueCounter;
                        }
                        valueCounter = 0;
                    }
                    // Same steps with question_id 2
                    else if (responses.question_id == 5)
                    {
                        if (QuestionFiveValueList.Count < 1 || !QuestionFiveValueList.Contains(responses.participant_answer))
                        {
                            QuestionFiveValueList.Add(responses.participant_answer);
                            valueCounter++;
                            QuestionFiveValueCount.Add(valueCounter);
                        }
                        else
                        {
                            index        = QuestionFiveValueList.IndexOf(responses.participant_answer);
                            valueCounter = QuestionFiveValueCount[index];
                            valueCounter++;
                            QuestionFiveValueCount[index] = valueCounter;
                        }
                        valueCounter = 0;
                    }
                    // Same steps with question_id 2
                    else if (responses.question_id == 6)
                    {
                        if (QuestionSixValueList.Count < 1 || !QuestionSixValueList.Contains(responses.participant_answer))
                        {
                            QuestionSixValueList.Add(responses.participant_answer);
                            valueCounter++;
                            QuestionSixValueCount.Add(valueCounter);
                        }
                        else
                        {
                            index        = QuestionSixValueList.IndexOf(responses.participant_answer);
                            valueCounter = QuestionSixValueCount[index];
                            valueCounter++;
                            QuestionSixValueCount[index] = valueCounter;
                        }
                        valueCounter = 0;
                    }
                    // Same steps with question_id 2
                    else if (responses.question_id == 8)
                    {
                        if (QuestionEightValueList.Count < 1 || !QuestionEightValueList.Contains(responses.participant_answer))
                        {
                            QuestionEightValueList.Add(responses.participant_answer);
                            valueCounter++;
                            QuestionEightValueCount.Add(valueCounter);
                        }
                        else
                        {
                            index        = QuestionEightValueList.IndexOf(responses.participant_answer);
                            valueCounter = QuestionEightValueCount[index];
                            valueCounter++;
                            QuestionEightValueCount[index] = valueCounter;
                        }
                        valueCounter = 0;
                    }
                    // Same steps with question_id 2
                    else if (responses.question_id == 9)
                    {
                        if (QuestionNineValueList.Count < 1 || !QuestionNineValueList.Contains(responses.participant_answer))
                        {
                            QuestionNineValueList.Add(responses.participant_answer);
                            valueCounter++;
                            QuestionNineValueCount.Add(valueCounter);
                        }
                        else
                        {
                            index        = QuestionNineValueList.IndexOf(responses.participant_answer);
                            valueCounter = QuestionNineValueCount[index];
                            valueCounter++;
                            QuestionNineValueCount[index] = valueCounter;
                        }
                        valueCounter = 0;
                    }
                    // Same steps with question_id 2
                    else if (responses.question_id == 10)
                    {
                        if (QuestionTenValueList.Count < 1 || !QuestionTenValueList.Contains(responses.participant_answer))
                        {
                            QuestionTenValueList.Add(responses.participant_answer);
                            valueCounter++;
                            QuestionTenValueCount.Add(valueCounter);
                        }
                        else
                        {
                            index        = QuestionTenValueList.IndexOf(responses.participant_answer);
                            valueCounter = QuestionTenValueCount[index];
                            valueCounter++;
                            QuestionTenValueCount[index] = valueCounter;
                        }
                        valueCounter = 0;
                    }
                }
                // Initialize finalReport POCO, assign designated list to each properties
                FinalReportPOCO finalReport = new FinalReportPOCO()
                {
                    QuestionTwoValueList    = QuestionTwoValueList,
                    QuestionTwoValueCount   = QuestionTwoValueCount,
                    QuestionThreeValueList  = QuestionThreeValueList,
                    QuestionThreeValueCount = QuestionThreeValueCount,
                    QuestionFourValueList   = QuestionFourValueList,
                    QuestionFourValueCount  = QuestionFourValueCount,
                    QuestionFiveValueList   = QuestionFiveValueList,
                    QuestionFiveValueCount  = QuestionFiveValueCount,
                    QuestionSixValueList    = QuestionSixValueList,
                    QuestionSixValueCount   = QuestionSixValueCount,
                    QuestionNineValueList   = QuestionNineValueList,
                    QuestionNineValueCount  = QuestionNineValueCount,
                    QuestionTenValueList    = QuestionTenValueList,
                    QuestionTenValueCount   = QuestionTenValueCount,
                    QuestionEightValueList  = QuestionEightValueList,
                    QuestionEightValueCount = QuestionEightValueCount,
                    SubmittedSurveyList     = submittedSurveyList,
                    Question = Questions
                };
                // return finalReport POCO
                return(finalReport);
            }
        }