Esempio n. 1
0
 /// <summary>
 /// 获取人的角色有四种方式:
 /// 1.通过User取角色
 /// 2.通过人所在的部门的职位取角色
 /// 3.通过部门取角色
 /// 4.通过职位取角色
 /// </summary>
 /// <param name="bIncludeDept">是否包含所在部门的角色</param>
 /// <returns></returns>
 public ViewBase GetRoles(bool bIncludeDept)
 {
     ViewBase vwRole = new ViewRole();
     string strCondition = "b.FK_UserID=" + base.ID.ToString();
     if (bIncludeDept)
     {
         //人所在部门职位的角色
         string strRole = this.GetRoleByDeptID();
         if (strRole.Length > 0)
         {
             strCondition += " OR a.ID IN (" + strRole + ")";
         }
     }
     vwRole.BaseCondition = strCondition;
     return vwRole;
 }
Esempio n. 2
0
 /// <summary>
 /// 通过角色名称获得角色
 /// </summary>
 /// <param name="strName">角色名称</param>
 /// <returns></returns>
 public static Role GetRole(string strName)
 {
     ViewRole vwRole = new ViewRole();
     vwRole.BaseCondition = "a.Name='" + strName + "'";
     return vwRole.Count > 0 ? vwRole.GetItem(0) as Role : null;
 }
Esempio n. 3
0
 /// <summary>
 /// 获得所有角色
 /// </summary>
 /// <returns></returns>
 public static ViewBase GetALLRole()
 {
     ViewRole vRole = new ViewRole(true);
     return vRole;
 }
Esempio n. 4
0
 /// <summary>
 /// 通过角色id获得角色
 /// </summary>
 /// <param name="iRoleID">角色id</param>
 /// <returns></returns>
 public static Role GetRole(int iRoleID)
 {
     ViewRole vwRole = new ViewRole();
     vwRole.BaseCondition = "a.ID='" + iRoleID + "'";
     return vwRole.Count > 0 ? vwRole.GetItem(0) as Role : null;
 }