private void AddRemoveMenuItem(SecurityTreeNode _node) { GroupRight groupRight; if (_node != null && CrGroup != null) { if (_node.Checked == true) { groupRight = CrGroup.GroupRights.Find(g => g.MenuID == _node.Name); if (groupRight == null) { groupRight = new GroupRight() { GroupID = CrGroup.GroupID, MenuID = _node.Name, AllowedFunctions = 0 }; CrGroup.GroupRights.Add(groupRight); } } else { groupRight = CrGroup.GroupRights.Find(g => g.MenuID == _node.Name); if (groupRight != null) { CrGroup.GroupRights.Remove(groupRight); } } } }
private void UpdateMenuItemRights(SecurityTreeNode _node, FormFunction _formFunction,CheckState _checkStatus) { if (AllowRightsUpdates == true && _node != null && CrGroup != null) { if (_checkStatus == CheckState.Checked) { if ((_node.MenuItem.FormAllowedFunctions & _formFunction.FunctionID) > 0) _node.GroupAllowedFunctions += _formFunction.FunctionID; } else { _node.GroupAllowedFunctions -= _formFunction.FunctionID; } var groupRight = CrGroup.GroupRights.Find(g => g.MenuID == _node.Name); if (groupRight != null) groupRight.AllowedFunctions = _node.GroupAllowedFunctions; } }
private void UnSelectAllChildNodes(SecurityTreeNode _node) { foreach (SecurityTreeNode node in _node.Nodes) { UnSelectAllChildNodes(node); node.Checked = false; } }
private void ShowMenuItemRights(SecurityTreeNode _node) { AllowRightsUpdates = false; for (int rightItemIndex = 0; rightItemIndex < lstRights.Items.Count; rightItemIndex++) { var rightItem = (FormFunction)lstRights.Items[rightItemIndex]; if ((rightItem.FunctionID & _node.MenuItem.FormAllowedFunctions & _node.GroupAllowedFunctions) > 0) lstRights.SetItemChecked(rightItemIndex, true); else lstRights.SetItemChecked(rightItemIndex, false); } AllowRightsUpdates = true; }
private void SelectAllChildNodes(SecurityTreeNode _node) { foreach (SecurityTreeNode node in _node.Nodes) { SelectAllChildNodes(node); node.Checked = true; } }
private void LoadAllForms() { List<BackOfficeBL.Security.MenuItem> allForms = BackOfficeBL.Security.MenuItem.LoadAllForms(); foreach (var form in allForms) { SecurityTreeNode node = new SecurityTreeNode(); node.Name = form.MenuID; node.Text = form.Text; node.MenuItem = form; node.GroupAllowedFunctions = 0; if (string.IsNullOrEmpty(form.ParentMenuID) == true) treeMenu.Nodes.Add(node); else { TreeNode[] prntNodes= treeMenu.Nodes.Find(form.ParentMenuID, true); if (prntNodes.Length > 0) { var prntNode = prntNodes.First(); prntNode.Nodes.Add(node); } } } }