Esempio n. 1
0
        public List <OrganizationUnit> FindChildren(long?parentId, bool recursive = false)
        {
            if (!recursive)
            {
                return(OrganizationUnitRepository.GetAllList(ou => ou.ParentId == parentId));
            }

            if (!parentId.HasValue)
            {
                return(OrganizationUnitRepository.GetAllList());
            }

            var code = GetCode(parentId.Value);

            return(OrganizationUnitRepository.GetAllList(
                       ou => ou.Code.StartsWith(code) && ou.Id != parentId.Value
                       ));
        }