天津投入产出系统后端
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.
 
 
 
 
 
 

46 lines
1.5 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
namespace QMAPP.WinForm.Common
{
/// <summary>
/// 读取菜单配置项获取按钮名称
/// </summary>
public class XmlReader
{
/// <summary>
/// 获取按钮名称
/// </summary>
/// <param name="powerList">权限ID列表</param>
/// <returns></returns>
public List<string> GetMenuBtnFromPower(List<string> powerList)
{
List<string> menuBtnList = new List<string>();
XDocument doc = XDocument.Load("Menu.xml");
foreach (XElement item in doc.Root.Descendants("PowerInfo"))//得到每一个Person节点,得到这个节点再取他的Name的这个节点的值
{
string a = item.Attribute("PowerID").Value.ToString();
FormAuthority auth = new FormAuthority
{
Form = item.Attribute("FormName") == null ? "" : item.Attribute("FormName").Value,
Button = item.Attribute("ButtonName").Value,
HasAuthority = false
};
if (powerList.Contains(item.Attribute("PowerID").Value))
{
auth.HasAuthority = true;
menuBtnList.Add(item.Attribute("ButtonName").Value);
}
ClientContext.AuthList.Add(item.Attribute("PowerID").Value, auth);
}
return menuBtnList;
}
}
}