168 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			168 lines
		
	
	
		
			4.3 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
 | |
| /// <summary>
 | |
| ///INTERFACE CLASS FOR TABLE t_RoleAuthority
 | |
| ///By wm with codesmith. 
 | |
| ///on 04/18/2017
 | |
| /// </summary>
 | |
| 
 | |
| 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.
 | |
|         /// <summary>
 | |
|         /// 根据权限取所有有用该权限的角色
 | |
|         /// </summary>
 | |
|         /// <param name="author"></param>
 | |
|         /// <returns></returns>
 | |
|         public DataTable GetRoleListByAuth(int author)
 | |
|         {
 | |
|             cmdParameters[0] = author;
 | |
|             return CustQuery(100).Tables[0];
 | |
|         }
 | |
|         /// <summary>
 | |
|         /// 取角色的人员列表
 | |
|         /// </summary>
 | |
|         /// <param name="author"></param>
 | |
|         /// <returns></returns>
 | |
|         public DataTable GetEmListByRole(int role)
 | |
|         {
 | |
|             cmdParameters[0] = role;
 | |
|             return CustQuery(200).Tables[0];
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 取有某权限的人员列表
 | |
|         /// </summary>
 | |
|         /// <param name="author"></param>
 | |
|         /// <returns></returns>
 | |
|         public DataTable GetEmListByAuth(int auth)
 | |
|         {
 | |
|             cmdParameters[0] = auth;
 | |
|             return CustQuery(300).Tables[0];
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 取某人的角色列表
 | |
|         /// </summary>
 | |
|         /// <param name="author"></param>
 | |
|         /// <returns></returns>
 | |
|         public DataTable GetRoleByEm(int emid)
 | |
|         {
 | |
|             cmdParameters[0] = emid;
 | |
|             return CustQuery(400).Tables[0];
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 取某人的权限列表
 | |
|         /// </summary>
 | |
|         /// <param name="author"></param>
 | |
|         /// <returns></returns>
 | |
|         public DataTable GetAuthByEm(int emid,int warehouse=-1)
 | |
|         {
 | |
|             cmdParameters[0] = emid;
 | |
|             cmdParameters[1] = warehouse;
 | |
|             return CustQuery(500).Tables[0];
 | |
|         }
 | |
| 
 | |
| 
 | |
|         /// <summary>
 | |
|         /// delete by role
 | |
|         /// </summary>
 | |
|         /// <param name="roleId"></param>
 | |
|         /// <returns></returns>
 | |
|         public int Delete(int roleId)
 | |
|         {
 | |
|             cmdParameters[0] = roleId;
 | |
|             return CustOper(600);  //delete by role
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         /// 取角色对应的权限列表
 | |
|         /// </summary>
 | |
|         /// <param name="author"></param>
 | |
|         /// <returns></returns>
 | |
|         public DataTable GetAuthByRole(int roleId)
 | |
|         {
 | |
|             cmdParameters[0] = roleId;
 | |
|             return CustQuery(700).Tables[0];
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///公共权限
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         public DataTable GetPublicAuthority()
 | |
|         {
 | |
|             return CustQuery(800).Tables[0];
 | |
|         }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///公共权限连接列表
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         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;
 | |
|         }
 | |
|         /// <summary>
 | |
|         ///用户的权限列表
 | |
|         /// </summary>
 | |
|         /// <returns></returns>
 | |
|         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;
 | |
| 
 | |
| 
 | |
|         }
 | |
|     }
 | |
| }
 |