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.
145 lines
5.3 KiB
C#
145 lines
5.3 KiB
C#
using System.Data;
|
|
using System.Linq;
|
|
using System.Windows.Forms;
|
|
using Mesnac.Action.Base;
|
|
using Mesnac.Codd.Session;
|
|
|
|
namespace Mesnac.Action.Default.Purview
|
|
{
|
|
|
|
public class BindRole : DatabaseAction , IAction
|
|
{
|
|
public void Run( Controls.Base.IBaseControl sender , string design , string runtime )
|
|
{
|
|
base.Run( sender );
|
|
|
|
base.LogDebug( "初始化绑定角色下拉列表" );
|
|
DbMCControl basRoleControl = this.GetDbMCControlByKey( DbType.local , "BasRole" ).FirstOrDefault();
|
|
if ( basRoleControl == null )
|
|
{
|
|
base.LogError( "角色信息加载 缺少角色组合框控件..." );
|
|
return;
|
|
}
|
|
|
|
DbHelper dbhelper;
|
|
if (!DbHelpers.TryGetValue(basRoleControl.DesignSource, out dbhelper))
|
|
{
|
|
return;
|
|
}
|
|
dbhelper.ClearParameter();
|
|
dbhelper.CommandType = CommandType.Text;
|
|
dbhelper.CommandText = "SELECT * FROM BasRole WHERE DeleteFlag='0';";
|
|
basRoleControl.BaseControl.BindDataSource = dbhelper.ToDataTable();
|
|
}
|
|
}
|
|
|
|
|
|
public class LoadFormPurview : DatabaseAction , IAction
|
|
{
|
|
public void Run( Controls.Base.IBaseControl sender , string design , string runtime )
|
|
{
|
|
base.Run( sender );
|
|
|
|
base.LogDebug( "向树控件初始化加载窗体级权限..." );
|
|
DbMCControl basRolePurviewControl = this.GetDbMCControlByKey( DbType.local , "BasRolePurview" ).FirstOrDefault();
|
|
if ( basRolePurviewControl == null || typeof(TreeView).IsInstanceOfType(basRolePurviewControl.BaseControl) )
|
|
{
|
|
base.LogError( "窗体级权限加载 缺少权限树形控件..." );
|
|
return;
|
|
}
|
|
|
|
DbHelper dbhelper;
|
|
if ( !DbHelpers.TryGetValue( basRolePurviewControl.DesignSource , out dbhelper ) )
|
|
{
|
|
return;
|
|
}
|
|
dbhelper.ClearParameter();
|
|
dbhelper.CommandType = CommandType.Text;
|
|
dbhelper.CommandText = "SELECT * FROM BasForm WHERE DeleteFlag='0' ORDER BY FormText;";
|
|
DataTable dt = dbhelper.ToDataTable();
|
|
if ( dt == null )
|
|
{
|
|
base.LogError( "窗体级权限加载 信息加载失败..." );
|
|
return;
|
|
}
|
|
|
|
TreeView tv = basRolePurviewControl.BaseControl as TreeView;
|
|
FormPurview frmPur;
|
|
TreeNode nodeL1;
|
|
foreach ( DataRow dr in dt.Rows )
|
|
{
|
|
frmPur = new FormPurview( dr[ "ObjID" ].ToString() , dr[ "FormName" ].ToString() , dr[ "FormText" ].ToString() , dr[ "FromType" ].ToString() );
|
|
|
|
nodeL1 = new TreeNode( frmPur.FormText );
|
|
nodeL1.Tag = frmPur;
|
|
|
|
tv.Nodes.Add( nodeL1 );
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public class LoadFunctionPurview : DatabaseAction , IAction
|
|
{
|
|
public void Run( Controls.Base.IBaseControl sender , string design , string runtime )
|
|
{
|
|
base.Run( sender );
|
|
|
|
base.LogDebug( "向树控件初始化加载控件级权限" );
|
|
DbMCControl basRolePurviewControl = this.GetDbMCControlByKey( DbType.local , "BasRolePurview" ).FirstOrDefault();
|
|
if ( basRolePurviewControl == null || typeof( TreeView ).IsInstanceOfType( basRolePurviewControl.BaseControl ) )
|
|
{
|
|
base.LogError( "控件级权限加载 缺少权限树形控件..." );
|
|
return;
|
|
}
|
|
|
|
DbHelper dbhelper;
|
|
if ( !DbHelpers.TryGetValue( basRolePurviewControl.DesignSource , out dbhelper ) )
|
|
{
|
|
return;
|
|
}
|
|
dbhelper.ClearParameter();
|
|
dbhelper.CommandType = CommandType.Text;
|
|
dbhelper.CommandText = "SELECT * FROM BasFormFunction WHERE DeleteFlag='0' ORDER BY FunctionText;";
|
|
DataTable dt = dbhelper.ToDataTable();
|
|
if ( dt == null )
|
|
{
|
|
base.LogError( "控件级权限加载 信息加载失败..." );
|
|
return;
|
|
}
|
|
|
|
TreeView tv = basRolePurviewControl.BaseControl as TreeView;
|
|
FormPurview frmPur;
|
|
FunctionPurview funcPur;
|
|
TreeNode nodeL2;
|
|
foreach ( DataRow dr in dt.Rows )
|
|
{
|
|
funcPur = new FunctionPurview( dr[ "ObjID" ].ToString() , dr[ "FormID" ].ToString() , dr[ "FunctionName" ].ToString() , dr[ "FunctionText" ].ToString() , dr[ "FunctionType" ].ToString() );
|
|
foreach(TreeNode nodeL1 in tv.Nodes)
|
|
{
|
|
frmPur = nodeL1.Tag as FormPurview;
|
|
if ( frmPur.ObjID == funcPur.ObjID )
|
|
{
|
|
nodeL2 = new TreeNode( funcPur.FunctionText );
|
|
nodeL2.Tag = funcPur;
|
|
nodeL1.Nodes.Add( nodeL2 );
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public class InitPurview : DatabaseAction , IAction
|
|
{
|
|
public void Run( Controls.Base.IBaseControl sender , string design , string runtime )
|
|
{
|
|
base.Run( sender );
|
|
|
|
base.LogDebug( "当班计划——窗体加载,即初始化操作" );
|
|
}
|
|
}
|
|
|
|
}
|