public static AdditionalMetricRequest Create(MetadataColumn metadataItem, dynamic studentDataRow)
 {
     return new AdditionalMetricRequest
     {
         ColumnMetadata = metadataItem,
         Metric = studentDataRow
     };
 }
 public static AdditionalPriorYearMetricRequest Create(MetadataColumn metadataItem, StudentSchoolMetricInstance priorYearStudentList, StudentMetric studentDataRow)
 {
     return new AdditionalPriorYearMetricRequest
     {
         MetadataItem = metadataItem,
         PriorYearStudentList = priorYearStudentList,
         StudentDataRow = studentDataRow
     };
 }
        public static StudentWithMetrics.Metric ToListCellTypedMetric(this StudentMetric metricData,
                                                                      MetadataColumn cell,
                                                                      IStudentListUtilitiesProvider utilitiesProvider,
                                                                      ITrendRenderingDispositionProvider trendRenderingDispositionProvider)
        {
            switch (cell.MetricListCellType)
            {
                case MetricListCellType.TrendMetric:
                    return utilitiesProvider.PrepareTrendMetric(metricData.StudentUSI, metricData.SchoolId,
                                                                cell.UniqueIdentifier, metricData.MetricVariantId,
                                                                metricData.Value, metricData.MetricStateTypeId,
                                                                metricData.ValueTypeName, metricData.TrendDirection,
                                                                trendRenderingDispositionProvider);
                case MetricListCellType.AssessmentMetric:
                    return utilitiesProvider.PrepareIndicatorMetric(metricData.StudentUSI, metricData.SchoolId,
                                                                    cell.UniqueIdentifier, metricData.MetricVariantId,
                                                                    metricData.Value, metricData.MetricStateTypeId,
                                                                    metricData.ValueTypeName);
            }

            return utilitiesProvider.PrepareMetric(metricData.StudentUSI, metricData.SchoolId, cell.UniqueIdentifier,
                                                   metricData.MetricVariantId, metricData.Value,
                                                   metricData.MetricStateTypeId, metricData.ValueTypeName);
        }
 protected override void EstablishContext()
 {
     schoolMetricStudentListMetricId = SuppliedMetricVariant1;
     sortColumn = new MetadataColumn { MetricVariantId = SuppliedMetricVariant1 };
     base.EstablishContext();
 }
 protected override void EstablishContext()
 {
     sortColumn = new MetadataColumn { MetricVariantId = SpecialMetricVariantSortingIds.GradeLevel };
     base.EstablishContext();
 }
 protected override void EstablishContext()
 {
     sortColumn = new MetadataColumn { MetricVariantId = -999 };
     base.EstablishContext();
 }
Esempio n. 7
0
 //TODO: All of this sorting code should be in it's own set of classes.  There should be some kind of factory that
 //  selects the correct sorting system.  This was not done due to time constraints.
 protected virtual IQueryable<EnhancedStudentInformation> SortStudents(
     IQueryable<EnhancedStudentInformation> query, MetadataColumn sortColumn, string sortDirection, int? schoolMetricStudentListMetricId)
 {
     if (sortColumn == null)
         return DefaultOrder(query, sortDirection);
     switch (sortColumn.MetricVariantId)
     {
         case SpecialMetricVariantSortingIds.Designations:
             return DesignationOrder(query, sortDirection);
         case SpecialMetricVariantSortingIds.GradeLevel:
             return GradeLevelOrder(query, sortDirection);
         case SpecialMetricVariantSortingIds.SchoolMetricStudentList:
             if (schoolMetricStudentListMetricId == null) break;
             return SchoolMetricStudentOrder(query, sortDirection, schoolMetricStudentListMetricId.Value);
         default:
             if (sortColumn.MetricVariantId > 0)
             {
                 return MetricValueOrder(query, sortColumn.MetricVariantId, sortDirection);
             }
             break;
     }
     return DefaultOrder(query, sortDirection);
 }
