Esempio n. 1
0
        /// <summary>
        /// Updates given user if such user exists.
        /// This command can be executed only using
        /// api_key belonging to user with admin rights.
        /// </summary>
        ///
        /// <param name="update">The User_Create object to modify a user.</param>
        /// <returns>API_Response containing results of operation.</returns>
        public ApiResponse <GenericApiResponse> UpdateUser(Requests.UserUpdate update)
        {
            // Build the arguments
            UpdateUserArgs args = new UpdateUserArgs
            {
                active    = update.Active,
                admin     = update.Admin,
                email     = update.Email,
                firstname = update.Firstname,
                lastname  = update.Lastname,
                ldap_dn   = update.LdapDn,
                password  = update.Password,
                username  = update.Username,
                userid    = update.Userid
            };

            // Create the request.
            ApiRequest request = new ApiRequest
            {
                method  = "update_user",
                api_key = _apiKey,
                args    = args
            };

            // Send the request and return response.
            return(Call <GenericApiResponse>(request));
        }
Esempio n. 2
0
        /// <summary>
        /// 编辑用户信息
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public CommandResult <int> UpdateUserInfo(UpdateUserArgs args)
        {
            ArgumentHelper.Require(args.UserId, "UserId", Arguments.Positive);
            ArgumentHelper.Require(args.SchoolId, "SchoolId", Arguments.Positive);
            ArgumentHelper.Require(args.ModifyBy, "ModifyBy", Arguments.Positive);
            ArgumentHelper.Require(args.Email, "Email", Arguments.NotEmptyOrWhitespace);
            ArgumentHelper.Require(args.Phone, "Phone", Arguments.NotEmptyOrWhitespace);

            return(ContainerFactory <IUserRepository> .Instance.UpdateUserInfo(args));
        }
Esempio n. 3
0
        public CommandResult <int> UpdateUserInfo(UpdateUserArgs args)
        {
            try
            {
                var result = ContainerFactory <ISqlExcuteContext> .Instance.ExcuteProceDure(0, "update_userinfo", args);

                return(result);
            }
            catch (Exception e)
            {
                LogHelper.Error(this.GetType(), "用户模块--通过角色ID获取角色权限列表失败", e);
                return(CommandResult.Failure <int>(e.ToString()));
            }
        }
Esempio n. 4
0
        public string UpdateUser(UpdateUserArgs args)
        {
            var userId   = ApplicationContext.UserId;
            var schoolId = ApplicationContext.SchoolId;

            if (args != null)
            {
                args.UserId   = userId;
                args.SchoolId = schoolId;
                args.ModifyBy = userId;
                var result = UserService.Instance.UpdateUserInfo(args);
                return(JsonHelper.Serialize(result));
            }
            return(JsonHelper.Serialize(CommandResult.Failure()));
        }