/// <summary> /// Perform the customer details retrieval process and return a view model with error handling /// </summary> /// <param name="inputModel">The forgotten password input model object</param> /// <returns>Forgotten password view model correctly populated for display</returns> private ForgottenPasswordViewModel getCustomerDetailsFromBackEnd(ForgottenPasswordInputModel inputModel) { ErrorObj talentErrObj = new ErrorObj(); DECustomer deCust = new DECustomer(); Mapper.CreateMap <ForgottenPasswordInputModel, DECustomer>(); DECustomerV11 deCustV11 = new DECustomerV11(); ForgottenPasswordViewModel viewModel = new ForgottenPasswordViewModel(true); deCust = Mapper.Map <DECustomer>(inputModel); deCust.Source = GlobalConstants.SOURCE; deCustV11.DECustomersV1.Add(deCust); _talCust.DeV11 = deCustV11; _talCust.Settings = Environment.Settings.DESettings; talentErrObj = _talCust.CustomerRetrieval(); viewModel.Error = Data.PopulateErrorObject(talentErrObj, _talCust.ResultDataSet, _talCust.Settings, 2); if (!viewModel.Error.HasError) { //Add the tokens to the result Set _dtCustomerResults = _talCust.ResultDataSet.Tables["CustomerResults"]; if (_dtCustomerResults.Rows.Count == 1) { _doTokenHashing = inputModel.DoTokenHashing; checkCustomerTokens(); if (generateResetTokens()) { if (generateTableRecords()) { generateEmail(); viewModel.Mode = GlobalConstants.PASSWORD_ENC_MODE_RESPONSE; } else { viewModel.Mode = GlobalConstants.PASSWORD_ENC_MODE_INITIAL; viewModel.Error.HasError = true; viewModel.Error.ErrorMessage = viewModel.GetPageText("UnspecifiedError"); _talCust.Settings.Logging.ErrorObjectLog("ForgottenPassword.aspx - Reset Password email", "FPW", "Cannot create reset password table records", "PasswordEncryptionLog"); } } else { viewModel.Mode = GlobalConstants.PASSWORD_ENC_MODE_INITIAL; viewModel.Error.HasError = true; viewModel.Error.ErrorMessage = viewModel.GetPageText("UnspecifiedError"); _talCust.Settings.Logging.ErrorObjectLog("ForgottenPassword.aspx - Reset Password email", "FPW", "Cannot create reset password tokens", "PasswordEncryptionLog"); } } else { viewModel.Mode = GlobalConstants.PASSWORD_ENC_MODE_INITIAL; viewModel.Error.HasError = true; viewModel.Error.ErrorMessage = viewModel.GetPageText("UnspecifiedError"); _talCust.Settings.Logging.ErrorObjectLog("ForgottenPassword.aspx - Reset Password email", "FPW", "No customer records have been returned from WS009R", "PasswordEncryptionLog"); } } else { viewModel.Mode = GlobalConstants.PASSWORD_ENC_MODE_INITIAL; _talCust.Settings.Logging.ErrorObjectLog("ForgottenPassword.aspx - Reset Password email", "FPW", viewModel.Error.ErrorMessage, "PasswordEncryptionLog"); } return(viewModel); }