最近客户提出需要做个权限项二开控制他们单据的调整,
于是四处查找sql
然没有点用,sql没必要写,直接用下面代码实现
如有疑问请私聊
//查找对应的权限id
string FZLFJSCid = "";
string sqlNew = string.Format(@"/*dialect*/select FITEMID from T_SEC_PermissionItem K2 where K2.FNUMBER='FZLFJSC'");
DataSet dsNew = DBUtils.ExecuteDataSet(this.Context, sqlNew);
if (dsNew != null && dsNew.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < dsNew.Tables[0].Rows.Count; i++)
{
FZLFJSCid = Convert.ToString(dsNew.Tables[0].Rows[i]["FITEMID"]);
}
}
//获取用户登录的全部信息 this.Context
//校验查看权限 PermissionConst.View
PermissionAuthResult IResult = PermissionServiceHelper.FuncPermissionAuth
(this.Context, new BusinessObject() { Id = "STK_InStock" }, FZLFJSCid);
//如果返回的值IResult,通过,说明有权限
if (IResult.Passed)
{
}
else
{
this.View.ShowMessage("你没有查看销售出库单权限");
return;
}
推荐阅读