private Boolean MatchDayTime(ObjectAttributeTypeDTO weekdayTime, ObjectAttributeTypeDTO weekendTime, int?attributeId) { var weekdayMatch = weekdayTime.Attributes.Exists(x => x.AttributeId == attributeId); var weekendMatch = weekendTime.Attributes.Exists(x => x.AttributeId == attributeId); return(weekdayMatch || weekendMatch); }
private ObjectAttributeTypeDTO GetPetAttributes(List <MpAttribute> mpAttributes, MpGroupSearchAttributes searchAttributes) { var petsAttributeType = mpAttributes.First(x => x.AttributeTypeId == GroupPetsAttributeTypeId); var groupPets = new ObjectAttributeTypeDTO() { AttributeTypeId = petsAttributeType.AttributeTypeId, Name = petsAttributeType.AttributeTypeName, Attributes = new List <ObjectAttributeDTO>() }; // TODO: Determine if we can loop over the attributes and lookup if attribute type is a searchAttrbitues.CatId or DogId var cat = ConvertToMultiAttribute(mpAttributes, GroupPetsCatAttributeId, searchAttributes.CatId.HasValue); groupPets.Attributes.Add(cat); var dog = ConvertToMultiAttribute(mpAttributes, GroupPetsDogAttributeId, searchAttributes.DogId.HasValue); groupPets.Attributes.Add(dog); return(groupPets); }
private static MpObjectAttribute TranslateMultiToMPAttribute(ObjectAttributeDTO objectAttribute, ObjectAttributeTypeDTO objectAttributeType) { var mpObjectAttribute = new MpObjectAttribute(); if (objectAttribute == null) { return(mpObjectAttribute); } mpObjectAttribute.AttributeId = objectAttribute.AttributeId; mpObjectAttribute.AttributeTypeId = objectAttributeType != null ? objectAttributeType.AttributeTypeId : 0; mpObjectAttribute.AttributeTypeName = objectAttributeType != null ? objectAttributeType.Name : string.Empty; mpObjectAttribute.StartDate = objectAttribute.StartDate; mpObjectAttribute.EndDate = objectAttribute.EndDate; mpObjectAttribute.Notes = objectAttribute.Notes; return(mpObjectAttribute); }