Beispiel #1
0
        public List <Domain.Report> QueryAuthorized(Func <QueryDescriptor <Domain.Report>, QueryDescriptor <Domain.Report> > container)
        {
            QueryDescriptor <Domain.Report> q = container(QueryDescriptorBuilder.Build <Domain.Report>());
            var datas = _reportRepository.Query(q)?.ToList();

            if (datas.NotEmpty())
            {
                var authIds = datas.Where(x => x.IsAuthorization).Select(x => x.ReportId).ToArray();
                if (authIds.NotEmpty())
                {
                    var authorizedItems = _roleObjectAccessService.Authorized(ReportDefaults.ModuleName, authIds);
                    datas.RemoveAll(x => x.IsAuthorization && !authorizedItems.Contains(x.ReportId));
                }
            }

            WrapLocalizedLabel(datas);
            return(datas);
        }
Beispiel #2
0
        public List <Domain.QueryView> QueryAuthorized(Func <QueryDescriptor <Domain.QueryView>, QueryDescriptor <Domain.QueryView> > container)
        {
            QueryDescriptor <Domain.QueryView> q = container(QueryDescriptorBuilder.Build <Domain.QueryView>());
            var datas = _queryViewRepository.Query(q).ToList();

            if (!_currentUser.IsSuperAdmin && datas.NotEmpty())
            {
                var authIds = datas.Where(x => x.AuthorizationEnabled).Select(x => x.QueryViewId).ToArray();
                if (authIds.NotEmpty())
                {
                    var authorizedItems = _roleObjectAccessService.Authorized(QueryViewDefaults.ModuleName, authIds);
                    datas.RemoveAll(x => x.AuthorizationEnabled && !authorizedItems.Contains(x.QueryViewId));
                }
            }

            WrapLocalizedLabel(datas);
            return(datas);
        }
Beispiel #3
0
        /// <summary>
        /// 查询数据
        /// </summary>
        /// <param name="predicate">过滤条件</param>
        /// <param name="sorts">排序</param>
        /// <returns></returns>
        public List <T> Query(Expression <Func <T, bool> > predicate, params Func <SortDescriptor <T>, SortDescriptor <T> >[] sorts)
        {
            QueryDescriptor <T> qq = QueryDescriptorBuilder.Build <T>().Where(predicate).Sort(sorts);
            ////var prd = new DomainTypeModifier(typeof(TImpl)).Modify(predicate);
            //QueryDescriptor<TImpl> q = QueryBuilder.Build<TImpl>();
            ////query.Where((Expression<Func<TImpl, bool>>)prd);
            //q.QueryText = qq.QueryText;
            //q.Parameters = qq.Parameters;

            ExecuteContext <TImpl> ctx = PocoHelper.ParseContext <T, TImpl>(MetaData, qq);
            var pageDatas = _repository.Query(ctx);

            if (pageDatas != null)
            {
                return(pageDatas.ToList <T>());
            }
            return(null);
        }
Beispiel #4
0
        public List <Domain.SystemForm> QueryAuthorized(Func <QueryDescriptor <Domain.SystemForm>, QueryDescriptor <Domain.SystemForm> > container, FormType formType)
        {
            container += (QueryDescriptor <Domain.SystemForm> x) => { x.Where(f => f.FormType == (int)formType); return(x); };
            QueryDescriptor <Domain.SystemForm> q = container(QueryDescriptorBuilder.Build <Domain.SystemForm>());
            var datas = _systemFormRepository.Query(q)?.ToList();

            if (datas.NotEmpty())
            {
                var formIds = datas.Where(x => x.AuthorizationEnabled).Select(x => x.SystemFormId).ToArray();
                if (formIds.NotEmpty())
                {
                    var authorizedItems = _roleObjectAccessService.Authorized(formType == FormType.Dashboard ? DashBoardDefaults.ModuleName : FormDefaults.ModuleName, formIds);
                    datas.RemoveAll(x => x.AuthorizationEnabled && !authorizedItems.Contains(x.SystemFormId));
                }
            }

            WrapLocalizedLabel(datas);
            return(datas);
        }
Beispiel #5
0
        public List <WorkFlow> QueryAuthorized(Guid entityid, FlowType category)
        {
            var q = QueryDescriptorBuilder.Build <WorkFlow>();

            q.Where(f => f.EntityId == entityid);
            var datas = _workFlowRepository.Query(x => x.EntityId == entityid && x.StateCode == Xms.Core.RecordState.Enabled && x.Category == (int)category)?.ToList();

            if (datas.NotEmpty())
            {
                var authIds = datas.Where(x => x.AuthorizationEnabled).Select(x => x.WorkFlowId).ToArray();
                if (authIds.NotEmpty())
                {
                    var authorizedItems = _roleObjectAccessService.Authorized(WorkFlowDefaults.ModuleName, authIds);
                    datas.RemoveAll(x => x.AuthorizationEnabled && !authorizedItems.Contains(x.WorkFlowId));
                }
            }
            WrapLocalizedLabel(datas);
            return(datas);
        }
        public List <BusinessProcessFlowInstance> Query(Func <QueryDescriptor <BusinessProcessFlowInstance>, QueryDescriptor <BusinessProcessFlowInstance> > container)
        {
            QueryDescriptor <BusinessProcessFlowInstance> q = container(QueryDescriptorBuilder.Build <BusinessProcessFlowInstance>());

            return(_businessProcessFlowInstanceRepository.Query(q)?.ToList());
        }
