public MetricMetadataNode GetOperationalDashboardMetricNode(MetricInstanceSetType metricInstanceSetType = MetricInstanceSetType.None, int? schoolId = null) { // If we're not given the set type, get it from the request context if (metricInstanceSetType == MetricInstanceSetType.None) { //Based on DomainEntity context lets grab the appropriate root. EdFiDashboardContext context = dashboardContextProvider.GetEdFiDashboardContext(); metricInstanceSetType = context.MetricInstanceSetType; if (metricInstanceSetType == MetricInstanceSetType.School) schoolId = context.SchoolId; } var metaDataTree = metricMetadataTreeService.Get(MetricMetadataTreeRequest.Create()); switch (metricInstanceSetType) { case MetricInstanceSetType.School: if (Convert.ToInt32(schoolId) == 0) throw new Exception("School Id was not provided (or possibly found in dashboard context) for determining the school-level operational dashboard metric node."); var schoolCategory = rootMetricNodeResolver.GetMetricHierarchyRoot(schoolId.Value); switch (schoolCategory) { case MetricHierarchyRoot.Elementary: return metaDataTree.AllNodesByMetricNodeId.GetValueOrDefault((int)SchoolMetricNodeIdEnum.ElementarychoolOperationalDashboard); case MetricHierarchyRoot.MiddleSchool: return metaDataTree.AllNodesByMetricNodeId.GetValueOrDefault((int)SchoolMetricNodeIdEnum.MiddleSchoolOperationalDashboard); case MetricHierarchyRoot.HighSchool: return metaDataTree.AllNodesByMetricNodeId.GetValueOrDefault((int)SchoolMetricNodeIdEnum.HighSchoolOperationalDashboard); } break; case MetricInstanceSetType.LocalEducationAgency: return metaDataTree.AllNodesByMetricNodeId.GetValueOrDefault((int)LocalEducationAgencyMetricNodeIdEnum.OperationalDashboard); case MetricInstanceSetType.StudentSchool: case MetricInstanceSetType.Staff: default: throw new NotSupportedException("Metric Instance Set Type '" + metricInstanceSetType + "' is not supported."); } // Should never get here, but need to make the compiler happy throw new NotSupportedException("Metric Instance Set Type '" + metricInstanceSetType + "' is not supported."); }
public static bool EqualTo(this string value, MetricInstanceSetType compare) { return value.Replace(" ", "").Equals(compare.ToString(), StringComparison.OrdinalIgnoreCase); }