private static bool AttributeInLoBacRange(ILotContainer lotContainer, IEnumerable <AttributeName> attributeNames, IAttributeNameKey staticAttributeName) { var attributeName = attributeNames.SingleOrDefault(n => n.AttributeNameKey_ShortName == staticAttributeName.AttributeNameKey_ShortName); if (attributeName == null) { return(false); } var attribute = lotContainer.Lot.Attributes.SingleOrDefault(c => c.AttributeShortName == attributeName.AttributeNameKey_ShortName); if (attribute == null) { return(false); } return(attribute.AttributeValue <= attributeName.LoBacLimit); }
public static bool DetermineChileLotIsLoBac(ILotContainer lotContainer, IEnumerable <AttributeName> attributeNames) { if (lotContainer == null) { throw new ArgumentNullException("lotContainer"); } if (attributeNames == null) { throw new ArgumentNullException("attributeNames"); } var attributes = (attributeNames as AttributeName[] ?? attributeNames.ToArray()).ToList(); var scanAttributeNameKey = StaticAttributeNames.Scan.ToAttributeNameKey(); if (AttributeInLoBacRange(lotContainer, attributes, scanAttributeNameKey)) { return(true); } attributes = attributes.Where(a => a.LoBacLimit != null && !scanAttributeNameKey.Equals(a)).ToList(); return(attributes.All(a => AttributeInLoBacRange(lotContainer, attributes, a))); }