private FinishedCaseViewModel Map(BaseAudit baseAudit) { var borrow = baseAudit.RelationPersonAudits.FirstOrDefault(t => t.RelationType == "-PersonType-JieKuanRen"); var firstContacter = borrow.IfNotNull(p => p.ContactAudits.FirstOrDefault(t => t.IsDefault)); var lendCase = new LendingDAL().Get(baseAudit.ID); var mortgage = new MortgageDAL().GetAll().Single(p => p.BaseAudit.CaseNum == baseAudit.CaseNum); var dictionaryDal = new DictionaryDAL(); var finishedCase = new FinishedCaseViewModel(); lendCase.CopyTo(finishedCase); finishedCase.ID = baseAudit.ID; finishedCase.CaseNum = baseAudit.CaseNum; finishedCase.CaseStatusText = CaseStatusHelper.GetBigStatusText(baseAudit.CaseStatus); finishedCase.IsCurrent = baseAudit.CaseStatus == CaseStatus.FinishCase; finishedCase.Borrower = borrow.IsNotNull() ? borrow.Name : ""; finishedCase.ContactNumber = firstContacter.IsNotNull() ? firstContacter.ContactNumber : ""; finishedCase.BankCard = baseAudit.BankCard; finishedCase.OpeningBank = baseAudit.OpeningBank; finishedCase.OpeningSite = baseAudit.OpeningSite; finishedCase.ContractAmount = mortgage.ContractAmount; finishedCase.SalesID = baseAudit.SalesID; finishedCase.SalesIDText = new SalesManDAL().FindBySalesID(baseAudit.SalesID).Name; finishedCase.Description = baseAudit.Description; finishedCase.CreateTime = baseAudit.CreateTime; finishedCase.ServiceCharge = baseAudit.ServiceCharge; finishedCase.ServiceChargeRate = baseAudit.ServiceChargeRate; finishedCase.Deposit = baseAudit.Deposit; finishedCase.DepositDate = baseAudit.DepositDate; finishedCase.IsActivitieRate = baseAudit.IsActivitieRate; finishedCase.IsActivitieRateText = dictionaryDal.GetText(baseAudit.IsActivitieRate.ToString()); finishedCase.Introducer = GetIntroducer(baseAudit); finishedCase.Merchandiser = baseAudit.Merchandiser; finishedCase.LenderName = baseAudit.LenderName; finishedCase.EarnestMoney = baseAudit.EarnestMoney; finishedCase.OutboundCost = baseAudit.OutboundCost; finishedCase.DebitNotarizationCost = baseAudit.DebitNotarizationCost; finishedCase.DebitEvaluationCost = baseAudit.DebitEvaluationCost; finishedCase.DebitGuaranteeCost = baseAudit.DebitGuaranteeCost; finishedCase.DebitInsuranceCost = baseAudit.DebitInsuranceCost; finishedCase.DebitOtherCost = baseAudit.DebitOtherCost; finishedCase.LevyNotarizationCost = baseAudit.LevyNotarizationCost; finishedCase.LevyAssetsSurveyCost = baseAudit.LevyAssetsSurveyCost; finishedCase.LevyCreditReportCost = baseAudit.LevyCreditReportCost; finishedCase.LevyOtherCost = baseAudit.LevyOtherCost; finishedCase.CaseMode = baseAudit.CaseMode; finishedCase.CaseModeText = dictionaryDal.GetText(baseAudit.CaseMode); finishedCase.ThirdParty = baseAudit.ThirdParty; finishedCase.ThirdPartyText = dictionaryDal.GetText(baseAudit.ThirdParty); finishedCase.MonthlyInterest = baseAudit.MonthlyInterest; finishedCase.LendingDate = baseAudit.LendingDate; finishedCase.PaymentDate = baseAudit.PaymentDate; finishedCase.ActualInterest = baseAudit.ActualInterest; finishedCase.AdvanceInterest = baseAudit.AdvanceInterest; finishedCase.AuditTerm = baseAudit.AuditTerm; finishedCase.AuditTermText = dictionaryDal.GetText(baseAudit.AuditTerm); finishedCase.AuditRate = baseAudit.AuditRate; finishedCase.LendFileName = GetFiles(finishedCase.LendFile); return(finishedCase); }