Esempio n. 8
0
 public IQueryable<EnhancedStudentInformation> GetOrderedStudentList(
     StudentMetricsProviderQueryOptions providerQueryOptions, MetadataColumn sortColumn = null,
     string sortDirection = "", int? schoolMetricStudentListMetricId = null)
 {
     var query = ApplyQueryOptionsAndSecurity(EnhancedStudentInformationRepository.GetAll(), providerQueryOptions);
     return SortStudents(query, sortColumn, sortDirection, schoolMetricStudentListMetricId);
 }
 /// <summary>
 /// Gets the student list. This is broken out into its own method so
 /// other projects can change how this data is retrieved.
 /// </summary>
 /// <param name="queryOptions">The query options.</param>
 /// <param name="sortColumn">The sort column.</param>
 /// <param name="sortDirection">The sort direction.</param>
 /// <returns></returns>
 protected virtual IQueryable<EnhancedStudentInformation> GetStudentList(
     StudentMetricsProviderQueryOptions queryOptions, MetadataColumn sortColumn = null, string sortDirection = "")
 {
     return StudentMetricsProvider.GetOrderedStudentList(queryOptions, sortColumn, sortDirection);
 }
 public IQueryable<SchoolMetricInstanceStudentList> GetStudentList(PriorYearStudentMetricsProviderQueryOptions providerQueryOptions, MetadataColumn sortColumn = null, string sortDirection = "")
 {
     var query = ApplyQueryOptionsAndSecurity(schoolMetricStudentListRepository.GetAll(), providerQueryOptions);
     return query;
 }
Esempio n. 11
0
        private static object CreateMetricCell(MetadataColumn column, StudentWithMetrics.Metric m)
        {
            if (column.MetricListCellType == MetricListCellType.AssessmentMetric)
            {
                var assessmentMetric = m as StudentWithMetrics.IndicatorMetric;
                if (assessmentMetric != null)
                {
                    if (assessmentMetric.Value != null)
                    {
                        var assessmentCellType = typeof(AssessmentMetricCellItem<>).MakeGenericType(GetTypeArray(assessmentMetric.Value.GetType()));
                        dynamic cellForMetricValue = Activator.CreateInstance(assessmentCellType);
                        cellForMetricValue.V = assessmentMetric.Value;
                        cellForMetricValue.DV = assessmentMetric.DisplayValue;
                        cellForMetricValue.A = (int)assessmentMetric.MetricIndicator;
                        cellForMetricValue.S = (int)assessmentMetric.State;
                        return cellForMetricValue;
                    }

                    return new AssessmentMetricCellItem<double?>
                               {
                                   DV = assessmentMetric.DisplayValue,
                                   V = assessmentMetric.Value,
                                   A = (int)assessmentMetric.MetricIndicator,
                                   S = (int)assessmentMetric.State,
                               };
                }
                return new AssessmentMetricCellItem<string>();
            }

            //Trend Metric
            if (column.MetricListCellType == MetricListCellType.TrendMetric)
            {
                var trendMetric = m as StudentWithMetrics.TrendMetric;
                if (trendMetric != null)
                {
                    if (trendMetric.Value != null)
                    {
                        var trendCellType = typeof(TrendMetricCellItem<>).MakeGenericType(GetTypeArray(trendMetric.Value.GetType()));
                        dynamic trendCellForMetricValue = Activator.CreateInstance(trendCellType);
                        trendCellForMetricValue.V = trendMetric.Value;
                        trendCellForMetricValue.DV = trendMetric.DisplayValue;
                        trendCellForMetricValue.T = trendMetric.Trend.ToString();
                        trendCellForMetricValue.S = (int)trendMetric.State;
                        return trendCellForMetricValue;
                    }

                    return new TrendMetricCellItem<double?>
                               {
                                   DV = trendMetric.DisplayValue,
                                   V = trendMetric.Value,
                                   T = trendMetric.Trend.ToString(),
                                   S = (int)trendMetric.State,
                               };
                }
                return new TrendMetricCellItem<string>();
            }

            if (m != null)
            {
                if (m.Value != null)
                {
                    var metricCellType =
                        typeof(MetricCellItem<>).MakeGenericType(GetTypeArray(m.Value.GetType()));
                    dynamic metricCellForMetricValue = Activator.CreateInstance(metricCellType);
                    metricCellForMetricValue.V = m.Value;
                    metricCellForMetricValue.DV = m.DisplayValue;
                    metricCellForMetricValue.S = (int)m.State;
                    return metricCellForMetricValue;
                }

                return new MetricCellItem<double?>
                           {
                               DV = m.DisplayValue,
                               V = m.Value,
                               S = (int)m.State,
                           };
            }

            return new MetricCellItem<string>();
        }
