/// <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); }
/// <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); }