12345678910111213141516171819202122232425262728 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Windows.Controls;
- using Aitex.Core.Account;
- using Aitex.Core.Util;
- namespace Aitex.Triton160.UI.Views
- {
- public static class UserControlExtender
- {
- /// <summary>
- /// 对UserControl类进行扩展
- /// </summary>
- /// <param name="userControl"></param>
- /// <returns></returns>
- public static ViewPermission GetPermission(this UserControl userControl)
- {
- var account = Globals.Session["CurrentUser"] as Account;
- if (account == null) return ViewPermission.Invisiable;
- var userControlName = userControl.Name;
- if (!account.Permission.ContainsKey(userControlName)) return ViewPermission.Invisiable;
- return account.Permission[userControlName];
- }
- }
- }
|