示例#1
0
        public bool Import(ThisEntity entity, ref SaveStatus status)
        {
            //do a get, and add to cache before updating
            if (entity.Id > 0)
            {
                //note could cause problems verifying after an import (i.e. shows cached version. Maybe remove from cache after completion.
                var detail = GetDetail(entity.Id);
            }
            bool          isValid  = new EntityMgr().Save(entity, ref status);
            List <string> messages = new List <string>();

            if (entity.Id > 0)
            {
                if (UtilityManager.GetAppKeyValue("delayingAllCacheUpdates", false) == false)
                {
                    //update cache
                    new CacheManager().PopulateEntityRelatedCaches(entity.RowId);
                    //update Elastic
                    if (Utilities.UtilityManager.GetAppKeyValue("usingElasticLearningOppSearch", false))
                    {
                        ElasticServices.LearningOpp_UpdateIndex(entity.Id);
                    }
                    else
                    {
                        new SearchPendingReindexManager().Add(7, entity.Id, 1, ref messages);
                        if (messages.Count > 0)
                        {
                            status.AddWarningRange(messages);
                        }
                    }
                }
                else
                {
                    new SearchPendingReindexManager().Add(CodesManager.ENTITY_TYPE_LEARNING_OPP_PROFILE, entity.Id, 1, ref messages);
                    new SearchPendingReindexManager().Add(CodesManager.ENTITY_TYPE_ORGANIZATION, entity.OwningOrganizationId, 1, ref messages);
                    if (messages.Count > 0)
                    {
                        status.AddWarningRange(messages);
                    }
                }

                CacheManager.RemoveItemFromCache("lopp", entity.Id);
            }

            return(isValid);
        }
        public bool Import(ThisEntity entity, ref SaveStatus status)
        {
            LoggingHelper.DoTrace(7, thisClassName + ".Import - entered");
            //do a get, and add to cache before updating
            if (entity.Id > 0)
            {
                //note could cause problems verifying after an import (i.e. shows cached version. Maybe remove from cache after completion.
                if (UtilityManager.GetAppKeyValue("learningOppCacheMinutes", 0) > 0)
                {
                    if (System.DateTime.Now.Hour > 7 && System.DateTime.Now.Hour < 18)
                    {
                        GetDetail(entity.Id);
                    }
                }
            }
            bool          isValid  = new EntityMgr().Save(entity, ref status);
            List <string> messages = new List <string>();

            if (entity.Id > 0)
            {
                if (UtilityManager.GetAppKeyValue("learningOppCacheMinutes", 0) > 0)
                {
                    CacheManager.RemoveItemFromCache("lopp_", entity.Id);
                }

                if (UtilityManager.GetAppKeyValue("delayingAllCacheUpdates", false) == false)
                {
                    //update cache
                    ThreadPool.QueueUserWorkItem(UpdateCaches, entity);
                    //new CacheManager().PopulateEntityRelatedCaches( entity.RowId );
                    //add owning org to reindex queue
                }
                else
                {
                    new SearchPendingReindexManager().Add(CodesManager.ENTITY_TYPE_LEARNING_OPP_PROFILE, entity.Id, 1, ref messages);
                    new SearchPendingReindexManager().Add(CodesManager.ENTITY_TYPE_ORGANIZATION, entity.OwningOrganizationId, 1, ref messages);
                    if (messages.Count > 0)
                    {
                        status.AddWarningRange(messages);
                    }
                }
            }

            return(isValid);
        }
