예제 #1
0
        public object GetDetails2(int page, int rows, string QueryString, string Value)
        {
            string SystemName = "";
            string ModuleName = "";

            if (QueryString == "SystemName")
            {
                SystemName = Value;
            }
            else
            {
                ModuleName = Value;
            }
            IQueryable <AUTH_MODULE> ModuleQuery = ModuleRepository.GetQueryable();
            var Module = ModuleQuery.Where(c => c.AUTH_SYSTEM.SYSTEM_NAME.Contains(SystemName) && c.MODULE_NAME.Contains(ModuleName))
                         .OrderBy(c => c.MODULE_NAME)
                         .Select(c => new
            {
                c.MODULE_ID,
                c.MODULE_NAME,
                c.MODULE_URL,
                ParentModule = c.PARENT_AUTH_MODULE.MODULE_NAME,
                c.AUTH_SYSTEM.SYSTEM_NAME
            });
            int total = Module.Count();

            Module = Module.Skip((page - 1) * rows).Take(rows);
            return(new { total, rows = Module.ToArray() });
        }
예제 #2
0
        public object GetDetails2(int page, int rows, string QueryString, string Value)
        {
            string SystemName = "";
            string ModuleName = "";

            if (QueryString == "SystemName")
            {
                SystemName = Value;
            }
            else
            {
                ModuleName = Value;
            }
            IQueryable <Module> ModuleQuery = ModuleRepository.GetQueryable();
            var Module = ModuleQuery.Where(c => c.System.SystemName.Contains(SystemName) && c.ModuleName.Contains(ModuleName))
                         .OrderBy(c => c.ModuleName)
                         .Select(c => new
            {
                c.ModuleID,
                c.ModuleName,
                c.ModuleURL,
                ParentModule = c.ParentModule.ModuleName,
                c.System.SystemName
            });
            int total = Module.Count();

            Module = Module.Skip((page - 1) * rows).Take(rows);
            return(new { total, rows = Module.ToArray() });
        }
예제 #3
0
        public object GetDetails()// 测试数据
        {
            IQueryable <AUTH_MODULE> queryModule = ModuleRepository.GetQueryable();
            int c       = queryModule.Count();
            var modules = queryModule.Select(m => m);

            return(modules.ToArray());
        }
예제 #4
0
        public object GetModuleFuns(string userName, string cityID, string moduleID)
        {
            if (String.IsNullOrEmpty(userName))
            {
                throw new ArgumentException("值不能为NULL或为空。", "userName");
            }
            if (String.IsNullOrEmpty(cityID))
            {
                throw new ArgumentException("值不能为NULL或为空。", "cityID");
            }
            if (String.IsNullOrEmpty(moduleID))
            {
                throw new ArgumentException("值不能为NULL或为空。", "moduleID");
            }

            IQueryable <AUTH_USER>   queryUser   = UserRepository.GetQueryable();
            IQueryable <AUTH_CITY>   queryCity   = CityRepository.GetQueryable();
            IQueryable <AUTH_MODULE> queryModule = ModuleRepository.GetQueryable();

            //Guid gCityID = new Guid(cityID);
            //Guid gModuleID = new Guid(moduleID);
            var user = queryUser.Single(u => u.USER_NAME == userName);
            var city = queryCity.Single(c => c.CITY_ID == cityID);
            // var module = queryModule.Single(m => m.ModuleID == gModuleID);
            var module = queryModule.Single(m => m.MODULE_ID == moduleID);

            var userModule = (from um in module.AUTH_USER_MODULE
                              where um.AUTH_USER_SYSTEM.AUTH_USER.USER_ID == user.USER_ID &&
                              um.AUTH_USER_SYSTEM.AUTH_CITY.CITY_ID == city.CITY_ID
                              select um).Single();

            var           userFunctions     = userModule.AUTH_USER_FUNCTION;
            Fun           fun               = new Fun();
            HashSet <Fun> moduleFunctionSet = new HashSet <Fun>();

            foreach (var userFunction in userFunctions)
            {
                var  roles   = user.AUTH_USER_ROLE.Select(ur => ur.AUTH_ROLE);
                bool bResult = userFunction.AUTH_FUNCTION.AUTH_ROLE_FUNCTION.Any(
                    rf => roles.Any(
                        r => r.ROLE_ID == rf.AUTH_ROLE_MODULE.AUTH_ROLE_SYSTEM.AUTH_ROLE.ROLE_ID &&
                        rf.IS_ACTIVE == "1"
                        )
                    );
                moduleFunctionSet.Add(new Fun()
                {
                    funid    = userFunction.AUTH_FUNCTION.FUNCTION_ID,
                    funname  = userFunction.AUTH_FUNCTION.CONTROL_NAME,
                    iconCls  = userFunction.AUTH_FUNCTION.INDICATE_IMAGE,
                    isActive = userFunction.IS_ACTIVE == "1" || bResult || user.USER_NAME == "Admin"
                });
            }
            fun.funs = moduleFunctionSet.ToArray();
            return(fun);
        }
