Ejemplo n.º 1
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;
        }