You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lj_plc/Actions/Default/Mesnac.Action.Default/Purview/SelectAllPurviewAction.cs

40 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mesnac.Action.Base;
using System.Windows.Forms;
namespace Mesnac.Action.Default.Purview
{
/// <summary>
/// 勾选所有权限项
/// 创建人:郑立兵
/// 创建时间2014-6-07
/// 说明:实现勾选权限树形控件的所有节点项
/// </summary>
public class SelectAllPurviewAction : DatabaseAction, IAction
{
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime);
ICSharpCode.Core.LoggingService<SelectAllPurviewAction>.Debug("在树控件中勾选所有权限");
DbMCControl basRolePurviewControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "BasRolePermission").FirstOrDefault();
if (basRolePurviewControl == null || !basRolePurviewControl.BaseControl.GetType().IsSubclassOf(typeof(TreeView)))
{
ICSharpCode.Core.LoggingService<SelectAllPurviewAction>.Warn("权限树初始化勾选 缺少权限树形控件...");
return;
}
TreeView tv = basRolePurviewControl.BaseControl as TreeView;
if (tv != null)
{
foreach (TreeNode node in tv.Nodes)
{
node.Checked = true;
}
}
}
}
}