public Boolean ManageProspectsSave(ManageProspectsViewModel manageProspectsViewModel)
        {
            var user = AccountHelper.GetUserAccount(HttpContext);

            Int32 status     = 0;
            Int32 concierge  = 0;
            Int32 callCenter = 0;
            Int32 loa        = 0;

            if (!String.IsNullOrEmpty(manageProspectsViewModel.SelectedCallCenter))
            {
                Int32.TryParse(manageProspectsViewModel.SelectedCallCenter, out callCenter);
            }

            if (!String.IsNullOrEmpty(manageProspectsViewModel.SelectedLoa))
            {
                Int32.TryParse(manageProspectsViewModel.SelectedLoa, out loa);
            }

            if (!String.IsNullOrEmpty(manageProspectsViewModel.SelectedStatus))
            {
                Int32.TryParse(manageProspectsViewModel.SelectedStatus, out status);
            }

            if (!String.IsNullOrEmpty(manageProspectsViewModel.SelectedConcierge))
            {
                Int32.TryParse(manageProspectsViewModel.SelectedConcierge, out concierge);
            }

            Guid companyId = Guid.Empty;

            if (!String.IsNullOrEmpty(manageProspectsViewModel.CompanyId))
            {
                Guid.TryParse(manageProspectsViewModel.CompanyId, out companyId);
            }

            var updated = ContactServiceFacade.UpdateContactProspect(
                manageProspectsViewModel.ProspectId, status, concierge, user.UserAccountId, companyId, manageProspectsViewModel.ChannelId, manageProspectsViewModel.DivisionId, manageProspectsViewModel.BranchId, callCenter, loa);

            if (manageProspectsViewModel.LoanId == Guid.Empty)
            {
                return(updated);
            }



            bool isSubmited = LoanServiceFacade.AssignOfficersToLoan(manageProspectsViewModel.LoanId, companyId, manageProspectsViewModel.ChannelId, manageProspectsViewModel.DivisionId, manageProspectsViewModel.BranchId, concierge, callCenter, loa);

            if (!isSubmited)
            {
                return(false);
            }

            ActivitiesServiceFacade.ExecuteActivityRulesConcierge(
                ActivitiesServiceFacade.RetrieveActivity(manageProspectsViewModel.LoanId, ActivityType.CompleteLoanApplication, user.UserAccountId).Id,
                ActivityStatus.Completed, ActivityMode.None, false, ActionIntent.LoanNoAndConciergeAssigned, user.Party.Id, user.UserAccountId);

            return(true);
        }
        public Boolean SaveAssignInfo(AssignLoanInfoViewModel assignLoanInfoViewModel)
        {
            UserAccount user = null;

            if (Session[SessionHelper.UserData] != null)
            {
                user = ( UserAccount )Session[SessionHelper.UserData];
            }
            try
            {
                var loaId       = assignLoanInfoViewModel.LoaId.HasValue ? assignLoanInfoViewModel.LoaId.Value : -1;
                var conciergeId = assignLoanInfoViewModel.ConciergeId.HasValue ? assignLoanInfoViewModel.ConciergeId.Value : -1;

                var callCenterId = assignLoanInfoViewModel.CallCenterId.HasValue ? assignLoanInfoViewModel.CallCenterId.Value : -1;

                Guid companyId = Guid.Empty;

                if (!String.IsNullOrEmpty(assignLoanInfoViewModel.CompanyId))
                {
                    Guid.TryParse(assignLoanInfoViewModel.CompanyId, out companyId);
                }

                int  loanNumber;
                bool isLoanNumberAssigned = int.TryParse(assignLoanInfoViewModel.LoanNumber, out loanNumber) && loanNumber > 0;

                if (user != null && !isLoanNumberAssigned)
                {
                    string loanNum = LoanServiceFacade.RetrieveLoanNumber(assignLoanInfoViewModel.LoanId, user.UserAccountId);
                    isLoanNumberAssigned = int.TryParse(loanNum, out loanNumber) && loanNumber > 0;
                }

                bool isSubmited = LoanServiceFacade.AssignConciergeLoanNumberAndLOA(assignLoanInfoViewModel.LoanId, conciergeId, assignLoanInfoViewModel.LoanNumber, assignLoanInfoViewModel.ConciergeNMLS, companyId, assignLoanInfoViewModel.ChannelId, assignLoanInfoViewModel.DivisionId, assignLoanInfoViewModel.BranchId, assignLoanInfoViewModel.EnableDigitalDocsCall, user.UserAccountId, loaId, callCenterId);

                if (isSubmited)
                {
                    int losFolderId = int.Parse(assignLoanInfoViewModel.LosFolder);
                    isSubmited = LoanServiceFacade.UpdateLosFolderId(assignLoanInfoViewModel.LoanId, losFolderId, user.UserAccountId);
                }

                if (isSubmited)
                {
                    isSubmited = ActivitiesServiceFacade.ExecuteActivityRulesConcierge(ActivitiesServiceFacade.RetrieveActivity(assignLoanInfoViewModel.LoanId, ActivityType.CompleteLoanApplication, user.UserAccountId).Id,
                                                                                       ActivityStatus.Completed, ActivityMode.None, false, ActionIntent.LoanNoAndConciergeAssigned, user.Party.Id, user.UserAccountId, loanNumberAlreadyAssigned: isLoanNumberAssigned);
                }

                return(isSubmited);
            }
            catch (Exception exception)
            {
                TraceHelper.Error(TraceCategory.Global, "ExportToLOS::LosFolderUpdated", exception, assignLoanInfoViewModel.LoanId, user != null ? user.UserAccountId : -1);
                return(false);
            }
        }
        public JsonResult GetDefaultPendingApprovalCommand(Guid loanId)
        {
            String result                = String.Empty;
            Int32  numberOfDocuments     = DocumentsServiceFacade.RetrieveNumberOfUploadedOrFaxedDocuments(loanId, IdentityManager.GetUserAccountId());
            String submittedActivityName = ActivitiesServiceFacade.RetrieveSubmittedActivityName(loanId, IdentityManager.GetUserAccountId());

            try
            {
                if (numberOfDocuments > 0 && String.IsNullOrEmpty(submittedActivityName))
                {
                    result = "Manage Documents";
                }
                else if (!String.IsNullOrEmpty(submittedActivityName))
                {
                    // evaluate command by submitted activity name

                    switch (submittedActivityName)
                    {
                    case "Upload Documents":
                        result = "Manage Documents";
                        break;

                    case "Order Appraisal":
                        result = "Manage Appraisal";
                        break;

                    case "Review Disclosures":
                        result = "Manage Disclosures";
                        break;

                    default:
                        result = "Manage Activities";
                        break;
                    }
                }
                else // in case number of documents = 0 and submitted activity is blank
                {
                    result = "Manage Activities";
                }

                return(Json(new { success = true, action = result }));
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, msg = ex.Message }));
            }
        }
