/// <summary> /// 【订阅作业结果】选中TreeView节点 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tvUserJob_AfterCheck(object sender, TreeViewEventArgs e) { if (!_isCanAfterCheckOfJob) { return; } TreeNode checkNode = e.Node; if (checkNode == null) { return; } //if (checkNode.Level == 0) { if (checkNode.Checked) { #region 新增用户作业授权 //过滤重复的[用户作业授权] if (!_userJobAuthoritiyList.Any(x => x.UJA_User_ID == mcbUserName.SelectedValue && x.BJ_ID == checkNode.Tag.ToString())) { _userJobAuthoritiyList.Add(new UserJobAuthorityUIModel() { UJA_IsValid = true, UJA_User_ID = mcbUserName.SelectedValue, UJA_BJ_ID = checkNode.Tag.ToString(), UJA_CreatedBy = LoginInfoDAX.UserName, UJA_UpdatedBy = LoginInfoDAX.UserName }); } #endregion } else { #region 除用户作业授权 List <UserJobAuthorityUIModel> deleteUserJobList = _userJobAuthoritiyList.Where( p => p.UJA_User_ID == mcbUserName.SelectedValue && p.BJ_ID == checkNode.Tag.ToString()) .ToList(); if (deleteUserJobList.Count > 0) { _userJobAuthoritiyList.Remove(deleteUserJobList[0]); } #endregion } } }
/// <summary> /// 选中组织节点【只有一级】 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tvOrg_AfterCheck(object sender, TreeViewEventArgs e) { if (!_isCanAfterCheck) { return; } TreeNode checkNode = e.Node; if (checkNode == null) { return; } if (tvOrg.Nodes.Contains(checkNode)) { if (checkNode.Checked) { //过滤重复的[用户组织] if (!_userOrgList.Any(x => x.UO_Org_ID == checkNode.Tag?.ToString() && x.UO_User_ID == txtUser_ID.Text.Trim())) { //添加 _userOrgList.Add(new UserOrgUIModel() { UO_Org_ID = checkNode.Tag?.ToString(), UO_User_ID = txtUser_ID.Text.Trim(), UO_IsValid = true, UO_CreatedBy = LoginInfoDAX.UserName, UO_CreatedTime = BLLCom.GetCurStdDatetime(), UO_UpdatedBy = LoginInfoDAX.UserName, UO_UpdatedTime = BLLCom.GetCurStdDatetime(), }); } } else { //删除 List <UserOrgUIModel> deleteUserOrgList = _userOrgList.Where(p => p.UO_Org_ID == checkNode.Tag?.ToString() && p.UO_User_ID == txtUser_ID.Text.Trim()) .ToList(); if (deleteUserOrgList.Count > 0) { _userOrgList.Remove(deleteUserOrgList[0]); } } } }
/// <summary> /// 【菜单动作授权】选中TreeView节点 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tvUserMenuAction_AfterCheck(object sender, TreeViewEventArgs e) { if (!_isCanAfterCheckOfMenu) { return; } //考虑三种情况 第一:点击菜单 第二:点击菜单明细 第三:点击菜单明细动作 TreeNode checkNode = e.Node; if (checkNode == null) { return; } if (checkNode.Level == 0) { #region 点击菜单的场合 //该[菜单]下所有[菜单明细]的勾选状态与该[菜单]一致 foreach (TreeNode loopMenuDetailTreeNode in checkNode.Nodes) { loopMenuDetailTreeNode.Checked = checkNode.Checked; } #endregion } else if (checkNode.Level == 1) { #region 点击菜单明细的场合【新增/删除用户菜单明细授权】 if (checkNode.Checked) { #region 新增用户菜单明细授权 //过滤重复的[用户菜单明细授权] if (!_userMenuAuthoritiyList.Any(x => x.UMA_User_ID == mcbUserName.SelectedValue && x.UMA_Org_ID == LoginInfoDAX.OrgID && x.UMA_MenuD_ID == checkNode.Tag.ToString())) { _userMenuAuthoritiyList.Add(new UserMenuAuthorityUIModel() { UMA_IsValid = true, UMA_User_ID = mcbUserName.SelectedValue, UMA_Org_ID = LoginInfoDAX.OrgID, UMA_MenuD_ID = checkNode.Tag.ToString(), UMA_CreatedBy = LoginInfoDAX.UserName, UMA_UpdatedBy = LoginInfoDAX.UserName }); } #endregion } else { #region 除用户菜单明细授权 List <UserMenuAuthorityUIModel> deleteUserMenuAuthorityList = _userMenuAuthoritiyList.Where(p => p.UMA_Org_ID == LoginInfoDAX.OrgID && p.UMA_User_ID == mcbUserName.SelectedValue && p.UMA_MenuD_ID == checkNode.Tag.ToString()).ToList(); if (deleteUserMenuAuthorityList.Count > 0) { _userMenuAuthoritiyList.Remove(deleteUserMenuAuthorityList[0]); } #endregion } //该[菜单明细]下所有[菜单明细动作]的勾选状态与该[菜单明细]一致 foreach (TreeNode loopMenuActionTreeNode in checkNode.Nodes) { loopMenuActionTreeNode.Checked = checkNode.Checked; } #endregion } else if (checkNode.Level == 2) { #region 点击菜单明细动作的场合【新增/删除用户菜单明细动作授权】 if (checkNode.Checked) { #region 新增用户菜单明细动作授权 //过滤重复的[用户菜单明细动作授权] if (!_userActionAuthoritiyList.Any(x => x.UAA_User_ID == mcbUserName.SelectedValue && x.UAA_Org_ID == LoginInfoDAX.OrgID && x.UAA_MenuD_ID == checkNode.Parent.Tag.ToString() && x.UAA_Action_ID == checkNode.Tag.ToString())) { _userActionAuthoritiyList.Add(new UserActionAuthorityUIModel() { UAA_IsValid = true, UAA_User_ID = mcbUserName.SelectedValue, UAA_Org_ID = LoginInfoDAX.OrgID, UAA_MenuD_ID = checkNode.Parent.Tag.ToString(), UAA_Action_ID = checkNode.Tag.ToString(), UAA_CreatedBy = LoginInfoDAX.UserName, UAA_UpdatedBy = LoginInfoDAX.UserName }); } #endregion } else { #region 除用户菜单明细动作授权 List <UserActionAuthorityUIModel> deleteUserActionAuthorityList = _userActionAuthoritiyList.Where(p => p.UAA_Org_ID == LoginInfoDAX.OrgID && p.UAA_User_ID == mcbUserName.SelectedValue && p.UAA_MenuD_ID == checkNode.Parent.Tag.ToString() && p.UAA_Action_ID == checkNode.Tag.ToString()).ToList(); if (deleteUserActionAuthorityList.Count > 0) { _userActionAuthoritiyList.Remove(deleteUserActionAuthorityList[0]); } #endregion } #endregion } }