public void InitSubMenu(string appId) { content += "<ul>"; SysModule[] modules = SysModuleRule.FindAll(); foreach (SysModule module in modules) { if (string.IsNullOrEmpty(module.ParentID) && module.ApplicationID == appId) { if (CheckExsitChild(modules, module.ModuleID)) { content += string.Format("<li><a href='{0}' target=workFrame>{1}</a>", module.Url == null ? "" : module.Url.ToString(), module.Name); InitSubs(modules, module); content += "</li>"; } else { content += string.Format(Template, module.Url == null ? "" : module.Url.ToString(), module.Name); } } } content += "</ul>"; }
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); } }