예제 #5
0
        public object GetModuleFuns(string userName, string cityID, string moduleID)
        {
            if (String.IsNullOrEmpty(userName))
            {
                throw new ArgumentException("值不能为NULL或为空。", "userName");
            }
            if (String.IsNullOrEmpty(cityID))
            {
                throw new ArgumentException("值不能为NULL或为空。", "cityID");
            }
            if (String.IsNullOrEmpty(moduleID))
            {
                throw new ArgumentException("值不能为NULL或为空。", "moduleID");
            }

            IQueryable <THOK.Authority.DbModel.User>   queryUser   = UserRepository.GetQueryable();
            IQueryable <THOK.Authority.DbModel.City>   queryCity   = CityRepository.GetQueryable();
            IQueryable <THOK.Authority.DbModel.Module> queryModule = ModuleRepository.GetQueryable();

            Guid gCityID   = new Guid(cityID);
            Guid gModuleID = new Guid(moduleID);
            var  user      = queryUser.Single(u => u.UserName == userName);
            var  city      = queryCity.Single(c => c.CityID == gCityID);
            var  module    = queryModule.Single(m => m.ModuleID == gModuleID);

            var userModule = (from um in module.UserModules
                              where um.UserSystem.User.UserID == user.UserID &&
                              um.UserSystem.City.CityID == city.CityID
                              select um).Single();

            var           userFunctions     = userModule.UserFunctions;
            Fun           fun               = new Fun();
            HashSet <Fun> moduleFunctionSet = new HashSet <Fun>();

            foreach (var userFunction in userFunctions)
            {
                var  roles   = user.UserRoles.Select(ur => ur.Role);
                bool bResult = userFunction.Function.RoleFunctions.Any(
                    rf => roles.Any(
                        r => r.RoleID == rf.RoleModule.RoleSystem.Role.RoleID &&
                        rf.IsActive
                        )
                    );
                moduleFunctionSet.Add(new Fun()
                {
                    funid    = userFunction.Function.FunctionID.ToString(),
                    funname  = userFunction.Function.ControlName,
                    iconCls  = userFunction.Function.IndicateImage,
                    isActive = userFunction.IsActive || bResult || user.UserName == "Admin"
                });
            }
            fun.funs = moduleFunctionSet.ToArray();
            return(fun);
        }
예제 #6
0
        public object GetHelpContentTree(string sysId)
        {
            IQueryable <THOK.Authority.DbModel.AUTH_SYSTEM>       querySystem      = SystemRepository.GetQueryable();
            IQueryable <THOK.Authority.DbModel.AUTH_MODULE>       queryModule      = ModuleRepository.GetQueryable();
            IQueryable <THOK.Authority.DbModel.AUTH_HELP_CONTENT> queryHelpContent = HelpContentRepository.GetQueryable();
            var systems = querySystem.AsEnumerable();

            if (sysId != null && sysId != string.Empty)
            {
                //Guid gsystemid = new Guid(sysId);
                systems = querySystem.Where(i => i.SYSTEM_ID == sysId)
                          .Select(i => i);
            }

            HashSet <Tree> systemTreeSet = new HashSet <Tree>();

            foreach (var system in systems)
            {
                Tree systemTree = new Tree();
                systemTree.id   = int.Parse(system.SYSTEM_ID).ToString();
                systemTree.text = system.SYSTEM_NAME;
                var helpContent = queryHelpContent.Where(m => m.AUTH_MODULE.SYSTEM_SYSTEM_ID == system.SYSTEM_ID && m.ID == m.FATHER_NODE_ID)
                                  .OrderBy(m => m.NODE_ORDER)
                                  .Select(m => m);
                var systemAttribute = new
                {
                    AttributeId  = int.Parse(system.SYSTEM_ID).ToString(),
                    AttributeTxt = system.SYSTEM_NAME
                };
                systemTree.attributes = systemAttribute;
                HashSet <Tree> contentTreeSet = new HashSet <Tree>();
                foreach (var item in helpContent)
                {
                    Tree helpContentTree = new Tree();
                    helpContentTree.id   = item.CONTENT_CODE;
                    helpContentTree.text = item.CONTENT_CODE + item.CONTENT_NAME;
                    var helpAttribute = new
                    {
                        AttributeId  = item.ID,
                        AttributeTxt = item.CONTENT_TEXT
                    };
                    helpContentTree.attributes = helpAttribute;
                    contentTreeSet.Add(helpContentTree);
                    GetChildTree(helpContentTree, item);
                    contentTreeSet.Add(helpContentTree);
                }
                systemTree.children = contentTreeSet.ToArray();
                systemTreeSet.Add(systemTree);
            }
            return(systemTreeSet.ToArray());
        }