Esempio n. 12
0
        private static object CreateEntityInformationCell(MetadataColumn column, StudentWithMetrics s, string uniqueListId)
        {
            if (string.Equals(column.ColumnName, "Flag", StringComparison.OrdinalIgnoreCase))
                return new FlagCellItem<bool> { V = s.IsFlagged, F = s.IsFlagged, };

            if (string.Equals(column.ColumnName, "Student", StringComparison.OrdinalIgnoreCase))
                return new StudentCellItem<string>(s.StudentUSI)
                {
                    V = s.Name,
                    DV = s.Name,
                    I = s.ThumbNail,
                    LUId = uniqueListId,
                    CId = s.SchoolId,
                    //Lets go and resolve the metric to a child one...
                    Url = s.Href != null ? s.Href.Href : null,
                    Links = s.Links
                };

            if (string.Equals(column.ColumnName, "Designations", StringComparison.OrdinalIgnoreCase))
            {
                var studentMetricWithAccommodations = (StudentWithMetricsAndAccommodations)s;
                return new DesignationsCellItem<string> { V = studentMetricWithAccommodations.Accommodations.Count.ToString(), D = studentMetricWithAccommodations.Accommodations };
            }

            if (string.Equals(column.ColumnName, "Grade Level", StringComparison.OrdinalIgnoreCase))
            {
                return new CellItem<int> { DV = s.GradeLevelDisplayValue, V = s.GradeLevel };
            }

            if (string.Equals(column.ColumnName, "School", StringComparison.OrdinalIgnoreCase))
            {
                return new CellItem<string> { DV = s.SchoolName };
            }

            if (string.Equals(column.ColumnName, "Metric Value", StringComparison.OrdinalIgnoreCase)
                || string.Equals(column.ColumnName, "Demographic", StringComparison.OrdinalIgnoreCase)
                || column.MetricListCellType == MetricListCellType.MetricValue)
            {
                var studentMetricWithPrimaryMetric = s as StudentWithMetricsAndPrimaryMetric ?? new StudentWithMetricsAndPrimaryMetric(s.StudentUSI);
                var cellType = (studentMetricWithPrimaryMetric.PrimaryMetricValue == null) ? typeof(CellItem<string>) : typeof(CellItem<>).MakeGenericType(GetTypeArray(studentMetricWithPrimaryMetric.PrimaryMetricValue.GetType()));
                dynamic cellForMetricValue = Activator.CreateInstance(cellType);
                cellForMetricValue.V = studentMetricWithPrimaryMetric.PrimaryMetricValue;
                cellForMetricValue.DV = studentMetricWithPrimaryMetric.PrimaryMetricDisplayValue;
                return cellForMetricValue;
            }

            return new CellItem<string> { DV = "New Entity information. Missing Logic." };
        }
Esempio n. 13
0
        private static Column GenerateColumn(MetadataColumn column, bool isFixedColumn)
        {
            if (string.Equals(column.ColumnName, "Flag", StringComparison.OrdinalIgnoreCase))
                return new ImageColumn { Src = "FlagWhite.gif", IsVisibleByDefault = true, IsFixedColumn = isFixedColumn };

            return new TextColumn
            {
                U = column.UniqueIdentifier,
                DisplayName = column.ColumnName,
                IsVisibleByDefault = column.IsVisibleByDefault,
                SortAscending = column.SortAscending,
                SortDescending = column.SortDescending,
                Tooltip = column.Tooltip,
                IsFixedColumn = isFixedColumn
            };
        }