public static ThisEntity GetByCtid(string ctid)
        {
            ThisEntity entity = new ThisEntity();

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

            return(EntityMgr.GetByCtid(ctid));
        }
        public bool Import(ThisEntity entity, ref SaveStatus status)
        {
            bool isValid = new EntityMgr().Save(entity, ref status);

            if (entity.Id > 0)
            {
                //update cache
                new CacheManager().PopulateEntityRelatedCaches(entity.RowId);

                //TODO - will need to update related elastic indices
                new SearchPendingReindexManager().Add(CodesManager.ENTITY_TYPE_ORGANIZATION, entity.OrganizationId, 1, ref messages);
            }

            return(isValid);
        }
示例#3
0
        /// <summary>
        /// Get all ConditionManifests for the provided entity
        /// The returned entities are just the basic, unless for the detail view
        /// </summary>
        /// <param name="parentUid"></param>
        /// <returns></returns>
        public static List <ConditionManifest> GetAll(Guid parentUid)
        {
            List <ConditionManifest> list = new List <ConditionManifest>();

            if (parentUid == null)
            {
                return(list);
            }
            ConditionManifest entity = new ConditionManifest();

            Entity parent = EntityManager.GetEntity(parentUid);

            LoggingHelper.DoTrace(7, string.Format("Entity_CommonConditionManager_GetAll: parentUid:{0} entityId:{1}, e.EntityTypeId:{2}", parentUid, parent.Id, parent.EntityTypeId));

            try
            {
                using (var context = new EntityContext())
                {
                    List <DBEntity> results = context.Entity_CommonCondition
                                              .Where(s => s.EntityId == parent.Id)
                                              .OrderBy(s => s.ConditionManifestId)
                                              .ToList();

                    if (results != null && results.Count > 0)
                    {
                        foreach (DBEntity item in results)
                        {
                            entity = new ConditionManifest();
                            //
                            //Need all the data for detail page - NA 6/2/2017
                            if (item.ConditionManifest != null && item.ConditionManifest.Id > 0 && item.ConditionManifest.EntityStateId > 2)
                            {
                                entity = ConditionManifestManager.Get(item.ConditionManifestId);

                                list.Add(entity);
                            }
                        }
                    }
                    return(list);
                }
            }
            catch (Exception ex)
            {
                LoggingHelper.LogError(ex, thisClassName + ".GetAll");
            }
            return(list);
        }