예제 #7
0
        public object GetHelpContentTree(string sysId)
        {
            IQueryable <THOK.Authority.DbModel.System>      querySystem      = SystemRepository.GetQueryable();
            IQueryable <THOK.Authority.DbModel.Module>      queryModule      = ModuleRepository.GetQueryable();
            IQueryable <THOK.Authority.DbModel.HelpContent> queryHelpContent = HelpContentRepository.GetQueryable();
            var systems = querySystem.AsEnumerable();

            if (sysId != null && sysId != string.Empty)
            {
                Guid gsystemid = new Guid(sysId);
                systems = querySystem.Where(i => i.SystemID == gsystemid)
                          .Select(i => i);
            }

            HashSet <Tree> systemTreeSet = new HashSet <Tree>();

            foreach (var system in systems)
            {
                Tree systemTree = new Tree();
                systemTree.id   = system.SystemID.ToString();
                systemTree.text = system.SystemName;
                var helpContent = queryHelpContent.Where(m => m.Module.System.SystemID == system.SystemID && m.ID == m.FatherNodeID)
                                  .OrderBy(m => m.NodeOrder)
                                  .Select(m => m);
                var systemAttribute = new
                {
                    AttributeId  = system.SystemID,
                    AttributeTxt = system.SystemName
                };
                systemTree.attributes = systemAttribute;
                HashSet <Tree> contentTreeSet = new HashSet <Tree>();
                foreach (var item in helpContent)
                {
                    Tree helpContentTree = new Tree();
                    helpContentTree.id   = item.ContentCode;
                    helpContentTree.text = item.ContentCode + item.ContentName;
                    var helpAttribute = new
                    {
                        AttributeId  = item.ID,
                        AttributeTxt = item.ContentText
                    };
                    helpContentTree.attributes = helpAttribute;
                    contentTreeSet.Add(helpContentTree);
                    GetChildTree(helpContentTree, item);
                    contentTreeSet.Add(helpContentTree);
                }
                systemTree.children = contentTreeSet.ToArray();
                systemTreeSet.Add(systemTree);
            }
            return(systemTreeSet.ToArray());
        }
예제 #8
0
        public object GetDetails(string systemID)
        {
            IQueryable <AUTH_SYSTEM> querySystem = SystemRepository.GetQueryable();
            IQueryable <AUTH_MODULE> queryModule = ModuleRepository.GetQueryable();
            var systems = querySystem.AsEnumerable();

            if (systemID != null && systemID != string.Empty)
            {
                // Guid gsystemid = new Guid(systemID);
                systems = querySystem.Where(i => i.SYSTEM_ID == systemID)
                          .Select(i => i);
            }

            HashSet <Menu> systemMenuSet = new HashSet <Menu>();

            foreach (var system in systems)
            {
                Menu systemMenu = new Menu();
                systemMenu.ModuleID   = system.SYSTEM_ID.ToString();
                systemMenu.ModuleName = system.SYSTEM_NAME;
                systemMenu.SystemID   = system.SYSTEM_ID.ToString();
                systemMenu.SystemName = system.SYSTEM_NAME;

                var modules = queryModule.Where(m => m.SYSTEM_SYSTEM_ID == system.SYSTEM_ID && m.MODULE_ID == m.PARENT_AUTH_MODULE.MODULE_ID)
                              .OrderBy(m => m.SHOW_ORDER)
                              .Select(m => m);
                HashSet <Menu> moduleMenuSet = new HashSet <Menu>();
                foreach (var item in modules)
                {
                    Menu moduleMenu = new Menu();
                    moduleMenu.ModuleID         = item.MODULE_ID.ToString();
                    moduleMenu.ModuleName       = item.MODULE_NAME;
                    moduleMenu.SystemID         = item.AUTH_SYSTEM.SYSTEM_ID;
                    moduleMenu.SystemName       = item.AUTH_SYSTEM.SYSTEM_NAME;
                    moduleMenu.ParentModuleID   = item.PARENT_AUTH_MODULE.MODULE_ID;
                    moduleMenu.ParentModuleName = item.PARENT_AUTH_MODULE.MODULE_NAME;

                    moduleMenu.ModuleURL = item.MODULE_URL;
                    moduleMenu.iconCls   = item.INDICATE_IMAGE;
                    moduleMenu.ShowOrder = Convert.ToInt32(item.SHOW_ORDER);
                    moduleMenuSet.Add(moduleMenu);
                    GetChildMenu(moduleMenu, item);
                    moduleMenuSet.Add(moduleMenu);
                }
                systemMenu.children = moduleMenuSet.ToArray();
                systemMenuSet.Add(systemMenu);
            }

            return(systemMenuSet.ToArray());
        }
