コード例 #1
0
ファイル: AppServiceServer'1.cs プロジェクト: xqj/Security
        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);
        }
コード例 #2
0
ファイル: AppServiceServer'1.cs プロジェクト: xqj/Security
        public FunctionOpenResult <bool> CancleById(List <int> idList)
        {
            var r = new FunctionOpenResult <bool>();

            r.Data = AppServiceDal.CancleById(idList);
            return(r);
        }
コード例 #3
0
ファイル: AppServiceServer.cs プロジェクト: xqj/Security
        public FunctionResult <AppService> Create(AppService info)
        {
            var r = new FunctionResult <AppService>(); int id = AppServiceDal.Add(info); if (id > 0)

            {
                r.Data = info; r.Data.AppServiceId = id;
            }

            return(r);
        }
コード例 #4
0
ファイル: AppServiceServer'1.cs プロジェクト: xqj/Security
        public FunctionOpenResult <bool> ExistAppService(int appId)
        {
            var r = new FunctionOpenResult <bool>();

            var parmater = new AppServiceSearchPamater();

            parmater.SetAppId(appId, PamaterOperationType.Equal);
            var source = AppServiceDal.GetList(parmater);

            if ((source != null) && (source.Count > 0))
            {
                r.Data = true;
            }
            else
            {
                r.Data = false;
            }
            return(r);
        }
コード例 #5
0
ファイル: AppServiceServer'1.cs プロジェクト: xqj/Security
        public FunctionListResult <AppService> Add(List <AppService> data)
        {
            var r = new FunctionListResult <AppService>();

            if (data != null)
            {
                data.ForEach(ap => {
                    ap.AppServiceId = AppServiceDal.Add(ap);
                    if (ap.AppFunctions != null)
                    {
                        ap.AppFunctions.ForEach(af => {
                            af.AppFuntionId = AppFunctionDal.Add(af);
                        });
                    }
                });
                r.Data = data;
            }
            return(r);
        }
コード例 #6
0
ファイル: AppServiceServer'1.cs プロジェクト: xqj/Security
        public FunctionOpenResult <bool> Update(int appInstanceId, int appId)
        {
            Rel_AppInstance_AppService raas = Rel_AppInstance_AppServiceDal.GetByAppInstanceId(appInstanceId);
            List <AppService>          data = (raas != null)?JsonHelper.Deserialize <List <AppService> >(raas.AppService):null;
            var r = new FunctionOpenResult <bool>();

            r.Data = false;
            if (data != null)
            {
                Rel_AppInstance_AppServiceDal.UpdateAppInstanceId(new Rel_AppInstance_AppService()
                {
                    AppInstanceId = appInstanceId,
                    AppService    = JsonHelper.Serlaize <List <AppService> >(data)
                });
                List <AppService> source = GetAppServiceByAppId(appId);
                data.ForEach(ap => {
                    var sap = source.Find(t => t.Name == ap.Name);
                    if (sap != null)
                    {
                        if (ap.AppFunctions != null)
                        {
                            ap.AppFunctions.ForEach(af => {
                                if (!(sap.AppFunctions.RemoveAll(t => t.FunctionName == af.FunctionName) > 0))//将已经保存的数据消除,如果消除数量为0表示此数据需要保存
                                {
                                    AppFunctionDal.Add(af);
                                }
                            });
                            if (sap.AppFunctions.Count > 0)//表示有实例未拥有的数据存在,需要打上无匹配的标识
                            {
                                sap.AppFunctions.ForEach(af => {
                                    AppFunctionDal.SigningNoMatching(af.AppFuntionId);
                                });
                                sap.AppFunctions.Clear();
                            }
                        }
                    }
                    else
                    {//数据中未找到的的AppService进行插入
                        int appServiceId = AppServiceDal.Add(ap);
                        if (appServiceId > 0)
                        {
                            if (ap.AppFunctions != null)
                            {
                                ap.AppFunctions.ForEach(af => {
                                    AppFunctionDal.Add(af);
                                });
                            }
                        }
                    }
                });
                var sapList = source.FindAll(ap => ap.AppFunctions.Count > 0);//找出无匹配的AppService,并且打上无匹配标识
                if (sapList != null)
                {
                    sapList.ForEach(ap => {
                        AppServiceDal.SigningNoMatching(ap.AppServiceId);
                        AppFunctionDal.SigningNoMatchingByAppServiceId(ap.AppServiceId);
                    });
                }
                r.Data = true;
            }
            return(r);
        }
コード例 #7
0
ファイル: AppServiceServer.cs プロジェクト: xqj/Security
 public GridPager <AppService> GetPager(GridPagerPamater <AppServiceSearchPamater> searchParam)
 {
     var r = AppServiceDal.GetGridPager(searchParam); return(r);
 }
コード例 #8
0
ファイル: AppServiceServer.cs プロジェクト: xqj/Security
 public FunctionListResult <AppService> GetList(AppServiceSearchPamater pamater)
 {
     var r = new FunctionListResult <AppService>(); r.Data = AppServiceDal.GetList(pamater); return(r);
 }
コード例 #9
0
ファイル: AppServiceServer.cs プロジェクト: xqj/Security
 public FunctionResult <AppService> Get(int Id)
 {
     var r = new FunctionResult <AppService>(); r.Data = AppServiceDal.Get(Id); return(r);
 }
コード例 #10
0
ファイル: AppServiceServer.cs プロジェクト: xqj/Security
 public FunctionOpenResult <bool> DeleteByID(List <int> idList)
 {
     var r = new FunctionOpenResult <bool>(); r.Data = AppServiceDal.Delete(idList); return(r);
 }
コード例 #11
0
ファイル: AppServiceServer.cs プロジェクト: xqj/Security
 public FunctionOpenResult <bool> UpdateByID(AppService info)
 {
     var r = new FunctionOpenResult <bool>(); r.Data = AppServiceDal.Update(info) > 0; return(r);
 }