Пример #1
0
        private void BuildCustomerSummary(ProfileSummaryModel summary, Customer customer)
        {
            summary.Id        = customer.Id;
            summary.IsOffline = customer.IsOffline;

            summary.AffordabilityAnalysis =
                new AffordabilityAnalysis {
                CashAvailabilityOrDeficits = "Not implemented now",
                EzBobMonthlyRepayment      = Money(GetRepaymentAmount(customer))
            };
            summary.LoanActivity = CreateLoanActivity(customer);
            summary.AmlBwa       =
                new AmlBwa {
                Aml     = customer.AMLResult,
                Bwa     = customer.BWAResult,
                Lighter = new Lighter(ObtainAmlState(customer))
            };
            summary.FraudCheck = new FraudCheck {
                Status = customer.Fraud.ToString(),
            };
            summary.OverallTurnOver = customer.PersonalInfo == null ? null : customer.PersonalInfo.OverallTurnOver;
            summary.WebSiteTurnOver = customer.PersonalInfo == null ? null : customer.PersonalInfo.WebSiteTurnOver;
            summary.Comment         = customer.Comment;

            summary.CompanyEmployeeCountInfo = new CompanyEmployeeCountInfo(customer.Company);
            summary.CompanyInfo = CompanyInfoMap.FromCompany(customer.Company);
            summary.IsOffline   = customer.IsOffline;
        }
