Пример #1
0
        /// <summary>
        /// Delete multiple users.
        /// </summary>
        /// <param name="authenticationToken">Encrypted forms auth token identifying the requesting user.</param>
        /// <param name="userIds">Array of unique identifiers of the users to delete.</param>
        /// <param name="deleteResponses">Indicates whether the user's responses should be deleted as well.</param>
        /// <returns></returns>
        /// <remarks>
        /// Users and their responses are "soft deleted" from the database. Records are flagged as deleted, but
        /// data is not removed from the database permanently.
        /// </remarks>
        private static bool DeleteUsers(string authenticationToken, string[] userIds, bool deleteResponses)
        {
            /*
             * If you are unable to reference System.Service make sure that the project is configured to
             * use the full 4.0 framework and not the client profile.
             */
            var proxy = new UserManagementServiceClient();
            var result = proxy.DeleteUsers(authenticationToken, userIds, deleteResponses);

            // Handle exceptions
            if (!result.CallSuccess)
            {
                Console.WriteLine(result.FailureMessage);
                return false;
            }

            // The DeleteUsers method does not return ResultData. Return true if the operation completed successfully.
            return true;
        }