///
///INTERFACE CLASS FOR TABLE t_RoleAuthority
///By wm with codesmith.
///on 04/18/2017
///
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Collections;
namespace DeiNiu.wms.Data.Model
{
[Serializable]
public class RoleAuthority : RoleAuthority_base
{
public RoleAuthority()
{
}
public RoleAuthority(int id): base(id)
{
}
protected override void getImp()
{
model_imp = new RoleAuthority_Imp();
}
//begin cust db operation, query, excute sql etc.
///
/// 根据权限取所有有用该权限的角色
///
///
///
public DataTable GetRoleListByAuth(int author)
{
cmdParameters[0] = author;
return CustQuery(100).Tables[0];
}
///
/// 取角色的人员列表
///
///
///
public DataTable GetEmListByRole(int role)
{
cmdParameters[0] = role;
return CustQuery(200).Tables[0];
}
///
/// 取有某权限的人员列表
///
///
///
public DataTable GetEmListByAuth(int auth)
{
cmdParameters[0] = auth;
return CustQuery(300).Tables[0];
}
///
/// 取某人的角色列表
///
///
///
public DataTable GetRoleByEm(int emid)
{
cmdParameters[0] = emid;
return CustQuery(400).Tables[0];
}
///
/// 取某人的权限列表
///
///
///
public DataTable GetAuthByEm(int emid,int warehouse=-1)
{
cmdParameters[0] = emid;
cmdParameters[1] = warehouse;
return CustQuery(500).Tables[0];
}
///
/// delete by role
///
///
///
public int Delete(int roleId)
{
cmdParameters[0] = roleId;
return CustOper(600); //delete by role
}
///
/// 取角色对应的权限列表
///
///
///
public DataTable GetAuthByRole(int roleId)
{
cmdParameters[0] = roleId;
return CustQuery(700).Tables[0];
}
///
///公共权限
///
///
public DataTable GetPublicAuthority()
{
return CustQuery(800).Tables[0];
}
///
///公共权限连接列表
///
///
public ArrayList GetPublicAuthorityList()
{
ArrayList al = new ArrayList();
DataTable dt = GetPublicAuthority();
foreach (DataRow dr in dt.Rows)
{
al.Add(dr["auth_link"].ToString().ToUpper().Trim());
}
return al;
}
///
///用户的权限列表
///
///
public ArrayList GetAuthorityList(int emId)
{
ArrayList al = new ArrayList();
DataTable dt = GetAuthByEm(emId);
foreach (DataRow dr in dt.Rows)
{
al.Add(dr["auth_link"].ToString().ToUpper().Trim());
}
return al;
}
public ArrayList GetApproveRoleList(int empId)
{
cmdParameters[0] = empId;
ArrayList al = new ArrayList();
DataTable dt = CustQuery(1000).Tables[0];
foreach (DataRow dr in dt.Rows)
{
al.Add(dr["ROLE_NAME"].ToString().ToUpper().Trim());
}
return al;
}
}
}