예제 #9
0
        public object GetDetails(string systemID)
        {
            IQueryable <THOK.Authority.DbModel.System> querySystem = SystemRepository.GetQueryable();
            IQueryable <THOK.Authority.DbModel.Module> queryModule = ModuleRepository.GetQueryable();
            var systems = querySystem.AsEnumerable();

            if (systemID != null && systemID != string.Empty)
            {
                Guid gsystemid = new Guid(systemID);
                systems = querySystem.Where(i => i.SystemID == gsystemid)
                          .Select(i => i);
            }

            HashSet <Menu> systemMenuSet = new HashSet <Menu>();

            foreach (var system in systems)
            {
                Menu systemMenu = new Menu();
                systemMenu.ModuleID   = system.SystemID.ToString();
                systemMenu.ModuleName = system.SystemName;
                systemMenu.SystemID   = system.SystemID.ToString();
                systemMenu.SystemName = system.SystemName;

                var modules = queryModule.Where(m => m.System.SystemID == system.SystemID && m.ModuleID == m.ParentModule.ModuleID)
                              .OrderBy(m => m.ShowOrder)
                              .Select(m => m);
                HashSet <Menu> moduleMenuSet = new HashSet <Menu>();
                foreach (var item in modules)
                {
                    Menu moduleMenu = new Menu();
                    moduleMenu.ModuleID         = item.ModuleID.ToString();
                    moduleMenu.ModuleName       = item.ModuleName;
                    moduleMenu.SystemID         = item.System.SystemID.ToString();
                    moduleMenu.SystemName       = item.System.SystemName;
                    moduleMenu.ParentModuleID   = item.ParentModule.ModuleID.ToString();
                    moduleMenu.ParentModuleName = item.ParentModule.ModuleName;

                    moduleMenu.ModuleURL = item.ModuleURL;
                    moduleMenu.iconCls   = item.IndicateImage;
                    moduleMenu.ShowOrder = item.ShowOrder;
                    moduleMenuSet.Add(moduleMenu);
                    GetChildMenu(moduleMenu, item);
                    moduleMenuSet.Add(moduleMenu);
                }
                systemMenu.children = moduleMenuSet.ToArray();
                systemMenuSet.Add(systemMenu);
            }

            return(systemMenuSet.ToArray());
        }
예제 #10
0
        public bool Save(string moduleID, string moduleName, int showOrder, string moduleUrl, string indicateImage, string deskTopImage)
        {
            IQueryable <THOK.Authority.DbModel.Module> queryModule = ModuleRepository.GetQueryable();
            Guid sid    = new Guid(moduleID);
            var  module = queryModule.FirstOrDefault(i => i.ModuleID == sid);

            module.ModuleName    = moduleName;
            module.ShowOrder     = showOrder;
            module.ModuleURL     = moduleUrl;
            module.IndicateImage = indicateImage;
            module.DeskTopImage  = deskTopImage;
            ModuleRepository.SaveChanges();
            return(true);
        }
