基于角色的权限管理思想
用户 -》 角色-》权限-》菜单。
用户表存储用户的角色信息
角色表存储用户的级别
权限表存储角色与菜单的对应关系
菜单表存储软件的菜单信息
View Code
using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Reflection; using SQLHelperTools; namespace RightTest { public partial class Frm_login : Form { public Frm_login() { InitializeComponent(); } DataTable dt = new DataTable(); private void btn_login_Click(object sender, EventArgs e) { IDataAccess data = DataAccessFactory.CreateDataAccess(); data.Open(); string sql = "select * from RoleRight,SysFun,UserInfo where UserInfo.RoleId=RoleRight.RoleId and RoleRight.NodeId=SysFun.NodeId and UserId='"+txt_userId.Text+"'"; data.GetTable(sql,dt); data.Close(); dgv_list.DataSource = dt; } private void btn_use_Click(object sender, EventArgs e) { foreach (DataRow item in dt.Rows) { if (item["NameSpaceName"].ToString() != "") { Form frm=(Form)Assembly.LoadFile(Application.StartupPath+"\\" + item["NameSpaceName"].ToString()+".dll").CreateInstance(item["NameSpaceName"].ToString() + "." + item["FullFrmName"].ToString()); frm.Show(); } } } } }