private bool IsStringParsedCorrectly(HUDAppraiserLicense importedRecord) { return !String.IsNullOrWhiteSpace(importedRecord.AppraiserID) || !String.IsNullOrWhiteSpace(importedRecord.State) || !String.IsNullOrWhiteSpace(importedRecord.License) || !importedRecord.ExpirationDate.HasValue || !importedRecord.AQBIndicator.HasValue || !importedRecord.LicenseType.HasValue; }
private string GetAppraiserLicenseParseProblem(HUDAppraiserLicense importedRecord) { string problemDescription = " problems:"; problemDescription += string.IsNullOrWhiteSpace(importedRecord.AppraiserID) ? "appraiserID is empty" : ""; problemDescription += string.IsNullOrWhiteSpace(importedRecord.State) ? "state is empty" : ""; problemDescription += string.IsNullOrWhiteSpace(importedRecord.License) ? "License is empty" : ""; problemDescription += importedRecord.ExpirationDate.HasValue ? "" : "cannot parse exp. date " + importedRecord.ExpirationDateString; problemDescription += importedRecord.AQBIndicator.HasValue ? "" : "cannot parse aqb indicator " + importedRecord.AQBIndicatorString; problemDescription += importedRecord.LicenseType.HasValue ? "" : "cannot parse license type " + importedRecord.LicenseTypeString; return problemDescription; }
public HUDAppraiserLicense GetAppraiserLicenseFromHUDString(string record) { if (string.IsNullOrWhiteSpace(record)) throw new ArgumentNullException("HUD record for appraiser license cannot be empty"); if (record.Length != 47) throw new ArgumentOutOfRangeException("HUD record length for appraiser license is incorrect " + record.Length); HUDAppraiserLicense currLicenseRecord = new HUDAppraiserLicense(); currLicenseRecord.AppraiserID = record.Substring(0, 6).Trim(); currLicenseRecord.State = record.Substring(6, 2).Trim(); currLicenseRecord.License = StringUtil.NormalizeLicenseNumber(record.Substring(10, 22)); currLicenseRecord.ExpirationDateString = record.Substring(34, 8).Trim(); currLicenseRecord.ExpirationDate = SafeConvert.ToDateTime(currLicenseRecord.ExpirationDateString, "yyyyMMdd"); currLicenseRecord.AQBIndicatorString = record.Substring(42, 1).Trim(); currLicenseRecord.AQBIndicator = ConvertAQBIndicator(currLicenseRecord.AQBIndicatorString); currLicenseRecord.LicenseTypeString = record.Substring(43, 1).Trim(); currLicenseRecord.LicenseType = SafeConvert.ToInt(currLicenseRecord.LicenseTypeString); return currLicenseRecord; }