/// <summary> /// View in Borrower /// </summary> /// <param name="loanId"></param> /// <returns></returns> public String ViewInBorrower(Guid loanId, string userAccId) { int userAccountId = 0; int.TryParse(userAccId, out userAccountId); if (userAccountId == 0) { userAccountId = LoanServiceFacade.RetrieveUserAccountIdByLoanId(loanId, -1); } UserAccount concierge = ( UserAccount )HttpContext.Session["UserData"]; LoanServiceFacade.ViewInBorrower(concierge.UserAccountId, loanId, userAccountId); UserAccount user = UserAccountServiceFacade.GetUserById(userAccountId); Guid token = MML.Common.Impersonation.ImpersonationToken.GetToken(); bool isInserted = ImpersonationTokenServiceFacade.InsertImpersonationToken(token, loanId, userAccountId); GetStartedHelper getStartedHelper = new GetStartedHelper(); GetStarted getStarted = getStartedHelper.GetStarted(HttpContext, concierge, token, user.Username, false, loanId: loanId); return(getStarted.BorrowerUrl); }
private GetStarted StartNewProspectFromManageProspects(Guid loanId, int userAccountId, int contactId) { UserAccount concierge = null; if (_httpContext.Session[SessionHelper.UserData] != null) { concierge = ( UserAccount )_httpContext.Session[SessionHelper.UserData]; } if (userAccountId <= 0) { userAccountId = LoanServiceFacade.RetrieveUserAccountIdByLoanId(loanId, userAccountId); LoanServiceFacade.ViewInBorrower(concierge.UserAccountId, loanId, userAccountId); } UserAccount user = UserAccountServiceFacade.GetUserById(userAccountId); if (user == null) { return(null); } Guid token = MML.Common.Impersonation.ImpersonationToken.GetToken(); bool isInserted = ImpersonationTokenServiceFacade.InsertImpersonationToken(token, loanId, userAccountId); if (!isInserted) { return(null); } GetStartedHelper getStartedHelper = new GetStartedHelper(); return(getStartedHelper.GetStarted(HttpContext, concierge, token, user.Username, true, contactId, loanId, openInterviewPage: 1)); }
private GetStarted StartNewProspect() { var user = AccountHelper.GetUserAccount(HttpContext); Int32 callCenterId = 0; if (user.Roles != null && user.Roles.OrderByDescending(r => r.RolePriority).FirstOrDefault() != null) { if (user.Roles.OrderByDescending(r => r.RolePriority).FirstOrDefault().RoleName.Equals(RoleName.LoanProcessor)) { callCenterId = user.UserAccountId; } } string message; Int32 createdUserAccountId; // Create account string username = "******" + DateTime.Now.ToString("MMddyyyyHmmss") + "@meandmyloan.com"; var newUserAccount = new UserAccount() { Username = username, DateCreated = DateTime.Now, IsActivated = false, IsLocked = false, IsTemporary = false, Password = String.Empty, PasswordHint = String.Empty, SecurityAnswer = String.Empty, SecurityQuestionId = 1, OpenedByLOorConcierge = true, CreationStatus = UserAccountCreationStatus.SystemGenerated, IsOnlineUser = true, // by default we create online user, this will be changed on CreateAccountLO page Party = new Party() { FirstName = "new", LastName = "prospect", SSN = "000-00-0000 ", MiddleName = String.Empty, CompanyName = String.Empty, EmailAddress = String.Empty, AlternateEmailAddress = String.Empty }, }; var hierarchy = new BrandingConfigurationHierarchy() { BranchId = user.BranchId == Guid.Empty ? null : ( Guid? )user.BranchId, ChannelId = user.ChannelId == 0 ? null : ( int? )user.ChannelId, DivisionId = user.DivisionId == 0 ? null : ( int? )user.DivisionId }; var brandingConfiguration = CompanyProfileServiceFacade.RetrieveBrandingConfigurationByHierarchy(hierarchy); if (UserAccountServiceFacade.CreateUserAccount(newUserAccount, false, out message, out createdUserAccountId, brandingConfiguration, createdByUserId: user.UserAccountId) == false) { throw new ApplicationException("Error creating new user account"); } if (createdUserAccountId < 0) { throw new ApplicationException("Error creating new user account"); } newUserAccount.UserAccountId = createdUserAccountId; // Create Contact var contact = new Contact { FirstName = "new", LastName = "prospect", UserAccount = newUserAccount, LoanId = null, OwnerAccountId = user.UserAccountId, IsInitialLead = true, }; if (brandingConfiguration != null) { contact.CompanyProfileId = brandingConfiguration.CompanyProfileId; contact.ChannelId = brandingConfiguration.ChannelId; contact.DivisionId = brandingConfiguration.DivisionId; contact.BranchId = brandingConfiguration.BranchId; } if (callCenterId != 0) { contact.CallCenterId = callCenterId; } var createdContact = ContactServiceFacade.CreateContact(contact); // Create impersonation token Guid token = MML.Common.Impersonation.ImpersonationToken.GetToken(); bool isInserted = ImpersonationTokenServiceFacade.InsertImpersonationToken(token, Guid.Empty, user.UserAccountId); if (isInserted) { GetStartedHelper getStartedHelper = new GetStartedHelper(); return(getStartedHelper.GetStarted(HttpContext, user, token, username, true, createdContact.ContactId, isTempUser: true)); } return(null); }