using MESClassLibrary.BLL.Log; using MESClassLibrary.Model; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Reflection; using System.Text; namespace MESClassLibrary.DAL.User { /// /// 用户按钮 /// lx 2017-06-28 /// public class Sys_ButtonsData { /// /// 获取用户有权限的按钮 /// /// /// /// public DataTable GetUserButtons(string menuID, string userID) { try { DataTable dt = new DataTable(); string sql = @" SELECT [BtnID] ,[BtnName] ,[ItemPic] ,[PowerID] ,[MenuID] ,[MenuName] ,[IsEnabled] ,[BtnCode] FROM [T_Sys_Buttons] where PowerID in ( select e.PowerID from T_Sys_Users a join T_Sys_UserRole b on a.UserID = b.UserID join T_Sys_Role c on b.RoleID = c.RoleID join T_Sys_RoleLinkPower d on c.RoleID = d.RoleID join T_Sys_Power e on d.PowerID = e.PowerID where a.UserID = @UserID ) and MenuID = @MenuID and IsEnabled = '1' "; SqlParameter[] param = new SqlParameter[2]; param[0] = new SqlParameter("@UserID", SqlDbType.UniqueIdentifier); param[0].Value = new Guid(userID); param[1] = new SqlParameter("@MenuID", SqlDbType.UniqueIdentifier); param[1].Value = new Guid(menuID); dt = SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, sql, param).Tables[0]; return dt; } catch (Exception ex) { LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); return new DataTable(); } } } }