public void AddEntityItemToAttributeDefinitionCache(string entityName, AttributeDefinition entityItem) { var foundEntity = AttributeDefinitionCacheList.SingleOrDefault(obj => obj.Name.ToLower() == entityName.ToLower()); if (foundEntity == null) { var attributeDefinitionCache = new AttributeDefinitionCache(entityName); attributeDefinitionCache.AddItem(entityItem); AttributeDefinitionCacheList.Add(attributeDefinitionCache); } else { foundEntity.AddItem(entityItem); } }
public AttributeDefinition ConvertToBusinessAttributeDefinition(FernBusinessBase.AttributeDefinition ad) { var busAd = new AttributeDefinition(); busAd.ID = ad.ID; busAd.CompanyID = ad.CompanyID; busAd.UserID = ad.UserID; busAd.DateCreated = ad.DateCreated; busAd.DateModified = ad.DateModified; busAd.Active = ad.Active; busAd.Deleted = ad.Deleted; busAd.VarName = ad.VarName; busAd.FriendlyName = ad.FriendlyName; busAd.Description = ad.Description; busAd.GroupID = ad.GroupID; busAd.VarType = ad.VarType; busAd.Format = ad.Format; busAd.CaptureHistory = ad.CaptureHistory; busAd.Viewable = ad.Viewable; busAd.EntityTypeName = ad.EntityTypeName; busAd.EntityTypeID = ad.EntityTypeID; return busAd; }
/// <summary> /// An attribute definition has changed, so we must go through all entities for this entity type, /// and update the definition fields where the entity has that attribute. /// </summary> /// <param name="entityName"></param> /// <param name="ad"></param> /// <returns></returns> public bool UpdateAttributeValueCacheByAttributeIDWithAttributeDefintion(string entityName, AttributeDefinition ad) { AttributeValueCache avCacheForEntity = AttributeValueCacheList.SingleOrDefault(obj => obj.Name.ToLower() == entityName.ToLower()); if (avCacheForEntity == null) { return false; } else { return avCacheForEntity.UpdateAttributeValueForAttributeIDWithAttributeDefintion(ad); } }
public List<AttributeValue> GetListFromAttributeValueCacheByAttributeID(string entityName, AttributeDefinition ad) { if (ad == null || ad.ID == Guid.Empty) return null; var foundEntity = AttributeValueCacheList.SingleOrDefault(obj => obj.Name.ToLower() == entityName.ToLower()); if (foundEntity == null) { return null; } else { return foundEntity.GetAttributeValueListForAttributeID(ad); } }