Ejemplo n.º 1
0
        private bool UpdateUserPermission(string type, string id, bool isActive)
        {
            bool result = false;

            if (type == "system")
            {
                IQueryable <THOK.Authority.DbModel.UserSystem> queryUserSystem = UserSystemRepository.GetQueryable();
                Guid sid    = new Guid(id);
                var  system = queryUserSystem.FirstOrDefault(i => i.UserSystemID == sid);
                system.IsActive = isActive;
                RoleSystemRepository.SaveChanges();
                result = true;
            }
            else if (type == "module")
            {
                IQueryable <THOK.Authority.DbModel.UserModule> queryUserModule = UserModuleRepository.GetQueryable();
                Guid mid    = new Guid(id);
                var  module = queryUserModule.FirstOrDefault(i => i.UserModuleID == mid);
                module.IsActive = isActive;
                RoleModuleRepository.SaveChanges();
                result = true;
            }
            else if (type == "function")
            {
                IQueryable <THOK.Authority.DbModel.UserFunction> queryUserFunction = UserFunctionRepository.GetQueryable();
                Guid fid    = new Guid(id);
                var  system = queryUserFunction.FirstOrDefault(i => i.UserFunctionID == fid);
                system.IsActive = isActive;
                RoleSystemRepository.SaveChanges();
                result = true;
            }
            return(result);
        }
Ejemplo n.º 2
0
        private bool UpdateUserPermission(string type, string id, string isActive)
        {
            bool result = false;

            if (type == "system")
            {
                IQueryable <AUTH_USER_SYSTEM> queryUserSystem = UserSystemRepository.GetQueryable();
                //Guid sid = new Guid(id);
                var system = queryUserSystem.FirstOrDefault(i => i.USER_SYSTEM_ID == id);
                system.IS_ACTIVE = isActive;
                RoleSystemRepository.SaveChanges();
                result = true;
            }
            else if (type == "module")
            {
                IQueryable <AUTH_USER_MODULE> queryUserModule = UserModuleRepository.GetQueryable();
                // Guid mid = new Guid(id);
                var module = queryUserModule.FirstOrDefault(i => i.USER_MODULE_ID == id);
                module.IS_ACTIVE = isActive;
                RoleModuleRepository.SaveChanges();
                result = true;
            }
            else if (type == "function")
            {
                IQueryable <AUTH_USER_FUNCTION> queryUserFunction = UserFunctionRepository.GetQueryable();
                //Guid fid = new Guid(id);
                var system = queryUserFunction.FirstOrDefault(i => i.USER_FUNCTION_ID == id);
                system.IS_ACTIVE = isActive;
                RoleSystemRepository.SaveChanges();
                result = true;
            }
            return(result);
        }
Ejemplo n.º 3
0
        private void SetModuleFunTree(Tree childTree, Module item, UserModule userModules)
        {
            var            function        = FunctionRepository.GetQueryable().Where(f => f.Module.ModuleID == item.ModuleID);
            HashSet <Tree> functionTreeSet = new HashSet <Tree>();

            foreach (var func in function)
            {
                Tree funcTree     = new Tree();
                var  userFunction = UserFunctionRepository.GetQueryable().FirstOrDefault(rf => rf.Function.FunctionID == func.FunctionID && rf.UserModule.UserModuleID == userModules.UserModuleID);
                funcTree.id         = userFunction.UserFunctionID.ToString();
                funcTree.text       = "功能:" + func.FunctionName;
                funcTree.@checked   = userFunction == null ? false : userFunction.IsActive;
                funcTree.attributes = "function";
                functionTreeSet.Add(funcTree);
            }
            childTree.children = functionTreeSet.ToArray();
        }
Ejemplo n.º 4
0
        private void SetModuleFunTree(Tree childTree, AUTH_MODULE item, AUTH_USER_MODULE userModules)
        {
            var            function        = FunctionRepository.GetQueryable().Where(f => f.AUTH_MODULE.MODULE_ID == item.MODULE_ID);
            HashSet <Tree> functionTreeSet = new HashSet <Tree>();

            foreach (var func in function)
            {
                Tree funcTree     = new Tree();
                var  userFunction = UserFunctionRepository.GetQueryable().FirstOrDefault(rf => rf.AUTH_FUNCTION.FUNCTION_ID == func.FUNCTION_ID && rf.AUTH_USER_MODULE.USER_MODULE_ID == userModules.USER_MODULE_ID);
                funcTree.id   = userFunction.USER_FUNCTION_ID.ToString();
                funcTree.text = "功能:" + func.FUNCTION_NAME;
                int a = Convert.ToInt32(userFunction.IS_ACTIVE);
                funcTree.@checked   = userFunction == null ? false : Convert.ToBoolean(a);
                funcTree.attributes = "function";
                functionTreeSet.Add(funcTree);
            }
            childTree.children = functionTreeSet.ToArray();
        }