public Role GetRole() { Role role; role = new Role { Name = this.txtName.Text.Trim(), Description = this.txtDesc.Text.Trim(), CreateDate = DateTime.Now }; role.ID = role.Name.GetHashCode().ToString(); role.PermFuncList.Clear(); this.funcIdList.Clear(); foreach (TreeNode node in this.tvFunc.Nodes) { this.AddCheckedNodes(node); } role.PermFuncList.AddRange(this.funcList); PermFunc item = new PermFunc("Aisino.Fwkp.Resources.Entry") { CreateDate = DateTime.Now }; role.PermFuncList.Add(item); return(role); }
public Dictionary <string, List <PermFunc> > SelectRoleFuncs() { Dictionary <string, List <PermFunc> > dictionary = new Dictionary <string, List <PermFunc> >(); try { foreach (object obj2 in this.baseDAO.querySQL("Aisino.Fwkp.Xtgl.SelectRoleFuncs", null)) { Dictionary <string, object> dictionary2 = obj2 as Dictionary <string, object>; if (dictionary2 != null) { string key = dictionary2["JSXX_DM"].ToString(); PermFunc item = new PermFunc(dictionary2["GNXX_DM"].ToString()); if (!dictionary.ContainsKey(key)) { dictionary.Add(key, new List <PermFunc>()); } dictionary[key].Add(item); } } } catch (Exception exception) { MessageManager.ShowMsgBox("INP-131301"); this.loger.Error(exception.Message, exception); } return(dictionary); }
private void AddCheckedNodes(TreeNode treeNode) { if (treeNode.Checked) { PermFunc item = new PermFunc(treeNode.Name) { CreateDate = DateTime.Now }; this.funcList.Add(item); foreach (TreeNode node in treeNode.Nodes) { this.AddCheckedNodes(node); } } }
private bool HasFuncChanged(Role role) { bool flag = false; this.selFuncIdList.Clear(); foreach (TreeNode node in this.tvRolePerm.Nodes) { this.AddCheckedFuncNodes(node); } if (this.selFuncIdList.Count != role.PermFuncList.Count) { flag = true; } else { foreach (PermFunc func in role.PermFuncList) { if ((func != null) && !this.selFuncIdList.Contains(func.FuncID)) { flag = true; break; } } } if (flag) { role.PermFuncList.Clear(); foreach (string str in this.selFuncIdList) { PermFunc func2 = new PermFunc(str) { CreateDate = DateTime.Now }; role.PermFuncList.Add(func2); } PermFunc item = new PermFunc("Aisino.Fwkp.Resources.Entry") { CreateDate = DateTime.Now }; role.PermFuncList.Add(item); } return(flag); }