public static FieldDefinition GetFieldDefinitionForTaxonomyLevel(TaxonomyLevelEnum taxonomyLevelEnum) { switch (taxonomyLevelEnum) { case TaxonomyLevelEnum.Leaf: return(FieldDefinition.ProjectType); case TaxonomyLevelEnum.Branch: return(FieldDefinition.TaxonomyBranch); case TaxonomyLevelEnum.Trunk: return(FieldDefinition.TaxonomyTrunk); default: throw new ArgumentOutOfRangeException(); } }
public static TaxonomyLevel ToType(TaxonomyLevelEnum enumValue) { switch (enumValue) { case TaxonomyLevelEnum.Branch: return(Branch); case TaxonomyLevelEnum.Leaf: return(Leaf); case TaxonomyLevelEnum.Trunk: return(Trunk); default: throw new ArgumentException(string.Format("Unable to map Enum: {0}", enumValue)); } }
public static string GetTaxonomyTierCountText(int countSelected, int maximumChildrenCount, TaxonomyLevelEnum taxonomyLevel) { var message = $"{countSelected} selected"; if (countSelected == maximumChildrenCount) { switch (taxonomyLevel) { case TaxonomyLevelEnum.Trunk: message = $"All {FieldDefinitionEnum.TaxonomyTrunk.ToType().GetFieldDefinitionLabelPluralized()}"; break; case TaxonomyLevelEnum.Branch: message = $"All {FieldDefinitionEnum.TaxonomyBranch.ToType().GetFieldDefinitionLabelPluralized()}"; break; case TaxonomyLevelEnum.Leaf: message = $"All {FieldDefinitionEnum.TaxonomyLeaf.ToType().GetFieldDefinitionLabelPluralized()}"; break; } } return(message); }