/// <summary> /// Get all assessments for the provided entity /// The returned entities are just the base /// </summary> /// <param name="parentUid"></param> /// <returns></returnsThisEntity public static List <AssessmentProfile> GetAll(Guid parentUid, int relationshipTypeId = 1) { List <AssessmentProfile> list = new List <AssessmentProfile>(); AssessmentProfile entity = new AssessmentProfile(); Entity parent = EntityManager.GetEntity(parentUid); LoggingHelper.DoTrace(7, string.Format("EntityAssessments_GetAll: parentUid:{0} entityId:{1}, e.EntityTypeId:{2}", parentUid, parent.Id, parent.EntityTypeId)); try { using (var context = new EntityContext()) { List <DBEntity> results = context.Entity_Assessment .Where(s => s.EntityId == parent.Id && s.RelationshipTypeId == relationshipTypeId) .OrderBy(s => s.Assessment.Name) .ToList(); if (results != null && results.Count > 0) { foreach (DBEntity item in results) { entity = new AssessmentProfile(); //need to distinguish between on a detail page for conditions and assessment detail //would usually only want basics here?? //17-05-26 mp- change to MapFromDB_Basic if (item.Assessment != null && item.Assessment.EntityStateId > 1) { AssessmentManager.MapFromDB_Basic(item.Assessment, entity, true); //includingCosts-not sure //add competencies AssessmentManager.MapFromDB_Competencies(entity); list.Add(entity); } } } return(list); } } catch (Exception ex) { LoggingHelper.LogError(ex, thisClassName + string.Format(".EntityAssessments_GetAll. Guid: {0}, parentType: {1} ({2}), ", parentUid, parent.EntityType, parent.EntityBaseId)); } return(list); }