Пример #4
0
        private void LoadDisclosureSummary(AppraisalViewModel userAppraisalViewModel, Guid loanId, UserAccount user)
        {
            DisclosuresSummaryInfo disclosuresSummaryInfo = DocumentsServiceFacade.RetrieveDisclosuresSummaryInfo(loanId, user.UserAccountId);

            userAppraisalViewModel.DisclosuresSummaryInfo = disclosuresSummaryInfo;

            var channel = CompanyProfileServiceFacade.GetChannelByChannelId(userAppraisalViewModel.Loan.ChannelId);

            var activateOrderAppraisal = false;

            if (channel != null && channel.ActivateOrderAppraisalSettings != null)
            {
                switch (channel.ActivateOrderAppraisalSettings.DisclosuresESignTriggerType)
                {
                case (int)OrderAppraisalTriggerEnum.FirstIntentToProceed:
                    IntegrationsSettings integrationSettings = LoanServiceFacade.RetrieveIntegrationsSettings(user.UserAccountId);
                    activateOrderAppraisal = (disclosuresSummaryInfo.IntentToProceedReceivedBorrower != null && disclosuresSummaryInfo.IntentToProceedReceivedCoBorrower != null) || (disclosuresSummaryInfo.IntentToProceedReceivedBorrower != null && integrationSettings != null && !integrationSettings.AllBorrowersMustESign);
                    break;

                case (int)OrderAppraisalTriggerEnum.LastIntentToProceed:
                    activateOrderAppraisal = DocumentsServiceFacade.CheckItpSetForAllLoanApplications(loanId, user.UserAccountId);
                    break;

                case (int)OrderAppraisalTriggerEnum.GFEandDisclosureActivity:
                    var activity = ActivitiesServiceFacade.RetrieveActivity(loanId, ActivityType.ReviewDisclosures, user.UserAccountId);
                    activateOrderAppraisal = channel.ActivateOrderAppraisalSettings.DisclosuresESignStatus == (int)ActivityStatus.Completed || channel.ActivateOrderAppraisalSettings.DisclosuresESignStatus == (int)ActivityStatus.Submitted;
                    if (((int)activity.Status == channel.ActivateOrderAppraisalSettings.DisclosuresESignStatus && channel.ActivateOrderAppraisalSettings.DisclosuresESignStatus == (int)ActivityStatus.Submitted) || activity.Status == ActivityStatus.Completed)
                    {
                        activateOrderAppraisal = true;
                    }
                    break;
                }
            }

            userAppraisalViewModel.IsAppraisalDisabled = !activateOrderAppraisal;
        }
        public ActionResult ShowBorrowerPopup(String loanId)
        {
            Guid loanIdValue;

            Guid.TryParse(loanId, out loanIdValue);

            if (loanIdValue == Guid.Empty)
            {
                return(null);
            }
            var userAccountId = IdentityManager.GetUserAccountId();

            var loanType           = LoanServiceFacade.RetrieveLoanType(loanIdValue, userAccountId);
            var loanHomebuyingType = LoanServiceFacade.RetrieveLoanHomeBuyingType(loanIdValue, userAccountId);
            PreApprovalStatus preApprovalStatus = LoanServiceFacade.RetrievePreApprovalStatus(loanIdValue);

            var activities  = ActivitiesServiceFacade.RetrieveActivities(loanIdValue, IdentityManager.GetUserAccountId());
            var activityCLA = activities == null ? null : activities.FirstOrDefault(c => c.ActivityType == ActivityType.CompleteLoanApplication);
            var activityPAR = activities == null ? null : activities.FirstOrDefault(c => c.ActivityType == ActivityType.PreApprovalRequest);

            bool IsPreApprovalQueue = !preApprovalStatus.Equals(PreApprovalStatus.Completed) && loanType.Equals(LoanTransactionType.Purchase) &&
                                      loanHomebuyingType.Equals(HomeBuyingType.GetPreApproved) &&
                                      activityPAR != null && (activityPAR.Status == ActivityStatus.Submitted ||
                                                              activityPAR.Status == ActivityStatus.Completed ||
                                                              activityPAR.Status == ActivityStatus.Update);

            if (((IsPreApprovalQueue && activityPAR.Status != ActivityStatus.Submitted && activityPAR.Status != ActivityStatus.Completed)))
            {
                return(PartialView("_borrowersInformationPopupMessage"));
            }

            if (!IsPreApprovalQueue && (activityCLA == null || (activityCLA.Status != ActivityStatus.Submitted && activityCLA.Status != ActivityStatus.Completed)))
            {
                return(PartialView("_borrowersInformationPopupMessage"));
            }


            Property property = PropertyServiceFacade.RetrieveSubjectProperty(loanIdValue, userAccountId);

            var borrowerModel = BorrowerServiceFacade.GetBorrowersInformation(loanIdValue);

            if (borrowerModel == null)
            {
                return(null);
            }

            if (property != null)
            {
                borrowerModel.OccupancyType = property.OccupancyType;
            }

            SetupLookups(borrowerModel);

            if (borrowerModel.Borrower != null && borrowerModel.CoBorrower != null)
            {
                borrowerModel.BorrowerAndCoBorrowerAddressAreSame = AddressHelper.BorrowerAndCoborrowerAddressesAreSame(borrowerModel.Borrower.Addresses.ToList(), borrowerModel.CoBorrower.Addresses.ToList());
            }

            if (borrowerModel.CoBorrower == null)
            {
                borrowerModel.CoBorrower = new Contracts.Borrower();
            }

            if (borrowerModel.CoBorrowerModelInfo == null)
            {
                borrowerModel.CoBorrowerModelInfo = new BorrowerModelInfo();
            }

            if (borrowerModel.CoBorrowerModelInfo.PresentAddress == null)
            {
                borrowerModel.CoBorrowerModelInfo.PresentAddress = new Address();
            }

            if (borrowerModel.CoBorrowerModelInfo.MailingAddress == null)
            {
                borrowerModel.CoBorrowerModelInfo.MailingAddress = new Address();
            }

            if (borrowerModel.CoBorrowerModelInfo.MailingAddress.IsSameAsPropertyAddress == null)
            {
                borrowerModel.CoBorrowerModelInfo.MailingAddress.IsSameAsPropertyAddress = false;
            }
            if (borrowerModel.Borrower != null)
            {
                borrowerModel.Borrower.Addresses = new Collection <Address>();
            }
            if (borrowerModel.CoBorrower != null)
            {
                borrowerModel.CoBorrower.Addresses = new Collection <Address>();
            }

            TitleInNameAndMannerTitleHeld titleInNameAndMannerTitleHeld = LoanServiceFacade.RetrieveTitleInNameAndMannerTitleHeld(loanIdValue, -1);

            borrowerModel.TitleAndManner = titleInNameAndMannerTitleHeld;
            borrowerModel.MannerTitleHeld.Insert(0, new Lookup {
                Name = "Select One", Value = -1
            });
            return(PartialView("_borrowersInformation", borrowerModel));
        }