Ejemplo n.º 1
0
 public bool SelfResendActivationEmail(string emailAddress)
 {
     // _logger.LogTrace(string.Format("Self Resend Activation Email For {0}", emailAddress));//for tracing purpose
     try
     {
         _efmUserService = new EfmUserServiceClient();//create instance to user service client
         //get response of notification email
         var response = _efmUserService.SelfResendActivationEmail(new SelfResendActivationEmailRequestType
         {
             Email = emailAddress,
         });
         if (response.Error.ErrorCode != "0")//raise app exception if any errors in response object
         {
             throw new AppException(response.Error.ErrorText, false, AppExceptionType.EFM);
         }
         return(true);
     }
     catch (TimeoutException te)// this is to handle timeout exceptions while interacting wiht EFM
     {
         ((EfmUserServiceClient)_efmUserService).Abort();
         throw new Exception(
                   "The state eFiling system has stopped responding. Please try again later.",
                   te);
     }
     catch (CommunicationException ce) // this is to handle communication exceptions while interacting with EFM
     {
         throw Util.BuildWcfException((EfmUserServiceClient)_efmUserService, ce);
     }
     catch (Exception e)            // this is to handle general exceptions while interacting wiht EFM
     {
         ((EfmUserServiceClient)_efmUserService).Abort();
         if (e.Message.ToLower().Contains("unknown error"))//if error message has unknown error throw it as technical issue.
         {
             throw new AppException("eFile manager is experiencing technical issues.  Please try again later.", true, AppExceptionType.EFM, e, "SelfResendActivationEmail");
         }
         throw new AppException(e.Message, true, AppExceptionType.EFM, e, "SelfResendActivationEmail");
     }
     finally
     {
         try
         {
             if ((_efmUserService) != null)//finally try to close the wrapper instance if not null
             {
                 ((EfmUserServiceClient)_efmUserService).Close();
             }
         }
         catch (Exception exception)
         {
             throw Util.BuildWcfException((EfmUserServiceClient)_efmUserService, exception);
         }
     }
 }
