Beispiel #1
0
        public Domain.SerialNumberRule FindByEntityId(Guid entityid)
        {
            List <Domain.SerialNumberRule> entities = _cacheService.GetVersionItems(entityid.ToString(), () =>
            {
                return(this.Query(n => n.Where(x => x.EntityId == entityid)));
            });

            if (entities.NotEmpty())
            {
                return(entities.SingleOrDefault(x => x.StateCode == Core.RecordState.Enabled));
            }
            return(null);
        }
Beispiel #2
0
        public List <Domain.Attribute> FindByEntityId(Guid entityId)
        {
            string sIndex = string.Join("/", entityId.ToString());
            List <Domain.Attribute> result = _cacheService.GetVersionItems(sIndex, () =>
            {
                return(_attributeRepository.Query(n => n.EntityId == entityId)?.ToList());
            });

            if (result.NotEmpty())
            {
                WrapLocalizedLabel(result);
            }
            return(result);
        }
Beispiel #3
0
        public List <Domain.Entity> FindByNames(params string[] name)
        {
            string sIndex   = string.Join("/", name);
            var    entities = _cacheService.GetVersionItems(sIndex, () =>
            {
                return(this.Query(n => n.Where(f => f.Name.In(name))));
            }
                                                            );

            if (entities != null)
            {
                WrapLocalizedLabel(entities);
            }
            return(entities);
        }
Beispiel #4
0
        public List <FilterRule> QueryByEntityId(Guid entityid, string eventName, RecordState?recordState)
        {
            List <FilterRule> entities = _cacheService.GetVersionItems(entityid + "/*/" + eventName + "/", () =>
            {
                if (recordState.HasValue)
                {
                    return(this.Query(n => n.Where(f => f.EntityId == entityid && f.EventName == eventName && f.StateCode == recordState.Value)));
                }
                return(this.Query(n => n.Where(f => f.EntityId == entityid && f.EventName == eventName)));
            });

            if (recordState.HasValue && entities.NotEmpty())
            {
                entities.RemoveAll(x => x.StateCode != recordState);
            }
            return(entities);
        }
Beispiel #5
0
        public Domain.QueryView FindEntityDefaultView(Guid entityId)
        {
            List <Domain.QueryView> views = _cacheService.GetVersionItems(entityId.ToString(), () =>
            {
                return(this.QueryAuthorized(n => n.Where(f => f.EntityId == entityId)));
            });

            Domain.QueryView defaultView = null;
            if (views.NotEmpty())
            {
                defaultView = views.FirstOrDefault(n => n.IsDefault == true);
            }
            if (defaultView != null)
            {
                WrapLocalizedLabel(defaultView);
            }
            return(defaultView);
        }
Beispiel #6
0
        public List <Domain.RelationShip> QueryByEntityId(Guid?referencingEntityId, Guid?referencedEntityId)
        {
            List <Domain.RelationShip> result = _cacheService.GetVersionItems(referencingEntityId + "/" + referencedEntityId, () =>
            {
                if (referencingEntityId.HasValue && referencedEntityId.HasValue)
                {
                    return(_relationShipRepository.Query(x => x.ReferencingEntityId == referencingEntityId.Value && x.ReferencedEntityId == referencedEntityId.Value)?.ToList());
                }
                else if (referencingEntityId.HasValue)
                {
                    return(_relationShipRepository.Query(x => x.ReferencingEntityId == referencingEntityId.Value)?.ToList());
                }
                return(_relationShipRepository.Query(x => x.ReferencedEntityId == referencedEntityId.Value)?.ToList());
            });

            //WrapLocalizedLabel(result);
            return(result);
        }
Beispiel #7
0
        public Domain.SystemForm FindEntityDefaultForm(Guid entityId)
        {
            List <Domain.SystemForm> items = _cacheService.GetVersionItems(entityId.ToString(), () =>
            {
                return(_systemFormRepository.Query(f => f.EntityId == entityId)?.ToList());
            });

            Domain.SystemForm defaultForm = null;
            if (items.NotEmpty())
            {
                defaultForm = items.FirstOrDefault(n => n.IsDefault == true);
            }
            if (defaultForm != null)
            {
                WrapLocalizedLabel(defaultForm);
            }
            return(defaultForm);
        }
Beispiel #8
0
        public List <EntityMap> FindAll()
        {
            var entities = _cacheService.GetVersionItems("all", () =>
            {
                return(PreCacheAll());
            });

            return(entities);
        }
Beispiel #9
0
        public List <EntityPlugin> QueryByEntityId(Guid entityid, string eventName, Guid?businessObjectId = null, PlugInType typeCode = PlugInType.Entity)
        {
            List <EntityPlugin> entities = _cacheService.GetVersionItems(entityid + "/" + eventName, () =>
            {
                return(_entityPluginRepository.Query(x => x.EntityId == entityid)?.ToList());
            });

            if (entities.NotEmpty())
            {
                if (businessObjectId.HasValue)
                {
                    entities.RemoveAll(x => !(x.EventName.IsCaseInsensitiveEqual(eventName) && x.BusinessObjectId == businessObjectId.Value && x.TypeCode == (int)typeCode));
                }
                else
                {
                    entities.RemoveAll(x => !(x.EventName.IsCaseInsensitiveEqual(eventName) && x.BusinessObjectId == Guid.Empty && x.TypeCode == (int)typeCode));
                }
            }
            return(entities.OrderBy(x => x.ProcessOrder).ToList());
        }
Beispiel #10
0
        public List <DuplicateRule> QueryByEntityId(Guid entityid, RecordState?state)
        {
            string sindex = entityid.ToString() + "/" + (state.HasValue ? "" : state.Value.ToString());
            List <DuplicateRule> entities = _cacheService.GetVersionItems(sindex, () =>
            {
                if (state.HasValue)
                {
                    return(this.Query(n => n.Where(f => f.EntityId == entityid && f.StateCode == state.Value)));
                }
                return(this.Query(n => n.Where(f => f.EntityId == entityid)));
            });

            if (entities.NotEmpty())
            {
                if (state.HasValue)
                {
                    entities.RemoveAll(x => x.StateCode != state.Value);
                }
            }
            return(entities);
        }
Beispiel #11
0
        public List <Domain.WebResource> FindByIds(params Guid[] ids)
        {
            string sIndex = string.Join("/", ids);
            var    datas  = _cacheService.GetVersionItems(sIndex, () =>
            {
                return(_webResourceRepository.Query(n => n.WebResourceId.In(ids))?.ToList());
            }
                                                          );

            WrapLocalizedLabel(datas);
            return(datas);
        }
Beispiel #12
0
        public List <Domain.OptionSet> FindAll()
        {
            var entities = _cacheService.GetVersionItems("all", () =>
            {
                return(PreCacheAll());
            });

            if (entities != null)
            {
                WrapLocalizedLabel(entities);
            }
            return(entities);
        }