public SalesForceModel() { PersonalModel = new PersonalModel(); MarketPlaces = new List <SalesForceMarketPlaceModel>(); CompanyFiles = new List <CompanyFile>(); Phones = new List <CrmPhoneNumber>(); Fraud = new FraudDetectionLogModel() { FraudDetectionLogRows = new List <FraudDetectionLogRowModel>() }; Messages = new List <MessagesModel>(); OldCrm = new List <CustomerRelationsModel>(); Loans = new List <LoanHistoryModel>(); Decisions = new List <DecisionHistoryModel>(); }
public void FromCustomer(EZBob.DatabaseLib.Model.Database.Customer customer) { PersonalModel = new PersonalModel { ID = customer.Id, Email = customer.Name, Name = customer.PersonalInfo != null ? customer.PersonalInfo.Fullname : string.Empty, FraudStatus = customer.FraudStatus.ToString(), CreditStatus = customer.CreditResult != null?customer.CreditResult.ToString() : string.Empty, AmlScore = customer.AmlScore, AmlDescription = customer.AmlDescription, IsPendingDecision = customer.CreditResult.HasValue && customer.CreditResult.Value == CreditResultStatus.ApprovedPending && (!customer.IsWaitingForSignature.HasValue || (!customer.IsWaitingForSignature.Value)), TypeOfBusiness = customer.PersonalInfo != null?customer.PersonalInfo.TypeOfBusiness.DescriptionAttr() : string.Empty, PromoCode = customer.PromoCode }; if (customer.Company != null) { PersonalModel.CompanyName = string.IsNullOrEmpty(customer.Company.ExperianCompanyName) ? customer.Company.CompanyName : customer.Company.ExperianCompanyName; PersonalModel.CompanyRefNumber = string.IsNullOrEmpty(customer.Company.ExperianRefNum) ? customer.Company.CompanyNumber : customer.Company.ExperianRefNum; } if (customer.IsWaitingForSignature.HasValue && customer.IsWaitingForSignature.Value) { PersonalModel.CreditStatus += " (Signatures)"; } MarketPlaces = customer .CustomerMarketPlaces .Where(x => x.Disabled == false) .Select(x => new SalesForceMarketPlaceModel { Created = x.Created, MpName = x.Marketplace.Name, displayName = x.DisplayName, UpdateError = x.UpdateError, Updated = x.UpdatingEnd }) .ToList(); Loans = customer .Loans .Select(LoanHistoryModel.Create) .OrderBy(x => x.DateApplied) .ToList(); }