示例#3
0
        //



        private static void MapJurisdictions(ThisEntity input, ref ThisEntityDetail output)
        {
            if (input.Jurisdiction != null && input.Jurisdiction.Any())
            {
                output.Jurisdiction = ServiceHelper.MapJurisdiction(input.Jurisdiction);
            }
            //return if no assertions
            if (input.JurisdictionAssertions == null || !input.JurisdictionAssertions.Any())
            {
                return;
            }
            //TODO - return all in a group or individual?
            //output.JurisdictionAssertion = ServiceHelper.MapJurisdiction( input.JurisdictionAssertions, "OfferedIn" );
            //OR

            var assertedIn = input.JurisdictionAssertions.Where(s => s.AssertedInTypeId == Entity_AgentRelationshipManager.ROLE_TYPE_AccreditedBy).ToList();

            if (assertedIn != null && assertedIn.Any())
            {
                output.AccreditedIn = ServiceHelper.MapJurisdiction(assertedIn, "AccreditedIn");
            }
            //
            assertedIn = input.JurisdictionAssertions.Where(s => s.AssertedInTypeId == Entity_AgentRelationshipManager.ROLE_TYPE_ApprovedBy).ToList();
            if (assertedIn != null && assertedIn.Any())
            {
                output.ApprovedIn = ServiceHelper.MapJurisdiction(assertedIn, "ApprovedIn");
            }
            //
            assertedIn = input.JurisdictionAssertions.Where(s => s.AssertedInTypeId == Entity_AgentRelationshipManager.ROLE_TYPE_RecognizedBy).ToList();
            if (assertedIn != null && assertedIn.Any())
            {
                output.RecognizedIn = ServiceHelper.MapJurisdiction(assertedIn, "RecognizedIn");
            }
            //
            assertedIn = input.JurisdictionAssertions.Where(s => s.AssertedInTypeId == Entity_AgentRelationshipManager.ROLE_TYPE_RegulatedBy).ToList();
            if (assertedIn != null && assertedIn.Any())
            {
                output.RegulatedIn = ServiceHelper.MapJurisdiction(assertedIn, "RegulatedIn");
            }
        }
