Exemplo n.º 1
0
        private UIPermissionInfo EnsurePropertiesExists(object key)
        {
            var p = (UIPermissionInfo)_permissions[key];

            if (p == null)
            {
                p = new UIPermissionInfo();
                _permissions[key] = p;
            }

            return(p);
        }
Exemplo n.º 2
0
 public void ActivatePermissionsOnUI()
 {
     foreach (DictionaryEntry item in _permissions)
     {
         var control = item.Key as Control;
         if (control != null)
         {
             UIPermissionInfo val = null;
             if (item.Value != null)
             {
                 val = item.Value as UIPermissionInfo;
                 if (!string.IsNullOrEmpty(val.Permission))
                 {
                     bool hasPermission = HasPermission(val.Permission);
                     control.Enabled = hasPermission;
                     if (val.Visible.HasValue && !val.Visible.Value)
                     {
                         control.Visible = hasPermission;
                     }
                 }
             }
         }
     }
 }