public bool IsFunctionalityOptional(Functionality functionality) { bool optional = true; FunctionalityItem item = _profileFunctionalities.Where(F => F.Functionality == functionality).FirstOrDefault(); if (item != null && item.Features != null) { optional = false; foreach (Feature feature in item.Features) { ProfileFeature f = _features.Where(F => F.Feature == feature).FirstOrDefault(); if (f != null) { if (f.State == ProfileFeatureState.Optional) { optional = true; break; } } } } return(optional); }
public bool IsFunctionalityOptional(Functionality functionality, IEnumerable <Feature> supportedFeatures) { bool optional = true; FunctionalityItem item = _profileFunctionalities.FirstOrDefault(F => F.Functionality == functionality); if (item != null && item.Features != null) { optional = false; foreach (Feature feature in item.Features) { ProfileFeature f = _features.FirstOrDefault(F => F.Feature == feature); if (f != null) { //[19.07.2013] AKS: //Suppose we have profile with mandatory functionality AorB, //i.e. either A or B should be supported. //Suppose functionality F require feature A. //There are two cases when feature A is not supported: //1. AorB is supported but A is not supported(i.e. only feature B is supported) => functionality F should be colored as absent and optional //2. AorB is not supported => functionality F should be colored as absent and mandatory if (ProfileFeatureState.Mandatory == f.State && FeatureUtils.IsCompoundFeature(feature)) { optional = supportedFeatures.ContainsFeature(feature); break; } else if (f.State == ProfileFeatureState.Optional) { optional = true; break; } } } } return(optional); }