示例#1
0
        private IList <Acatalog> GetCatalogs(Type type, TypeActionInSystem typeActionInSystem, CatalogDto catalog = null)
        {
            var filter = new AcatalogFilter
            {
                UserPrivilege = new UserPrivilegeFilter
                {
                    Role = new RoleFilter
                    {
                        UserRoles = new UserRoleFilter()
                    },
                    UnitFunction = new UnitFunctionFilter
                    {
                        Standard = typeActionInSystem,
                        SectionOfSystemUnitcode = new SectionOfSystemFilter
                        {
                            UnitCode = GetSectionOfSystem(type)
                        }
                    }
                }
            };

            if (catalog != null)
            {
                filter.Rn = catalog.Rn;
            }

            return(GetEntities <AcatalogFilter, Acatalog>(filter));
        }
示例#2
0
        /// <summary>
        /// The get catalog hierarchical.
        /// </summary>
        /// <param name="type">
        /// The type.
        /// </param>
        /// <param name="typeActionInSystem">
        /// The type action in system.
        /// </param>
        /// <returns>
        /// The <see cref="CatalogHierarchical"/>.
        /// </returns>
        public CatalogHierarchical GetCatalogHierarchical([NotNull] Type type, TypeActionInSystem typeActionInSystem)
        {
            var filter = new AcatalogFilter
            {
                SectionOfSystem =
                    new SectionOfSystemFilter {
                    UnitCode = GetSectionOfSystem(type)
                }
            };

            IList <CatalogHierarchical> catalogfull =
                GetEntities <AcatalogFilter, Acatalog>(filter).ConvertToHierarchical();

            if (catalogfull == null || !catalogfull.Any())
            {
                throw new CatalogNotExistException(GetSectionOfSystem(type));
            }

            var access = GetCatalogs(type, typeActionInSystem).SetIsAccess(catalogfull);

            return(access[0]);
        }