public static CustomerExpectationDisplayModel GenerateModelForList(CustomerExpectation customerExpectation)
        {
            CustomerExpectationDisplayModel model = new CustomerExpectationDisplayModel()
            {
                CEID               = customerExpectation.Id,
                CustomerName       = customerExpectation.Customer.CustomerName,
                IDNumber           = customerExpectation.Customer.IDNumber,
                PhoneNumber        = customerExpectation.Customer.PhoneNumber,
                CustomerCreatedOn  = customerExpectation.Customer.CreatedOn,
                customerType       = (CustomerType)customerExpectation.CustomerTypeId,
                CreatedOn          = customerExpectation.CreatedOn,
                ExpectedLoanAmount = customerExpectation.ExpectedLoanAmount,
                ExpectedLoanTime   = customerExpectation.ExpectedLoanTime,
                //CompanyName = (CustomerType)customerExpectation.CustomerTypeId == CustomerType.自雇 ? customerExpectation.CustomerSelfEmployeds.First().CompanyName : customerExpectation.CustomerHireds.First().CompanyName,
                HavingCreditCardCarLoan = customerExpectation.HavingCreditCardCarLoan,
                HavingRealEstate        = customerExpectation.HavingRealEstate,
                HavingLifeInsurance     = customerExpectation.HavingLifeInsurance,
            };

            return(model);
        }
        public static CustomerExpectationDisplayModel GenerateModel(CustomerExpectation customerExpectation)
        {
            CustomerExpectationDisplayModel model = new CustomerExpectationDisplayModel()
            {
                CEID               = customerExpectation.Id,
                CustomerName       = customerExpectation.Customer.CustomerName,
                IDNumber           = customerExpectation.Customer.IDNumber,
                PhoneNumber        = customerExpectation.Customer.PhoneNumber,
                CustomerCreatedOn  = customerExpectation.Customer.CreatedOn,
                customerType       = (CustomerType)customerExpectation.CustomerTypeId,
                WorkingAddress     = customerExpectation.WorkingAddress,
                CreatedOn          = customerExpectation.CreatedOn,
                ExpectedLoanAmount = customerExpectation.ExpectedLoanAmount,
                ExpectedLoanTime   = customerExpectation.ExpectedLoanTime,
                //CompanyName = (CustomerType)customerExpectation.CustomerTypeId == CustomerType.自雇 ? customerExpectation.CustomerSelfEmployeds.First().CompanyName : customerExpectation.CustomerHireds.First().CompanyName,
                HavingCreditCardCarLoan = customerExpectation.HavingCreditCardCarLoan,
                HavingRealEstate        = customerExpectation.HavingRealEstate,
                HavingLifeInsurance     = customerExpectation.HavingLifeInsurance,
            };

            if (model.customerType == CustomerType.班)
            {
                var chs           = customerExpectation.CustomerHireds;
                var customerHired = chs.First();
                model.CompanyName    = customerHired.CompanyName;
                model.SalaryAfterTax = customerHired.SalaryAfterTax;

                if (model.HavingSIHF)
                {
                    model.SocialInsuranceBase = customerHired.SocialInsuranceBase;
                    model.HousingFundBase     = customerHired.HousingFundBase;
                }
            }
            else if (model.customerType == CustomerType.自雇)
            {
                var customerSelfEmployed = customerExpectation.CustomerSelfEmployeds.First();
                model.AnnualTaxAmount        = customerSelfEmployed.AnnualTaxAmount;
                model.AnnualTurnover         = customerSelfEmployed.AnnualTurnover;
                model.AnnualVATInvoiceAmount = customerSelfEmployed.AnnualVATInvoiceAmount;
            }
            if (model.HavingLifeInsurance)
            {
                var lfis = customerExpectation.CLifeInsurances;
                var ls   = lfis.ToList();
                if (ls.First() != null)
                {
                    var l = lfis.First();
                    model.AnnualPremium0         = l.AnnualPremium;
                    model.EarliestEffectiveTime0 = l.EarliestEffectiveTime;
                    model.LifeInsuranceCompany0  = l.LifeInsuranceCompany;
                }
                try
                {
                    {
                        var l = ls[1];
                        model.AnnualPremium1         = l.AnnualPremium;
                        model.EarliestEffectiveTime1 = l.EarliestEffectiveTime;
                        model.LifeInsuranceCompany1  = l.LifeInsuranceCompany;
                    }
                    {
                        var l = ls[2];
                        model.AnnualPremium2         = l.AnnualPremium;
                        model.EarliestEffectiveTime2 = l.EarliestEffectiveTime;
                        model.LifeInsuranceCompany2  = l.LifeInsuranceCompany;
                    }
                }
                catch (Exception ex)
                { }
            }
            if (model.HavingCreditCardCarLoan)
            {
                var ccc = customerExpectation.CCreditCardCarLoans.First();
                model.NumberOfRepaymentsCC = ccc.NumberOfRepaymentsCC;
                model.CCLMonthlyAmount     = ccc.MonthlyAmount;
            }
            if (model.HavingRealEstate)
            {
                var re = customerExpectation.CRealEstates.First();
                model.RealEstateAddress        = re.RealEstateAddress;
                model.realEstateLoanType       = (RealEstateLoanType)re.LoanTypeId;
                model.realEstatePropertyNature = (RealEstatePropertyNature)re.PropertyNatureId;
                model.RealEstateValue          = re.RealEstateValue;
                model.BankName           = re.BankName;
                model.NumberOfRepayments = re.NumberOfRepayments;
                model.ConstructionArea   = re.ConstructionArea;
                model.MonthlyPayment     = re.MonthlyPayment;
            }

            return(model);
        }