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
{
///
/// 取消勾选所有权限项
/// 创建人:郑立兵
/// 创建时间:2014-6-07
/// 说明:实现取消勾选权限树形控件的所有节点项
///
public class ClearSelectAction : DatabaseAction, IAction
{
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime);
ICSharpCode.Core.LoggingService.Debug("在树控件中取消勾选所有权限");
DbMCControl basRolePurviewControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "BasRolePermission").FirstOrDefault();
if (basRolePurviewControl == null || !basRolePurviewControl.BaseControl.GetType().IsSubclassOf(typeof(TreeView)))
{
ICSharpCode.Core.LoggingService.Warn("权限树初始化勾选 缺少权限树形控件...");
return;
}
TreeView tv = basRolePurviewControl.BaseControl as TreeView;
if (tv != null)
{
foreach (TreeNode node in tv.Nodes)
{
node.Checked = false;
}
}
}
}
}