用户管理弹出菜单改进方案
作者:C/S框架网  发布日期:2016-10-28 11:48:01
  用户管理弹出菜单改进方案



<旧代码导致反复退出界面重复生成菜单项目>

V4.5.0或以下的版本统一改为下面的方式,注销frmUser.InitializeForm方法内重复的代码!


C# Code:

private void gvSummary_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e)
{
   if (e.MenuType == GridMenuType.Row)
   {
      if (this.ButtonAuthorized(ButtonAuthority.EDIT))
      frmGridCustomize.CreatePopupMenuItem(e.Menu, "修改密码", Globals.LoadImage("16_08.png"), OnChangePwdClick, true);
      
      //管理员才添加弹出菜单
      if (Loginer.CurrentUser.IsAdmin())
      {
         frmGridCustomize.CreatePopupMenuItem(e.Menu, "复制权限", Globals.LoadImage("16_01.png"), OnCopyRights, true);
         frmGridCustomize.CreatePopupMenuItem(e.Menu, "解除用户的权限", Globals.LoadImage("16_04.png"), OnCancelRights, false);
         
         frmGridCustomize.CreatePopupMenuItem(e.Menu, "锁定当前用户", Globals.LoadImage("16_05.png"), OnLockUser, true);
         frmGridCustomize.CreatePopupMenuItem(e.Menu, "解除锁定", Globals.LoadImage("16_06.png"), OnUnLockUser, false);
      }
   }
}

//来源:C/S框架网(www.csframework.com) QQ:1980854898



贴图图片



上一篇 下一篇