public static PathwaySet PathwaySetGetByCtid(string ctid)
        {
            var entity = new PathwaySet();

            if (string.IsNullOrWhiteSpace(ctid))
            {
                return(entity);
            }

            return(PathwaySetManager.GetByCtid(ctid));
        }
Example #2
0
        public static TopLevelObject GetEntityAsTopLevelObject(Guid uid)
        {
            TopLevelObject tlo = new TopLevelObject();

            var entity = EntityManager.GetEntity(uid, false);

            if (entity == null || entity.Id == 0)
            {
                return(null);
            }
            //
            if (entity.EntityTypeId == CodesManager.ENTITY_TYPE_CREDENTIAL)
            {
                //actually should return some type info
                tlo = CredentialManager.GetBasic(entity.EntityBaseId);
                tlo.EntityTypeId = entity.EntityTypeId;
            }
            else if (entity.EntityTypeId == CodesManager.ENTITY_TYPE_ORGANIZATION)
            {
                tlo = OrganizationManager.GetBasics(entity.EntityUid);
                tlo.EntityTypeId = entity.EntityTypeId;
            }
            else if (entity.EntityTypeId == CodesManager.ENTITY_TYPE_ASSESSMENT_PROFILE)
            {
                tlo = AssessmentManager.GetBasic(entity.EntityBaseId);
                tlo.EntityTypeId = entity.EntityTypeId;
            }
            else if (entity.EntityTypeId == CodesManager.ENTITY_TYPE_LEARNING_OPP_PROFILE)
            {
                tlo = LearningOpportunityManager.GetBasic(entity.EntityBaseId);
                tlo.EntityTypeId = entity.EntityTypeId;
            }
            else if (entity.EntityTypeId == CodesManager.ENTITY_TYPE_PATHWAY)
            {
                tlo = PathwayManager.GetBasic(entity.EntityBaseId);
                tlo.EntityTypeId = entity.EntityTypeId;
            }
            else if (entity.EntityTypeId == CodesManager.ENTITY_TYPE_PATHWAY_COMPONENT)
            {
                tlo = PathwayComponentManager.Get(entity.EntityBaseId);
                tlo.EntityTypeId = entity.EntityTypeId;
            }
            else if (entity.EntityTypeId == CodesManager.ENTITY_TYPE_PATHWAY_SET)
            {
                tlo = PathwaySetManager.Get(entity.EntityBaseId);
                tlo.EntityTypeId = entity.EntityTypeId;
            }
            else if (entity.EntityTypeId == CodesManager.ENTITY_TYPE_TRANSFER_VALUE_PROFILE)
            {
                tlo = TransferValueProfileManager.Get(entity.EntityBaseId);
                tlo.EntityTypeId = entity.EntityTypeId;
            }
            return(tlo);
        }
        public static List <PathwaySetSummary> GetPathwaySetsOwnedByOrg(int orgId, int maxRecords)
        {
            string where = "";
            List <string> competencies = new List <string>();
            int           totalRows    = 0;

            //only target full entities
            where = " ( base.EntityStateId = 3 ) ";

            if (orgId > 0)
            {
                where = where + " AND " + string.Format(" ( base.OrganizationId = {0} ) ", orgId);
            }

            LoggingHelper.DoTrace(5, "PathwayServices.GetPathwaySetsOwnedByOrg(). Filter: " + where);
            return(PathwaySetManager.Search(where, "", 1, maxRecords, ref totalRows));
        }
        public bool PathwaySetImport(PathwaySet entity, ref SaveStatus status)
        {
            //do a get, and add to cache before updating
            if (entity.Id > 0)
            {
                //need to force caching here
                //var detail = GetDetail( entity.Id );
            }
            bool          isValid  = new PathwaySetManager().Save(entity, ref status);
            List <string> messages = new List <string>();

            if (entity.Id > 0)
            {
                if (UtilityManager.GetAppKeyValue("delayingAllCacheUpdates", false) == false)
                {
                    //no caching at this time
                    //new CacheManager().PopulateEntityRelatedCaches( entity.RowId );
                    //update Elastic
                    if (UtilityManager.GetAppKeyValue("usingElasticPathwaySearch", false))
                    {
                        ElasticHelper.Pathway_UpdateIndex(entity.Id);
                    }
                    else
                    {
                        new SearchPendingReindexManager().Add(CodesManager.ENTITY_TYPE_PATHWAY_SET, entity.Id, 1, ref messages);
                        if (messages.Count > 0)
                        {
                            status.AddWarningRange(messages);
                        }
                    }
                }
                else
                {
                    new SearchPendingReindexManager().Add(CodesManager.ENTITY_TYPE_PATHWAY_SET, 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);
        }
        }        //

        public static List <PathwaySetSummary> DoPathwaySetSearch(MainSearchInput data, ref int totalRows)
        {
            string where = "";

            //only target full entities
            where = " ( base.EntityStateId = 3 ) ";

            //need to create a new category id for custom filters
            //SearchServices.HandleCustomFilters( data, 61, ref where );

            SetKeywordFilter(data.Keywords, false, ref where);
            SearchServices.SetSubjectsFilter(data, CodesManager.ENTITY_TYPE_PATHWAY, ref where);

            //SetPropertiesFilter( data, ref where );
            SearchServices.SetRolesFilter(data, ref where);
            SearchServices.SetBoundariesFilter(data, ref where);


            LoggingHelper.DoTrace(5, "PathwayServices.DoPathwaySetSearch(). Filter: " + where);
            return(PathwaySetManager.Search(where, data.SortOrder, data.StartPage, data.PageSize, ref totalRows));
        }
        public static PathwaySet PathwaySetGetDetail(int id)
        {
            var entity = PathwaySetManager.Get(id, true);

            return(entity);
        }
        //public static PathwaySet PathwaySetGetDetailByCtid( string ctid, bool skippingCache = false )
        //{
        //	var entity = new PathwaySet();
        //	if ( string.IsNullOrWhiteSpace( ctid ) )
        //		return entity;
        //	var record = PathwaySetManager.GetByCtid( ctid );

        //	return PathwaySetGetDetail( record.Id, skippingCache );
        //}
        public static PathwaySet PathwaySetGetBasic(int id)
        {
            var entity = PathwaySetManager.Get(id);

            return(entity);
        }