/// <summary>
        /// 给用户权限(分子系统)
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="systemCode">系统编号</param>
        /// <param name="userId">用户主键</param>
        /// <param name="permissionCode">权限编号</param>
        /// <returns>主键</returns>
        public string GrantUserPermission(BaseUserInfo userInfo, string systemCode, string userId, string permissionCode)
        {
            var result = string.Empty;

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

            ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (ServiceUtil.ProcessFun)((dbHelper) =>
            {
                var userPermissionManager = new BasePermissionManager((IDbHelper)dbHelper, (BaseUserInfo)userInfo);
                result = userPermissionManager.GrantByPermissionCode(systemCode, userId, permissionCode);
            }));
            return(result);
        }
        /// <summary>
        /// 给用户权限
        /// </summary>
        /// <param name="userInfo">用户</param>
        /// <param name="userName">用户名</param>
        /// <param name="permissionCode">权限编号</param>
        /// <returns>主键</returns>
        public string GrantUserPermission(BaseUserInfo userInfo, string userName, string permissionCode)
        {
            var result = string.Empty;

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

            ServiceUtil.ProcessUserCenterWriteDb(userInfo, parameter, (ServiceUtil.ProcessFun)((dbHelper) =>
            {
                var userManager = new BaseUserManager(dbHelper, userInfo);
                var userId      = userManager.GetId(new KeyValuePair <string, object>(BaseUserEntity.FieldUserName, userName));

                if (ValidateUtil.IsInt(userId))
                {
                    var userPermissionManager = new BasePermissionManager((IDbHelper)dbHelper, (BaseUserInfo)userInfo);
                    result = userPermissionManager.GrantByPermissionCode(userInfo.SystemCode, userId, permissionCode);
                }
            }));

            return(result);
        }