示例#4
0
        private static MCD.LearningOpportunityDetail MapToAPI(ThisEntity input)
        {
            var searchType = "learningopportunity";
            var output     = new MCD.LearningOpportunityDetail()
            {
                Meta_Id               = input.Id,
                CTID                  = input.CTID,
                Name                  = input.Name,
                FriendlyName          = HttpUtility.UrlPathEncode(input.Name),
                Description           = input.Description,
                SubjectWebpage        = input.SubjectWebpage,
                EntityTypeId          = 7,
                CredentialRegistryURL = RegistryServices.GetResourceUrl(input.CTID),
                RegistryData          = ServiceHelper.FillRegistryData(input.CTID)
            };

            output.Meta_LastUpdated = input.EntityLastUpdated;
            output.Meta_StateId     = input.EntityStateId;
            if (input.InLanguageCodeList != null && input.InLanguageCodeList.Any())
            {
                //output.Meta_Language = input.InLanguageCodeList[ 0 ].TextTitle;
                output.InLanguage = new List <string>();
                foreach (var item in input.InLanguageCodeList)
                {
                    output.InLanguage.Add(item.TextTitle);
                }
            }
            if (input.OwningOrganizationId > 0)
            {
                output.OwnedByLabel = ServiceHelper.MapDetailLink("Organization", input.OrganizationName, input.OwningOrganizationId);
            }
            var work = ServiceHelper.MapOrganizationRoleProfileToOutline(input.OrganizationRole, Entity_AgentRelationshipManager.ROLE_TYPE_OWNER);

            output.OwnedBy = ServiceHelper.MapOutlineToAJAX(work, "");
            //
            work             = ServiceHelper.MapOrganizationRoleProfileToOutline(input.OrganizationRole, Entity_AgentRelationshipManager.ROLE_TYPE_OFFERED_BY);
            output.OfferedBy = ServiceHelper.MapOutlineToAJAX(work, "Offered by {0} Organization(s)");
            //
            //
            //QA for owner,not offerer
            if (input.OwningOrganization != null && input.OwningOrganization.Id > 0)
            {
                if (input.OwningOrganization.OrganizationRole_Recipient != null && input.OwningOrganization.OrganizationRole_Recipient.Any())
                {
                    output.OwnerQAReceived = ServiceHelper.MapQAReceived(input.OwningOrganization.OrganizationRole_Recipient, searchType);
                }
            }
            //
            output.AssessmentMethodType        = ServiceHelper.MapPropertyLabelLinks(input.AssessmentMethodType, searchType);
            output.AssessmentMethodDescription = input.AssessmentMethodDescription;

            if (!string.IsNullOrWhiteSpace(input.AvailabilityListing))
            {
                output.AvailabilityListing = new List <string>()
                {
                    input.AvailabilityListing
                }
            }
            ;
            if (!string.IsNullOrWhiteSpace(input.AvailableOnlineAt))
            {
                output.AvailableOnlineAt = new List <string>()
                {
                    input.AvailableOnlineAt
                }
            }
            ;
            //MapAddress( input, ref output );
            output.AvailableAt = ServiceHelper.MapAddress(input.Addresses);

            //
            output.AudienceLevelType         = ServiceHelper.MapPropertyLabelLinks(input.AudienceLevelType, searchType);
            output.AudienceType              = ServiceHelper.MapPropertyLabelLinks(input.AudienceType, searchType);
            output.CreditUnitTypeDescription = input.CreditUnitTypeDescription;
            output.CreditValue = ServiceHelper.MapValueProfile(input.CreditValue, searchType);

            //
            output.DateEffective           = input.DateEffective;
            output.ExpirationDate          = input.ExpirationDate;
            output.DeliveryType            = ServiceHelper.MapPropertyLabelLinks(input.DeliveryType, searchType);
            output.DeliveryTypeDescription = input.DeliveryTypeDescription;
            output.EstimatedDuration       = ServiceHelper.MapDurationProfiles(input.EstimatedDuration);
            //
            //CostProfiles
            if (input.CommonCosts != null && input.CommonCosts.Any())
            {
                output.CommonCosts   = ServiceHelper.MapCostManifests(input.CommonCosts, searchType);
                output.EstimatedCost = new List <Models.Elastic.CostProfile>();
                foreach (var item in output.CommonCosts)
                {
                    output.EstimatedCost.AddRange(item.EstimatedCost);
                }
                output.CommonCosts = null;
            }

            if (input.EstimatedCost != null && input.EstimatedCost.Any())
            {
                if (output.EstimatedCost == null)
                {
                    output.EstimatedCost = new List <Models.Elastic.CostProfile>();
                }

                var estimatedCost = ServiceHelper.MapCostProfiles(input.EstimatedCost, searchType);
                if (estimatedCost != null && estimatedCost.Any())
                {
                    output.EstimatedCost.AddRange(estimatedCost);
                }
            }
            //
            if (input.FinancialAssistance != null && input.FinancialAssistance.Any())
            {
                output.FinancialAssistance = ServiceHelper.MapFinancialAssistanceProfiles(input.FinancialAssistance, searchType);
            }

            //condition profiles
            output.Corequisite    = ServiceHelper.MapToConditionProfiles(input.Corequisite, searchType);
            output.EntryCondition = ServiceHelper.MapToConditionProfiles(input.EntryCondition, searchType);
            output.Recommends     = ServiceHelper.MapToConditionProfiles(input.Recommends, searchType);
            output.EntryCondition = ServiceHelper.MapToConditionProfiles(input.EntryCondition, searchType);
            output.Requires       = ServiceHelper.MapToConditionProfiles(input.Requires, searchType);
            //
            if (input.CommonConditions != null && input.CommonConditions.Any())
            {
                output.CommonConditions = ServiceHelper.MapConditionManifests(input.CommonConditions, searchType);
                if (output.CommonConditions != null && output.CommonConditions.Any())
                {
                    foreach (var item in output.CommonConditions)
                    {
                        if (item.Requires != null && item.Requires.Any())
                        {
                            output.Requires = ServiceHelper.AppendConditions(item.Requires, output.Requires);
                        }
                        if (item.Recommends != null && item.Recommends.Any())
                        {
                            output.Recommends = ServiceHelper.AppendConditions(item.Recommends, output.Recommends);
                        }
                        if (item.Corequisite != null && item.Corequisite.Any())
                        {
                            output.Corequisite = ServiceHelper.AppendConditions(item.Requires, output.Corequisite);
                        }
                        if (item.EntryCondition != null && item.EntryCondition.Any())
                        {
                            output.EntryCondition = ServiceHelper.AppendConditions(item.EntryCondition, output.EntryCondition);
                        }
                    }
                }
            }
            //
            //connection profiles
            output.AdvancedStandingFrom  = ServiceHelper.MapToConditionProfiles(input.AdvancedStandingFrom, searchType);
            output.IsAdvancedStandingFor = ServiceHelper.MapToConditionProfiles(input.IsAdvancedStandingFor, searchType);
            //
            output.PreparationFrom  = ServiceHelper.MapToConditionProfiles(input.PreparationFrom, searchType);
            output.IsPreparationFor = ServiceHelper.MapToConditionProfiles(input.IsPreparationFor, searchType);
            //
            output.IsRequiredFor    = ServiceHelper.MapToConditionProfiles(input.IsRequiredFor, searchType);
            output.IsRecommendedFor = ServiceHelper.MapToConditionProfiles(input.IsRecommendedFor, searchType);
            //
            //
            if (input.HasPart != null && input.HasPart.Any())
            {
                output.HasPart = new List <MCD.Outline>();
                foreach (var target in input.HasPart)
                {
                    if (target != null && !string.IsNullOrWhiteSpace(target.Name))
                    {
                        output.HasPart.Add(ServiceHelper.MapToOutline(target, searchType));
                    }
                }
            }
            //
            if (input.IsPartOf != null && input.IsPartOf.Any())
            {
                output.IsPartOf = new List <MCD.Outline>();
                foreach (var target in input.IsPartOf)
                {
                    if (target != null && !string.IsNullOrWhiteSpace(target.Name))
                    {
                        output.IsPartOf.Add(ServiceHelper.MapToOutline(target, searchType));
                    }
                }
            }
            //
            output.Identifier = ServiceHelper.MapIdentifierValue(input.Identifier);
            //
            output.IndustryType             = ServiceHelper.MapReferenceFrameworkLabelLink(input.IndustryType, searchType, CodesManager.PROPERTY_CATEGORY_NAICS);
            output.OccupationType           = ServiceHelper.MapReferenceFrameworkLabelLink(input.OccupationType, searchType, CodesManager.PROPERTY_CATEGORY_SOC);
            output.InstructionalProgramType = ServiceHelper.MapReferenceFrameworkLabelLink(input.InstructionalProgramType, searchType, CodesManager.PROPERTY_CATEGORY_CIP);
            output.IsReferenceVersion       = input.IsReferenceVersion;
            //
            MapJurisdictions(input, ref output);

            //
            if (input.Keyword != null && input.Keyword.Any())
            {
                output.Keyword = ServiceHelper.MapPropertyLabelLinks(input.Keyword, searchType);
            }
            if (input.Subject != null && input.Subject.Any())
            {
                output.Subject = ServiceHelper.MapPropertyLabelLinks(input.Subject, searchType);
            }
            //
            output.LearningMethodType        = ServiceHelper.MapPropertyLabelLinks(input.LearningMethodType, searchType);
            output.LearningMethodDescription = input.LearningMethodDescription;
            //
            //none yet, leave here for likely additions
            //MapProcessProfiles( input, ref output );
            //
            output.SameAs = ServiceHelper.MapTextValueProfileTextValue(input.SameAs);
            //
            output.VersionIdentifier = ServiceHelper.MapIdentifierValue(input.VersionIdentifierList, "Version Identifier");
            //QA received
            //==> need to exclude 30-published by
            if (input.OrganizationRole.Any())
            {
                output.QAReceived = ServiceHelper.MapQAReceived(input.OrganizationRole, searchType);
            }

            return(output);
        }