예제 #11
0
        public bool Save(string moduleID, string moduleName, int showOrder, string moduleUrl, string indicateImage, string deskTopImage)
        {
            // IQueryable<AUTH_MODULE> queryModule = ModuleRepository.GetQueryable();
            //Guid sid = new Guid(moduleID);
            //var module = queryModule.FirstOrDefault(i => i.ModuleID == sid);

            var module = ModuleRepository.GetQueryable().FirstOrDefault(i => i.MODULE_ID == moduleID);

            //var module = queryModule.FirstOrDefault(i => i.MODULE_ID == moduleID);
            module.MODULE_NAME    = moduleName;
            module.SHOW_ORDER     = showOrder;
            module.MODULE_URL     = moduleUrl;
            module.INDICATE_IMAGE = indicateImage;
            module.DESK_TOP_IMAGE = deskTopImage;
            ModuleRepository.SaveChanges();
            return(true);
        }
예제 #12
0
        public object GetRoleSystemDetails(string roleID, string cityID, string systemID)
        {
            IQueryable <AUTH_SYSTEM>      querySystem     = SystemRepository.GetQueryable();
            IQueryable <AUTH_MODULE>      queryModule     = ModuleRepository.GetQueryable();
            IQueryable <AUTH_ROLE_SYSTEM> queryRoleSystem = RoleSystemRepository.GetQueryable();
            IQueryable <AUTH_ROLE_MODULE> queryRoleModule = RoleModuleRepository.GetQueryable();
            var            systems           = querySystem.Single(i => i.SYSTEM_ID == systemID);
            var            roleSystems       = queryRoleSystem.FirstOrDefault(i => i.AUTH_SYSTEM.SYSTEM_ID == systemID && i.AUTH_ROLE.ROLE_ID == roleID && i.AUTH_CITY.CITY_ID == cityID);
            HashSet <Tree> RolesystemTreeSet = new HashSet <Tree>();
            Tree           roleSystemTree    = new Tree();

            roleSystemTree.id   = roleSystems.ROLE_SYSTEM_ID.ToString();
            roleSystemTree.text = "系统:" + systems.SYSTEM_NAME;
            int a = Convert.ToInt32(roleSystems.IS_ACTIVE);

            roleSystemTree.@checked   = Convert.ToBoolean(a);
            roleSystemTree.attributes = "system";

            var modules = queryModule.Where(m => m.AUTH_SYSTEM.SYSTEM_ID == systems.SYSTEM_ID && m.MODULE_ID == m.PARENT_AUTH_MODULE.MODULE_ID)
                          .OrderBy(m => m.SHOW_ORDER)
                          .Select(m => m);
            HashSet <Tree> moduleTreeSet = new HashSet <Tree>();

            foreach (var item in modules)
            {
                Tree   moduleTree = new Tree();
                string moduleID   = item.MODULE_ID.ToString();
                //var roleModules = queryRoleModule.FirstOrDefault(i => i.Module.ModuleID == new Guid(moduleID) && i.RoleSystem.RoleSystemID == roleSystems.RoleSystemID);
                var roleModules = queryRoleModule.FirstOrDefault(i => i.AUTH_MODULE.MODULE_ID == moduleID && i.AUTH_ROLE_SYSTEM.ROLE_SYSTEM_ID == roleSystems.ROLE_SYSTEM_ID);
                moduleTree.id   = roleModules.ROLE_MODULE_ID.ToString();
                moduleTree.text = "模块:" + item.MODULE_NAME;
                string b = roleModules.IS_ACTIVE == "1" ? "true" : "false";
                moduleTree.@checked   = bool.Parse(b);
                moduleTree.attributes = "module";

                moduleTreeSet.Add(moduleTree);
                SetTree(moduleTree, item, roleSystems);
                moduleTreeSet.Add(moduleTree);
            }
            roleSystemTree.children = moduleTreeSet.ToArray();
            RolesystemTreeSet.Add(roleSystemTree);
            return(RolesystemTreeSet.ToArray());
        }