Beispiel #7
0
        public List <Language> Query(Func <QueryDescriptor <Language>, QueryDescriptor <Language> > container)
        {
            QueryDescriptor <Language> q = container(QueryDescriptorBuilder.Build <Language>());

            return(_languageRepository.Query(q)?.ToList());
        }
Beispiel #8
0
        public List <Topic> Query(Func <QueryDescriptor <Topic>, QueryDescriptor <Topic> > container)
        {
            QueryDescriptor <Topic> q = container(QueryDescriptorBuilder.Build <Topic>());

            return(_topicRepository.Query(q)?.ToList());
        }
Beispiel #9
0
        public PagedList <Topic> QueryPaged(Func <QueryDescriptor <Topic>, QueryDescriptor <Topic> > container)
        {
            QueryDescriptor <Topic> q = container(QueryDescriptorBuilder.Build <Topic>());

            return(_topicRepository.QueryPaged(q));
        }
Beispiel #10
0
        public List <EventMessage> Query(Func <QueryDescriptor <EventMessage>, QueryDescriptor <EventMessage> > container)
        {
            QueryDescriptor <EventMessage> q = container(QueryDescriptorBuilder.Build <EventMessage>());

            return(_eventMessageRepository.Query(q)?.ToList());
        }
Beispiel #11
0
        public PagedList <Consumer> QueryPaged(Func <QueryDescriptor <Consumer>, QueryDescriptor <Consumer> > container)
        {
            QueryDescriptor <Consumer> q = container(QueryDescriptorBuilder.Build <Consumer>());

            return(_consumerRepository.QueryPaged(q));
        }
        public List <RoleObjectAccessEntityPermission> Query(Func <QueryDescriptor <RoleObjectAccessEntityPermission>, QueryDescriptor <RoleObjectAccessEntityPermission> > container)
        {
            QueryDescriptor <RoleObjectAccessEntityPermission> q = container(QueryDescriptorBuilder.Build <RoleObjectAccessEntityPermission>());

            return(_roleObjectAccessEntityPermissionRepository.Query(q)?.ToList());
        }
Beispiel #13
0
        public PagedList <ImportData> QueryPaged(Func <QueryDescriptor <ImportData>, QueryDescriptor <ImportData> > container)
        {
            QueryDescriptor <ImportData> q = container(QueryDescriptorBuilder.Build <ImportData>());

            return(_importDataRepository.QueryPaged(q));
        }
Beispiel #14
0
        public PagedList <Domain.Organization> QueryPaged(Func <QueryDescriptor <Domain.Organization>, QueryDescriptor <Domain.Organization> > container)
        {
            QueryDescriptor <Domain.Organization> q = container(QueryDescriptorBuilder.Build <Domain.Organization>());

            return(_organizationRepository.QueryPaged(q));
        }
Beispiel #15
0
        public PagedList <EntityPlugin> QueryPaged(Func <QueryDescriptor <EntityPlugin>, QueryDescriptor <EntityPlugin> > container)
        {
            QueryDescriptor <EntityPlugin> q = container(QueryDescriptorBuilder.Build <EntityPlugin>());

            return(_entityPluginRepository.QueryPaged(q));
        }
Beispiel #16
0
        public List <Domain.Solution> Query(Func <QueryDescriptor <Domain.Solution>, QueryDescriptor <Domain.Solution> > container)
        {
            QueryDescriptor <Domain.Solution> q = container(QueryDescriptorBuilder.Build <Domain.Solution>());

            return(_solutionRepository.Query(q)?.ToList());
        }
Beispiel #17
0
        public List <EntityLog> Query(Func <QueryDescriptor <EntityLog>, QueryDescriptor <EntityLog> > container)
        {
            QueryDescriptor <EntityLog> q = container(QueryDescriptorBuilder.Build <EntityLog>());

            return(_entityLogRepository.Query(q)?.ToList());
        }
Beispiel #18
0
        public List <BusinessUnit> Query(Func <QueryDescriptor <BusinessUnit>, QueryDescriptor <BusinessUnit> > container)
        {
            QueryDescriptor <BusinessUnit> q = container(QueryDescriptorBuilder.Build <BusinessUnit>());

            return(_businessUnitRepository.Query(q)?.ToList());
        }
