public CsvResult Get(EdFiDashboardContext context)
        {
            var learningStandards = _service.Get(new LearningStandardRequest()
            {
                StudentUSI = context.StudentUSI.GetValueOrDefault(),
                SchoolId = context.SchoolId.GetValueOrDefault(),
                MetricVariantId = context.MetricVariantId.GetValueOrDefault()
            });

            var export = new ExportAllModel();
            var rows = new List<ExportAllModel.Row>();
            
            foreach (var learningStandard in learningStandards)
            {
                var cells = new List<KeyValuePair<string, object>>()
                                {
                                    new KeyValuePair<string, object>("Learning Standard", learningStandard.LearningStandard),
                                    new KeyValuePair<string, object>("Description", learningStandard.Description),
                                };
                
                cells.AddRange(learningStandard.Assessments.Select(assessment => new KeyValuePair<string, object>(assessment.AssessmentTitle, assessment.Value)));

                rows.Add(new ExportAllModel.Row() { Cells = cells });
            }

            export.Rows = rows;

            return new CsvResult(export);
        }
        public CsvResult Get(EdFiDashboardContext context)
        {
            var learningObjectives = _service.Get(new LearningObjectiveRequest()
            {
                StudentUSI = context.StudentUSI.GetValueOrDefault(),
                SchoolId = context.SchoolId.GetValueOrDefault(),
                MetricVariantId = context.MetricVariantId.GetValueOrDefault()
            });

            var orderedSkills = learningObjectives.LearningObjectiveSkills.OrderBy(los => los.SectionName).ThenBy(los => los.SkillName);

            var export = new ExportAllModel();
            var rows = new List<ExportAllModel.Row>();

            foreach (var skill in orderedSkills)
            {
                var cells = new List<KeyValuePair<string, object>>()
                                {
                                    new KeyValuePair<string, object>("Section Name", skill.SectionName),
                                    new KeyValuePair<string, object>("Skill Name", skill.SkillName),
                                };
                
                cells.AddRange(skill.SkillValues.Select(skillValue => new KeyValuePair<string, object>(skillValue.Title, skillValue.Value)));

                rows.Add(new ExportAllModel.Row() { Cells = cells });
            }

            export.Rows = rows;

            return new CsvResult(export);
        }
        public CsvResult Get(EdFiGridExportRequest request)
        {
            // for some reason the json being sent from the export form isn't
            // properly serialized so this will do the serialization
            var serializer = new JavaScriptSerializer();
            request.StudentWatchListData = serializer.Deserialize<List<NameValuesType>>(request.StudentWatchListJson);

            var exportResult = EdFiGridExportService.Get(request);

            // flatten out the columns for the export
            var exportColumns = new List<MetadataColumn>();
            foreach (var columnGroup in exportResult.ExportColumns)
            {
                exportColumns.AddRange(columnGroup.Columns);
            }

            // use the column groups to create the row data
            var exportRows =
                exportResult.ExportColumns.GenerateRowsForExport(exportResult.ExportRows.ToList<StudentWithMetrics>());

            var export = new ExportAllModel();
            var rows =
                exportRows.Select(
                    exportRow =>
                        exportRow.Select(
                            (t, i) => new KeyValuePair<string, object>(exportColumns[i].ColumnName, GetCellItemValue(t)))
                            .ToList()).Select(cells => new ExportAllModel.Row
                            {
                                Cells = cells
                            }).ToList();

            export.Rows = rows;
            return new CsvResult(export);
        }
        public CsvResult Get(EdFiDashboardContext context)
        {
            var schoolMetrics = _service.Get(new SchoolPriorYearMetricTableRequest() { MetricVariantId = context.MetricVariantId.GetValueOrDefault(), LocalEducationAgencyId = context.LocalEducationAgencyId.GetValueOrDefault() });
            var export = new ExportAllModel();
            var rows = new List<ExportAllModel.Row>();
            
            rows.AddRange(schoolMetrics.OrderBy(x => x.Name)
                .Select(schoolMetric => new ExportAllModel.Row()
                    {
                        Cells = new List<KeyValuePair<string, object>>
                        {
                            new KeyValuePair<string, object>("School", schoolMetric.Name),
                            new KeyValuePair<string, object>("Type", schoolMetric.SchoolCategory),
                            new KeyValuePair<string, object>("School Metric Value", schoolMetric.Value),
                            new KeyValuePair<string, object>("School Goal", schoolMetric.Goal),
                            new KeyValuePair<string, object>("Difference from Goal", schoolMetric.GoalDifference)
                        }
                    }));

            export.Rows = rows;

            return new CsvResult(export);
        }
 protected override void ExecuteTest()
 {
     var service = new ExportAllMetricsService(studentInformationRepository, rootMetricNodeResolver, domainMetricService, metricTreeToIEnumerableOfKeyValuePairProvider);
     actualModel = service.Get(new ExportAllMetricsRequest(){SchoolId = suppliedSchoolId, StudentUSI = suppliedStudentUSI});
 }
 protected override void ExecuteTest()
 {
     var service = new ExportMetricListService(schoolMetricTableService, metadataListIdResolver, listMetadataProvider);
     actualModel = service.Get(new ExportMetricListRequest
                                   {
                                       LocalEducationAgencyId = suppliedLocalEducationAgencyId,
                                       MetricVariantId = suppliedMetricVariantId
                                   });
 }
        protected override void ExecuteTest()
        {
            var service = new ExportAllMetricsService(localEducationAgencyInformationRepository,
                                                                   domainMetricService,
                                                                   rootMetricNodeResolver, 
                                                                   metricTreeToIEnumerableOfKeyValuePairProvider, 
                                                                   domainSpecificMetricNodeResolver);

            actualModel = service.Get(new ExportAllMetricsRequest() { LocalEducationAgencyId = suppliedLocalEducationAgencyId });
        }