public static List <ThisEntity> GetTVPOwnedByOrg(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, "TransferValueServices.Search(). Filter: " + where); return(EntityMgr.Search(where, "", 1, maxRecords, ref totalRows)); }
public bool Import(ThisEntity entity, ref SaveStatus status) { 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 - not applicable yet //update Elastic if (Utilities.UtilityManager.GetAppKeyValue("updatingElasticIndexImmediately", false)) { //ElasticHelper.TransferValueProfile_UpdateIndex( entity.Id ); } else { new SearchPendingReindexManager().Add(CodesManager.ENTITY_TYPE_TRANSFER_VALUE_PROFILE, entity.Id, 1, ref messages); if (messages.Count > 0) { status.AddWarningRange(messages); } } //also update related org new SearchPendingReindexManager().Add(CodesManager.ENTITY_TYPE_ORGANIZATION, entity.OwningOrganizationId, 1, ref messages); } else { new SearchPendingReindexManager().Add(CodesManager.ENTITY_TYPE_TRANSFER_VALUE_PROFILE, entity.Id, 1, ref messages); if (entity.OwningOrganizationId > 0) { new SearchPendingReindexManager().Add(CodesManager.ENTITY_TYPE_ORGANIZATION, entity.OwningOrganizationId, 1, ref messages); } if (messages.Count > 0) { status.AddWarningRange(messages); } } //no caching needed yet //CacheManager.RemoveItemFromCache( "cframework", entity.Id ); } return(isValid); }
/// <summary> /// Get all TransferValueProfiles for the provided entity /// The returned entities are just the base /// </summary> /// <param name="parentUid"></param> /// <returns></returnsThisEntity public static List <TransferValueProfile> GetAll(Guid parentUid) { List <TransferValueProfile> list = new List <TransferValueProfile>(); TransferValueProfile entity = new TransferValueProfile(); Entity parent = EntityManager.GetEntity(parentUid); LoggingHelper.DoTrace(7, string.Format("EntityTransferValueProfiles_GetAll: parentUid:{0} entityId:{1}, e.EntityTypeId:{2}", parentUid, parent.Id, parent.EntityTypeId)); try { using (var context = new EntityContext()) { List <DBEntity> results = context.Entity_TransferValueProfile .Where(s => s.EntityId == parent.Id) .OrderBy(s => s.TransferValueProfile.Name) .ToList(); if (results != null && results.Count > 0) { foreach (DBEntity item in results) { entity = new TransferValueProfile(); //need to distinguish between on a detail page for conditions and TransferValueProfile detail //would usually only want basics here?? //17-05-26 mp- change to MapFromDB_Basic if (item.TransferValueProfile != null && item.TransferValueProfile.EntityStateId > 1) { TransferValueProfileManager.MapFromDB(item.TransferValueProfile, entity, false); list.Add(entity); } } } return(list); } } catch (Exception ex) { LoggingHelper.LogError(ex, thisClassName + string.Format(".EntityTransferValueProfiles_GetAll. Guid: {0}, parentType: {1} ({2}), ", parentUid, parent.EntityType, parent.EntityBaseId)); } return(list); }
} // public static List <ThisEntity> DoSearch(MainSearchInput data, ref int totalRows) { string where = ""; List <string> competencies = new List <string>(); //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_TRANSFER_VALUE_PROFILE, ref where ); //SetPropertiesFilter( data, ref where ); SearchServices.SetRolesFilter(data, ref where); SearchServices.SetBoundariesFilter(data, ref where); //Competencies //SetCompetenciesFilter( data, ref where, ref competencies ); LoggingHelper.DoTrace(5, "TransferValueServices.Search(). Filter: " + where); return(EntityMgr.Search(where, data.SortOrder, data.StartPage, data.PageSize, ref totalRows)); }
public static ThisEntity Get(int parentId, int TransferValueProfileId) { ThisEntity entity = new ThisEntity(); if (parentId < 1 || TransferValueProfileId < 1) { return(entity); } try { using (var context = new EntityContext()) { EM.Entity_TransferValueProfile from = context.Entity_TransferValueProfile .SingleOrDefault(s => s.TransferValueProfileId == TransferValueProfileId && s.EntityId == parentId); if (from != null && from.Id > 0) { entity.Id = from.Id; entity.TransferValueProfileId = from.TransferValueProfileId; entity.EntityId = from.EntityId; entity.TransferValueProfile = new TransferValueProfile(); TransferValueProfileManager.MapFromDB(from.TransferValueProfile, entity.TransferValueProfile); if (IsValidDate(from.Created)) { entity.Created = ( DateTime )from.Created; } } } } catch (Exception ex) { LoggingHelper.LogError(ex, thisClassName + ".Get"); } return(entity); } //