Exemplo n.º 1
0
        private static List <AppService> GetAppServiceByAppId(int appId)
        {
            var parmater = new AppServiceSearchPamater();

            parmater.SetAppId(appId, PamaterOperationType.Equal);
            parmater.SetStatus(null, PamaterOperationType.In);
            parmater.StatusList = new List <byte>()
            {
                0, 1
            };
            var source = AppServiceDal.GetList(parmater);

            if (source != null)
            {
                var functionParamter = new AppFunctionSearchPamater();
                functionParamter.SetAppServiceId(null, PamaterOperationType.In);
                functionParamter.AppServiceIdList = source.Select(a => a.AppServiceId).ToList();
                functionParamter.SetStatus(null, PamaterOperationType.In);
                functionParamter.StatusList = new List <byte>()
                {
                    0, 1
                };
                var functionSource = AppFunctionDal.GetList(functionParamter);
                if (functionSource != null)
                {
                    source.ForEach(ap =>
                    {
                        ap.AppFunctions = functionSource.FindAll(af => af.AppServiceId == ap.AppServiceId);
                    });
                }
            }

            return(source);
        }
Exemplo n.º 2
0
        public FunctionListResult <AppService> GetJobAuthority(int jobId)
        {
            var r       = new FunctionListResult <AppService>();
            var pamater = new JobGrantSearchPamater();

            pamater.SetJobId(jobId, PamaterOperationType.Equal);
            var list = JobGrantDal.GetList(pamater);
            List <AppService> asList = null;

            r.Data = asList;
            if (list != null)
            {
                asList = list.Select(a => new AppService()
                {
                    AppServiceId = a.AppServiceId, AppFunctions = new List <AppFunction>()
                }).ToList();
                var functionPamater = new AppFunctionSearchPamater();
                functionPamater.SetAppFuntionId(null, PamaterOperationType.In);
                functionPamater.AppFuntionIdList = list.Select(a => a.AppFunctionId).ToList();
                functionPamater.SetStatus(1, PamaterOperationType.Equal);
                var appFunctions = AppFunctionDal.GetList(functionPamater);
                if (appFunctions != null)
                {
                    if (asList != null)
                    {
                        asList.ForEach(t => {
                            t.AppFunctions = appFunctions.FindAll(af => af.AppServiceId == t.AppServiceId);
                        });
                    }
                }
            }
            return(r);
        }
Exemplo n.º 3
0
 public FunctionListResult <AppFunction> GetList(AppFunctionSearchPamater pamater)
 {
     var r = new FunctionListResult <AppFunction>(); r.Data = AppFunctionDal.GetList(pamater); return(r);
 }