Beispiel #1
0
        /// <summary>
        /// This is the common private method to map user type data to filer object data
        /// </summary>
        /// <param name="response">UserType object with data to map</param>
        /// <returns>return Filer object with mapped data </returns>
        private FilerModel MapGetUserResponseToFiler(UserType response)
        {
            //create new filer instance and assign data to all required properties
            FilerModel filer = new FilerModel
            {
                FirstName             = response.FirstName,
                MiddleName            = response.MiddleName ?? "",
                LastName              = response.LastName,
                EFMUserId             = response.UserID,
                EmailAddress          = response.Email,
                LastLoginToEFM        = response.LastLoginDate,
                LastLogin             = response.LastLoginDate,
                IsApproved            = response.IsApproved,
                RestrictFiling        = response.RestrictFiling,
                RestrictFilingComment = response.RestrictFilingComment,
                IsActive              = true,
                IsLockedOut           = response.IsLockedOut,
                ActiveIndicator       = true,
            };

            //add filer role
            if (response.Role != null && response.Role.Any(x => x.RoleName == RoleType.Filer))
            {
                filer.Roles = "Filer";
            }
            //add admin firm role
            if (response.Role != null && response.Role.Any(x => x.RoleName == RoleType.FirmAdmin))
            {
                if (string.IsNullOrEmpty(filer.Roles))     //assign only admin role
                {
                    filer.Roles = "Admin";
                }
                else
                {
                    filer.Roles += ",Admin";// add admin role
                }
            }
            return(filer);//return updated filer object
        }
Beispiel #2
0
 /// <summary>
 /// This is the method to filer notification Preferencess data
 /// </summary>
 /// <param name="filer">filer object to get data</param>
 /// <returns>returns List<eFileTexasNotification> of  notification preferencess</returns>
 public List <eFileTexasNotificationModel> GetNotificationPreferences(FilerModel filer)
 {
     try
     {
         //add authentication data to the client
         Util.AddAuthInfoToClient((EfmUserServiceClient)_efmUserService, filer.EmailAddress, filer.Password);
         //get notifications response from efm
         var response = _efmUserService.GetNotificationPreferences();
         if (response.Error.ErrorCode != "0")//raise app exception if any errors in response object
         {
             throw new AppException(response.Error.ErrorText, false, AppExceptionType.EFM);
         }
         if (response.Notification != null)//check      //get Notification data is there or not
         {
             var eFileTexasNotificationList = new List <eFileTexasNotificationModel>();
             foreach (var notificationItem in response.Notification) //loop Notification data and add to the list
             {
                 eFileTexasNotificationList.Add(new eFileTexasNotificationModel()
                 {//assign data to all required properties
                     Code        = notificationItem.Code,
                     Description = notificationItem.Description,
                     IsSelected  = notificationItem.IsActive,
                 });
             }
             return(eFileTexasNotificationList); // return Notification list
         }
         else
         {
             return(new List <eFileTexasNotificationModel>());
         }
     }
     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)
     //        {
     //            //((EfmUserServiceClient)_efmUserService).Close();
     //        }
     //    }
     //    catch (Exception exception)
     //    {
     //        throw Util.BuildWcfException((EfmUserServiceClient)_efmUserService, exception);
     //    }
     //}
 }
Beispiel #3
0
        /// <summary>
        /// This is the method to update notification preferences data of a filer
        /// </summary>
        /// <param name="filer">filer object with data to authenticate the user</param>
        public void UpdateNotificationPreferences(FilerModel filer)
        {
            try
            {
                //add authentication data to the client
                Util.AddAuthInfoToClient((EfmUserServiceClient)_efmUserService, filer.EmailAddress, filer.Password);
                //create instance
                var UpdateNotificationPreferencesRequestType = new UpdateNotificationPreferencesRequestType();
                var notificationTypeList = new List <NotificationType>();
                //check fier has notifications data
                if (!string.IsNullOrEmpty(filer.eFileTexasNotiPref))
                {
                    string[] spiltNotiPref = filer.EFMNotificationPreference.Split(','); //split data by comma
                    if (spiltNotiPref != null && spiltNotiPref.Length > 0)               //if length is greater than zero

                    {
                        foreach (var splt in spiltNotiPref) //loop all preferences and add to the list
                        {
                            if (!string.IsNullOrEmpty(splt))
                            {
                                if (filer.eFileTexasNotiPref.Contains(splt))
                                {
                                    notificationTypeList.Add(new NotificationType()
                                    {
                                        Code = splt, IsActive = true
                                    });
                                }
                                else
                                {
                                    notificationTypeList.Add(new NotificationType()
                                    {
                                        Code = splt, IsActive = false
                                    });
                                }
                            }
                        }
                    }
                }
                //assign notification list to the request object and update in efm
                UpdateNotificationPreferencesRequestType.Notification = notificationTypeList.ToArray();
                //get notifications response from efm
                var response = _efmUserService.UpdateNotificationPreferences(UpdateNotificationPreferencesRequestType);
                if (response.Error.ErrorCode != "0")//send error message if response has errors
                {
                    throw new AppException(response.Error.ErrorText, false, AppExceptionType.EFM);
                }
            }
            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)
            //        {
            //            //((EfmUserServiceClient)_efmUserService).Close();
            //        }
            //    }
            //    catch (Exception exception)// this is to handle general exceptions while interacting wiht EFM
            //    {
            //        throw Util.BuildWcfException((EfmUserServiceClient)_efmUserService, exception);
            //    }
            //}
        }
Beispiel #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);
                }
            }
        }