/// <summary>
/// 系统缓存,存放全局变量
/// </summary>
public static class Caches
{
#region 菜单
private static List<Feature> m_menu = null;
public static List<Feature> AllMenu
{
get
{
if (m_menu.IsNull() || m_menu.Count.Equals(0))
{
m_menu = new List<Feature>();
lock (m_menu)
{
if (m_menu.IsNull() || m_menu.Count.Equals(0))
{
IList<SysMenu> menuList = NhbHelper.GetCurrentSession().CreateCriteria(typeof(SysMenu))
.List<SysMenu>();
GreatMenu(null, m_menu, 0,CBF.WMS.Common.Net.ConvertHelper.IListToList<SysMenu>(menuList));
}
}
}
return m_menu;
}
}
private static void GreatMenu(object parent, List<Feature> table, int level, List<SysMenu> list)
{
Feature feat=null;
List<SysMenu> tmpMenuList;
tmpMenuList = list.FindAll(
delegate(SysMenu menu)
{ return menu.ParentCode ==parent; }
);
//list.FindAll(s => s.ParentCode ==parent);
foreach (SysMenu mdl in tmpMenuList)
{
if (parent == mdl.ParentCode)
{
feat = new Feature();
feat.Level = level;
feat.Id = mdl.Id;
feat.Name = mdl.Name;
feat.State = mdl.State;
feat.Url = mdl.Iconic;
if (!mdl.ParentCode.IsNull())
{
feat.Parent = mdl.ParentCode.Id;
}
feat.Pic = "../Icons/folder.png";
table.Add(feat);
GreatMenu(mdl, table, level + 1, list);
}
}
}
public static void ClearMenu()
{
m_menu = null;
}
#endregion
}
注:在904 南丰的CBF.Integration.src.Cash.Caches.cs下面有!