Пример #2
0
        }         // constructor

        public WizardModel BuildWizardModel(
            Customer cus,
            HttpSessionStateBase session,
            string profile,
            string requestUrl,
            bool isProfile
            )
        {
            CustomerOrigin uiOrigin = cus == null?UiCustomerOrigin.Get() : cus.CustomerOrigin;

            var wizardModel = new WizardModel();

            Log.InfoFormat(
                "BuildWizardModel URL: {0} origin {1} customer {2}",
                requestUrl,
                uiOrigin.Name,
                cus == null ? "null" : cus.Id.ToString()
                );

            var customerModel = new CustomerModel {
                loggedIn         = cus != null,
                bankAccountAdded = false,
                Origin           = uiOrigin.Name,
            };

            if (!string.IsNullOrEmpty(profile))
            {
                wizardModel.WhiteLabel     = _whiteLabelProviderRepository.GetByName(profile);
                customerModel.IsWhiteLabel = wizardModel.WhiteLabel != null;
                customerModel.WhiteLabelId = wizardModel.WhiteLabel != null ? wizardModel.WhiteLabel.Id : 0;
            }

            wizardModel.Customer = customerModel;

            if (!customerModel.loggedIn)
            {
                customerModel.IsBrokerFill =
                    (session[Constant.Broker.FillsForCustomer] ?? Constant.No).ToString() == Constant.Yes;

                return(wizardModel);
            }             // if

            if (cus == null)
            {
                return(wizardModel);
            }

            var customer = m_oCustomerRepository.GetAndInitialize(cus.Id);

            if (customer == null)
            {
                return(wizardModel);
            }

            var user = m_oUsers.Get(cus.Id);

            customerModel.Origin = customer.CustomerOrigin.Name;
            customerModel.IsTest = customer.IsTest;

            if (customer.WhiteLabel != null)
            {
                wizardModel.WhiteLabel     = customer.WhiteLabel;
                customerModel.IsWhiteLabel = wizardModel.WhiteLabel != null;
                customerModel.WhiteLabelId = customer.WhiteLabel.Id;
            }             // if

            customerModel.Id         = customer.Id;
            customerModel.RefNumber  = customer.RefNumber;
            customerModel.userName   = user.Name;
            customerModel.Email      = customer.Name;
            customerModel.EmailState = EmailConfirmationState.Get(customer);

            customerModel.CustomerPersonalInfo = customer.PersonalInfo;

            customerModel.IsAlibaba = customer.IsAlibaba;

            if (customer.PropertyStatus != null)
            {
                customerModel.PropertyStatus = new PropertyStatusModel {
                    Id          = customer.PropertyStatus.Id,
                    Description = customer.PropertyStatus.Description,
                    IsOwnerOfOtherProperties = customer.PropertyStatus.IsOwnerOfOtherProperties,
                    IsOwnerOfMainAddress     = customer.PropertyStatus.IsOwnerOfMainAddress
                };
            }
            else
            {
                customerModel.PropertyStatus = new PropertyStatusModel();
            }             // if

            customerModel.BusinessTypeReduced = customerModel.CustomerPersonalInfo == null?
                                                TypeOfBusinessReduced.Personal.ToString() : customer.PersonalInfo.TypeOfBusiness.Reduce().ToString();

            customerModel.mpAccounts   = customer.GetMarketPlaces();
            customerModel.CreditSum    = customer.CreditSum;
            customerModel.CreditResult = customer.CreditResult.ToString();
            customerModel.Status       = customer.Status.ToString();

            var account = new AccountSettingsModel {
                SecurityQuestions = m_oQuestions.GetQuestions(),

                SecurityQuestionModel = new SecurityQuestionModel {
                    Question = user.SecurityQuestion == null ? 0 : user.SecurityQuestion.Id,
                    Answer   = user.SecurityAnswer
                },
            };

            customerModel.AccountSettings = account;

            customerModel.GreetingMailSentDate = customer.GreetingMailSentDate;

            var company = customer.Company;

            customerModel.CanHaveDirectors = false;

            if (company != null)
            {
                customerModel.CanHaveDirectors = company.TypeOfBusiness != TypeOfBusiness.SoleTrader;

                customerModel.CompanyInfo    = CompanyInfoMap.FromCompany(company);
                customerModel.CompanyAddress = company.CompanyAddress.ToArray();

                customerModel.CompanyInfo.Directors.AddRange(
                    m_oExperianDirectors.Find(customer.Id)
                    .Select(ed => DirectorModel.FromExperianDirector(ed, company.TypeOfBusiness.Reduce()))
                    );
            }             // if

            if (customer.AddressInfo != null)
            {
                customerModel.PersonalAddress          = customer.AddressInfo.PersonalAddress.ToArray();
                customerModel.PrevPersonAddresses      = customer.AddressInfo.PrevPersonAddresses.ToArray();
                customerModel.OtherPropertiesAddresses = customer.AddressInfo.OtherPropertiesAddresses.ToArray();
            }             // if

            customerModel.CompanyEmployeeCountInfo = new CompanyEmployeeCountInfo(customer.Company);

            customerModel.CustomerStatusName = customer.CollectionStatus.Name;

            // customerModel.LoyaltyPoints = customer.LoyaltyPoints();
            customerModel.IsOffline  = customer.IsOffline;
            customerModel.IsDisabled = !customer.CollectionStatus.IsEnabled;

            customerModel.LastSavedWizardStep = ((customer.WizardStep == null) || customer.WizardStep.TheLastOne)
                                ? string.Empty
                                : customer.WizardStep.Name;

            customerModel.QuickOffer = BuildQuickOfferModel(customer);

            CustomerRequestedLoan ra = customer.CustomerRequestedLoan.OrderByDescending(x => x.Created).FirstOrDefault();

            customerModel.RequestedLoan = ra ?? new CustomerRequestedLoan();

            customerModel.IsBrokerFill = customer.FilledByBroker;
            customerModel.DefaultCardSelectionAllowed = customer.DefaultCardSelectionAllowed;

            var cr = customer.LastCashRequest;

            customerModel.IsCurrentCashRequestFromQuickOffer = (cr != null) && (cr.QuickOffer != null);

            customerModel.IsLoanDetailsFixed = !m_oChangeLoanDetailsModelBuilder.IsAmountChangingAllowed(cr);

            customerModel.LastCashRequestID = (cr == null) ? 0 : cr.Id;

            if (isProfile)
            {
                BuildProfileModel(customerModel, customer);
            }

            return(wizardModel);
        }         // BuildWizardModel