Beispiel #19
0
        public List <TeamMembership> Query(Func <QueryDescriptor <TeamMembership>, QueryDescriptor <TeamMembership> > container)
        {
            QueryDescriptor <TeamMembership> q = container(QueryDescriptorBuilder.Build <TeamMembership>());

            return(_teamMembershipRepository.Query(q)?.ToList());
        }
Beispiel #20
0
        public List <ImportFile> Query(Func <QueryDescriptor <ImportFile>, QueryDescriptor <ImportFile> > container)
        {
            QueryDescriptor <ImportFile> q = container(QueryDescriptorBuilder.Build <ImportFile>());

            return(_importFileRepository.Query(q)?.ToList());
        }
Beispiel #21
0
        public List <FilterRule> Query(Func <QueryDescriptor <FilterRule>, QueryDescriptor <FilterRule> > container)
        {
            QueryDescriptor <FilterRule> q = container(QueryDescriptorBuilder.Build <FilterRule>());

            return(_filterRuleRepository.Query(q)?.ToList());
        }
        public List <DuplicateRuleCondition> Query(Func <QueryDescriptor <DuplicateRuleCondition>, QueryDescriptor <DuplicateRuleCondition> > container)
        {
            QueryDescriptor <DuplicateRuleCondition> q = container(QueryDescriptorBuilder.Build <DuplicateRuleCondition>());

            return(_duplicateRuleConditionRepository.Query(q)?.ToList());
        }
Beispiel #23
0
        public List <EntityPermission> Query(Func <QueryDescriptor <EntityPermission>, QueryDescriptor <EntityPermission> > container)
        {
            QueryDescriptor <EntityPermission> q = container(QueryDescriptorBuilder.Build <EntityPermission>());

            return(_entityPermissionRepository.Query(q)?.ToList());
        }
        public PagedList <PrincipalObjectAccess> QueryPaged(Func <QueryDescriptor <PrincipalObjectAccess>, QueryDescriptor <PrincipalObjectAccess> > container)
        {
            QueryDescriptor <PrincipalObjectAccess> q = container(QueryDescriptorBuilder.Build <PrincipalObjectAccess>());

            return(_principalObjectAccessRepository.QueryPaged(q));
        }
Beispiel #25
0
        public PagedList <WorkFlowInstance> QueryPaged(Func <QueryDescriptor <WorkFlowInstance>, QueryDescriptor <WorkFlowInstance> > container)
        {
            QueryDescriptor <WorkFlowInstance> q = container(QueryDescriptorBuilder.Build <WorkFlowInstance>());

            return(_workFlowInstanceRepository.QueryPaged(q));
        }
Beispiel #26
0
        public List <RoleObjectAccess> Query(Func <QueryDescriptor <RoleObjectAccess>, QueryDescriptor <RoleObjectAccess> > container)
        {
            QueryDescriptor <RoleObjectAccess> q = container(QueryDescriptorBuilder.Build <RoleObjectAccess>());

            return(_roleObjectAccessRepository.Query(q)?.ToList());
        }
        public List <WorkFlowProcessLog> Query(Func <QueryDescriptor <WorkFlowProcessLog>, QueryDescriptor <WorkFlowProcessLog> > container)
        {
            QueryDescriptor <WorkFlowProcessLog> q = container(QueryDescriptorBuilder.Build <WorkFlowProcessLog>());

            return(_workFlowProcessLogRepository.Query(q)?.ToList());
        }
Beispiel #28
0
        public List <Domain.ResourceOwner> Query(Func <QueryDescriptor <Domain.ResourceOwner>, QueryDescriptor <Domain.ResourceOwner> > container)
        {
            QueryDescriptor <Domain.ResourceOwner> q = container(QueryDescriptorBuilder.Build <Domain.ResourceOwner>());

            return(_resourceOwnerRepository.Query(q)?.ToList());
        }
Beispiel #29
0
        public List <Consumer> Query(Func <QueryDescriptor <Consumer>, QueryDescriptor <Consumer> > container)
        {
            QueryDescriptor <Consumer> q = container(QueryDescriptorBuilder.Build <Consumer>());

            return(_consumerRepository.Query(q)?.ToList());
        }
Beispiel #30
0
        /// <summary>
        /// 分页查询记录
        /// </summary>
        /// <param name="container">查询表达式</param>
        /// <returns></returns>
        public PagedList <WorkFlowProcess> QueryPaged(Func <QueryDescriptor <WorkFlowProcess>, QueryDescriptor <WorkFlowProcess> > container)
        {
            QueryDescriptor <WorkFlowProcess> q = container(QueryDescriptorBuilder.Build <WorkFlowProcess>());

            return(_workFlowProcessRepository.QueryPaged(q));
        }