Ejemplo n.º 2
0
        public string GetPasswordQuestion(string emailAddress)
        {
            //_logger.LogTrace(string.Format("getting  password question for  {0}", emailAddress));//for tracing purpose

            try
            {
                _efmUserService = new EfmUserServiceClient();// create istance to the user service client
                var response = _efmUserService.GetPasswordQuestion(new GetPasswordQuestionRequestType {
                    Email = emailAddress
                });
                if (response.Error.ErrorCode != "0")//raise app exception if any erros in response object
                {
                    throw new AppException(response.Error.ErrorText, false, AppExceptionType.EFM);
                }
                return(response.PasswordQuestion); //return the question
            }
            catch (TimeoutException te)            // this is to handle timeout exceptions while interacting wiht EFM
            {
                ((EfmUserServiceClient)_efmUserService).Abort();
                throw new Exception(
                          "The state eFiling system has stopped responding. We cannot proceed. Your information has been saved as a draft. You may continue this filing later.",
                          te);
            }
            catch (CommunicationException ce) // this is to handle communication exceptions while interacting with EFM
            {
                throw Util.BuildWcfException((EfmUserServiceClient)_efmUserService, ce);
            }
            catch (Exception e)            // this is to handle general exceptions while interacting wiht EFM
            {
                ((EfmUserServiceClient)_efmUserService).Abort();
                if (e.Message.ToLower().Contains("unknown error"))//if error message has unknown error throw it as technical issue.
                {
                    throw new AppException("eFile manager is experiencing technical issues.  Please try again later.", true, AppExceptionType.EFM, e);
                }
                throw new AppException(e.Message, false, AppExceptionType.EFM, e);
            }
            finally
            {
                //close the client if it is active
                try
                {
                    if ((_efmUserService) != null)//finally try to close the wrapper instance if not null
                    {
                        ((EfmUserServiceClient)_efmUserService).Close();
                    }
                }
                catch (Exception exception)    // this is to handle general exceptions
                {
                    throw Util.BuildWcfException((EfmUserServiceClient)_efmUserService, exception);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        ///  This is the method to validate the filer against efm data with user name and password asynchronously and return the filer details
        /// </summary>
        /// <param name="requestModel"></param>
        /// <returns></returns>
        public async Task <UserLoginResponseModel> LoginAsync(UserLoginRequestModel requestModel)
        {
            try
            {
                _efmUserService = new EfmUserServiceClient();//get the user service client
                // make sure authenticate the user with email and password
                AuthenticateResponseType response =
                    await
                    _efmUserService.AuthenticateUserAsync(new AuthenticateRequestType
                {
                    Email    = requestModel.UserName,
                    Password = requestModel.Password
                });

                if (response.Error.ErrorCode != "0")//raise exception if any errors in response object
                {
                    throw new AppException(response.Error.ErrorText, false, AppExceptionType.EFM);
                }
                //return new filer object with data
                return(new UserLoginResponseModel
                {
                    FirstName = response.FirstName,
                    LastName = response.LastName,
                    EmailAddress = response.Email,
                    EFMUserId = response.UserID,
                    Password = response.PasswordHash
                });
            }
            catch (TimeoutException te)                          //this is to handle timeout exceptions
            {
                ((EfmUserServiceClient)_efmUserService).Abort(); //abort the sercive any any from semding message
                throw new Exception(
                          "The state eFiling system has stopped responding. We cannot proceed. Your information has been saved as a draft. You may continue this filing later.",
                          te);
            }
            catch (CommunicationException ce)                                            //this is to handle communication exceptions
            {
                throw Util.BuildWcfException((EfmUserServiceClient)_efmUserService, ce); // throw wcf exceptions if any
            }
            catch (Exception e)                                                          //this is to handle general exceptions
            {
                ((EfmUserServiceClient)_efmUserService).Abort();
                if (e.Message.ToLower().Contains("unknown error"))//if error message has unknown error throw it as technical issue.
                {
                    throw new AppException("eFile manager is experiencing technical issues.  Please try again later.", true, AppExceptionType.EFM, e);
                }
                throw new AppException(e.Message, true, AppExceptionType.EFM, e);
            }
            finally
            {
                try
                {
                    if ((_efmUserService) != null)//finally try to close the wrapper instance if not null
                    {
                        ((EfmUserServiceClient)_efmUserService).Close();
                    }
                }
                catch (Exception exception)//this is to handle exceptions
                {
                    throw Util.BuildWcfException((EfmUserServiceClient)_efmUserService, exception);
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// This is the method to change password of the filer
        /// </summary>
        /// <param name="filer">filer details to know before procedding </param>
        /// <param name="password">old password details</param>
        /// <param name="newPassword">new password details</param>
        /// <param name="question">security question</param>
        /// <param name="answer">security answer</param>
        /// <returns>returns PasswordHash value</returns>
        public string ChangePassword(FilerModel filer, string password, string newPassword, string question, string answer)
        {
            // _logger.LogTrace(string.Format("changing password for  {0}", filer.EmailAddress));//this is for tracing purpose


            try
            {
                _efmUserService = new EfmUserServiceClient();// create istance to the user service client
                //add authentication data to the client
                Util.AddAuthInfoToClient((EfmUserServiceClient)_efmUserService, filer.EmailAddress, filer.Password);
                //get response of changepassword call
                var response = _efmUserService.ChangePassword(new ChangePasswordRequestType
                {
                    PasswordQuestion = "question",
                    PasswordAnswer   = "answer",
                    NewPassword      = newPassword,
                    OldPassword      = password
                });
                if (response.Error.ErrorText == "Old Password does not match existing password.")
                {
                    response.Error.ErrorText = "Current Password does not match existing password.";
                }
                if (response.Error.ErrorCode != "0")//raise app exception if any errors in response object
                {
                    throw new AppException(response.Error.ErrorText, false, AppExceptionType.EFM);
                }
                return(response.PasswordHash); //return the response
            }
            catch (TimeoutException te)        // this is to handle timeout exceptions while interacting wiht EFM
            {
                ((EfmUserServiceClient)_efmUserService).Abort();
                throw new Exception(
                          "The state eFiling system has stopped responding. We cannot proceed. Your information has been saved as a draft. You may continue this filing later.",
                          te);
            }
            catch (CommunicationException ce) // this is to handle communication exceptions while interacting with EFM
            {
                throw Util.BuildWcfException((EfmUserServiceClient)_efmUserService, ce);
            }
            catch (Exception e)            // this is to handle general exceptions while interacting wiht EFM
            {
                ((EfmUserServiceClient)_efmUserService).Abort();
                if (e.Message.ToLower().Contains("unknown error"))//if error message has unknown error throw it as technical issue.
                {
                    throw new AppException("eFile manager is experiencing technical issues.  Please try again later.", true, AppExceptionType.EFM, e);
                }
                throw new AppException(e.Message, true, AppExceptionType.EFM, e);
            }
            finally
            {
                try
                {
                    if ((_efmUserService) != null)//finally try to close the wrapper instance if not null
                    {
                        ((EfmUserServiceClient)_efmUserService).Close();
                    }
                }
                catch (Exception exception)//throw wcf exceptions
                {
                    throw Util.BuildWcfException((EfmUserServiceClient)_efmUserService, exception);
                }
            }
        }