private void GetTotalNumberOfRequests(
            AnalysisDictionary analysisResult,
            string exclusionFilter,
            DateTime startDate,
            DateTime endDate,
            int period,
            int threshold,
            int costPerRequest,
            string currencySymbol)
        {
            try
            {
                using (var connection = new SqlConnection(this.ConnectionString))
                {
                    connection.Open();
                    var command = new SqlCommand(GetTotalNumberOfRequestsSql(exclusionFilter), connection);
                    command.Parameters.Add("EndDate", SqlDbType.Date).Value = endDate.AddDays(1);
                    command.Parameters.Add("StartDate", SqlDbType.Date).Value = startDate;
                    command.Parameters.Add("Threshold", SqlDbType.Int).Value = threshold;

                    using (var reader = command.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            // Total Number Of One Off Requests
                            var totalNumberOfOneOffRequest = Convert.ToInt32(reader["TotalNumberOfOneOffRequest"]);
                            var analysisAttribute = new AnalysisAttribute
                                {
                                    Value = string.Format("{0:n0}", totalNumberOfOneOffRequest)
                                };

                            analysisResult.Add("TotalNumberOfOneOffRequest", analysisAttribute);

                            // Total Number Of Requests
                            var totalNumberOfRequests = Convert.ToInt32(reader["TotalNumberOfRequests"]);
                            analysisAttribute = new AnalysisAttribute
                            {
                                Value = string.Format("{0:n0}", totalNumberOfRequests)
                            };
                            analysisResult.Add("TotalNumberOfRequests", analysisAttribute);

                            // Total Number Of Requests in a year
                            analysisAttribute = new AnalysisAttribute
                            {
                                Value = string.Format("{0:n0}", 365 * totalNumberOfRequests / period)
                            };
                            analysisResult.Add("TotalNumberOfRequestsInAYear", analysisAttribute);

                            // Total Number Of One Off Requests in a year
                            var totalNumberOfOneOffRequestInAYear = 365 * totalNumberOfOneOffRequest / period;
                            analysisAttribute = new AnalysisAttribute
                            {
                                Value = string.Format("{0:n0}", 365 * totalNumberOfOneOffRequest / period)
                            };
                            analysisResult.Add("TotalNumberOfOneOffRequestInAYear", analysisAttribute);

                            // Total Number Of One Off Requests Cost
                            analysisAttribute = new AnalysisAttribute
                                {
                                    Value = string.Format("{0}{1:n0}", currencySymbol, totalNumberOfOneOffRequestInAYear * costPerRequest)
                                };

                            analysisResult.Add("TotalNumberOfOneOffRequestCost", analysisAttribute);

                            // Total Number Of One Off Requests in a year Cost
                            analysisAttribute = new AnalysisAttribute
                            {
                                Value = string.Format("{0}{1:n0}", currencySymbol, totalNumberOfOneOffRequest * costPerRequest)
                            };

                            analysisResult.Add("TotalNumberOfOneOffRequestInAYearCost", analysisAttribute);
                        }

                        reader.Close();
                    }
                }
            }
            catch (Exception e)
            {
                // Need logging
                throw new Exception("Could not get total number of  requests", e);
            }
        }
        private void CreateSQLParameterArray(AnalysisDictionary values, out SqlParameter[] sqlParamArray)
        {
            // Period
            var period = new AnalysisAttribute();
            if (values.ContainsKey("Period"))
            {
                period = values["Period"];
            }

            // Start Date
            var startDate = new AnalysisAttribute();
            if (values.ContainsKey("StartDate"))
            {
                startDate = values["StartDate"];
            }

            // End Date
            var endDate = new AnalysisAttribute();
            if (values.ContainsKey("EndDate"))
            {
                endDate = values["EndDate"];
            }

            sqlParamArray = new[]
                {
                    new SqlParameter("@Period", SqlDbType.Int) { Value = period.Value },
                    new SqlParameter("@StartDate", SqlDbType.DateTime) { Value = startDate.Value },
                    new SqlParameter("@EndDate", SqlDbType.DateTime) { Value = endDate.Value }
                };
        }