Exemplo n.º 1
0
        /// <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));
        }
        public ConciergeCommandEmbedded OpenConciergeCommandEmbedded(string workQueueType, string action, Guid loanId, string prospectId, bool hideHeader)
        {
            var user = ( UserAccount )HttpContext.Session[SessionHelper.UserData];

            if (action == "DefaultCommand")
            {
                if (loanId != Guid.Empty)
                {
                    prospectId = String.Empty;
                }

                if (workQueueType == "Prospects")
                {
                    if (loanId == Guid.Empty)
                    {
                        action = "Manage Prospects";
                    }
                    else
                    {
                        action = "Manage Loan Application";
                    }
                }
                else
                {
                    action = "Manage Loan Application";
                }
            }

            String additionalInformation = "";

            if (action == "Manage Disclosures")
            {
                var disclosureModel = LoanServiceFacade.RetrieveDisclosureModel(loanId, IdentityManager.GetUserAccountId());

                additionalInformation = GeneralSettingsServiceFacade.RetrieveeSigningVendorIntegrationEnabled() &&
                                        LoanServiceFacade.RetrieveeSigningEnabledForLoan(loanId) && disclosureModel == DisclosuresModel.eSign
                                            ? "eSigning Room"
                                            : "";
            }

            Int32 tempuserAccount = 0;

            int         userAccountId = LoanServiceFacade.RetrieveUserAccountIdByLoanId(loanId, user.UserAccountId);
            UserAccount userAccount   = UserAccountServiceFacade.GetUserById(userAccountId);

            if (userAccount.IsTemporary)
            {
                tempuserAccount = userAccountId;
            }

            string conciergeUrl = GetConciergeUrl(new Guid(), workQueueType, action, loanId, prospectId, tempuserAccount);

            var titleInformation = ConciergeWorkQueueServiceFacade.ExecuteSPGetBorrowerData("GetBorrowerData", loanId, user.UserAccountId);

            if (userAccount.IsTemporary)
            {
                titleInformation = "";
            }

            var leadSourceInformation = ContactServiceFacade.RetrieveLeadSourceByContactIdAndLoanId(-1, loanId, user.UserAccountId);
            var leadSourceInfo        = String.Empty;

            if (leadSourceInformation != null)
            {
                if (leadSourceInformation.AffinityGroup == Contracts.Affiliate.AffinityGroup.PartnersProfiles)
                {
                    if (leadSourceInformation.HBMId != null && leadSourceInformation.HBMId != Guid.Empty)
                    {
                        leadSourceInfo = leadSourceInformation.LeadSourceId + " Realtor HBM";
                    }
                    else
                    {
                        leadSourceInfo = leadSourceInformation.LeadSourceId + " Realtor";
                    }
                }
                else
                {
                    leadSourceInfo = leadSourceInformation.LeadSourceId + " " + leadSourceInformation.Description;
                }
            }
            string title = action;

            switch (title)
            {
            case "Manage Loan Application":
                title = "Loan Application";
                break;

            case "Manage Loan":
                title = "Loan Details";
                break;

            case "Manage Disclosures":
                title = "Disclosures";
                break;

            case "Manage Documents":
                title = "Documents";
                break;

            case "Manage Appraisal":
                title = "Appraisal";
                break;

            case "Manage Activities":
                title = "Activities";
                break;

            case "Manage Alerts":
                title = "Alerts";
                break;

            case "Manage Credit":
                title = "Credit";
                break;
            }

            if (userAccount.IsTemporary && title == "Loan Application")
            {
                title = "Create Account";
            }

            return(new ConciergeCommandEmbedded()
            {
                Title = title, TitleInformation = titleInformation, ConciergeUrl = conciergeUrl, LeadSourceInformation = leadSourceInfo, AdditionalInformation = additionalInformation, HideHeader = hideHeader
            });
        }