You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.7 KiB
76 lines
2.7 KiB
2 months ago
|
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
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 用户按钮
|
||
|
/// lx 2017-06-28
|
||
|
/// </summary>
|
||
|
public class Sys_ButtonsData
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 获取用户有权限的按钮
|
||
|
/// </summary>
|
||
|
/// <param name="menuID"></param>
|
||
|
/// <param name="userID"></param>
|
||
|
/// <returns></returns>
|
||
|
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();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|