예제 #13
0
        public object GetUserSystemDetails(string userID, string cityID, string systemID)
        {
            IQueryable <AUTH_SYSTEM>      querySystem     = SystemRepository.GetQueryable();
            IQueryable <AUTH_MODULE>      queryModule     = ModuleRepository.GetQueryable();
            IQueryable <AUTH_USER_SYSTEM> queryUserSystem = UserSystemRepository.GetQueryable();
            IQueryable <AUTH_USER_MODULE> queryUserModule = UserModuleRepository.GetQueryable();
            var            systems           = querySystem.Single(i => i.SYSTEM_ID == systemID);
            var            userSystems       = queryUserSystem.FirstOrDefault(i => i.AUTH_SYSTEM.SYSTEM_ID == systemID && i.AUTH_USER.USER_ID == userID && i.AUTH_CITY.CITY_ID == cityID);
            HashSet <Tree> userSystemTreeSet = new HashSet <Tree>();
            Tree           userSystemTree    = new Tree();

            userSystemTree.id         = userSystems.USER_SYSTEM_ID.ToString();
            userSystemTree.text       = "系统:" + systems.SYSTEM_NAME;
            userSystemTree.@checked   = userSystems.IS_ACTIVE == "1"?true:false;
            userSystemTree.attributes = "system";

            var modules = queryModule.Where(m => m.AUTH_SYSTEM.SYSTEM_ID == systems.SYSTEM_ID && m.MODULE_ID == m.PARENT_AUTH_MODULE.MODULE_ID)
                          .OrderBy(m => m.SHOW_ORDER)
                          .Select(m => m);
            HashSet <Tree> moduleTreeSet = new HashSet <Tree>();

            foreach (var item in modules)
            {
                Tree   moduleTree = new Tree();
                string moduleID   = item.MODULE_ID.ToString();
                //var userModules = queryUserModule.FirstOrDefault(i => i.Module.ModuleID == new Guid(moduleID) && i.UserSystem.UserSystemID == userSystems.UserSystemID);
                var userModules = queryUserModule.FirstOrDefault(i => i.AUTH_MODULE.MODULE_ID == moduleID && i.AUTH_USER_SYSTEM.USER_SYSTEM_ID == userSystems.USER_SYSTEM_ID);

                moduleTree.id   = userModules.USER_MODULE_ID.ToString();
                moduleTree.text = "模块:" + item.MODULE_NAME;
                int a = Convert.ToInt32(userModules.IS_ACTIVE);
                moduleTree.@checked   = Convert.ToBoolean(a);
                moduleTree.attributes = "module";

                moduleTreeSet.Add(moduleTree);
                SetModuleTree(moduleTree, item, userSystems);
                moduleTreeSet.Add(moduleTree);
            }
            userSystemTree.children = moduleTreeSet.ToArray();
            userSystemTreeSet.Add(userSystemTree);
            return(userSystemTreeSet.ToArray());
        }
예제 #14
0
        public bool CreateExceptionLog(string ModuleNam, string FunctionName, string ExceptionalType, string ExceptionalDescription, string State)
        {
            var moduleRepository = ModuleRepository.GetQueryable().Where(m => m.ModuleURL == ModuleNam).Select(m => new { modulname = m.ModuleName }).ToArray();

            if (moduleRepository.Length > 0)
            {
                var ExceptionalLogs = new ExceptionalLog()
                {
                    ExceptionalLogID       = Guid.NewGuid(),
                    CatchTime              = DateTime.Now.ToString(),
                    ModuleName             = moduleRepository[0].modulname,
                    FunctionName           = FunctionName,
                    ExceptionalType        = ExceptionalType,
                    ExceptionalDescription = ExceptionalDescription,
                    State = State,
                };
                ExceptionalLogRepository.Add(ExceptionalLogs);
                ExceptionalLogRepository.SaveChanges();
            }
            return(true);
        }
