用户管理弹出菜单改进方案
用户管理弹出菜单改进方案
扫一扫加作者微信
<旧代码导致反复退出界面重复生成菜单项目>
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
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
扫一扫加作者微信
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网