Esempio n. 1
0
        public FunctionResult <AppComponent> Get(int Id)
        {
            var r = new FunctionResult <AppComponent>();

            r.Data = AppComponentDal.Get(Id);
            return(r);
        }
Esempio n. 2
0
        /// <summary>
        /// No safe TODO
        /// </summary>
        /// <param name="appId"></param>
        /// <param name="componentId"></param>
        /// <param name="appUserId"></param>
        /// <returns></returns>
        public FunctionOpenResult <bool> SetComponent(int appId, int componentId, int appUserId)
        {
            FunctionOpenResult <bool> r = new FunctionOpenResult <bool>();
            var existResult             = ExistComponent(appId, componentId, appUserId);

            if (existResult.ActionResult && existResult.Data)
            {
                Rel_AppComponent_AppUserDal.Delete(appId, componentId);
            }
            var list = AppComponentDal.GetList(new AppComponentSearchPamater()
            {
                ComponentId = componentId
            });

            if (list != null)
            {
                list.ForEach(c =>
                {
                    Rel_AppComponent_AppUserDal.Add(new Rel_AppComponent_AppUser()
                    {
                        AppComponentId = c.AppComponentId,
                        AppUserId      = appUserId,
                        AppId          = appId
                    });
                });
            }
            r.Data = true;
            return(r);
        }
Esempio n. 3
0
        public FunctionListResult <AppComponent> GetAppComponentListWithAppUser(int appId, int componentId)
        {
            var r = new FunctionListResult <AppComponent>();

            r.Data = AppComponentDal.GetList(appId, componentId);
            return(r);
        }
Esempio n. 4
0
        public FunctionListResult <AppComponent> GetList(int appId, string name)
        {
            var r = new FunctionListResult <AppComponent>();

            r.Data = AppComponentDal.GetList(appId, name);
            return(r);
        }
Esempio n. 5
0
        public FunctionResult <AppComponent> Create(AppComponent info)
        {
            var r  = new FunctionResult <AppComponent>();
            int id = AppComponentDal.Add(info);

            if (id > 0)
            {
                r.Data = info; r.Data.AppComponentId = id;
            }
            return(r);
        }
Esempio n. 6
0
        public FunctionOpenResult <bool> DeleteByID(List <int> idList)
        {
            var r = new FunctionOpenResult <bool>();

            r.Data = AppComponentDal.Delete(idList);
            if (r.Data)
            {
                idList.ForEach(id =>
                {
                    AppComponentInterfaceDal.DeleteByAppComponentId(id);
                });
            }
            return(r);
        }
Esempio n. 7
0
        public FunctionOpenResult <bool> UpdateByID(AppComponent info, List <String> interfaces)
        {
            var r = new FunctionOpenResult <bool>();

            r.Data = AppComponentDal.Update(info) > 0;
            if (r.Data)
            {
                AppComponentInterfaceDal.DeleteByAppComponentId(info.AppComponentId);
                interfaces.ForEach(i =>
                {
                    AppComponentInterfaceDal.Add(new AppComponentInterface()
                    {
                        ComponentInterface = i,
                        AppComponentId     = info.AppComponentId
                    });
                });
            }
            return(r);
        }
Esempio n. 8
0
        public FunctionResult <AppComponent> Create(AppComponent info, List <String> interfaces)
        {
            var r  = new FunctionResult <AppComponent>();
            int id = AppComponentDal.Add(info);

            if (id > 0)
            {
                r.Data = info; r.Data.AppComponentId = id;
                interfaces.ForEach(i =>
                {
                    AppComponentInterfaceDal.Add(new AppComponentInterface()
                    {
                        ComponentInterface = i,
                        AppComponentId     = id
                    });
                });
            }
            return(r);
        }
Esempio n. 9
0
 public GridPager <AppComponent> GetPager(GridPagerPamater <AppComponentSearchPamater> searchParam)
 {
     var r = AppComponentDal.GetGridPager(searchParam); return(r);
 }
Esempio n. 10
0
 public FunctionListResult <AppComponent> GetList(AppComponentSearchPamater pamater)
 {
     var r = new FunctionListResult <AppComponent>(); r.Data = AppComponentDal.GetList(pamater); return(r);
 }
Esempio n. 11
0
 public FunctionOpenResult <bool> UpdateByID(AppComponent info)
 {
     var r = new FunctionOpenResult <bool>(); r.Data = AppComponentDal.Update(info) > 0; return(r);
 }