protected void Page_Load(object sender, EventArgs e) { if (this.IsAsyncRequest) { switch (this.RequestAction) { case RequestActionEnum.Custom: if (RequestActionString == "querychildren") { string id = (RequestData.ContainsKey("ID") ? RequestData["ID"].ToString() : String.Empty); string type = RequestData["Type"].ToString().ToLower(); if (RequestData.ContainsKey("Type")) { if (type == "gtype") { ents = SysGroup.FindAll("FROM SysGroup as ent WHERE ent.Type = ?", id); this.PageState.Add("DtList", ents); } } } break; } } else { SysGroupType[] typeList = SysGroupTypeRule.FindAll(); this.PageState.Add("DtList", typeList); } }
protected void Page_Load(object sender, EventArgs e) { SearchCriterion.AutoOrder = false; SearchCriterion.SetOrder(SysUser.Prop_WorkNo); string dName = SearchCriterion.GetSearchValue <string>("Name"); if (dName != null && dName.Trim() != "") { string where = "select * from SysUser where " + GetPinyinWhereString("Name", dName); this.PageState.Add("UsrList", DataHelper.QueryDictList(where)); } else { ents = SysUserRule.FindAll(SearchCriterion); this.PageState.Add("UsrList", ents); } if (this.IsAsyncRequest) { switch (this.RequestAction) { case RequestActionEnum.Custom: if (RequestActionString == "querychildren") { string id = (RequestData.ContainsKey("ID") ? RequestData["ID"].ToString() : String.Empty); string ttype = RequestData["Type"].ToString().ToLower(); if (RequestData.ContainsKey("Type")) { if (ttype == "atype") // 1为入口权限 { SysAuth[] auths = SysAuth.FindAll("FROM SysAuth as ent WHERE ent.Type = ?", id); this.PageState.Add("DtList", auths); } } } break; default: break; } } else { SysAuthType[] authTypeList = SysAuthTypeRule.FindAll(); this.PageState.Add("DtList", authTypeList); } }
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); } }
protected void Page_Load(object sender, EventArgs e) { switch (this.RequestAction) { case RequestActionEnum.Custom: if (RequestActionString == "querychildren") { string id = (RequestData.ContainsKey("ID") ? RequestData["ID"].ToString() : String.Empty); string ttype = RequestData["Type"].ToString().ToLower(); if (RequestData.ContainsKey("Type")) { SysAuth[] ents = null; if (ttype == "atype") // 1为入口权限 { ents = SysAuth.FindAll("FROM SysAuth as ent WHERE ent.Type = ? AND ent.ParentID is null", id); } else { ents = SysAuth.FindAll("FROM SysAuth as ent WHERE ent.ParentID = ?", id); } this.PageState.Add("DtList", ents.OrderBy(v => v.SortIndex).ThenBy(v => v.CreateDate)); } } else if (RequestActionString == "refreshsys") { PortalService.RefreshSysModules(); SetMessage("操作成功!"); } break; } if (!IsAsyncRequest) { SysAuthType[] authTypeList = SysAuthTypeRule.FindAll(); this.PageState.Add("DtList", authTypeList); } }
protected void Page_Load(object sender, EventArgs e) { if (this.IsAsyncRequest) { switch (this.RequestAction) { case RequestActionEnum.Custom: if (RequestActionString == "querychildren") { string id = (RequestData.ContainsKey("ID") ? RequestData["ID"].ToString() : String.Empty); string type = String.Empty; ents = SysGroup.FindAll("FROM SysGroup as ent WHERE ent.ParentID = ? order by sortindex", id); this.PageState.Add("DtList", ents); //if (RequestData.ContainsKey("Type")) //{ // type = RequestData["Type"].ToString().ToLower(); // if (type == "gtype") // { // ents = SysGroup.FindAll("FROM SysGroup as ent WHERE ent.Type = ? order by sortindex", id); // this.PageState.Add("DtList", ents); // } //} } break; } } else { //SysGroupType[] typeList = SysGroupType.FindAllByProperties("GroupTypeID",2); SysGroup[] typeList = SysGroup.FindAll(Expression.IsNull(SysGroup.Prop_ParentID)); this.PageState.Add("DtList", typeList); } }
protected void Page_Load(object sender, EventArgs e) { if (this.IsAsyncRequest) { switch (this.RequestAction) { case RequestActionEnum.Custom: if (RequestActionString == "querychildren") { string id = (RequestData.ContainsKey("ID") ? RequestData["ID"].ToString() : String.Empty); if (RequestData.ContainsKey("Type")) { string type = RequestData["Type"].ToString().ToLower(); if (type == "gtype") { ents = SysGroup.FindAll("FROM SysGroup as ent WHERE ent.Type = ? and ent.ParentID is null order by SortIndex", id); this.PageState.Add("DtList", ents); } if (id != "" && id.Length > 1) { ents = SysGroup.FindAll("FROM SysGroup as ent WHERE ent.ParentID = ? and ent.Type=2 order by SortIndex ", id); this.PageState.Add("DtList", ents); } } } break; } } else { // 选择组织结构类型 ents = SysGroup.FindAll("FROM SysGroup as ent WHERE ent.GroupID = 'A67ADFAA-CC13-4168-9588-B52D6BC555D3' and ent.Type=2 order by SortIndex "); this.PageState.Add("DtList", ents); } }
IList <string> pids = null; // 父节点列表 protected void Page_Load(object sender, EventArgs e) { id = RequestData.Get <string>("id", String.Empty); ids = RequestData.GetList <string>("ids"); pids = RequestData.GetList <string>("pids"); if (IsAsyncRequest) { switch (this.RequestAction) { case RequestActionEnum.Custom: if (RequestActionString == "querychildren") { id = (RequestData.ContainsKey("id") ? RequestData["id"].ToString() : String.Empty); string sql = @"select distinct b.GroupId,b.Name,b.Path,b.PathLevel,b.ParentID from ( select GroupID,Name,Path from BJKY_Portal..SysGroup c where exists ( select DeptId from( SELECT * FROM BJKY_IntegratedManage..Rule_Regulation where AuthType='all' union select a.* from BJKY_IntegratedManage..Rule_Regulation a left join BJKY_Portal..View_SysUserGroup b on a.DeptId like '%'+b.DeptId+'%' where b.UserId='{0}' and b.Type<>'3' and a.AuthType='dept' union select a.* from BJKY_IntegratedManage..Rule_Regulation a left join BJKY_IntegratedManage..Rule_Regulation_BrowseAuth b on b.Rule_Regulation=a.Id where b.UserId='{0}' and a.AuthType='specify' union select a.* from BJKY_IntegratedManage..Rule_Regulation a left join BJKY_IntegratedManage..Rule_Regulation_BrowseDept b on b.Rule_Regulation=a.Id left join BJKY_Portal..View_SysUserGroup c on b.DeptId=c.DeptId where c.UserId='{0}' and c.Type<>'3' and a.AuthType='specify')a where charindex(c.GroupID,a.DeptId)>0 ) )a left join BJKY_Portal..SysGroup b on a.Path like '%'+b.Path+'%'"; sql = string.Format(sql, UserInfo.UserID); DataTable dt = new DataTable(); dt = DataHelper.QueryDataTable(sql, DataHelper.GetCurrentDbConnection(typeof(Rule_Regulation_BrowseAuth))); string jsonString = JsonHelper.GetJsonString(this.ToExtTreeCollection(dt, null)); Response.Write(jsonString); Response.End(); } break; default: SysGroup[] grpList = SysGroup.FindAll("From SysGroup as ent where ParentId is null and Type = 2 Order By SortIndex, CreateDate Desc"); this.PageState.Add("DtList", grpList); break; } } else { ents = SysGroup.FindAll(Expression.Eq("PathLevel", 1)); //ents = ents.OrderByDescending(ment => ment.Type).ToArray(); this.PageState.Add("DtList", ents); } }
string type = String.Empty; // 查询类型 protected void Page_Load(object sender, EventArgs e) { id = (RequestData.ContainsKey("id") ? RequestData["id"].ToString() : String.Empty); type = (RequestData.ContainsKey("type") ? RequestData["type"].ToString() : String.Empty).ToLower(); if (this.IsAsyncRequest) { switch (this.RequestAction) { case RequestActionEnum.Custom: if (RequestActionString == "querychildren" || RequestActionString == "querydescendant") { SysModule[] ents = null; if (RequestActionString == "querychildren") { string atype = String.Empty; ents = SysModule.FindAll("FROM SysModule as ent WHERE ent.ParentID = ?", id); } else if (RequestActionString == "querydescendant") { string atype = String.Empty; ents = UserContext.AccessibleModules.Where(tent => tent.Path != null && tent.Path.IndexOf(id) > 0).ToArray(); } string jsonString = JsonHelper.GetJsonString(this.ToExtTreeCollection(ents.OrderBy(v => v.SortIndex).ThenBy(v => v.CreateDate), null)); Response.Write(jsonString); Response.End(); } break; } } else { SysAuthType[] authTypeList = SysAuthTypeRule.FindAll(); if (this.Request.QueryString["Role"] != null && this.Request.QueryString["Role"] == "User") { authTypeList = SysAuthType.FindAllByProperties(SysAuthType.Prop_AuthTypeID, 1); } IEnumerable <SysModule> ents = UserContext.AccessibleModules.Where(tent => tent.ApplicationID == id && tent.ParentID == null) .OrderBy(tent => tent.SortIndex); this.PageState.Add("DtList", ents.ToList()); //this.PageState.Add("DtList", authTypeList); } // 获取权限列表 /*if (RequestAction != RequestActionEnum.Custom) * { * this.PageState.Add("EntityID", id); * * IEnumerable<string> authIDs = null; * using (new Castle.ActiveRecord.SessionScope()) * { * if (type == "user" && !String.IsNullOrEmpty(id)) * { * SysUser user = SysUser.Find(id); * if (this.RequestData.Get<string>("Deny") != null && this.RequestData.Get<string>("Deny").Trim() == "Y") * { * authIDs = (user.AuthNo).Select((ent) => { return ent.AuthID; }); * } * else * authIDs = (user.Auth).Select((ent) => { return ent.AuthID; }); * } * else if (type == "group" && !String.IsNullOrEmpty(id)) * { * SysGroup group = SysGroup.Find(id); * authIDs = (group.Auth).Select((ent) => { return ent.AuthID; }); * } * else if (type == "role" && !String.IsNullOrEmpty(id)) * { * SysRole role = SysRole.Find(id); * authIDs = (role.Auth).Select((ent) => { return ent.AuthID; }); * } * * this.PageState.Add("AtList", new List<string>(authIDs)); * } * }*/ }
string type = String.Empty; // 查询类型 protected void Page_Load(object sender, EventArgs e) { id = (RequestData.ContainsKey("id") ? RequestData["id"].ToString() : String.Empty); type = (RequestData.ContainsKey("type") ? RequestData["type"].ToString() : String.Empty).ToLower(); if (this.IsAsyncRequest) { switch (this.RequestAction) { case RequestActionEnum.Custom: if (RequestActionString == "querychildren" || RequestActionString == "querydescendant") { SysAuth[] ents = null; if (RequestActionString == "querychildren") { string atype = String.Empty; if (type == "atype") { ents = SysAuth.FindAll("FROM SysAuth as ent WHERE ent.Type = ? AND ent.ParentID IS NULL", id); } else { ents = SysAuth.FindAll("FROM SysAuth as ent WHERE ent.ParentID = ?", id); } } else if (RequestActionString == "querydescendant") { string atype = String.Empty; if (type == "atype") { ents = SysAuth.FindAll("FROM SysAuth as ent WHERE ent.Type = ?", id); } else { ents = SysAuth.FindAll("FROM SysAuth as ent WHERE ent.Path LIKE %?%", id); } } string jsonString = JsonHelper.GetJsonString(this.ToExtTreeCollection(ents.OrderBy(v => v.SortIndex).ThenBy(v => v.CreateDate), null)); Response.Write(jsonString); Response.End(); } else if (RequestActionString == "savechanges") { ICollection authAdded = RequestData["added"] as ICollection; ICollection authRemoved = RequestData["removed"] as ICollection; if (type == "user" && !String.IsNullOrEmpty(id)) { SysAuthRule.GrantAuthToUser(authAdded, id); SysAuthRule.RevokeAuthFromUser(authRemoved, id); } else if (type == "group" && !String.IsNullOrEmpty(id)) { SysAuthRule.GrantAuthToGroup(authAdded, id); SysAuthRule.RevokeAuthFromGroup(authRemoved, id); } else if (type == "role" && !String.IsNullOrEmpty(id)) { SysAuthRule.GrantAuthToRole(authAdded, id); SysAuthRule.RevokeAuthFromRole(authRemoved, id); } } break; } } else { SysAuthType[] authTypeList = SysAuthTypeRule.FindAll(); this.PageState.Add("DtList", authTypeList); } // 获取权限列表 if (RequestAction != RequestActionEnum.Custom) { this.PageState.Add("EntityID", id); IEnumerable <string> authIDs = null; using (new Castle.ActiveRecord.SessionScope()) { if (type == "user" && !String.IsNullOrEmpty(id)) { SysUser user = SysUser.Find(id); authIDs = (user.Auth).Select((ent) => { return(ent.AuthID); }); } else if (type == "group" && !String.IsNullOrEmpty(id)) { SysGroup group = SysGroup.Find(id); authIDs = (group.Auth).Select((ent) => { return(ent.AuthID); }); } else if (type == "role" && !String.IsNullOrEmpty(id)) { SysRole role = SysRole.Find(id); authIDs = (role.Auth).Select((ent) => { return(ent.AuthID); }); } this.PageState.Add("AtList", new List <string>(authIDs)); } } }
string type = String.Empty; // 查询类型 protected void Page_Load(object sender, EventArgs e) { id = (RequestData.ContainsKey("id") ? RequestData["id"].ToString() : UserInfo.UserID); type = (RequestData.ContainsKey("type") ? RequestData["type"].ToString() : String.Empty).ToLower(); if (this.IsAsyncRequest) { switch (this.RequestAction) { case RequestActionEnum.Custom: if (RequestActionString == "querydescendant") { SysAuth[] ents = null; string atype = String.Empty; //ents = SysAuth.FindAll("FROM SysAuth as ent WHERE ent.Type = ?", id); SysUser user = SysUser.Find(this.UserInfo.UserID); ents = this.UserContext.Auths.OrderBy(ens => ens.SortIndex).ToArray(); //SysAuth.FindAll(Expression.Sql("AuthID in (select AuthID from SysUserPermission where UserID ='" + this.UserInfo.UserID + "')")); //user.Auth.ToArray(); string jsonString = JsonHelper.GetJsonString(this.ToExtTreeCollection(ents.OrderBy(v => v.SortIndex).ThenBy(v => v.CreateDate), null)); Response.Write(jsonString); Response.End(); } else if (RequestActionString == "savechanges") { ICollection authAdded = RequestData["added"] as ICollection; ICollection authRemoved = RequestData["removed"] as ICollection; if (type == "user" && !String.IsNullOrEmpty(id)) { SysAuth[] tAuths = SysAuthRule.GetAuthByIDs(authAdded).ToArray(); foreach (SysAuth auth in tAuths) { MyShortCut cut = new MyShortCut(); cut.CreateId = this.UserInfo.UserID; cut.CreateName = this.UserInfo.Name; cut.CreateTime = DateTime.Now; cut.ModuleUrl = SysModule.Find(auth.ModuleID).Url; cut.AuthId = auth.AuthID; cut.AuthName = auth.Name; cut.IconFileName = "/images/shared/read.gif"; cut.Save(); } if (authRemoved.Count > 0) { ICollection myAuthIDs = null; if (authRemoved is JArray) { JArray arrAuths = authRemoved as JArray; myAuthIDs = new List <string>(arrAuths.Values <string>()); } else { myAuthIDs = authRemoved; } foreach (string s in myAuthIDs) { DataHelper.ExecSql("delete from MyShortCut where AuthId like '%" + s + "%' and CreateId='" + this.UserInfo.UserID + "'", DataHelper.GetCurrentDbConnection(typeof(MyShortCut))); } } //SysAuthRule.GrantAuthToUser(authAdded, id); //SysAuthRule.RevokeAuthFromUser(authRemoved, id); } /*else if (type == "group" && !String.IsNullOrEmpty(id)) * { * SysAuthRule.GrantAuthToGroup(authAdded, id); * SysAuthRule.RevokeAuthFromGroup(authRemoved, id); * } * else if (type == "role" && !String.IsNullOrEmpty(id)) * { * SysAuthRule.GrantAuthToRole(authAdded, id); * SysAuthRule.RevokeAuthFromRole(authRemoved, id); * }*/ } break; } } else { SysAuthType[] authTypeList = SysAuthTypeRule.FindAll(); if (this.Request.QueryString["Role"] != null && this.Request.QueryString["Role"] == "User") { authTypeList = SysAuthType.FindAllByProperties(SysAuthType.Prop_AuthTypeID, 1); } this.PageState.Add("DtList", authTypeList); } // 获取权限列表 if (RequestAction != RequestActionEnum.Custom) { this.PageState.Add("EntityID", id); IEnumerable <string> authIDs = null; IList <MyShortCut> mscEnts = MyShortCut.FindAllByProperty(MyShortCut.Prop_CreateId, UserInfo.UserID); authIDs = mscEnts.Select(s => s.AuthId); this.PageState.Add("AtList", new List <string>(authIDs)); //using (new Castle.ActiveRecord.SessionScope()) //{ // if (type == "user" && !String.IsNullOrEmpty(id)) // { // SysUser user = SysUser.Find(id); // if (this.RequestData.Get<string>("Deny") != null && this.RequestData.Get<string>("Deny").Trim() == "Y") // { // authIDs = (user.AuthNo).Select((ent) => { return ent.AuthID; }); // } // else // authIDs = (user.Auth).Select((ent) => { return ent.AuthID; }); // } // else if (type == "group" && !String.IsNullOrEmpty(id)) // { // SysGroup group = SysGroup.Find(id); // authIDs = (group.Auth).Select((ent) => { return ent.AuthID; }); // } // else if (type == "role" && !String.IsNullOrEmpty(id)) // { // SysRole role = SysRole.Find(id); // authIDs = (role.Auth).Select((ent) => { return ent.AuthID; }); // } // this.PageState.Add("AtList", new List<string>(authIDs)); //} } }
string type = String.Empty; // 查询类型 protected void Page_Load(object sender, EventArgs e) { id = (RequestData.ContainsKey("id") ? RequestData["id"].ToString() : String.Empty); type = (RequestData.ContainsKey("type") ? RequestData["type"].ToString() : String.Empty).ToLower(); if (this.IsAsyncRequest) { switch (this.RequestAction) { case RequestActionEnum.Custom: if (RequestActionString == "querychildren" || RequestActionString == "querydescendant") { SysRole[] ents = null; if (RequestActionString == "querychildren" || RequestActionString == "querydescendant") { string atype = String.Empty; if (type == "rtype") { ents = SysRole.FindAll("FROM SysRole as ent WHERE ent.Type = ?", id); } } string jsonString = JsonHelper.GetJsonString(this.ToExtTreeCollection(ents, null)); Response.Write(jsonString); Response.End(); } else if (RequestActionString == "savechanges") { ICollection authAdded = RequestData["added"] as ICollection; ICollection authRemoved = RequestData["removed"] as ICollection; if (type == "user" && !String.IsNullOrEmpty(id)) { SysRoleRule.GrantRoleToUser(authAdded, id); SysRoleRule.RevokeRoleFromUser(authRemoved, id); } else if (type == "group" && !String.IsNullOrEmpty(id)) { SysRoleRule.GrantRoleToGroup(authAdded, id); SysRoleRule.RevokeRoleFromGroup(authRemoved, id); } } break; } } else { SysRoleType[] typeList = SysRoleTypeRule.FindAll(); this.PageState.Add("EntData", typeList); } // 获取权限列表 if (RequestAction != RequestActionEnum.Custom) { this.PageState.Add("EntityID", id); IEnumerable <string> roleIDs = null; using (new Castle.ActiveRecord.SessionScope()) { if (type == "user" && !String.IsNullOrEmpty(id)) { SysUser user = SysUser.Find(id); roleIDs = (user.Role).Select((ent) => { return(ent.RoleID); }); } else if (type == "group" && !String.IsNullOrEmpty(id)) { SysGroup group = SysGroup.Find(id); roleIDs = (group.Role).Select((ent) => { return(ent.RoleID); }); } this.PageState.Add("EntList", new List <string>(roleIDs)); } } }