权限管理发现两处BUG及解决方法
权限管理发现两处BUG及解决方法
Bug 1:
扫一扫加微信
Bug 1:
点击模块主窗体上的按钮打开窗体时报错,此时sender参数为:SimpleButton, 当转换为ToolStripMenuItem为null导致对象引用失败。
解决方法:
取消 sender as ToolStripMenuItem 类型转换,改为对应的菜单对象。
Bug 2:
权限树无法展示销售模块已设置的权限,原因是frmSalesMain窗体SetMenuTag()方法代码错误:
请改为:
修改后的代码:
解决方法:
取消 sender as ToolStripMenuItem 类型转换,改为对应的菜单对象。
C# Code:
private void menuSalesOrder_Click(object sender, EventArgs e)
{
MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(frmSO), menuSalesOrder);
}
private void menuItemInvoice_Click(object sender, EventArgs e)
{
MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(frmSO), menuItemInvoice);
}
private void menuItemAR_Click(object sender, EventArgs e)
{
MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(frmSO), menuItemAR);
}
//来源:C/S框架网(www.csframework.com) QQ:1980854898
private void menuSalesOrder_Click(object sender, EventArgs e)
{
MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(frmSO), menuSalesOrder);
}
private void menuItemInvoice_Click(object sender, EventArgs e)
{
MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(frmSO), menuItemInvoice);
}
private void menuItemAR_Click(object sender, EventArgs e)
{
MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(frmSO), menuItemAR);
}
//来源:C/S框架网(www.csframework.com) QQ:1980854898
Bug 2:
权限树无法展示销售模块已设置的权限,原因是frmSalesMain窗体SetMenuTag()方法代码错误:
C# Code:
menuMainSalesModule.Text = ModuleNames.SalesModule;
menuMainSalesModule.Tag = new MenuItemTag(MenuType.ItemOwner, (int)ModuleID.SalesModule, AuthorityCategory.NONE);
menuMainSalesModule.Text = ModuleNames.SalesModule;
menuMainSalesModule.Tag = new MenuItemTag(MenuType.ItemOwner, (int)ModuleID.SalesModule, AuthorityCategory.NONE);
请改为:
C# Code:
menuMainSalesSystem.Text = ModuleNames.SalesModule;
menuMainSalesSystem.Tag = new MenuItemTag(MenuType.ItemOwner, (int)ModuleID.SalesModule, AuthorityCategory.NONE);
menuMainSalesSystem.Text = ModuleNames.SalesModule;
menuMainSalesSystem.Tag = new MenuItemTag(MenuType.ItemOwner, (int)ModuleID.SalesModule, AuthorityCategory.NONE);
修改后的代码:
扫一扫加微信
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网