protected void Page_Load(object sender, EventArgs e) { SysApplication app = SysApplicationRule.FindByCode(APP_CODE); IList <SysModule> mdls = app.GetModulesByLevel(0, 5); // 获取深度为0~5的模块 PageState.Add("Mdls", mdls); }
protected void Page_Load(object sender, EventArgs e) { if (IsAsyncRequest) { switch (this.RequestAction) { case RequestActionEnum.Custom: if (RequestActionString == "querychildren") { SysModule[] mdls = null; if (RequestData.ContainsKey("ModuleID") && RequestData["ModuleID"] != null) { mdls = SysModule.FindAll("FROM SysModule as mdl WHERE mdl.ParentID = ?", RequestData["ModuleID"]); } else if (RequestData.ContainsKey("ApplicationID") && RequestData["ApplicationID"] != null) { mdls = SysModule.FindAll("FROM SysModule as mdl WHERE mdl.ApplicationID = ? AND mdl.ParentID is null", RequestData["ApplicationID"]); } mdls = mdls.OrderBy(ent => ent.SortIndex).ToArray(); this.PageState.Add("Mdls", mdls); } else if (RequestActionString == "refreshsys") { PortalService.RefreshSysModules(); SetMessage("操作成功!"); } break; } } else { SysApplication[] sysApps = SysApplicationRule.FindAll(); sysApps = sysApps.OrderBy(ent => ent.SortIndex).ToArray(); this.PageState.Add("Apps", sysApps); DataEnum de = SysModuleTypeRule.GetModuleTypeEnum(); this.PageState.Add("MdlTypeEnum", de); } }
private byte[] ExecuteServiceByMsgObj(OpMessage opMsg) { try { byte[] data = null; Object dataObj = null; if (String.IsNullOrEmpty(opMsg.Operation)) { return(null); } string label = (opMsg.Lable == null ? String.Empty : opMsg.Lable).ToLower(); string op = (opMsg.Operation == null ? String.Empty : opMsg.Operation).ToLower(); if (label == "getuserdata") { using (new SessionScope()) { UserLogonInfo logonInfo = Server.GetLogonInfo(opMsg.SessionID); IList <string> ids = new List <string>(); if (logonInfo != null) { if (op == "getlogoninfo") { dataObj = logonInfo; } else if (op == "getalluserauth") { dataObj = logonInfo.User.RetrieveAllAuth(); } else if (op == "getallusergroup") { dataObj = logonInfo.User.RetrieveAllGroup(); } else if (op == "getalluserrole") { dataObj = logonInfo.User.RetrieveAllRole(); } else if (op == "getalluserauthids") { IList <SysAuth> auths = logonInfo.User.RetrieveAllAuth(); IEnumerable <string> authIDs = auths.Select(ent => { return(ent.AuthID); }); dataObj = new List <string>(authIDs); } else if (op == "getallusergroupids") { IList <SysGroup> grps = logonInfo.User.RetrieveAllGroup(); IEnumerable <string> grpIDs = grps.Select(ent => { return(ent.GroupID); }); dataObj = new List <string>(grpIDs); } else if (op == "getalluserroleids") { IList <SysRole> roles = logonInfo.User.RetrieveAllRole(); IEnumerable <string> roleIDs = roles.Select(ent => { return(ent.RoleID); }); dataObj = new List <string>(roleIDs); } else if (op == "getuserinfo") { dataObj = new SimpleUserInfo(logonInfo); } else if (op == "getsysuser") { dataObj = logonInfo.User; } } } } else if (label == "getsystemdata") { using (new SessionScope()) { if (opMsg.Operation == "getallapplications") { dataObj = new List <SysApplication>(SysApplicationRule.FindAll()); } else if (opMsg.Operation == "getallmodules") { dataObj = new List <SysModule>(SysModuleRule.FindAll()); } else if (opMsg.Operation == "getallgroups") { dataObj = new List <SysGroup>(SysGroupRule.FindAll()); } else if (opMsg.Operation == "getallusers") { dataObj = new List <SysUser>(SysUserRule.FindAll()); } else if (opMsg.Operation == "getallroles") { dataObj = new List <SysRole>(SysRoleRule.FindAll()); } else if (opMsg.Operation == "getallauths") { dataObj = new List <SysAuth>(SysAuthRule.FindAll()); } } } else { try { if (op == "checkusersession") { dataObj = Server.CheckUserSession(opMsg.SessionID); } else if (op == "releasesession") { dataObj = Server.ReleaseSession(opMsg.SessionID); } else if (op == "setpreprelease") { if (opMsg["logmode"].Type != TypeCode.Empty) { Server.SetPrepRelease(opMsg.SessionID, (LoginTypeEnum)opMsg["logmode"].Value); } else { Server.SetPrepRelease(opMsg.SessionID); } Server.SetPrepRelease(opMsg.SessionID); } else if (op == "refreshsession") { Server.RefreshSession(opMsg.SessionID); } } catch (Exception ex) { dataObj = false; } } if (dataObj != null) { data = ServiceHelper.SerializeToBytes(dataObj); } return(data); } catch (Exception ex) { return(null); } }