private void LoadRoleTree(Microsoft.Web.UI.WebControls.TreeNode currentNode, RoleType currentRoleType) { IList subRoleType = null; if (currentRoleType != null) { subRoleType = currentRoleType.SubRoleTypes; } else { subRoleType = RoleTypeSrv.GetAllTopRoleType(); } //增加角色分类。 foreach (RoleType rt in subRoleType) { Microsoft.Web.UI.WebControls.TreeNode node = new Microsoft.Web.UI.WebControls.TreeNode(); currentNode.Nodes.Add(node); node.Type = "roletype"; node.Text = rt.Name; node.PKId = rt.Id; node.OrderId = rt.OrderId.ToString(); LoadRoleTree(node, rt); node.Expanded = true; } currentNode.Expanded = true; }
public ActionResult RoleTypeInfo(RoleTypeDTO dto) { if (ModelState.IsValid) { if (string.IsNullOrEmpty(dto.Id)) { string result = RoleTypeSrv.InsertRoleType(dto); if (!string.IsNullOrEmpty(result) && result != "-2") { result = "1"; } return(Content(result, "text/plain")); } else { RoleTypeSrv.UpdateRoleType(dto); return(Content("1")); } } //获取ErrorMessage string errorMsg = ModelState.Values.First(x => x.Errors.Count > 0).Errors[0].ErrorMessage; return(Content(errorMsg, "text/plain")); }
/// <summary> /// 删除Roletype /// </summary> /// <param name="Id"></param> /// <returns></returns> public ActionResult DelRoleType(string Id) { string sSucceed = "1"; try { RoleTypeSrv.DeleteModuleType(Id); } catch (Exception ex) { sSucceed = "-1"; } return(Content(sSucceed)); }
public ActionResult MoveRoleType(string Id, string newParentPKId) { string sSucceed = "1"; try { RoleTypeSrv.MoveRoleType(Id, newParentPKId); } catch (Exception ex) { sSucceed = "-1"; } return(Content(sSucceed)); }
private void LoadRoleTree(Staff s) { IList ilRoleType = RoleTypeSrv.GetAllTopRoleType(); //增加角色分类 foreach (RoleType rt in ilRoleType) { Microsoft.Web.UI.WebControls.TreeNode node = new Microsoft.Web.UI.WebControls.TreeNode(); tvRoles.Nodes.Add(node); node.Type = "roletype"; node.Text = rt.Name; node.PKId = rt.Id; AddSubNodes(node, rt, s); node.Expanded = true; } tvRoles.Nodes[0].Expanded = true; }
public ActionResult RoleTypeInfoTree() { NodeType ntype = new NodeType(); ntype.id = "0"; ntype.text = "角色分类"; ntype.ntype = "root"; IList ilRoleType = RoleTypeSrv.GetAllTopRoleType(); var ilNodeType = GetRoleTypeList(ilRoleType); ntype.children = ilNodeType; var rNodeType = new List <NodeType>(); rNodeType.Add(ntype); string jsonResult = JsonConvert.SerializeObject(rNodeType, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); return(Content(jsonResult, "application/json")); }
public ActionResult RolesTree(string Id) { IList ilRoleType = RoleTypeSrv.GetAllTopRoleType(); Staff staff = CommonSrv.LoadObjectById(typeof(Staff), Id) as Staff; NodeType ntype = new NodeType(); ntype.id = "0"; ntype.text = "角色分类"; ntype.ntype = "root"; var ilNodeType = GetModulePermissionList(ilRoleType, staff); ntype.children = ilNodeType; var rNodeType = new List <NodeType>(); rNodeType.Add(ntype); string jsonResult = JsonConvert.SerializeObject(rNodeType, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); return(Content(jsonResult, "application/json")); }