예제 #15
0
        public object GetUserSystemDetails(string userID, string cityID, string systemID)
        {
            IQueryable <THOK.Authority.DbModel.System>     querySystem     = SystemRepository.GetQueryable();
            IQueryable <THOK.Authority.DbModel.Module>     queryModule     = ModuleRepository.GetQueryable();
            IQueryable <THOK.Authority.DbModel.UserSystem> queryUserSystem = UserSystemRepository.GetQueryable();
            IQueryable <THOK.Authority.DbModel.UserModule> queryUserModule = UserModuleRepository.GetQueryable();
            var            systems           = querySystem.Single(i => i.SystemID == new Guid(systemID));
            var            userSystems       = queryUserSystem.FirstOrDefault(i => i.System.SystemID == new Guid(systemID) && i.User.UserID == new Guid(userID) && i.City.CityID == new Guid(cityID));
            HashSet <Tree> userSystemTreeSet = new HashSet <Tree>();
            Tree           userSystemTree    = new Tree();

            userSystemTree.id         = userSystems.UserSystemID.ToString();
            userSystemTree.text       = "系统:" + systems.SystemName;
            userSystemTree.@checked   = userSystems.IsActive;
            userSystemTree.attributes = "system";

            var modules = queryModule.Where(m => m.System.SystemID == systems.SystemID && m.ModuleID == m.ParentModule.ModuleID)
                          .OrderBy(m => m.ShowOrder)
                          .Select(m => m);
            HashSet <Tree> moduleTreeSet = new HashSet <Tree>();

            foreach (var item in modules)
            {
                Tree   moduleTree  = new Tree();
                string moduleID    = item.ModuleID.ToString();
                var    userModules = queryUserModule.FirstOrDefault(i => i.Module.ModuleID == new Guid(moduleID) && i.UserSystem.UserSystemID == userSystems.UserSystemID);
                moduleTree.id         = userModules.UserModuleID.ToString();
                moduleTree.text       = "模块:" + item.ModuleName;
                moduleTree.@checked   = userModules.IsActive;
                moduleTree.attributes = "module";

                moduleTreeSet.Add(moduleTree);
                SetModuleTree(moduleTree, item, userSystems);
                moduleTreeSet.Add(moduleTree);
            }
            userSystemTree.children = moduleTreeSet.ToArray();
            userSystemTreeSet.Add(userSystemTree);
            return(userSystemTreeSet.ToArray());
        }
예제 #16
0
        public bool Add(string moduleName, int showOrder, string moduleUrl, string indicateImage, string desktopImage, string systemID, string moduleID)
        {
            IQueryable <THOK.Authority.DbModel.System> querySystem = SystemRepository.GetQueryable();
            IQueryable <THOK.Authority.DbModel.Module> queryModule = ModuleRepository.GetQueryable();

            moduleID = !String.IsNullOrEmpty(moduleID) ? moduleID : "40DD7298-F410-43F2-840A-7C04F09B5CE2";
            var system       = querySystem.FirstOrDefault(i => i.SystemID == new Guid(systemID));
            var parentModule = queryModule.FirstOrDefault(i => i.ModuleID == new Guid(moduleID));
            var module       = new Module();

            module.ModuleID      = Guid.NewGuid();
            module.ModuleName    = moduleName;
            module.ShowOrder     = showOrder;
            module.ModuleURL     = moduleUrl;
            module.IndicateImage = indicateImage;
            module.DeskTopImage  = desktopImage;
            module.System        = system;
            module.ParentModule  = parentModule ?? module;
            ModuleRepository.Add(module);
            ModuleRepository.SaveChanges();
            return(true);
        }
예제 #17
0
        public bool Delete(string moduleID)
        {
            IQueryable <THOK.Authority.DbModel.Module> queryModule = ModuleRepository.GetQueryable();

            Guid gmoduleId = new Guid(moduleID);
            var  module    = queryModule.FirstOrDefault(i => i.ModuleID == gmoduleId);

            if (module != null)
            {
                Del(FunctionRepository, module.Functions);
                Del(ModuleRepository, module.Modules);
                Del(RoleModuleRepository, module.RoleModules);
                Del(UserModuleRepository, module.UserModules);

                ModuleRepository.Delete(module);
                ModuleRepository.SaveChanges();
            }
            else
            {
                return(false);
            }
            return(true);
        }
예제 #18
0
        public bool Add(string moduleName, int showOrder, string moduleUrl, string indicateImage, string desktopImage, string systemID, string moduleID)
        {
            IQueryable <AUTH_SYSTEM> querySystem = SystemRepository.GetQueryable();
            IQueryable <AUTH_MODULE> queryModule = ModuleRepository.GetQueryable();

            moduleID = !String.IsNullOrEmpty(moduleID) ? moduleID : "000001";
            var system       = querySystem.FirstOrDefault(i => i.SYSTEM_ID == systemID);
            var parentModule = queryModule.FirstOrDefault(i => i.MODULE_ID == moduleID);
            var module       = new AUTH_MODULE();

            //module.MODULE_ID = Guid.NewGuid();
            module.MODULE_ID          = ModuleRepository.GetNewID("AUTH_MODULE", "MODULE_ID");
            module.MODULE_NAME        = moduleName;
            module.SHOW_ORDER         = showOrder;
            module.MODULE_URL         = moduleUrl;
            module.INDICATE_IMAGE     = indicateImage;
            module.DESK_TOP_IMAGE     = desktopImage;
            module.AUTH_SYSTEM        = system;
            module.PARENT_AUTH_MODULE = parentModule ?? module;
            ModuleRepository.Add(module);
            ModuleRepository.SaveChanges();
            return(true);
        }
