Ejemplo n.º 1
0
        /// <summary>
        /// 组织机构添加到角色
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="roleId">角色主键</param>
        /// <param name="organizeIds">组织机构主键</param>
        /// <returns>影响行数</returns>
        public int AddOrganizeToRole(BaseUserInfo userInfo, string roleId, string[] organizeIds)
        {
            int result = 0;

            var parameter = ServiceInfo.Create(userInfo, MethodBase.GetCurrentMethod());

            ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (dbHelper) =>
            {
                var manager = new BaseOrganizeManager(dbHelper, userInfo);
                // 小心异常,检查一下参数的有效性
                if (organizeIds != null)
                {
                    result += manager.AddToRole(userInfo.SystemCode, organizeIds, roleId);
                }
            });

            return(result);
        }