示例#5
0
        public static ThisEntity GetBasic(int id, bool forEditView = false)
        {
            ThisEntity entity = EntityMgr.GetBasic(id);

            return(entity);
        }
示例#6
0
        //public static ThisEntity GetDetail( int id )
        //{
        //    ThisEntity entity = EntityMgr.GetForDetail( id );
        //    return entity;

        //}
        public static ThisEntity GetDetail(int id, bool skippingCache = false)
        {
            int      cacheMinutes = UtilityManager.GetAppKeyValue("learningOppCacheMinutes", 0);
            DateTime maxTime      = DateTime.Now.AddMinutes(cacheMinutes * -1);
            string   key          = "lopp_" + id.ToString();

            if (skippingCache == false &&
                HttpRuntime.Cache[key] != null && cacheMinutes > 0)
            {
                var cache = ( CachedLopp )HttpRuntime.Cache[key];
                try
                {
                    if (cache.lastUpdated > maxTime)
                    {
                        LoggingHelper.DoTrace(6, string.Format(thisClassName + ".GetDetail === Using cached version of Lopp, Id: {0}, {1}", cache.Item.Id, cache.Item.Name));

                        return(cache.Item);
                    }
                }
                catch (Exception ex)
                {
                    LoggingHelper.DoTrace(6, thisClassName + ".GetDetail === exception " + ex.Message);
                }
            }
            else
            {
                LoggingHelper.DoTrace(8, thisClassName + string.Format(".GetDetail === Retrieving full version of Lopp, Id: {0}", id));
            }

            DateTime start = DateTime.Now;

            ThisEntity entity = EntityMgr.GetForDetail(id);

            DateTime end     = DateTime.Now;
            int      elasped = (end - start).Seconds;

            //Cache the output if more than specific seconds,
            //NOTE need to be able to force it for imports
            //&& elasped > 2
            if (key.Length > 0 && cacheMinutes > 0)
            {
                var newCache = new CachedLopp()
                {
                    Item        = entity,
                    lastUpdated = DateTime.Now
                };
                if (HttpContext.Current != null)
                {
                    if (HttpContext.Current.Cache[key] != null)
                    {
                        HttpRuntime.Cache.Remove(key);
                        HttpRuntime.Cache.Insert(key, newCache);

                        LoggingHelper.DoTrace(5, string.Format("==={0}.GetDetail $$$ Updating cached version of Lopp, Id: {1}, {2}", thisClassName, entity.Id, entity.Name));
                    }
                    else
                    {
                        LoggingHelper.DoTrace(5, string.Format("==={0}.GetDetail ****** Inserting new cached version of Lopp, Id: {1}, {2}", thisClassName, entity.Id, entity.Name));

                        System.Web.HttpRuntime.Cache.Insert(key, newCache, null, DateTime.Now.AddMinutes(cacheMinutes), TimeSpan.Zero);
                    }
                }
            }
            else
            {
                LoggingHelper.DoTrace(7, string.Format("==={0}.GetDetail $$$$$$ skipping caching of Lopp, Id: {1}, {2}, elasped:{3}", thisClassName, entity.Id, entity.Name, elasped));
            }

            return(entity);
        }
        /// <summary>
        /// Get all learning opportunties for the parent
        /// Uses the parent Guid to retrieve the related Entity, then uses the EntityId to retrieve the child objects.
        /// </summary>
        /// <param name="parentUid"></param>
        /// <param name="forProfilesList"></param>
        /// <returns></returns>
        public static List <ThisEntity> LearningOpps_GetAll(Guid parentUid,
                                                            bool forProfilesList,
                                                            bool isForCredentialDetails = false, int relationshipTypeId = 1)
        {
            List <ThisEntity> list   = new List <ThisEntity>();
            ThisEntity        entity = new ThisEntity();

            Entity parent = EntityManager.GetEntity(parentUid);

            if (parent == null || parent.Id == 0)
            {
                return(list);
            }
            //TODO - this was left over from the publisher, needs to be cleaned up
            bool includingProperties = isForCredentialDetails;
            bool includingProfiles   = false;

            if (isForCredentialDetails)
            {
                includingProperties = true;
                includingProfiles   = true;
            }
            LoggingHelper.DoTrace(7, string.Format("Entity_LearningOpps_GetAll: parentUid:{0} entityId:{1}, e.EntityTypeId:{2}", parentUid, parent.Id, parent.EntityTypeId));
            try
            {
                using (var context = new EntityContext())
                {
                    List <DBEntity> results = context.Entity_LearningOpportunity
                                              .Where(s => s.EntityId == parent.Id && s.RelationshipTypeId == relationshipTypeId)
                                              .OrderBy(s => s.LearningOpportunity.Name)
                                              .ToList();

                    if (results != null && results.Count > 0)
                    {
                        foreach (DBEntity item in results)
                        {
                            entity = new ThisEntity();
                            if (item.LearningOpportunity != null && item.LearningOpportunity.EntityStateId > 1)
                            {
                                if (forProfilesList || isForCredentialDetails)
                                {
                                    LearningOpportunityManager.MapFromDB_Basic(item.LearningOpportunity, entity,
                                                                               true);

                                    if (isForCredentialDetails)
                                    {
                                        entity.EstimatedDuration = DurationProfileManager.GetAll(entity.RowId);
                                        LearningOpportunityManager.MapFromDB_HasPart(entity, false);
                                        LearningOpportunityManager.MapFromDB_Competencies(entity);
                                    }
                                    list.Add(entity);
                                }
                                else
                                {
                                    if (CacheManager.IsLearningOpportunityAvailableFromCache(item.LearningOpportunityId, ref entity))
                                    {
                                        list.Add(entity);
                                    }
                                    else
                                    {
                                        //TODO - is this section used??
                                        //to determine minimum needed for a or detail page
                                        LearningOpportunityManager.MapFromDB(item.LearningOpportunity, entity,
                                                                             includingProperties,
                                                                             includingProfiles,
                                                                             false //includeWhereUsed
                                                                             );
                                        list.Add(entity);
                                        if (entity.HasPart.Count > 0)
                                        {
                                            CacheManager.AddLearningOpportunityToCache(entity);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    return(list);
                }
            }
            catch (Exception ex)
            {
                LoggingHelper.LogError(ex, thisClassName + string.Format(".LearningOpps_GetAll. Guid: {0}, parentType: {1} ({2}), ", parentUid, parent.EntityType, parent.EntityBaseId));
            }
            return(list);
        }
        /// <summary>
        /// Get all learning opportunties for the parent
        /// Uses the parent Guid to retrieve the related Entity, then uses the EntityId to retrieve the child objects.
        /// </summary>
        /// <param name="parentUid"></param>
        /// <param name="forProfilesList"></param>
        /// <returns></returns>
        public static List <ThisEntity> LearningOpps_GetAll(Guid parentUid,
                                                            bool forProfilesList,
                                                            bool isForCredentialDetails = false)
        {
            List <ThisEntity> list   = new List <ThisEntity>();
            ThisEntity        entity = new ThisEntity();

            Entity parent = EntityManager.GetEntity(parentUid);

            if (parent == null || parent.Id == 0)
            {
                return(list);
            }
            //TODO - this was left over from the publisher, needs to be cleaned up
            bool includingProperties = isForCredentialDetails;
            bool includingProfiles   = false;

            if (isForCredentialDetails)
            {
                includingProperties = true;
                includingProfiles   = true;
            }
            LoggingHelper.DoTrace(7, string.Format("Entity_LearningOpps_GetAll: parentUid:{0} entityId:{1}, e.EntityTypeId:{2}", parentUid, parent.Id, parent.EntityTypeId));
            try
            {
                using (var context = new EntityContext())
                {
                    List <DBEntity> results = context.Entity_LearningOpportunity
                                              .Where(s => s.EntityId == parent.Id)
                                              .OrderBy(s => s.LearningOpportunity.Name)
                                              .ToList();

                    if (results != null && results.Count > 0)
                    {
                        foreach (DBEntity item in results)
                        {
                            entity = new ThisEntity();
                            if (item.LearningOpportunity != null && item.LearningOpportunity.EntityStateId > 1)
                            {
                                if (forProfilesList || isForCredentialDetails)
                                {
                                    LearningOpportunityManager.MapFromDB_Basic(item.LearningOpportunity, entity,
                                                                               true);

                                    //entity.Id = item.LearningOpportunityId;
                                    //                           entity.RowId = item.LearningOpportunity.RowId;

                                    //                           entity.Name = item.LearningOpportunity.Name;
                                    //                           entity.Description = item.LearningOpportunity.Description == null ? "" : item.LearningOpportunity.Description;
                                    //entity.EntityStateId = ( int )( item.LearningOpportunity.EntityStateId ?? 1 );
                                    //entity.SubjectWebpage = item.LearningOpportunity.SubjectWebpage;
                                    //                           entity.CTID = item.LearningOpportunity.CTID;
                                    //also get costs - really only need the profile list view
                                    //entity.EstimatedCost = CostProfileManager.GetAllForList( entity.RowId );
                                    //entity.CommonCosts = Entity_CommonCostManager.GetAll( entity.RowId );
                                    //get durations - need this for search and compare
                                    //entity.EstimatedDuration = DurationProfileManager.GetAll( entity.RowId );
                                    if (isForCredentialDetails)
                                    {
                                        entity.EstimatedDuration = DurationProfileManager.GetAll(entity.RowId);
                                        LearningOpportunityManager.MapFromDB_HasPart(entity, false);
                                        LearningOpportunityManager.MapFromDB_Competencies(entity);
                                    }
                                    list.Add(entity);
                                }
                                else
                                {
                                    if (CacheManager.IsLearningOpportunityAvailableFromCache(item.LearningOpportunityId, ref entity))
                                    {
                                        list.Add(entity);
                                    }
                                    else
                                    {
                                        //TODO - is this section used??
                                        //to determine minimum needed for a or detail page
                                        LearningOpportunityManager.MapFromDB(item.LearningOpportunity, entity,
                                                                             includingProperties,
                                                                             includingProfiles,
                                                                             false //includeWhereUsed
                                                                             );
                                        list.Add(entity);
                                        if (entity.HasPart.Count > 0)
                                        {
                                            CacheManager.AddLearningOpportunityToCache(entity);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    return(list);
                }
            }
            catch (Exception ex)
            {
                LoggingHelper.LogError(ex, thisClassName + ".LearningOpps_GetAll");
            }
            return(list);
        }