/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="pageCode"></param>
/// <param name="buttonList"></param>
/// <returns></returns>
public Hashtable GetPageButton(string pageCode, List<string> buttonList)
{
Hashtable ht = new Hashtable();
if (!ISRG)
ht = ManagementJurProxy.GetPageButton(ts.CurrentUser.User_ID, pageCode, buttonList);
else
{
foreach (string but in buttonList)
{
ht.Add(but, true);
}
}
return ht;
}
//Hashtable 的用法
Hashtable ht = new Hashtable();
List<string> list = new List<string>();
list.Add("Open_Object_btnCraetProj");
list.Add("Open_Object_lbtnUpdata");
list.Add("Open_Object_lbtnDelete");
list.Add("Open_Object_lbtnToExcel");
list.Add("Open_Object_ModelManage");
ht = base.GetPageButton("Open_Object", list);
this.btnCraetProj.Visible = bool.Parse(ht["Open_Object_btnCraetProj"].ToString());
this.btnManage.Visible = bool.Parse(ht["Open_Object_ModelManage"].ToString());
#region 获取按钮权限
/// <summary>
/// 获取按钮权限
/// </summary>
/// <param name="userID"></param>
/// <param name="pageCode"></param>
/// <param name="buttonCode"></param>
/// <returns></returns>
public static Hashtable GetPageButton(Guid userID, string pageCode, List<string> buttonCode)
{
List<bool> list = new List<bool>();
Hashtable ht = new Hashtable();
List<string> code = new List<string>();
try
{
Database db = DatabaseFactory.CreateDatabase(Constants.Database.BnspData);
using (DbCommand command = db.GetSqlStringCommand(SQL_GetPageButton))
{
db.AddInParameter(command, "userID", DbType.Guid, userID);
db.AddInParameter(command, "pageCode", DbType.String, pageCode);
using (IDataReader dr = db.ExecuteReader(command))
{
while (dr.Read())
{
code.Add(dr["function_code"].ToString());
}
}
foreach (string i in buttonCode)
{
if (code.Contains(i))
ht.Add(i, true);
else
ht.Add(i, false);
}
return ht;
}
}
catch
{
throw;
}
}
#endregion