private string BuildPoRLabel(AddressSelection address) { if (address == null || address.CustomerAddressId < 1) { return("No address data found."); } return(address?.CustomerAddressId == address?.PropertySecurityAddressId ? "Re-mortgage" : "Purchase"); }
public Case(CaseStateHistory history, Origination origination, Account account, KeyFactsIllustration kfi, PropertyVisit visit, AddressSelection address) : this(history, origination, account, kfi) { ValuationDate = visit?.DateOfSurvey; PoR = BuildPoRLabel(address); FullAddress = BuildAddressLabel(address); PostCode = address?.PostCode; }
private string BuildAddressLabel(AddressSelection address) { if (string.IsNullOrWhiteSpace(address?.Street)) { return("No address data found."); } var builder = new StringBuilder(); if (address.Street != null) { builder.AppendFormat("{0}, ", address.Street.Trim()); } if (!string.IsNullOrWhiteSpace(address.District)) { builder.AppendFormat("{0}, ", address.District.Trim()); } if (!string.IsNullOrWhiteSpace(address.County)) { builder.AppendFormat("{0}, ", address.County.Trim()); } if (!string.IsNullOrWhiteSpace(address.Region)) { builder.AppendFormat("{0}, ", address.Region.Trim()); } if (address.PostCode != null) { builder.AppendFormat("{0}.", address.PostCode.Trim()); } return(builder.ToString()); }