Ejemplo n.º 1
0
        /// <summary>
        ///  remove user reqeust
        /// </summary>
        /// <param name="userkey">user id</param>
        /// <param name="community">community id</param>
        /// <returns>request</returns>
        public static UnenrollRequest GetUnenrollRequest(string userkey, string community)
        {
            var request = new UnenrollRequest();

            request.AuthenticationDetails = GetExternalAuthenticationRecord(userkey, community);
            return(request);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Remove a user request
        /// </summary>
        /// <param name="request">request for remove user</param>
        /// <param name="shallNotRun">Shall not run for normal cases</param>
        /// <returns>response for removing user</returns>
        public async Task <Unenroll_Response> RemoveUser(UnenrollRequest request, bool shallNotRun = true)
        {
            Unenroll_Response response;

            using (var client = VisaRtmClientManager.Instance.GetVisaRtmClient())
            {
                Stopwatch sprocTimer = Stopwatch.StartNew();
                try
                {
                    if (shallNotRun)
                    {
                        response         = new Unenroll_Response();
                        response.Success = true;
                    }
                    else
                    {
#if !XXXDEBUG
                        string logstring = string.Format("{0} UnenrollRequest {1}\n",
                                                         DateTime.Now.ToString(CultureInfo.InvariantCulture),
                                                         ((ExternalAuthenticationRecord)request.AuthenticationRecord)
                                                         .UserKey);
                        // just the last four digits
                        File.AppendAllText(Logfilename, logstring);
#endif
                        response = await client.UnenrollAsync(request).ConfigureAwait(false);

#if !XXXDEBUG
                        if (response.Success)
                        {
                            logstring = string.Format("{0} UnenrollResponse {1} {2}\n",
                                                      DateTime.Now.ToString(CultureInfo.InvariantCulture),
                                                      ((ExternalAuthenticationRecord)request.AuthenticationRecord)
                                                      .UserKey,
                                                      response.Success);
                            File.AppendAllText(Logfilename, logstring);
                        }
#endif
                    }
                }
                finally
                {
                    sprocTimer.Stop();
                    if (PerformanceInformation != null)
                    {
                        PerformanceInformation.Add("Visa RemoveUser ",
                                                   String.Format("{0} ms", sprocTimer.ElapsedMilliseconds));
                    }
                }
            }
            return(response);
        }