예제 #19
0
        public bool Delete(string moduleID)
        {
            IQueryable <AUTH_MODULE> queryModule = ModuleRepository.GetQueryable();

            //Guid gmoduleId = new Guid(moduleID);
            //var module = queryModule.FirstOrDefault(i => i.ModuleID == gmoduleId);
            var module = queryModule.FirstOrDefault(i => i.MODULE_ID == moduleID);

            if (module != null)
            {
                Del(FunctionRepository, module.AUTH_FUNCTION);
                Del(ModuleRepository, module.AUTH_MODULES);
                Del(RoleModuleRepository, module.AUTH_ROLE_MODULE);
                Del(UserModuleRepository, module.AUTH_USER_MODULE);

                ModuleRepository.Delete(module);
                ModuleRepository.SaveChanges();
            }
            else
            {
                return(false);
            }
            return(true);
        }
예제 #20
0
        public System.Data.DataTable GetModules(int page, int rows, Module module, bool systemIdIsNull)
        {
            IQueryable <Module> moduleQuery = ModuleRepository.GetQueryable();

            var moduleDetail = moduleQuery;

            if (systemIdIsNull == false)
            {
                moduleDetail = moduleDetail.Where(m => m.System_SystemID == module.System_SystemID);
            }

            var system = moduleDetail.ToArray().OrderBy(s => s.ShowOrder).Select(s => new {
                ModuleName    = s.System.SystemName,
                IndicateImage = "",
                ModuleURL     = "",
                ShowOrder     = ""
            }).Distinct();

            //var ParentModule = moduleDetail.Where(s => s.ParentModule_ModuleID == s.ModuleID).ToArray()
            //    .OrderBy(s => s.ShowOrder)
            //    .Select(p => new
            //    {
            //        ModuleName = "    |---" + p.ModuleName,
            //        p.IndicateImage,
            //        p.ModuleURL,
            //        p.ShowOrder,
            //        p.ModuleID
            //    });

            //var module_Detail = moduleDetail.Where(s => s.ParentModule_ModuleID != s.ModuleID).ToArray()
            //    .OrderBy(s => s.ShowOrder)
            //    .Select(m => new
            //    {
            //        ModuleName ="        |---"+m.ModuleName,
            //        IndicateImage="        |---"+m.IndicateImage,
            //        ModuleURL="        |---"+m.ModuleURL,
            //        ShowOrder = "        |---" + m.ShowOrder
            //    });
            System.Data.DataTable dt = new System.Data.DataTable();
            dt.Columns.Add("模块名称", typeof(string));
            dt.Columns.Add("图标", typeof(string));
            dt.Columns.Add("路径", typeof(string));
            dt.Columns.Add("显标顺序", typeof(string));
            foreach (var sys in system)
            {
                dt.Rows.Add
                (
                    sys.ModuleName,
                    sys.IndicateImage,
                    sys.ModuleURL,
                    sys.ShowOrder
                );
                var ParentModule = moduleDetail.Where(s => s.ParentModule_ModuleID == s.ModuleID &&
                                                      s.System.SystemName == sys.ModuleName).ToArray()
                                   .OrderBy(s => s.ShowOrder)
                                   .Select(p => new
                {
                    ModuleName = "    |---" + p.ModuleName,
                    p.IndicateImage,
                    p.ModuleURL,
                    p.ShowOrder,
                    p.ModuleID
                });
                foreach (var pm in ParentModule)
                {
                    dt.Rows.Add
                    (
                        pm.ModuleName,
                        pm.IndicateImage,
                        pm.ModuleURL,
                        pm.ShowOrder
                    );
                    var module_Detail = moduleDetail.Where(s => s.ParentModule_ModuleID != s.ModuleID &&
                                                           s.ParentModule_ModuleID == pm.ModuleID).ToArray()
                                        .OrderBy(s => s.ShowOrder)
                                        .Select(m => new
                    {
                        ModuleName = "    |---------" + m.ModuleName,
                        m.IndicateImage,
                        m.ModuleURL,
                        m.ShowOrder
                    });
                    foreach (var m in module_Detail)
                    {
                        dt.Rows.Add
                        (
                            m.ModuleName,
                            m.IndicateImage,
                            m.ModuleURL,
                            m.ShowOrder
                        );
                    }
                }
            }
            return(dt);
        }